From 73c76de91edbf8a55eb725196ff54583e3428510 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 8 Jul 2013 01:37:30 +0200 Subject: demux: simplify demux_open() calls The demux_open as well as demux_open_withparams calls don't use the stream selection parameters anymore, so remove them everywhere. Completes the previous commit. --- core/timeline/tl_cue.c | 12 ++---------- core/timeline/tl_edl.c | 3 --- core/timeline/tl_matroska.c | 3 +-- 3 files changed, 3 insertions(+), 15 deletions(-) (limited to 'core/timeline') diff --git a/core/timeline/tl_cue.c b/core/timeline/tl_cue.c index d9160e0b8e..a965cfd877 100644 --- a/core/timeline/tl_cue.c +++ b/core/timeline/tl_cue.c @@ -192,11 +192,7 @@ static bool try_open(struct MPContext *mpctx, char *filename) struct stream *s = open_stream(filename, &mpctx->opts, &format); if (!s) return false; - struct demuxer *d = demux_open(&mpctx->opts, s, format, - mpctx->opts.audio_id, - mpctx->opts.video_id, - mpctx->opts.sub_id, - filename); + struct demuxer *d = demux_open(&mpctx->opts, s, format, filename); // Since .bin files are raw PCM data with no headers, we have to explicitly // open them. Also, try to avoid to open files that are most likely not .bin // files, as that would only play noise. Checking the file extension is @@ -205,11 +201,7 @@ static bool try_open(struct MPContext *mpctx, char *filename) // CD sector size (2352 bytes) if (!d && bstr_case_endswith(bfilename, bstr0(".bin"))) { mp_msg(MSGT_CPLAYER, MSGL_WARN, "CUE: Opening as BIN file!\n"); - d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_RAWAUDIO, - mpctx->opts.audio_id, - mpctx->opts.video_id, - mpctx->opts.sub_id, - filename); + d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_RAWAUDIO, filename); } if (d) { add_source(mpctx, d); diff --git a/core/timeline/tl_edl.c b/core/timeline/tl_edl.c index 5ec04ac716..0303956513 100644 --- a/core/timeline/tl_edl.c +++ b/core/timeline/tl_edl.c @@ -360,9 +360,6 @@ void build_edl_timeline(struct MPContext *mpctx) if (!s) goto openfail; struct demuxer *d = demux_open(&mpctx->opts, s, format, - mpctx->opts.audio_id, - mpctx->opts.video_id, - mpctx->opts.sub_id, edl_ids[i].filename); if (!d) { free_stream(s); diff --git a/core/timeline/tl_matroska.c b/core/timeline/tl_matroska.c index 11fcc67583..6752b5ff4c 100644 --- a/core/timeline/tl_matroska.c +++ b/core/timeline/tl_matroska.c @@ -117,8 +117,7 @@ static struct demuxer *open_demuxer(struct stream *stream, struct MPContext *mpctx, char *filename, struct demuxer_params *params) { return demux_open_withparams(&mpctx->opts, stream, - DEMUXER_TYPE_MATROSKA, NULL, mpctx->opts.audio_id, - mpctx->opts.video_id, mpctx->opts.sub_id, filename, params); + DEMUXER_TYPE_MATROSKA, NULL, filename, params); } static int enable_cache(struct MPContext *mpctx, struct stream **stream, -- cgit v1.2.3 From 52c3eb69765a0d1070bf240353095c8ff546765b Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 11 Jul 2013 21:10:42 +0200 Subject: core: change open_stream and demux_open signature This removes the dependency on DEMUXER_TYPE_* and the file_format parameter from the stream open functions. Remove some of the playlist handling code. It looks like this was needed only for loading linked mov files with demux_mov (which was removed long ago). Delete a minor bit of dead network-related code from stream.c as well. --- core/timeline/tl_cue.c | 7 +++---- core/timeline/tl_edl.c | 7 ++----- core/timeline/tl_matroska.c | 17 ++++------------- 3 files changed, 9 insertions(+), 22 deletions(-) (limited to 'core/timeline') diff --git a/core/timeline/tl_cue.c b/core/timeline/tl_cue.c index a965cfd877..1953f46116 100644 --- a/core/timeline/tl_cue.c +++ b/core/timeline/tl_cue.c @@ -188,11 +188,10 @@ static bool try_open(struct MPContext *mpctx, char *filename) || bstrcasecmp(bstr0(mpctx->demuxer->filename), bfilename) == 0) return false; - int format = 0; - struct stream *s = open_stream(filename, &mpctx->opts, &format); + struct stream *s = stream_open(filename, &mpctx->opts); if (!s) return false; - struct demuxer *d = demux_open(&mpctx->opts, s, format, filename); + struct demuxer *d = demux_open(s, NULL, NULL, &mpctx->opts); // Since .bin files are raw PCM data with no headers, we have to explicitly // open them. Also, try to avoid to open files that are most likely not .bin // files, as that would only play noise. Checking the file extension is @@ -201,7 +200,7 @@ static bool try_open(struct MPContext *mpctx, char *filename) // CD sector size (2352 bytes) if (!d && bstr_case_endswith(bfilename, bstr0(".bin"))) { mp_msg(MSGT_CPLAYER, MSGL_WARN, "CUE: Opening as BIN file!\n"); - d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_RAWAUDIO, filename); + d = demux_open(s, "rawaudio", NULL, &mpctx->opts); } if (d) { add_source(mpctx, d); diff --git a/core/timeline/tl_edl.c b/core/timeline/tl_edl.c index 0303956513..6096d03b6a 100644 --- a/core/timeline/tl_edl.c +++ b/core/timeline/tl_edl.c @@ -354,13 +354,10 @@ void build_edl_timeline(struct MPContext *mpctx) mpctx->num_sources = 1; for (int i = 0; i < num_sources; i++) { - int format = 0; - struct stream *s = open_stream(edl_ids[i].filename, &mpctx->opts, - &format); + struct stream *s = stream_open(edl_ids[i].filename, &mpctx->opts); if (!s) goto openfail; - struct demuxer *d = demux_open(&mpctx->opts, s, format, - edl_ids[i].filename); + struct demuxer *d = demux_open(s, NULL, NULL, &mpctx->opts); if (!d) { free_stream(s); openfail: diff --git a/core/timeline/tl_matroska.c b/core/timeline/tl_matroska.c index 6752b5ff4c..614ce0d6b7 100644 --- a/core/timeline/tl_matroska.c +++ b/core/timeline/tl_matroska.c @@ -113,13 +113,6 @@ static char **find_files(const char *original_file, const char *suffix) return results; } -static struct demuxer *open_demuxer(struct stream *stream, - struct MPContext *mpctx, char *filename, struct demuxer_params *params) -{ - return demux_open_withparams(&mpctx->opts, stream, - DEMUXER_TYPE_MATROSKA, NULL, filename, params); -} - static int enable_cache(struct MPContext *mpctx, struct stream **stream, struct demuxer **demuxer, struct demuxer_params *params) { @@ -133,8 +126,7 @@ static int enable_cache(struct MPContext *mpctx, struct stream **stream, free_demuxer(*demuxer); free_stream(*stream); - int format = 0; - *stream = open_stream(filename, &mpctx->opts, &format); + *stream = stream_open(filename, &mpctx->opts); if (!*stream) { talloc_free(filename); return -1; @@ -145,7 +137,7 @@ static int enable_cache(struct MPContext *mpctx, struct stream **stream, opts->stream_cache_min_percent, opts->stream_cache_seek_min_percent); - *demuxer = open_demuxer(*stream, mpctx, filename, params); + *demuxer = demux_open(*stream, "mkv", params, &mpctx->opts); if (!*demuxer) { talloc_free(filename); free_stream(*stream); @@ -167,11 +159,10 @@ static bool check_file_seg(struct MPContext *mpctx, struct demuxer **sources, .matroska_wanted_segment = segment, .matroska_was_valid = &was_valid, }; - int format = 0; - struct stream *s = open_stream(filename, &mpctx->opts, &format); + struct stream *s = stream_open(filename, &mpctx->opts); if (!s) return false; - struct demuxer *d = open_demuxer(s, mpctx, filename, ¶ms); + struct demuxer *d = demux_open(s, "mkv", ¶ms, &mpctx->opts); if (!d) { free_stream(s); -- cgit v1.2.3 From 3269bd178020c5d821e8b2d1fd807a38d63e93ce Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 12 Jul 2013 21:58:11 +0200 Subject: 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. --- core/timeline/tl_matroska.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/timeline') diff --git a/core/timeline/tl_matroska.c b/core/timeline/tl_matroska.c index 614ce0d6b7..f01160b60e 100644 --- a/core/timeline/tl_matroska.c +++ b/core/timeline/tl_matroska.c @@ -168,7 +168,7 @@ static bool check_file_seg(struct MPContext *mpctx, struct demuxer **sources, free_stream(s); return was_valid; } - if (d->file_format == DEMUXER_TYPE_MATROSKA) { + if (d->type == DEMUXER_TYPE_MATROSKA) { for (int i = 1; i < num_sources; i++) { if (sources[i]) continue; -- cgit v1.2.3