summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mythtv/trunk/mythtv/hdpvr-livetv.patch
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/mythtv/trunk/mythtv/hdpvr-livetv.patch')
-rw-r--r--abs/core-testing/mythtv/trunk/mythtv/hdpvr-livetv.patch109
1 files changed, 109 insertions, 0 deletions
diff --git a/abs/core-testing/mythtv/trunk/mythtv/hdpvr-livetv.patch b/abs/core-testing/mythtv/trunk/mythtv/hdpvr-livetv.patch
new file mode 100644
index 0000000..6297ae1
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv/hdpvr-livetv.patch
@@ -0,0 +1,109 @@
+Index: libs/libmythtv/mpegrecorder.cpp
+===================================================================
+--- libs/libmythtv/mpegrecorder.cpp.orig
++++ libs/libmythtv/mpegrecorder.cpp
+@@ -1109,6 +1109,14 @@ void MpegRecorder::StartRecording(void)
+
+ if (driver == "hdpvr")
+ {
++ if (curRecording->recgroup == "LiveTV")
++ {
++ // Don't bother checking resolution, always use best bitrate
++ int maxbitrate = std::max(high_mpeg4peakbitrate,
++ high_mpeg4avgbitrate);
++ SetBitrate(high_mpeg4avgbitrate, maxbitrate, "LiveTV");
++ }
++
+ int progNum = 1;
+ MPEGStreamData *sd = new MPEGStreamData(progNum, true);
+ sd->SetRecordingType(_recording_type);
+@@ -1553,7 +1561,7 @@ bool MpegRecorder::StartEncoding(int fd)
+ memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
+ command.cmd = V4L2_ENC_CMD_START;
+
+- if (driver == "hdpvr")
++ if (driver == "hdpvr" && curRecording->recgroup != "LiveTV")
+ HandleResolutionChanges();
+
+ VERBOSE(VB_RECORD, LOC + "StartEncoding");
+@@ -1755,6 +1763,35 @@ bool MpegRecorder::WaitFor_HDPVR(void)
+ return false;
+ }
+
++void MpegRecorder::SetBitrate(int bitrate, int maxbitrate,
++ const QString & reason)
++{
++ if (maxbitrate == bitrate)
++ {
++ VERBOSE(VB_RECORD, LOC + QString("%1 bitrate %2 kbps CBR")
++ .arg(reason).arg(bitrate));
++ }
++ else
++ {
++ VERBOSE(VB_RECORD, LOC + QString("%1 bitrate %2/%3 kbps VBR")
++ .arg(reason).arg(bitrate).arg(maxbitrate));
++ }
++
++ vector<struct v4l2_ext_control> ext_ctrls;
++ add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
++ (maxbitrate == bitrate) ?
++ V4L2_MPEG_VIDEO_BITRATE_MODE_CBR :
++ V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
++
++ add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE,
++ bitrate * 1000);
++
++ add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
++ maxbitrate * 1000);
++
++ set_ctrls(readfd, ext_ctrls);
++}
++
+ void MpegRecorder::HandleResolutionChanges(void)
+ {
+ VERBOSE(VB_RECORD, LOC + "Checking Resolution");
+@@ -1819,30 +1856,7 @@ void MpegRecorder::HandleResolutionChang
+ .arg(old_avg).arg(old_max));
+ }
+
+- if (maxbitrate == bitrate)
+- {
+- VERBOSE(VB_RECORD, LOC + QString("New bitrate %1 kbps CBR")
+- .arg(bitrate));
+- }
+- else
+- {
+- VERBOSE(VB_RECORD, LOC + QString("New bitrate %1/%2 kbps VBR")
+- .arg(bitrate).arg(maxbitrate));
+- }
+-
+- vector<struct v4l2_ext_control> ext_ctrls;
+- add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
+- (maxbitrate == bitrate) ?
+- V4L2_MPEG_VIDEO_BITRATE_MODE_CBR :
+- V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
+-
+- add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE,
+- bitrate * 1000);
+-
+- add_ext_ctrl(ext_ctrls, V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
+- maxbitrate * 1000);
+-
+- set_ctrls(readfd, ext_ctrls);
+-
++ SetBitrate(bitrate, maxbitrate, "New");
+ }
+ }
++
+Index: libs/libmythtv/mpegrecorder.h
+===================================================================
+--- libs/libmythtv/mpegrecorder.h.orig
++++ libs/libmythtv/mpegrecorder.h
+@@ -87,6 +87,7 @@ class MpegRecorder : public DTVRecorder,
+ void ResetForNewFile(void);
+
+ bool WaitFor_HDPVR(void);
++ void SetBitrate(int bitrate, int maxbitrate, const QString & reason);
+ void HandleResolutionChanges(void);
+
+ inline bool CheckCC(uint pid, uint cc);