summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Ralph <tralph@mythtv.org>2012-03-06 01:54:43 (GMT)
committer Taylor Ralph <tralph@mythtv.org>2012-03-06 01:54:43 (GMT)
commit02dd6ee9b999d647d4a151390c18e4a82d7b38d9 (patch)
tree09746adc4e897f742aeec1df235836466b2f148e
parent3449b0fcb24ec7729875975254bd90459cc2a6b9 (diff)
AvFormatDecoder: add FORCE_DTS_TIMESTAMPS environment variable
This allows a user to force the player to use video dts timestamps for av-sync purposes in the event they have material with busted pts timestamps. backport 40c69e1c48a51d9061a01e5041b4ad88ce73d862 Fixes #10007.
-rw-r--r--mythtv/libs/libmythtv/avformatdecoder.cpp17
-rw-r--r--mythtv/libs/libmythtv/avformatdecoder.h2
2 files changed, 16 insertions, 3 deletions
diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
index 587316d..ff19d00 100644
--- a/mythtv/libs/libmythtv/avformatdecoder.cpp
+++ b/mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -268,6 +268,7 @@ AvFormatDecoder::AvFormatDecoder(MythPlayer *parent,
pts_detected(false),
reordered_pts_detected(false),
pts_selected(true),
+ force_dts_timestamps(false),
using_null_videoout(use_null_videoout),
video_codec_id(kCodec_NONE),
no_hardware_decoders(no_hardware_decode),
@@ -1073,6 +1074,9 @@ int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo,
.arg(framenum));
}
+ if (getenv("FORCE_DTS_TIMESTAMPS"))
+ force_dts_timestamps = true;
+
// Return true if recording has position map
return recordingHasPositionMap;
}
@@ -3121,7 +3125,13 @@ bool AvFormatDecoder::ProcessVideoPacket(AVStream *curstream, AVPacket *pkt)
// the DTS timestamp is missing. Also use fixups for missing PTS instead of
// DTS to avoid oscillating between PTS and DTS. Only select DTS if PTS is
// more faulty or never detected.
- if (ringBuffer->isDVD())
+ if (force_dts_timestamps)
+ {
+ if (pkt->dts != (int64_t)AV_NOPTS_VALUE)
+ pts = pkt->dts;
+ pts_selected = false;
+ }
+ else if (ringBuffer->isDVD())
{
if (pkt->dts != (int64_t)AV_NOPTS_VALUE)
pts = pkt->dts;
@@ -3161,10 +3171,11 @@ bool AvFormatDecoder::ProcessVideoPacket(AVStream *curstream, AVPacket *pkt)
}
VERBOSE(VB_PLAYBACK+VB_TIMESTAMP, LOC +
- QString("video timecode %1 %2 %3 %4 %5 %6 (%7 active)%8")
+ QString("video timecode %1 %2 %3 %4 %5 %6 (%7)%8")
.arg(mpa_pic.reordered_opaque).arg(pkt->pts).arg(pkt->dts)
.arg(vpts).arg(temppts).arg(lastvpts)
- .arg((pts_selected) ? "reordered" : "dts")
+ .arg((force_dts_timestamps) ? "dts forced" :
+ (pts_selected) ? "reordered" : "dts")
.arg((vpts != temppts) ? " fixup" : ""));
/* XXX: Broken.
diff --git a/mythtv/libs/libmythtv/avformatdecoder.h b/mythtv/libs/libmythtv/avformatdecoder.h
index bb775e2..22f9d7a 100644
--- a/mythtv/libs/libmythtv/avformatdecoder.h
+++ b/mythtv/libs/libmythtv/avformatdecoder.h
@@ -288,6 +288,8 @@ class AvFormatDecoder : public DecoderBase
bool reordered_pts_detected;
bool pts_selected;
+ bool force_dts_timestamps;
+
bool using_null_videoout;
MythCodecID video_codec_id;
bool no_hardware_decoders;