diff options
author | 2001-06-04 17:58:32 +0000 | |
---|---|---|
committer | 2001-06-04 17:58:32 +0000 | |
commit | 5783fc9c0cf397ec300826252493eb5518014c10 (patch) | |
tree | 4760041285081457fad89518c3562eeacce4919d /mplayer.c | |
parent | 599832fdfff5c0fbbeada74328aaa86747645465 (diff) |
Streaming function return the file_format and should be tested.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1003 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 35 |
1 files changed, 31 insertions, 4 deletions
@@ -644,14 +644,13 @@ if(vcd_track){ stream->end_pos=len; #ifdef STREAMING } else { - int streaming_protocol; - streaming_protocol=autodetectProtocol( url, &f ); - if( streaming_protocol==STREAMING_TYPE_UNKNOWN ) { + file_format=autodetectProtocol( url, &f ); + if( file_format==DEMUXER_TYPE_UNKNOWN ) { printf("Unable to open URL: %s\n", filename); url_free(url); return 1; } else { - f=streaming_start( &url, f, streaming_protocol ); + f=streaming_start( &url, f, file_format ); if(f<0){ printf("Unable to open URL: %s\n", url->url); return 1; } printf("Connected to server: %s\n", url->hostname ); } @@ -684,6 +683,25 @@ if(vcd_track){ if(!has_audio) audio_id=-2; // do NOT read audio packets... //=============== Try to open as AVI file: ================= +#ifdef STREAMING +if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_AVI){ + stream_reset(stream); + demuxer=new_demuxer(stream,DEMUXER_TYPE_AVI,audio_id,video_id,dvdsub_id); + stream_seek(demuxer->stream,seek_to_byte); + //printf("stream3=0x%X vs. 0x%X\n",demuxer->stream,stream); + { //---- RIFF header: + int id=stream_read_dword_le(demuxer->stream); // "RIFF" + if(id==mmioFOURCC('R','I','F','F')){ + stream_read_dword_le(demuxer->stream); //filesize + id=stream_read_dword_le(demuxer->stream); // "AVI " + if(id==formtypeAVI){ + printf("Detected AVI file format!\n"); + file_format=DEMUXER_TYPE_AVI; + } + } + } +} +#else stream_reset(stream); demuxer=new_demuxer(stream,DEMUXER_TYPE_AVI,audio_id,video_id,dvdsub_id); stream_seek(demuxer->stream,seek_to_byte); @@ -699,8 +717,13 @@ stream_seek(demuxer->stream,seek_to_byte); } } } +#endif //=============== Try to open as ASF file: ================= +#ifdef STREAMING +if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_ASF){ +#else if(file_format==DEMUXER_TYPE_UNKNOWN){ +#endif stream_reset(stream); demuxer=new_demuxer(stream,DEMUXER_TYPE_ASF,audio_id,video_id,dvdsub_id); stream_seek(demuxer->stream,seek_to_byte); @@ -710,7 +733,11 @@ if(file_format==DEMUXER_TYPE_UNKNOWN){ } } //=============== Try to open as MPEG-PS file: ================= +#ifdef STREAMING +if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_MPEG_PS){ +#else if(file_format==DEMUXER_TYPE_UNKNOWN){ +#endif stream_reset(stream); demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_PS,audio_id,video_id,dvdsub_id); stream_seek(demuxer->stream,seek_to_byte); |