mirror of
https://github.com/mpv-player/mpv
synced 2025-01-05 03:06:28 +01:00
demux_mf: map to codecs directly
Instead of going through FourCCs and codec_tags.c.
This commit is contained in:
parent
bab429870e
commit
10ed11eefa
@ -290,9 +290,6 @@ static const struct mp_codec_tag mp_video_codec_tags[] = {
|
||||
{MKTAG('M', 'V', 'I', '1'), "motionpixels"},
|
||||
{MKTAG('M', 'D', 'E', 'C'), "mdec"},
|
||||
{MKTAG('N', 'U', 'V', '1'), "nuv"},
|
||||
{MKTAG('p', 't', 'x', ' '), "ptx"},
|
||||
{MKTAG('S', 'G', 'I', '1'), "sgi"},
|
||||
{MKTAG('s', 'u', 'n', ' '), "sunrast"},
|
||||
{MKTAG('F', 'L', 'I', 'C'), "flic"},
|
||||
{MKTAG('R', 'o', 'Q', 'V'), "roq"},
|
||||
{MKTAG('A', 'M', 'V', 'V'), "amv"},
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user