Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix "mythcommflag --rebuild" for non-HDPVR recordings.

By default, only identify IDR keyframes for h.264 recordings.
However, since DVB-S recordings may lack IDR frames, we check after
1000 frames whether any keyframes have been found, and if not, back up
and restart using the more lenient setting.

Adapted from 802e32b and
77bf327.
  • Loading branch information...
commit fa3ebd4324883bd942324ff2fdb0de52faaaec5a 1 parent 52d0f56
@stichnot stichnot authored
View
2  mythtv/libs/libmythbase/mythversion.h
@@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
-#define MYTH_BINARY_VERSION "0.25.20120506-1"
+#define MYTH_BINARY_VERSION "0.25.20130112-1"
/** \brief Increment this whenever the MythTV network protocol changes.
*
View
2  mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -324,7 +324,7 @@ AvFormatDecoder::AvFormatDecoder(MythPlayer *parent,
cc608_build_parity_table(cc608_parity_table);
- m_h264_parser->use_I_forKeyframes(false);
+ SetIdrOnlyKeyframes(true);
LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("PlayerFlags: 0x%1")
.arg(playerFlags, 0, 16));
View
3  mythtv/libs/libmythtv/avformatdecoder.h
@@ -160,6 +160,9 @@ class AvFormatDecoder : public DecoderBase
virtual long long GetChapter(int chapter);
virtual bool DoRewind(long long desiredFrame, bool doflush = true);
virtual bool DoFastForward(long long desiredFrame, bool doflush = true);
+ virtual void SetIdrOnlyKeyframes(bool value) {
+ m_h264_parser->use_I_forKeyframes(!value);
+ }
virtual int64_t NormalizeVideoTimecode(int64_t timecode);
virtual int64_t NormalizeVideoTimecode(AVStream *st, int64_t timecode);
View
3  mythtv/libs/libmythtv/decoderbase.h
@@ -136,6 +136,7 @@ class DecoderBase
virtual long long GetChapter(int chapter) { return framesPlayed; }
virtual bool DoRewind(long long desiredFrame, bool doflush = true);
virtual bool DoFastForward(long long desiredFrame, bool doflush = true);
+ virtual void SetIdrOnlyKeyframes(bool value) { }
float GetVideoAspect(void) const { return current_aspect; }
@@ -182,6 +183,8 @@ class DecoderBase
bool IsErrored() const { return errored; }
+ bool HasPositionMap(void) const { return GetPositionMapSize(); }
+
void SetWaitForChange(void);
bool GetWaitForChange(void) const;
void SetReadAdjust(long long adjust);
View
21 mythtv/libs/libmythtv/mythcommflagplayer.cpp
@@ -105,6 +105,7 @@ bool MythCommFlagPlayer::RebuildSeekTable(
cout << "\r \r" << flush;
int prevperc = -1;
+ bool usingIframes = false;
while (!GetEof())
{
if (inuse_timer.elapsed() > 2534)
@@ -179,6 +180,26 @@ bool MythCommFlagPlayer::RebuildSeekTable(
if (DecoderGetFrame(kDecodeNothing,true))
myFramesPlayed = decoder->GetFramesRead();
+
+ // H.264 recordings from an HD-PVR contain IDR keyframes,
+ // which are the only valid cut points for lossless cuts.
+ // However, DVB-S h.264 recordings may lack IDR keyframes, in
+ // which case we need to allow non-IDR I-frames. If we get
+ // far enough into the rebuild without having created any
+ // seektable entries, we can assume it is because of the IDR
+ // keyframe setting, and so we rewind and allow h.264 non-IDR
+ // I-frames to be treated as keyframes.
+ uint64_t frames = decoder->GetFramesRead();
+ if (!usingIframes &&
+ (GetEof() || (frames > 1000 && frames < 1100)) &&
+ !decoder->HasPositionMap())
+ {
+ decoder->DoRewind(0);
+ decoder->Reset(true, true, true);
+ pmap_first = pmap_last = myFramesPlayed = 0;
+ decoder->SetIdrOnlyKeyframes(false);
+ usingIframes = true;
+ }
}
if (showPercentage)
Please sign in to comment.
Something went wrong with that request. Please try again.