Mercurial > mplayer.hg
changeset 1002:f035bd1f2749
Streaming function return the file_format and should be tested.
author | bertrand |
---|---|
date | Mon, 04 Jun 2001 17:58:32 +0000 |
parents | 876c3edc2fa9 |
children | 26579d6e6c38 |
files | mplayer.c |
diffstat | 1 files changed, 31 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mplayer.c Mon Jun 04 17:54:59 2001 +0000 +++ b/mplayer.c Mon Jun 04 17:58:32 2001 +0000 @@ -644,14 +644,13 @@ 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(!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 @@ } } } +#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 @@ } } //=============== 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);