summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorStephen Hutchinson <qyot27@gmail.com>2013-02-14 07:23:26 -0500
committerwm4 <wm4@nowhere>2013-03-14 00:07:28 +0100
commit1877d7933ec44b392291c3c1ddd220e8dc66758d (patch)
treeaf353473db23d145e042971fb4895c7e3b9f0380 /demux
parent21e4f1680c379407d77f0ac976aa8236f8227be0 (diff)
downloadmpv-1877d7933ec44b392291c3c1ddd220e8dc66758d.tar.bz2
mpv-1877d7933ec44b392291c3c1ddd220e8dc66758d.tar.xz
demux_mkv: Support playing Opus streams in Matroska
FFmpeg recently changed how it writes Opus-in-Matroska to match the A_OPUS/EXPERIMENTAL name that mkvmerge uses, with the caveat that things will change and compatibility with old files can get worked out when the spec is finalized. This adds both A_OPUS and A_OPUS/EXPERIMENTAL so that *hopefully* it can play both the newer files that use A_OPUS/EXPERIMENTAL, and older ones muxed by FFmpeg that were simply A_OPUS, since this is also what FFmpeg seems to be doing to handle the situation.
Diffstat (limited to 'demux')
-rw-r--r--demux/codec_tags.c1
-rw-r--r--demux/demux_mkv.c5
-rw-r--r--demux/matroska.h2
3 files changed, 8 insertions, 0 deletions
diff --git a/demux/codec_tags.c b/demux/codec_tags.c
index d1a6cee65f..8f535ba487 100644
--- a/demux/codec_tags.c
+++ b/demux/codec_tags.c
@@ -103,6 +103,7 @@ static const struct mp_codec_tag mp_audio_codec_tags[] = {
{0x3 , "pcm"}, // lavf: pcm_f32le
{0xfffe , "pcm"},
// ------- internal mplayer FourCCs ------
+ {MKTAG('O', 'p', 'u', 's'), "opus"}, // demux_mkv.c
{MKTAG('S', 'a', 'd', 'x'), "adpcm_adx"},
{MKTAG('A', 'M', 'V', 'A'), "adpcm_ima_amv"},
{MKTAG('R', 'o', 'Q', 'A'), "roq_dpcm"},
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index a769aac127..012ddba516 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -1314,6 +1314,8 @@ static struct mkv_audio_tag {
{ MKV_A_AAC_4LTP, 0, mmioFOURCC('M', 'P', '4', 'A') },
{ MKV_A_AAC, 0, mmioFOURCC('M', 'P', '4', 'A') },
{ MKV_A_VORBIS, 0, mmioFOURCC('v', 'r', 'b', 's') },
+ { MKV_A_OPUS, 0, mmioFOURCC('O', 'p', 'u', 's') },
+ { MKV_A_OPUS_EXP, 0, mmioFOURCC('O', 'p', 'u', 's') },
{ MKV_A_QDMC, 0, mmioFOURCC('Q', 'D', 'M', 'C') },
{ MKV_A_QDMC2, 0, mmioFOURCC('Q', 'D', 'M', '2') },
{ MKV_A_WAVPACK, 0, mmioFOURCC('W', 'V', 'P', 'K') },
@@ -1462,6 +1464,9 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track,
memcpy((unsigned char *) (sh_a->wf + 1), track->private_data,
sh_a->wf->cbSize);
}
+ } else if (!strcmp(track->codec_id, MKV_A_OPUS)
+ || !strcmp(track->codec_id, MKV_A_OPUS_EXP)) {
+ sh_a->format = mmioFOURCC('O', 'p', 'u', 's');
} else if (!strncmp(track->codec_id, MKV_A_REALATRC, 7)) {
if (track->private_size < RAPROPERTIES4_SIZE)
goto error;
diff --git a/demux/matroska.h b/demux/matroska.h
index 41ccfe2b26..2d424e2a40 100644
--- a/demux/matroska.h
+++ b/demux/matroska.h
@@ -41,6 +41,8 @@
#define MKV_A_PCM "A_PCM/INT/LIT"
#define MKV_A_PCM_BE "A_PCM/INT/BIG"
#define MKV_A_VORBIS "A_VORBIS"
+#define MKV_A_OPUS "A_OPUS"
+#define MKV_A_OPUS_EXP "A_OPUS/EXPERIMENTAL"
#define MKV_A_ACM "A_MS/ACM"
#define MKV_A_REAL28 "A_REAL/28_8"
#define MKV_A_REALATRC "A_REAL/ATRC"