Skip to content
Browse files

Make the Studio Levels 'filter' a persistent database setting.

- add a keybinding to toggle studio levels (default - no binding).
- add an OSD menu option to toggle studio levels when available.
- store the value in the database along with other persistent settings
such as volume, av sync offset, brightness, contrast, colour and hue.

This is currently only available with VDPAU playback and the old
vdpaustudio filter option is removed.

I've also allowed toggling studio levels via the TOGGLEPICCONTROLS
binding - though as it is a binary setting, it doesn't look sensible in
relation to the other playback controls that have a full range.


git-svn-id: http://svn.mythtv.org/svn/trunk@27322 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information...
1 parent d2a3e10 commit a9d80d88cc3f7c369e67ff5417f176f63b34adca Mark Kendall committed Nov 23, 2010
View
17 mythtv/libs/libmythtv/mythplayer.cpp
@@ -4557,6 +4557,23 @@ QString MythPlayer::GetError(void) const
return tmp;
}
+void MythPlayer::ToggleStudioLevels(void)
+{
+ if (!videoOutput)
+ return;
+
+ if (!(videoOutput->GetSupportedPictureAttributes() &
+ kPictureAttributeSupported_StudioLevels))
+ return;
+
+ int val = videoOutput->GetPictureAttribute(kPictureAttribute_StudioLevels);
+ val = (val > 0) ? 0 : 1;
+ videoOutput->SetPictureAttribute(kPictureAttribute_StudioLevels, val);
+ QString msg = (val > 0) ? QObject::tr("Enabled Studio Levels") :
+ QObject::tr("Disabled Studio Levels");
+ SetOSDMessage(msg, kOSDTimeout_Med);
+}
+
void MythPlayer::SetOSDMessage(const QString &msg, OSDTimeout timeout)
{
if (!osd)
View
3 mythtv/libs/libmythtv/mythplayer.h
@@ -301,6 +301,9 @@ class MPUBLIC MythPlayer
void LockOSD(void) { osdLock.lock(); }
void UnlockOSD(void) { osdLock.unlock(); }
+ // Public picture controls
+ void ToggleStudioLevels(void);
+
protected:
// Initialization
void OpenDummy(void);
View
38 mythtv/libs/libmythtv/tv_play.cpp
@@ -707,6 +707,9 @@ void TV::InitKeys(void)
REG_KEY("TV Playback", "TOGGLEPICCONTROLS",
QT_TRANSLATE_NOOP("MythControls", "Playback picture adjustments"),
"F");
+ REG_KEY("TV Playback", "TOGGLESTUDIOLEVELS",
+ QT_TRANSLATE_NOOP("MythControls", "Playback picture adjustments"),
+ "");
REG_KEY("TV Playback", "TOGGLECHANCONTROLS",
QT_TRANSLATE_NOOP("MythControls", "Recording picture adjustments "
"for this channel"), "Ctrl+G");
@@ -4453,6 +4456,8 @@ bool TV::ToggleHandleAction(PlayerContext *ctx,
ChangeAudioSync(ctx, 0); // just display
else if (has_action("TOGGLEPICCONTROLS", actions))
DoTogglePictureAttribute(ctx, kAdjustingPicture_Playback);
+ else if (has_action("TOGGLESTUDIOLEVELS", actions))
+ DoToggleStudioLevels(ctx);
else if (has_action("TOGGLESTRETCH", actions))
ToggleTimeStretch(ctx);
else if (has_action("TOGGLEUPMIX", actions))
@@ -8927,6 +8932,13 @@ static PictureAttribute next(
return next((PictureAttributeSupported)sup, attr);
}
+void TV::DoToggleStudioLevels(const PlayerContext *ctx)
+{
+ ctx->LockDeletePlayer(__FILE__, __LINE__);
+ ctx->player->ToggleStudioLevels();
+ ctx->UnlockDeletePlayer(__FILE__, __LINE__);
+}
+
void TV::DoTogglePictureAttribute(const PlayerContext *ctx,
PictureAdjustType type)
{
@@ -9792,6 +9804,10 @@ void TV::OSDDialogEvent(int result, QString text, QString action)
(action.right(1).toInt() - 1);
DoTogglePictureAttribute(actx, kAdjustingPicture_Playback);
}
+ else if (action.left(18) == "TOGGLESTUDIOLEVELS")
+ {
+ DoToggleStudioLevels(actx);
+ }
else if (action.left(12) == "TOGGLEASPECT")
{
ToggleAspectOverride(actx,
@@ -10088,6 +10104,7 @@ void TV::FillOSDMenuVideo(const PlayerContext *ctx, OSD *osd,
QStringList tracks;
uint curtrack = ~0;
uint sup = kPictureAttributeSupported_None;
+ bool studio_levels = false;
bool autodetect = false;
AdjustFillMode adjustfill = kAdjustFill_Off;
AspectOverrideMode aspectoverride = kAspect_Off;
@@ -10104,10 +10121,12 @@ void TV::FillOSDMenuVideo(const PlayerContext *ctx, OSD *osd,
scan_type_locked = ctx->player->IsScanTypeLocked();
if (!tracks.empty())
curtrack = (uint) ctx->player->GetTrack(kTrackTypeVideo);
- if (ctx->player->getVideoOutput())
+ VideoOutput *vo = ctx->player->getVideoOutput();
+ if (vo)
{
- sup = ctx->player->getVideoOutput()->GetSupportedPictureAttributes();
- autodetect = !ctx->player->getVideoOutput()->hasHWAcceleration();
+ sup = vo->GetSupportedPictureAttributes();
+ studio_levels = vo->GetPictureAttribute(kPictureAttribute_StudioLevels) > 0;
+ autodetect = !vo->hasHWAcceleration();
}
}
ctx->UnlockDeletePlayer(__FILE__, __LINE__);
@@ -10186,8 +10205,17 @@ void TV::FillOSDMenuVideo(const PlayerContext *ctx, OSD *osd,
{
if (toMask((PictureAttribute)i) & sup)
{
- osd->DialogAddButton(toString((PictureAttribute) i),
- QString("TOGGLEPICCONTROLS%1").arg(i));
+ if ((PictureAttribute)i == kPictureAttribute_StudioLevels)
+ {
+ QString msg = studio_levels ? tr("Disable studio levels") :
+ tr("Enable studio levels");
+ osd->DialogAddButton(msg, "TOGGLESTUDIOLEVELS");
+ }
+ else
+ {
+ osd->DialogAddButton(toString((PictureAttribute) i),
+ QString("TOGGLEPICCONTROLS%1").arg(i));
+ }
}
}
}
View
1 mythtv/libs/libmythtv/tv_play.h
@@ -517,6 +517,7 @@ class MPUBLIC TV : public QThread
void ToggleRecord(PlayerContext*);
+ void DoToggleStudioLevels(const PlayerContext *ctx);
void DoTogglePictureAttribute(const PlayerContext*,
PictureAdjustType type);
void DoChangePictureAttribute(
View
21 mythtv/libs/libmythtv/videoout_vdpau.cpp
@@ -59,7 +59,7 @@ VideoOutputVDPAU::VideoOutputVDPAU()
m_lock(QMutex::Recursive), m_pip_layer(0), m_pip_surface(0),
m_pip_ready(false), m_osd_painter(NULL), m_using_piccontrols(false),
m_skip_chroma(false), m_denoise(0.0f),
- m_sharpen(0.0f), m_studio(false),
+ m_sharpen(0.0f),
m_colorspace(VDP_COLOR_STANDARD_ITUR_BT_601)
{
if (gCoreContext->GetNumSetting("UseVideoModes", 0))
@@ -112,7 +112,7 @@ bool VideoOutputVDPAU::Init(int width, int height, float aspect, WId winid,
return ok;
}
- m_using_piccontrols = (db_use_picture_controls || m_studio ||
+ m_using_piccontrols = (db_use_picture_controls ||
m_colorspace != VDP_COLOR_STANDARD_ITUR_BT_601);
if (m_using_piccontrols)
InitPictureAttributes();
@@ -796,18 +796,15 @@ void VideoOutputVDPAU::InitPictureAttributes(void)
(kPictureAttributeSupported_Brightness |
kPictureAttributeSupported_Contrast |
kPictureAttributeSupported_Colour |
- kPictureAttributeSupported_Hue);
+ kPictureAttributeSupported_Hue |
+ kPictureAttributeSupported_StudioLevels);
VERBOSE(VB_PLAYBACK, LOC + QString("PictureAttributes: %1")
.arg(toString(supported_attributes)));
VideoOutput::InitPictureAttributes();
m_lock.lock();
if (m_render && m_video_mixer)
{
- if (m_studio)
- m_render->SetMixerAttribute(m_video_mixer,
- kVDPAttribStudioLevels, 1);
-
if (m_colorspace < 0)
{
QSize size = window.GetVideoDim();
@@ -851,6 +848,9 @@ int VideoOutputVDPAU::SetPictureAttribute(PictureAttribute attribute,
case kPictureAttribute_Hue:
vdpau_attrib = kVDPAttribHue;
break;
+ case kPictureAttribute_StudioLevels:
+ vdpau_attrib = kVDPAttribStudioLevels;
+ break;
default:
newValue = -1;
}
@@ -1163,7 +1163,6 @@ void VideoOutputVDPAU::ParseOptions(void)
m_skip_chroma = false;
m_denoise = 0.0f;
m_sharpen = 0.0f;
- m_studio = false;
m_colorspace = VDP_COLOR_STANDARD_ITUR_BT_601;
m_buffer_size = NUM_VDPAU_BUFFERS;
m_mixer_features = kVDPFeatNone;
@@ -1243,12 +1242,6 @@ void VideoOutputVDPAU::ParseOptions(void)
"BT.601" : "BT.709"));
}
}
- else if (name.contains("vdpaustudio"))
- {
- VERBOSE(VB_PLAYBACK, LOC +
- QString("Enabling Studio Levels [16-235]."));
- m_studio = true;
- }
else if (name.contains("vdpauhqscaling"))
{
m_mixer_features |= kVDPFeatHQScaling;
View
7 mythtv/libs/libmythtv/videooutbase.cpp
@@ -360,6 +360,8 @@ VideoOutput::VideoOutput() :
gCoreContext->GetNumSetting("PlaybackColour", 50);
db_pict_attr[kPictureAttribute_Hue] =
gCoreContext->GetNumSetting("PlaybackHue", 0);
+ db_pict_attr[kPictureAttribute_StudioLevels] =
+ gCoreContext->GetNumSetting("PlaybackStudioLevels", 0);
db_aspectoverride = (AspectOverrideMode)
gCoreContext->GetNumSetting("AspectOverride", 0);
@@ -852,6 +854,9 @@ int VideoOutput::ChangePictureAttribute(
if (kPictureAttribute_Hue == attributeType)
newVal = newVal % 100;
+ if ((kPictureAttribute_StudioLevels == attributeType) && newVal > 1)
+ newVal = 1;
+
newVal = min(max(newVal, 0), 100);
return SetPictureAttribute(attributeType, newVal);
@@ -898,6 +903,8 @@ void VideoOutput::SetPictureAttributeDBValue(
dbName = "PlaybackColour";
else if (kPictureAttribute_Hue == attributeType)
dbName = "PlaybackHue";
+ else if (kPictureAttribute_StudioLevels == attributeType)
+ dbName = "PlaybackStudioLevels";
if (!dbName.isEmpty())
gCoreContext->SaveSetting(dbName, newValue);
View
3 mythtv/libs/libmythui/mythrender_vdpau.cpp
@@ -96,6 +96,7 @@ class VDPAUCSCMatrix
m_procamp.hue = 0.0f;
memset(&m_csc, 0, sizeof(VdpCSCMatrix));
}
+ void SetStudioLevels(bool studio) { m_studio = studio; }
void SetBrightness(int val) { m_procamp.brightness = (val * 0.02f) - 1.0f; }
void SetContrast(int val) { m_procamp.contrast = (val * 0.02f); }
void SetColour(int val) { m_procamp.saturation = (val * 0.02f); }
@@ -1208,6 +1209,8 @@ int MythRenderVDPAU::SetMixerAttribute(uint id, uint attrib, int value)
m_videoMixers[id].m_csc->SetColour(value);
else if (attrib == kVDPAttribBrightness)
m_videoMixers[id].m_csc->SetBrightness(value);
+ else if (attrib == kVDPAttribStudioLevels)
+ m_videoMixers[id].m_csc->SetStudioLevels(value > 0);
else
return -1;

0 comments on commit a9d80d8

Please sign in to comment.
Something went wrong with that request. Please try again.