Add picture adjustment support for vdpau.

This commit is contained in:
Johns 2012-09-03 16:39:33 +02:00
parent a61cbcb65a
commit 73fe963c36
4 changed files with 133 additions and 1 deletions

View File

@ -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.

View File

@ -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];

68
video.c
View File

@ -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);
@ -10011,6 +10015,70 @@ void VideoSetBlackPicture(int onoff)
VideoShowBlackPicture = 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.
///

12
video.h
View File

@ -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);