summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mythtv/trunk/mythtv/hdpvr-signalmonitor.patch
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/mythtv/trunk/mythtv/hdpvr-signalmonitor.patch')
-rw-r--r--abs/core-testing/mythtv/trunk/mythtv/hdpvr-signalmonitor.patch292
1 files changed, 0 insertions, 292 deletions
diff --git a/abs/core-testing/mythtv/trunk/mythtv/hdpvr-signalmonitor.patch b/abs/core-testing/mythtv/trunk/mythtv/hdpvr-signalmonitor.patch
deleted file mode 100644
index 2465cfe..0000000
--- a/abs/core-testing/mythtv/trunk/mythtv/hdpvr-signalmonitor.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-Index: libs/libmythtv/analogsignalmonitor.cpp
-===================================================================
---- libs/libmythtv/analogsignalmonitor.cpp.orig
-+++ libs/libmythtv/analogsignalmonitor.cpp
-@@ -4,23 +4,92 @@
- #include <cerrno>
- #include <unistd.h>
- #include <sys/ioctl.h>
-+#include <poll.h>
-
- #include "videodev_myth.h"
- #include "mythcontext.h"
- #include "analogsignalmonitor.h"
- #include "v4lchannel.h"
-
--#define LOC QString("AnalogSM: ").arg(channel->GetDevice())
--#define LOC_ERR QString("AnalogSM, Error: ").arg(channel->GetDevice())
-+#define LOC QString("AnalogSM: %1 ").arg(channel->GetDevice())
-+#define LOC_ERR QString("AnalogSM, Error: %1 ").arg(channel->GetDevice())
-
--AnalogSignalMonitor::AnalogSignalMonitor(
-- int db_cardnum, V4LChannel *_channel, uint64_t _flags) :
-+AnalogSignalMonitor::AnalogSignalMonitor(int db_cardnum, V4LChannel *_channel,
-+ uint64_t _flags) :
- SignalMonitor(db_cardnum, _channel, _flags),
-- usingv4l2(false)
-+ m_usingv4l2(false),
-+ m_stage(0)
- {
- int videofd = channel->GetFd();
- if (videofd >= 0)
-- usingv4l2 = CardUtil::hasV4L2(videofd);
-+ {
-+ m_usingv4l2 = CardUtil::hasV4L2(videofd);
-+ CardUtil::GetV4LInfo(videofd, m_card, m_driver, m_version);
-+ VERBOSE(VB_RECORD, LOC + QString("card '%1' driver '%2' version '%3'")
-+ .arg(m_card).arg(m_driver).arg(m_version));
-+ }
-+}
-+
-+bool AnalogSignalMonitor::handleHDPVR(int videofd)
-+{
-+ struct v4l2_encoder_cmd command;
-+ struct pollfd polls;
-+ int idx;
-+
-+ if (m_stage == 0)
-+ {
-+ VERBOSE(VB_RECORD, LOC + "hd-pvr start encoding");
-+ // Tell it to start encoding, then wait for it to actually feed us
-+ // some data.
-+ memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
-+ command.cmd = V4L2_ENC_CMD_START;
-+ if (ioctl(videofd, VIDIOC_ENCODER_CMD, &command) == 0)
-+ m_stage = 1;
-+ else
-+ VERBOSE(VB_IMPORTANT, LOC_ERR + "Start encoding failed" + ENO);
-+ }
-+
-+ if (m_stage == 1)
-+ {
-+ VERBOSE(VB_RECORD, LOC + "hd-pvr wait for data");
-+
-+ polls.fd = videofd;
-+ polls.events = POLLIN;
-+ polls.revents = 0;
-+
-+ if (poll(&polls, 1, 1500) > 0)
-+ m_stage = 2;
-+ else
-+ {
-+ VERBOSE(VB_RECORD, LOC + "Poll timed-out. Resetting");
-+ memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
-+ command.cmd = V4L2_ENC_CMD_STOP;
-+ ioctl(videofd, VIDIOC_ENCODER_CMD, &command);
-+ m_stage = 0;
-+ }
-+ }
-+
-+ if (m_stage == 2)
-+ {
-+ VERBOSE(VB_RECORD, LOC + "hd-pvr data ready. Stop encoding");
-+
-+ command.cmd = V4L2_ENC_CMD_STOP;
-+ if (ioctl(videofd, VIDIOC_ENCODER_CMD, &command) == 0)
-+ m_stage = 3;
-+ }
-+
-+ if (m_stage == 3)
-+ {
-+ struct v4l2_format vfmt;
-+ memset(&vfmt, 0, sizeof(vfmt));
-+ vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-+
-+ VERBOSE(VB_RECORD, LOC + "hd-pvr waiting for valid resolution");
-+ if ((ioctl(videofd, VIDIOC_G_FMT, &vfmt) == 0) && vfmt.fmt.pix.width)
-+ m_stage = 4;
-+ }
-+
-+ return (m_stage == 4);
- }
-
- void AnalogSignalMonitor::UpdateValues(void)
-@@ -33,19 +102,24 @@ void AnalogSignalMonitor::UpdateValues(v
- return;
-
- bool isLocked = false;
-- if (usingv4l2)
-+ if (m_usingv4l2)
- {
-- struct v4l2_tuner tuner;
-- bzero(&tuner, sizeof(tuner));
--
-- if (ioctl(videofd, VIDIOC_G_TUNER, &tuner, 0) < 0)
-- {
-- VERBOSE(VB_IMPORTANT,
-- LOC_ERR + "Failed to probe signal (v4l2)" + ENO);
-- }
-+ if (m_driver == "hdpvr")
-+ isLocked = handleHDPVR(videofd);
- else
- {
-- isLocked = tuner.signal;
-+ struct v4l2_tuner tuner;
-+ bzero(&tuner, sizeof(tuner));
-+
-+ if (ioctl(videofd, VIDIOC_G_TUNER, &tuner, 0) < 0)
-+ {
-+ VERBOSE(VB_IMPORTANT,
-+ LOC_ERR + "Failed to probe signal (v4l2)" + ENO);
-+ }
-+ else
-+ {
-+ isLocked = tuner.signal;
-+ }
- }
- }
- else
-Index: libs/libmythtv/analogsignalmonitor.h
-===================================================================
---- libs/libmythtv/analogsignalmonitor.h.orig
-+++ libs/libmythtv/analogsignalmonitor.h
-@@ -19,7 +19,13 @@ class AnalogSignalMonitor : public Signa
- virtual void UpdateValues(void);
-
- private:
-- bool usingv4l2;
-+ bool handleHDPVR(int videofd);
-+
-+ bool m_usingv4l2;
-+ QString m_card;
-+ QString m_driver;
-+ uint32_t m_version;
-+ int m_stage;
- };
-
- #endif // _ANALOG_SIGNAL_MONITOR_H_
-Index: libs/libmythtv/mpegrecorder.cpp
-===================================================================
---- libs/libmythtv/mpegrecorder.cpp.orig
-+++ libs/libmythtv/mpegrecorder.cpp
-@@ -1041,14 +1041,6 @@ 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);
-@@ -1492,7 +1484,7 @@ bool MpegRecorder::StartEncoding(int fd)
- memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
- command.cmd = V4L2_ENC_CMD_START;
-
-- if (driver == "hdpvr" && curRecording->recgroup != "LiveTV")
-+ if (driver == "hdpvr")
- HandleResolutionChanges();
-
- VERBOSE(VB_RECORD, LOC + "StartEncoding");
-@@ -1615,64 +1607,6 @@ void MpegRecorder::HandleSingleProgramPM
- DTVRecorder::BufferedWrite(*(reinterpret_cast<TSPacket*>(&buf[i])));
- }
-
--/// After a resolution change, it can take the HD-PVR a few
--/// seconds before it is usable again.
--bool MpegRecorder::WaitFor_HDPVR(void)
--{
-- struct v4l2_encoder_cmd command;
-- struct v4l2_format vfmt;
-- struct pollfd polls;
-- int idx;
--
-- // Tell it to start encoding, then wait for it to actually feed us
-- // some data.
-- QMutexLocker locker(&start_stop_encoding_lock);
--
-- // Sleep any less than 1.5 seconds, and the HD-PVR will
-- // return the old resolution, when the resolution is changing.
-- usleep(1500 * 1000);
--
-- memset(&command, 0, sizeof(struct v4l2_encoder_cmd));
-- command.cmd = V4L2_ENC_CMD_START;
--
-- for (idx = 0; idx < 20; ++idx)
-- {
-- if (ioctl(readfd, VIDIOC_ENCODER_CMD, &command) == 0)
-- break;
-- usleep(100 * 1000);
-- }
--
-- if (idx == 20)
-- return false;
--
-- polls.fd = readfd;
-- polls.events = POLLIN;
-- polls.revents = 0;
--
-- if (poll(&polls, 1, 5000) <= 0)
-- return false;
--
-- // HD-PVR should now be "ready"
-- command.cmd = V4L2_ENC_CMD_STOP;
--
-- if (ioctl(readfd, VIDIOC_ENCODER_CMD, &command) < 0)
-- return false;
--
-- memset(&vfmt, 0, sizeof(vfmt));
-- vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
--
-- for (idx = 0; idx < 20; ++idx)
-- {
-- if (0 == ioctl(chanfd, VIDIOC_G_FMT, &vfmt))
-- return true;
-- // Typically takes 0.9 seconds after a resolution change
-- usleep(100 * 1000);
-- }
--
-- VERBOSE(VB_RECORD, LOC + "WaitForHDPVR failed");
-- return false;
--}
--
- void MpegRecorder::SetBitrate(int bitrate, int maxbitrate,
- const QString & reason)
- {
-@@ -1710,9 +1644,6 @@ void MpegRecorder::HandleResolutionChang
- memset(&vfmt, 0, sizeof(vfmt));
- vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-
-- if (driver == "hdpvr")
-- WaitFor_HDPVR();
--
- if (0 == ioctl(chanfd, VIDIOC_G_FMT, &vfmt))
- {
- VERBOSE(VB_RECORD, LOC + QString("Got Resolution %1x%2")
-Index: libs/libmythtv/mpegrecorder.h
-===================================================================
---- libs/libmythtv/mpegrecorder.h.orig
-+++ libs/libmythtv/mpegrecorder.h
-@@ -86,7 +86,6 @@ class MpegRecorder : public DTVRecorder,
-
- void ResetForNewFile(void);
-
-- bool WaitFor_HDPVR(void);
- void SetBitrate(int bitrate, int maxbitrate, const QString & reason);
- void HandleResolutionChanges(void);
-
-Index: libs/libmythtv/signalmonitor.h
-===================================================================
---- libs/libmythtv/signalmonitor.h.orig
-+++ libs/libmythtv/signalmonitor.h
-@@ -287,6 +287,7 @@ inline bool SignalMonitor::IsRequired(co
- return (CardUtil::IsDVBCardType(cardtype) ||
- (cardtype.toUpper() == "HDTV") ||
- (cardtype.toUpper() == "HDHOMERUN") ||
-+ (cardtype.toUpper() == "HDPVR") ||
- (cardtype.toUpper() == "FIREWIRE") ||
- (cardtype.toUpper() == "FREEBOX"));
- }
-@@ -295,6 +296,7 @@ inline bool SignalMonitor::IsSupported(c
- {
- return (IsRequired(cardtype) ||
- (cardtype.toUpper() == "V4L") ||
-+ (cardtype.toUpper() == "HDPVR") ||
- (cardtype.toUpper() == "MPEG"));
- }
-