Skip to content

Commit

Permalink
Add support for Matroska DolbyVision
Browse files Browse the repository at this point in the history
This commit adds support to Dolby Vision combined layer present on mkv files
  • Loading branch information
fandangos committed Dec 21, 2020
1 parent 39d0d50 commit 0282f84
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tools/depends/target/ffmpeg/FFMPEG-VERSION
@@ -1,4 +1,4 @@
LIBNAME=ffmpeg
BASE_URL=https://github.com/xbmc/FFmpeg
VERSION=4.3.1-Matrix-Beta1
BASE_URL=https://github.com/fandangos/FFmpeg
VERSION=4.3.1-Matrix-DV1
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
Expand Up @@ -498,6 +498,12 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio
m_mime = "video/dolby-vision";
m_formatname = "amc-dvh1";
}
else if (m_hints.codec_tag == MKBETAG('d', 'v', 'v', 'C') ||
m_hints.codec_tag == MKBETAG('d', 'v', 'c', 'C'))
{
m_mime = "video/dolby-vision";
m_formatname = "amc-dvh1";
}
else
{
m_mime = "video/hevc";
Expand Down
16 changes: 15 additions & 1 deletion xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
Expand Up @@ -47,6 +47,7 @@
#endif

extern "C" {
#include "libavutil/dovi_meta.h"
#include <libavutil/dict.h>
#include <libavutil/opt.h>
}
Expand Down Expand Up @@ -1629,7 +1630,20 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)
stereoMode = GetStereoModeFromMetadata(m_pFormatContext->metadata);
if (!stereoMode.empty())
st->stereo_mode = stereoMode;


if (m_bMatroska)
{
int size;
uint8_t* side_data = av_stream_get_side_data(pStream, AV_PKT_DATA_DOVI_CONF, &size);
if (size > 0 && side_data)
{
auto dovi = reinterpret_cast<AVDOVIDecoderConfigurationRecord*>(side_data);
if (dovi->dv_profile > 7)
pStream->codecpar->codec_tag = MKBETAG('d', 'v', 'v', 'C');
else
pStream->codecpar->codec_tag = MKBETAG('d', 'v', 'c', 'C');
}
}

if (m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD))
{
Expand Down

0 comments on commit 0282f84

Please sign in to comment.