diff options
author | Johns <johns98@gmx.net> | 2012-09-03 16:39:33 +0200 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-09-03 16:39:33 +0200 |
commit | 73fe963c36a52e28ae900db493ca24c104954af0 (patch) | |
tree | ac68542bb3accfce71430ea7fc9aec43b201e064 | |
parent | a61cbcb65af38193db0ec0383305c37f1c3ce4be (diff) | |
download | vdr-plugin-softhddevice-73fe963c36a52e28ae900db493ca24c104954af0.tar.gz vdr-plugin-softhddevice-73fe963c36a52e28ae900db493ca24c104954af0.tar.bz2 |
Add picture adjustment support for vdpau.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | softhddevice.cpp | 53 | ||||
-rw-r--r-- | video.c | 68 | ||||
-rw-r--r-- | video.h | 12 |
4 files changed, 133 insertions, 1 deletions
@@ -1,6 +1,7 @@ User johns Date: + Add picture adjustment support for vdpau. Revert "mpeg_vdpau" back to "mpegvideo_vdpau". Fix bug: Can't use software decoder with VDPAU. Resume plugin, if suspend control stops. diff --git a/softhddevice.cpp b/softhddevice.cpp index a6646a6..16064c9 100644 --- a/softhddevice.cpp +++ b/softhddevice.cpp @@ -50,7 +50,7 @@ extern "C" /// vdr-plugin version number. /// Makefile extracts the version number for generating the file name /// for the distribution archive. -static const char *const VERSION = "0.5.1" +static const char *const VERSION = "0.5.2" #ifdef GIT_REV "-GIT" GIT_REV #endif @@ -88,6 +88,11 @@ static char ConfigVideo60HzMode; ///< config use 60Hz display mode static char ConfigVideoSoftStartSync; ///< config use softstart sync static char ConfigVideoBlackPicture; ///< config enable black picture mode +static int ConfigVideoBrightness; ///< config video brightness +static int ConfigVideoContrast = 1000; ///< config video contrast +static int ConfigVideoSaturation = 1000; ///< config video saturation +static int ConfigVideoHue; ///< config video hue + /// config deinterlace static int ConfigVideoDeinterlace[RESOLUTIONS]; @@ -559,6 +564,11 @@ class cMenuSetupSoft:public cMenuSetupPage int SoftStartSync; int BlackPicture; + int Brightness; + int Contrast; + int Saturation; + int Hue; + int ResolutionShown[RESOLUTIONS]; int Scaling[RESOLUTIONS]; int Deinterlace[RESOLUTIONS]; @@ -732,6 +742,15 @@ void cMenuSetupSoft::Create(void) Add(new cMenuEditBoolItem(tr("Black during channel switch"), &BlackPicture, trVDR("no"), trVDR("yes"))); + Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"), + &Brightness, -1000, 1000, tr("min"), tr("max"))); + Add(new cMenuEditIntItem(tr("Contrast (0..10000) (vdpau)"), &Contrast, + 0, 10000, tr("min"), tr("max"))); + Add(new cMenuEditIntItem(tr("Saturation (0..10000) (vdpau)"), + &Saturation, 0, 10000, tr("min"), tr("max"))); + Add(new cMenuEditIntItem(tr("Hue (-3141..3141) (vdpau)"), &Brightness, + -3141, 3141, tr("min"), tr("max"))); + for (i = 0; i < RESOLUTIONS; ++i) { cString msg; @@ -898,6 +917,11 @@ cMenuSetupSoft::cMenuSetupSoft(void) SoftStartSync = ConfigVideoSoftStartSync; BlackPicture = ConfigVideoBlackPicture; + Brightness = ConfigVideoBrightness; + Contrast = ConfigVideoContrast; + Saturation = ConfigVideoSaturation; + Hue = ConfigVideoHue; + for (i = 0; i < RESOLUTIONS; ++i) { ResolutionShown[i] = 0; Scaling[i] = ConfigVideoScaling[i]; @@ -997,6 +1021,15 @@ void cMenuSetupSoft::Store(void) SetupStore("BlackPicture", ConfigVideoBlackPicture = BlackPicture); VideoSetBlackPicture(ConfigVideoBlackPicture); + SetupStore("Brightness", ConfigVideoBrightness = Brightness); + VideoSetBrightness(ConfigVideoBrightness); + SetupStore("Contrast", ConfigVideoContrast = Contrast); + VideoSetContrast(ConfigVideoContrast); + SetupStore("Saturation", ConfigVideoSaturation = Saturation); + VideoSetSaturation(ConfigVideoSaturation); + SetupStore("Hue", ConfigVideoHue = Hue); + VideoSetHue(ConfigVideoHue); + for (i = 0; i < RESOLUTIONS; ++i) { char buf[128]; @@ -1118,6 +1151,7 @@ eOSState cSoftHdControl::ProcessKey(eKeys key) if (SuspendMode == SUSPEND_NORMAL && (!ISMODELESSKEY(key) || key == kMenu || key == kBack || key == kStop)) { delete Player; + Player = NULL; Resume(); SuspendMode = NOT_SUSPENDED; @@ -1140,6 +1174,7 @@ cSoftHdControl::cSoftHdControl(void) cSoftHdControl::~cSoftHdControl() { delete Player; + Player = NULL; // loose control resume if (SuspendMode == SUSPEND_NORMAL) { @@ -2117,6 +2152,22 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value) VideoSetBlackPicture(ConfigVideoBlackPicture = atoi(value)); return true; } + if (!strcasecmp(name, "Brightness")) { + VideoSetBrightness(ConfigVideoBrightness = atoi(value)); + return true; + } + if (!strcasecmp(name, "Contrast")) { + VideoSetContrast(ConfigVideoContrast = atoi(value)); + return true; + } + if (!strcasecmp(name, "Saturation")) { + VideoSetSaturation(ConfigVideoSaturation = atoi(value)); + return true; + } + if (!strcasecmp(name, "Hue")) { + VideoSetHue(ConfigVideoHue = atoi(value)); + return true; + } for (i = 0; i < RESOLUTIONS; ++i) { char buf[128]; @@ -9350,6 +9350,10 @@ enum PixelFormat Video_get_format(VideoHwDecoder * hw_decoder, void VideoRenderFrame(VideoHwDecoder * hw_decoder, const AVCodecContext * video_ctx, const AVFrame * frame) { + if (0) { + fprintf(stderr, "video: render frame pts %s closing %d\n", + Timestamp2String(frame->pkt_pts), hw_decoder->Vdpau.Closing); + } if (frame->repeat_pict && !VideoIgnoreRepeatPict) { Warning(_("video: repeated pict %d found, but not handled\n"), frame->repeat_pict); @@ -10012,6 +10016,70 @@ void VideoSetBlackPicture(int onoff) } /// +/// Set brightness adjustment. +/// +/// @param brightness between -1000 and 1000. +/// 0 represents no modification +/// +void VideoSetBrightness(int brightness) +{ +#ifdef USE_VDPAU + if (VideoUsedModule == &VdpauModule) { + VdpauDecoders[0]->Procamp.brightness = brightness / 1000; + } +#endif + // FIXME: VA-API support +} + +/// +/// Set contrast adjustment. +/// +/// @param contrast between 0 and 10000. +/// 1000 represents no modification +/// +void VideoSetContrast(int contrast) +{ +#ifdef USE_VDPAU + if (VideoUsedModule == &VdpauModule) { + VdpauDecoders[0]->Procamp.contrast = contrast / 1000; + } +#endif + // FIXME: VA-API support +} + +/// +/// Set saturation adjustment. +/// +/// @param saturation between 0 and 10000. +/// 1000 represents no modification +/// +void VideoSetSaturation(int saturation) +{ +#ifdef USE_VDPAU + if (VideoUsedModule == &VdpauModule) { + VdpauDecoders[0]->Procamp.saturation = saturation / 1000; + } +#endif + // FIXME: VA-API support +} + +/// +/// Set hue adjustment. +/// +/// @param hue between -PI*1000 and PI*1000. +/// 0 represents no modification +/// +void VideoSetHue(int hue) +{ +#ifdef USE_VDPAU + if (VideoUsedModule == &VdpauModule) { + VdpauDecoders[0]->Procamp.hue = hue / 1000; + } +#endif + // FIXME: VA-API support +} + +/// /// Set video output position. /// /// @param x video output x coordinate inside the window @@ -97,6 +97,18 @@ extern void VideoSetSoftStartSync(int); /// Set show black picture during channel switch. extern void VideoSetBlackPicture(int); + /// Set brightness adjustment. +extern void VideoSetBrightness(int); + + /// Set contrast adjustment. +extern void VideoSetContrast(int); + + /// Set saturation adjustment. +extern void VideoSetSaturation(int); + + /// Set hue adjustment. +extern void VideoSetHue(int); + /// Set video output position. extern void VideoSetOutputPosition(int, int, int, int); |