1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 08:12:17 +00:00

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.
This commit is contained in:
Stephen Hutchinson 2013-02-14 07:23:26 -05:00 committed by wm4
parent 21e4f1680c
commit 1877d7933e
3 changed files with 8 additions and 0 deletions

View File

@ -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"},

View File

@ -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;

View File

@ -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"