Skip to content

Commit

Permalink
Merge pull request xbmc#15056 from peak3d/mpeg4
Browse files Browse the repository at this point in the history
[Android] remove mpeg4 HD restriction / use dts for unknown pts for mpeg4
  • Loading branch information
peak3d authored Dec 14, 2018
2 parents 57abba2 + f2b8077 commit 4c17e77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ CDVDVideoCodecAndroidMediaCodec::CDVDVideoCodecAndroidMediaCodec(CProcessInfo &p
, m_bitstream(nullptr)
, m_render_surface(surface_render)
, m_mpeg2_sequence(nullptr)
, m_useDTSforPTS(false)
{
m_videobuffer.Reset();
}
Expand Down Expand Up @@ -418,6 +419,7 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio
m_hints = hints;
m_indexInputBuffer = -1;
m_dtsShift = DVD_NOPTS_VALUE;
m_useDTSforPTS = false;

CLog::Log(LOGDEBUG, LOGVIDEO, "CDVDVideoCodecAndroidMediaCodec::Open hints: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale);
CLog::Log(LOGDEBUG, LOGVIDEO, "CDVDVideoCodecAndroidMediaCodec::Open hints: CodecID %d \n", m_hints.codec);
Expand All @@ -441,10 +443,9 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio
m_formatname = "amc-mpeg2";
break;
case AV_CODEC_ID_MPEG4:
if (hints.width <= 800)
goto FAIL;
m_mime = "video/mp4v-es";
m_formatname = "amc-mpeg4";
m_useDTSforPTS = true;
break;
case AV_CODEC_ID_H263:
m_mime = "video/3gpp";
Expand Down Expand Up @@ -906,6 +907,8 @@ bool CDVDVideoCodecAndroidMediaCodec::AddData(const DemuxPacket &packet)
int64_t presentationTimeUs = 0;
if (pts != DVD_NOPTS_VALUE)
presentationTimeUs = (pts - m_dtsShift);
else if (m_useDTSforPTS && dts != DVD_NOPTS_VALUE)
presentationTimeUs = (dts - m_dtsShift);

int flags = 0;
int offset = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class CDVDVideoCodecAndroidMediaCodec : public CDVDVideoCodec, public CJNISurfac
mpeg2_sequence *m_mpeg2_sequence;
int m_src_offset[4];
int m_src_stride[4];
bool m_useDTSforPTS;

// CJNISurfaceHolderCallback interface
public:
Expand Down

0 comments on commit 4c17e77

Please sign in to comment.