summaryrefslogtreecommitdiffstats
path: root/demux/demux_mf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-24 16:31:43 +0100
committerwm4 <wm4@nowhere>2013-02-24 16:31:43 +0100
commit10ed11eefad93479bd7c8340da4c7603726329e5 (patch)
tree3b26ec251e472cc00249627fb1baa6b2040ce94f /demux/demux_mf.c
parentbab429870e63bc13bc7583c2eba66f93cfd768a2 (diff)
downloadmpv-10ed11eefad93479bd7c8340da4c7603726329e5.tar.bz2
mpv-10ed11eefad93479bd7c8340da4c7603726329e5.tar.xz
demux_mf: map to codecs directly
Instead of going through FourCCs and codec_tags.c.
Diffstat (limited to 'demux/demux_mf.c')
-rw-r--r--demux/demux_mf.c71
1 files changed, 35 insertions, 36 deletions
diff --git a/demux/demux_mf.c b/demux/demux_mf.c
index 6d47bc7338..bbeda26bbf 100644
--- a/demux/demux_mf.c
+++ b/demux/demux_mf.c
@@ -98,42 +98,42 @@ static int demux_mf_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds){
static const struct {
const char *type;
- uint32_t format;
+ const char *codec;
} type2format[] = {
- { "bmp", mmioFOURCC('b', 'm', 'p', ' ') },
- { "dpx", mmioFOURCC('d', 'p', 'x', ' ') },
- { "j2c", mmioFOURCC('M', 'J', '2', 'C') },
- { "j2k", mmioFOURCC('M', 'J', '2', 'C') },
- { "jp2", mmioFOURCC('M', 'J', '2', 'C') },
- { "jpc", mmioFOURCC('M', 'J', '2', 'C') },
- { "jpeg", mmioFOURCC('I', 'J', 'P', 'G') },
- { "jpg", mmioFOURCC('I', 'J', 'P', 'G') },
- { "jps", mmioFOURCC('I', 'J', 'P', 'G') },
- { "jls", mmioFOURCC('I', 'J', 'P', 'G') },
- { "thm", mmioFOURCC('I', 'J', 'P', 'G') },
- { "db", mmioFOURCC('I', 'J', 'P', 'G') },
- { "pcx", mmioFOURCC('p', 'c', 'x', ' ') },
- { "png", mmioFOURCC('M', 'P', 'N', 'G') },
- { "pns", mmioFOURCC('M', 'P', 'N', 'G') },
- { "ptx", mmioFOURCC('p', 't', 'x', ' ') },
- { "tga", mmioFOURCC('M', 'T', 'G', 'A') },
- { "tif", mmioFOURCC('t', 'i', 'f', 'f') },
- { "tiff", mmioFOURCC('t', 'i', 'f', 'f') },
- { "sgi", mmioFOURCC('S', 'G', 'I', '1') },
- { "sun", mmioFOURCC('s', 'u', 'n', ' ') },
- { "ras", mmioFOURCC('s', 'u', 'n', ' ') },
- { "ra", mmioFOURCC('s', 'u', 'n', ' ') },
- { "im1", mmioFOURCC('s', 'u', 'n', ' ') },
- { "im8", mmioFOURCC('s', 'u', 'n', ' ') },
- { "im24", mmioFOURCC('s', 'u', 'n', ' ') },
- { "sunras", mmioFOURCC('s', 'u', 'n', ' ') },
- { NULL, 0 }
+ { "bmp", "bmp" },
+ { "dpx", "dpx" },
+ { "j2c", "jpeg2000" },
+ { "j2k", "jpeg2000" },
+ { "jp2", "jpeg2000" },
+ { "jpc", "jpeg2000" },
+ { "jpeg", "mjpeg" },
+ { "jpg", "mjpeg" },
+ { "jps", "mjpeg" },
+ { "jls", "ljpeg" },
+ { "thm", "mjpeg" },
+ { "db", "mjpeg" },
+ { "pcx", "pcx" },
+ { "png", "png" },
+ { "pns", "png" },
+ { "ptx", "ptx" },
+ { "tga", "targa" },
+ { "tif", "tiff" },
+ { "tiff", "tiff" },
+ { "sgi", "sgi" },
+ { "sun", "sunrast" },
+ { "ras", "sunrast" },
+ { "ra", "sunrast" },
+ { "im1", "sunrast" },
+ { "im8", "sunrast" },
+ { "im24", "sunrast" },
+ { "sunras", "sunrast" },
+ {0}
};
-static uint32_t probe_format(mf_t *mf)
+static const char *probe_format(mf_t *mf)
{
if (mf->nr_of_files < 1)
- return 0;
+ return NULL;
char *type = mf_type;
if (!type || !type[0]) {
char *p = strrchr(mf->names[0], '.');
@@ -141,13 +141,13 @@ static uint32_t probe_format(mf_t *mf)
type = p + 1;
}
if (!type || !type[0])
- return 0;
+ return NULL;
int i;
for (i = 0; type2format[i].type; i++) {
if (strcasecmp(type, type2format[i].type) == 0)
break;
}
- return type2format[i].format;
+ return type2format[i].codec;
}
static mf_t *open_mf(demuxer_t *demuxer)
@@ -193,12 +193,11 @@ static demuxer_t* demux_open_mf(demuxer_t* demuxer){
// (even though new_sh_video() ought to take care of it)
demuxer->video->sh = sh_video;
- sh_video->format = probe_format(mf);
- if (!sh_video->format) {
+ sh_video->gsh->codec = probe_format(mf);
+ if (!sh_video->gsh->codec) {
mp_msg(MSGT_DEMUX, MSGL_INFO, "[demux_mf] file type was not set! (try -mf type=ext)\n" );
goto error;
}
- mp_set_video_codec_from_tag(sh_video);
// make sure that the video demuxer stream header knows about its
// parent video demuxer stream (this is getting wacky), or else