diff options
author | wm4 <wm4@nowhere> | 2013-07-12 21:58:11 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-12 22:16:26 +0200 |
commit | 3269bd178020c5d821e8b2d1fd807a38d63e93ce (patch) | |
tree | 474e0f7a712cc7002984ec1bdda7d445b5fd8c77 /stream | |
parent | 311d2f199a7b1f4d819cfb799a0f0f571596b91e (diff) | |
download | mpv-3269bd178020c5d821e8b2d1fd807a38d63e93ce.tar.bz2 mpv-3269bd178020c5d821e8b2d1fd807a38d63e93ce.tar.xz |
demux: rewrite probing and demuxer initialization
Get rid of the strange and messy reliance on DEMUXER_TYPE_ constants.
Instead of having two open functions for the demuxer callbacks (which
somehow are both optional, but you can also decide to implement both...),
just have one function. This function takes a parameter that tells the
demuxer how strictly it should check for the file headers. This is a
nice simplification and allows more flexibility.
Remove the file extension code. This literally did nothing (anymore).
Change demux_lavf so that we check our other builtin demuxers first
before libavformat tries to guess by file extension.
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_dvb.c | 3 | ||||
-rw-r--r-- | stream/stream_mf.c | 2 | ||||
-rw-r--r-- | stream/tv.c | 5 |
3 files changed, 7 insertions, 3 deletions
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 8fabfb4fc1..3847e26c75 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -739,7 +739,8 @@ static int dvb_open(stream_t *stream, int mode, void *opts) stream->close = dvbin_close; m_struct_free(&stream_opts, opts); - stream->demuxer = "lavf:mpegts"; + stream->demuxer = "lavf"; + stream->lavf_type = "mpegts"; return STREAM_OK; } diff --git a/stream/stream_mf.c b/stream/stream_mf.c index eef5d6fc4d..9354005ae4 100644 --- a/stream/stream_mf.c +++ b/stream/stream_mf.c @@ -32,7 +32,7 @@ static int mf_stream_open (stream_t *stream, int mode, void *opts) { stream->type = STREAMTYPE_MF; - stream->demuxer = "lavf"; + stream->demuxer = "mf"; return STREAM_OK; } diff --git a/stream/tv.c b/stream/tv.c index aa5383402f..9ddf3771ed 100644 --- a/stream/tv.c +++ b/stream/tv.c @@ -701,13 +701,16 @@ static int tv_uninit(tvi_handle_t *tvh) return res; } -static int demux_open_tv(demuxer_t *demuxer) +static int demux_open_tv(demuxer_t *demuxer, enum demux_check check) { tvi_handle_t *tvh; sh_video_t *sh_video; sh_audio_t *sh_audio = NULL; const tvi_functions_t *funcs; + if (check > DEMUX_CHECK_REQUEST || demuxer->stream->type != STREAMTYPE_TV) + return -1; + demuxer->priv=NULL; if(!(tvh=tv_begin(demuxer->stream->priv))) return -1; if (!tvh->functions->init(tvh->priv)) return -1; |