Skip to content

Commit

Permalink
avformatdecoder.cpp: silence -Wundef
Browse files Browse the repository at this point in the history
by removing the dts seeking hack, which hasn't compiled since
the FFmpeg 5.1 merge, which moved AVStream::cur_dts to the internal
struct FFStream.
  • Loading branch information
ulmus-scott authored and bennettpeter committed Nov 24, 2022
1 parent 430ee11 commit 1d5dab7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 69 deletions.
68 changes: 0 additions & 68 deletions mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -614,19 +614,6 @@ bool AvFormatDecoder::DoFastForward(long long desiredFrame, bool discardFrames)
bool oldrawstate = m_getRawFrames;
m_getRawFrames = false;

#if DTS_SEEKING_HACK
AVStream *st = nullptr;
for (uint i = 0; i < m_ic->nb_streams; i++)
{
AVStream *st1 = m_ic->streams[i];
if (st1 && st1->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
{
st = st1;
break;
}
}
#endif

int seekDelta = desiredFrame - m_framesPlayed;

// avoid using av_frame_seek if we are seeking frame-by-frame when paused
Expand Down Expand Up @@ -661,51 +648,7 @@ bool AvFormatDecoder::DoFastForward(long long desiredFrame, bool discardFrames)

int normalframes = 0;

#if DTS_SEEKING_HACK
if (st && st->cur_dts != AV_NOPTS_VALUE)
{

int64_t adj_cur_dts = st->cur_dts;

if (m_ic->start_time != AV_NOPTS_VALUE)
{
int64_t st1 = av_rescale(m_ic->start_time,
st->time_base.den,
AV_TIME_BASE * (int64_t)st->time_base.num);
adj_cur_dts = lsb3full(adj_cur_dts, st1, st->pts_wrap_bits);
}

int64_t adj_seek_dts = av_rescale(seekts,
st->time_base.den,
AV_TIME_BASE * (int64_t)st->time_base.num);

int64_t max_dts = (st->pts_wrap_bits < 64) ? (1LL<<st->pts_wrap_bits)-1 : -1LL;

// When seeking near the start of a stream the current dts is sometimes
// less than the start time which causes lsb3full to return adj_cur_dts
// close to the maximum dts value. If so, set adj_cur_dts to zero.
if (adj_seek_dts < max_dts / 64 && adj_cur_dts > max_dts / 2)
adj_cur_dts = 0;

long long newts = av_rescale(adj_cur_dts,
(int64_t)AV_TIME_BASE *
(int64_t)st->time_base.num,
st->time_base.den);

m_lastKey = (long long)((newts*(long double)m_fps)/AV_TIME_BASE);
m_framesPlayed = m_lastKey;
m_fpsSkip = 0;
m_framesRead = m_lastKey;

normalframes = (exactseeks) ? desiredFrame - m_framesPlayed : 0;
normalframes = std::max(normalframes, 0);
m_noDtsHack = false;
}
else
#endif
{
LOG(VB_GENERAL, LOG_INFO, LOC + "No DTS Seeking Hack!");
m_noDtsHack = true;
m_framesPlayed = desiredFrame;
m_fpsSkip = 0;
m_framesRead = desiredFrame;
Expand Down Expand Up @@ -792,17 +735,6 @@ void AvFormatDecoder::SeekReset(long long newKey, uint skipFrames,

m_prevGopPos = 0;
m_gopSet = false;
if (!m_ringBuffer->IsDVD())
{
if (!m_noDtsHack)
{
m_framesPlayed = m_lastKey;
m_fpsSkip = 0;
m_framesRead = m_lastKey;
}

m_noDtsHack = false;
}
}

// Skip all the desired number of skipFrames
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.h
Expand Up @@ -274,7 +274,6 @@ class AvFormatDecoder : public DecoderBase
struct SwsContext *m_swsCtx {nullptr};
bool m_directRendering {false};

bool m_noDtsHack {false};
bool m_doRewind {false};

bool m_gopSet {false};
Expand Down

0 comments on commit 1d5dab7

Please sign in to comment.