summaryrefslogtreecommitdiffstats
path: root/demux/demux_subreader.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-12 21:58:11 +0200
committerwm4 <wm4@nowhere>2013-07-12 22:16:26 +0200
commit3269bd178020c5d821e8b2d1fd807a38d63e93ce (patch)
tree474e0f7a712cc7002984ec1bdda7d445b5fd8c77 /demux/demux_subreader.c
parent311d2f199a7b1f4d819cfb799a0f0f571596b91e (diff)
downloadmpv-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 'demux/demux_subreader.c')
-rw-r--r--demux/demux_subreader.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/demux/demux_subreader.c b/demux/demux_subreader.c
index 7758aa968c..24604978d5 100644
--- a/demux/demux_subreader.c
+++ b/demux/demux_subreader.c
@@ -1326,8 +1326,11 @@ static struct stream *read_probe_stream(struct stream *s, int max)
#define PROBE_SIZE FFMIN(32 * 1024, STREAM_MAX_BUFFER_SIZE)
-static int d_check_file(struct demuxer *demuxer)
+static int d_open_file(struct demuxer *demuxer, enum demux_check check)
{
+ if (check > DEMUX_CHECK_REQUEST)
+ return -1;
+
struct stream *ps = read_probe_stream(demuxer->stream, PROBE_SIZE);
struct subreader sr;
@@ -1393,9 +1396,7 @@ const struct demuxer_desc demuxer_desc_subreader = {
.shortdesc = "Deprecated Subreader",
.author = "",
.comment = "",
- .type = DEMUXER_TYPE_SUBREADER,
- .safe_check = 1,
- .check_file = d_check_file,
+ .open = d_open_file,
.fill_buffer = d_fill_buffer,
.seek = d_seek,
.control = d_control,