[mythtv] RFC: Expanded playgroup settings
Kevin Kuphal
kuphal at dls.net
Mon Dec 3 19:41:39 UTC 2007
This is a short patch that I'm working on currently that adds the
ability to set the Video Scan method in a Playgroup in order to, for
example, force interlacing for stations that broadcast a mix of
progressive and interlaced frames which throws off the Auto-detector.
I'm not thouroughly familiar with the interlacing setup so I'm
throwing this out there for comment. It works for me, but I'm not
sure if it is the proper way of handling. What I basically did is add
a method to set a default video scan type, remove the hard-coded
setting of detecting if the default type is set, and then call the
function to set the scan type once the player is set up.
Like I said, it seems to work but I'd like another set of eyes on it
before I commit anything. This patch doesn't include it but you also
just need to add an INT field of "interlacing" to the playgroup table.
Thanks,
Kevin
Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.cpp (revision 14314)
+++ libs/libmythtv/NuppelVideoPlayer.cpp (working copy)
@@ -836,6 +836,16 @@
m_scan_locked = false;
}
+void NuppelVideoPlayer::SetDefaultScanType(FrameScanType scan)
+{
+ VERBOSE(VB_IMPORTANT, QString("Setting default scan type to %1")
+ .arg(scan));
+ m_scan = scan;
+ m_scan_locked = (scan != kScan_Detect);
+
+ return;
+}
+
void NuppelVideoPlayer::SetScanType(FrameScanType scan)
{
QMutexLocker locker(&videofiltersLock);
@@ -847,7 +857,7 @@
if (scan == m_scan)
return;
-
+
bool interlaced = scan == kScan_Interlaced || kScan_Intr2ndField == scan;
if (interlaced && !m_DeintSetting)
{
@@ -2610,11 +2620,15 @@
// Enable autodetection of interlaced/progressive from video stream
// And initialoze m_scan_tracker to 2 which will immediately switch to
// progressive if the first frame is progressive in AutoDeint().
- m_scan = kScan_Interlaced;
- m_scan_locked = false;
- m_double_framerate = false;
- m_can_double = false;
- m_scan_tracker = 2;
+ // Unless the defaults have already be set by Playback Group.
+ if (!(m_scan_locked))
+ {
+ m_scan = kScan_Interlaced;
+ m_scan_locked = false;
+ m_double_framerate = false;
+ m_can_double = false;
+ m_scan_tracker = 2;
+ }
if (using_null_videoout)
{
Index: libs/libmythtv/playgroup.cpp
===================================================================
--- libs/libmythtv/playgroup.cpp (revision 14314)
+++ libs/libmythtv/playgroup.cpp (working copy)
@@ -77,6 +77,20 @@
};
};
+class Interlacing : public SpinBoxSetting, public PlayGroupDBStorage
+{
+ public:
+ Interlacing(const PlayGroup& _parent):
+ SpinBoxSetting(this, 0, 4, 1, true,
+ "(" + QObject::tr("default") + ")"),
+ PlayGroupDBStorage(this, _parent, "interlacing")
+ {
+ setLabel(QObject::tr("Video Scan"));
+ setHelpText(QObject::tr("Set the default video scan. 0 is
Detect. 1 is Interlaced."
+ " 2 is Interlaced Reversed. 3 is Progressive."));
+ };
+};
+
class JumpMinutes : public SpinBoxSetting, public PlayGroupDBStorage
{
public:
@@ -130,6 +144,7 @@
cgroup->addChild(new SkipBack(*this));
cgroup->addChild(new JumpMinutes(*this));
cgroup->addChild(new TimeStretch(*this));
+ cgroup->addChild(new Interlacing(*this));
addChild(cgroup);
};
Index: libs/libmythtv/tv_play.h
===================================================================
--- libs/libmythtv/tv_play.h (revision 14314)
+++ libs/libmythtv/tv_play.h (working copy)
@@ -397,6 +397,7 @@
int fftime;
int rewtime;
int jumptime;
+ int scan_type;
bool db_use_picture_attr;
bool smartChannelChange;
bool MuteIndividualChannels;
Index: libs/libmythtv/NuppelVideoPlayer.h
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.h (revision 14314)
+++ libs/libmythtv/NuppelVideoPlayer.h (working copy)
@@ -163,6 +163,7 @@
void NextScanType(void)
{ SetScanType((FrameScanType)(((int)m_scan + 1) & 0x3)); }
void SetScanType(FrameScanType);
+ void SetDefaultScanType(FrameScanType);
FrameScanType GetScanType(void) const { return m_scan; }
bool IsScanTypeLocked(void) const { return m_scan_locked; }
Index: libs/libmythtv/tv_play.cpp
===================================================================
--- libs/libmythtv/tv_play.cpp (revision 14314)
+++ libs/libmythtv/tv_play.cpp (working copy)
@@ -469,6 +469,7 @@
baseFilters(""), db_time_format("h:mm AP"), db_short_date_format("M/d"),
fftime(0), rewtime(0),
jumptime(0), smartChannelChange(false),
+ scan_type(0),
MuteIndividualChannels(false), arrowAccel(false),
osd_general_timeout(2), osd_prog_info_timeout(3),
autoCommercialSkip(CommSkipOff), tryUnflaggedSkip(false),
@@ -779,6 +780,7 @@
rewtime = PlayGroup::GetSetting(group, "skipback", 5);
jumptime = PlayGroup::GetSetting(group, "jump", 10);
normal_speed = PlayGroup::GetSetting(group, "timestretch", 100) / 100.0;
+ scan_type = PlayGroup::GetSetting(group, "interlacing", 0);
if (normal_speed == 1.0f)
prev_speed = 1.5f;
else
@@ -1398,6 +1400,7 @@
{
nvp->ResetCaptions();
nvp->ResetTeletext();
+ nvp->SetDefaultScanType((FrameScanType) scan_type);
activenvp = nvp;
activerbuffer = prbuffer;
More information about the mythtv-dev
mailing list