Skip to content

Commit

Permalink
[VideoPlayer] DemuxFFmpeg: Properly demuxing h264_mvc streams.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Fedchin authored and popcornmix committed Apr 3, 2020
1 parent d85d9d2 commit 3abb0e1
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "DVDDemuxFFmpeg.h"

#include "DVDCodecs/DVDCodecUtils.h"
#include "DVDDemuxUtils.h"
#include "DVDInputStreams/DVDInputStream.h"
#include "DVDInputStreams/DVDInputStreamFFmpeg.h"
Expand Down Expand Up @@ -1556,6 +1557,15 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)
}
case AVMEDIA_TYPE_VIDEO:
{
if (pStream->codec->codec_id == AV_CODEC_ID_H264_MVC)
{
// ignore MVC extension streams, they are handled specially
stream = new CDemuxStream();
stream->type = STREAM_DATA;
stream->disabled = true;
pStream->need_parsing = AVSTREAM_PARSE_NONE;
break;
}
CDemuxStreamVideoFFmpeg* st = new CDemuxStreamVideoFFmpeg(pStream);
stream = st;
if (strcmp(m_pFormatContext->iformat->name, "flv") == 0)
Expand All @@ -1564,7 +1574,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)
st->bVFR = false;

// never trust pts in avi files with h264.
if (m_bAVI && pStream->codecpar->codec_id == AV_CODEC_ID_H264)
if (m_bAVI && (pStream->codecpar->codec_id == AV_CODEC_ID_H264 || pStream->codecpar->codec_id == AV_CODEC_ID_H264_MVC))
st->bPTSInvalid = true;

AVRational r_frame_rate = pStream->r_frame_rate;
Expand Down Expand Up @@ -1634,6 +1644,17 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)
if (av_dict_get(pStream->metadata, "title", NULL, 0))
st->m_description = av_dict_get(pStream->metadata, "title", NULL, 0)->value;

if (pStream->codec->codec_id == AV_CODEC_ID_H264)
{
if (CDVDCodecUtils::IsH264AnnexB(m_pFormatContext->iformat->name, pStream))
{
// TODO
}
else if (CDVDCodecUtils::ProcessH264MVCExtradata(pStream->codec->extradata, pStream->codec->extradata_size))
{
pStream->codecpar->codec_tag = MKTAG('M', 'V', 'C', '1');
}
}
break;
}
case AVMEDIA_TYPE_DATA:
Expand Down

0 comments on commit 3abb0e1

Please sign in to comment.