Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2013-11-08 21:58:33 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2013-11-08 22:00:47 +0400
commit0825694b839bec8071e282ce37db940f2ea519ea (patch)
tree8ddbd9f61fdfe01b0606b730d0c72578cb960ee4 /demuxer
parent36365f767e5dd1128a5501a3a63174cbfc918711 (diff)
Disable MPEG-TS H.264 to AVC1 conversion by default
The conversion is not required for any competent decoders. However for compat reasons still send a AVC1 type as a second media type for legacy decoders.
Diffstat (limited to 'demuxer')
-rw-r--r--demuxer/Demuxers/LAVFStreamInfo.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/demuxer/Demuxers/LAVFStreamInfo.cpp b/demuxer/Demuxers/LAVFStreamInfo.cpp
index faa796b2..794b0ad5 100644
--- a/demuxer/Demuxers/LAVFStreamInfo.cpp
+++ b/demuxer/Demuxers/LAVFStreamInfo.cpp
@@ -252,11 +252,10 @@ STDMETHODIMP CLAVFStreamInfo::CreateVideoMediaType(AVFormatContext *avctx, AVStr
} else if (mtype.formattype == FORMAT_MPEGVideo) {
mtype.pbFormat = (BYTE *)g_VideoHelper.CreateMPEG1VI(avstream, &mtype.cbFormat, m_containerFormat);
} else if (mtype.formattype == FORMAT_MPEG2Video) {
- BOOL bConvertToAVC1 = (m_containerFormat == "mpegts");
- mtype.pbFormat = (BYTE *)g_VideoHelper.CreateMPEG2VI(avstream, &mtype.cbFormat, m_containerFormat, bConvertToAVC1);
+ mtype.pbFormat = (BYTE *)g_VideoHelper.CreateMPEG2VI(avstream, &mtype.cbFormat, m_containerFormat, FALSE);
MPEG2VIDEOINFO *mp2vi = (MPEG2VIDEOINFO *)mtype.pbFormat;
if (avstream->codec->codec_id == AV_CODEC_ID_H264) {
- if (!bConvertToAVC1 && h264_is_annexb(m_containerFormat, avstream)) {
+ if (h264_is_annexb(m_containerFormat, avstream)) {
mtype.subtype = MEDIASUBTYPE_H264;
} else {
mtype.subtype = MEDIASUBTYPE_AVC1;
@@ -264,6 +263,17 @@ STDMETHODIMP CLAVFStreamInfo::CreateVideoMediaType(AVFormatContext *avctx, AVStr
mp2vi->dwFlags = 4;
}
mp2vi->hdr.bmiHeader.biCompression = mtype.subtype.Data1;
+
+ // Create a second AVC1 compat type for mpegts
+ // This should only ever be used by "legacy" decoders
+ if (mtype.subtype == MEDIASUBTYPE_H264 && m_containerFormat == "mpegts") {
+ mtypes.push_back(mtype);
+ mtype.ResetFormatBuffer();
+ mtype.subtype = MEDIASUBTYPE_AVC1;
+ mtype.pbFormat = (BYTE *)g_VideoHelper.CreateMPEG2VI(avstream, &mtype.cbFormat, m_containerFormat, TRUE);
+ MPEG2VIDEOINFO *mp2vi = (MPEG2VIDEOINFO *)mtype.pbFormat;
+ mp2vi->hdr.bmiHeader.biCompression = mtype.subtype.Data1;
+ }
} else if (avstream->codec->codec_id == AV_CODEC_ID_HEVC) {
if (hevc_is_annexb(m_containerFormat, avstream)) {
mtype.subtype = MEDIASUBTYPE_HEVC;