mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Support configuration and set of video background.
This commit is contained in:
parent
82f61de117
commit
668a6ec277
@ -1,6 +1,7 @@
|
|||||||
User johns
|
User johns
|
||||||
Date:
|
Date:
|
||||||
|
|
||||||
|
Support configuration and set of video background.
|
||||||
Survive lost X11 display.
|
Survive lost X11 display.
|
||||||
Fix bug: 100% cpu use with plugins like mp3.
|
Fix bug: 100% cpu use with plugins like mp3.
|
||||||
Wakeup display thread on channel switch, osd can now be shown without
|
Wakeup display thread on channel switch, osd can now be shown without
|
||||||
|
@ -66,6 +66,7 @@ static const char *const Resolution[RESOLUTIONS] = {
|
|||||||
static char ConfigMakePrimary; ///< config primary wanted
|
static char ConfigMakePrimary; ///< config primary wanted
|
||||||
static char ConfigHideMainMenuEntry; ///< config hide main menu entry
|
static char ConfigHideMainMenuEntry; ///< config hide main menu entry
|
||||||
|
|
||||||
|
static uint32_t ConfigVideoBackground; ///< config video background color
|
||||||
static int ConfigVideoSkipLines; ///< config skip lines top/bottom
|
static int ConfigVideoSkipLines; ///< config skip lines top/bottom
|
||||||
static int ConfigVideoStudioLevels; ///< config use studio levels
|
static int ConfigVideoStudioLevels; ///< config use studio levels
|
||||||
static int ConfigVideo60HzMode; ///< config use 60Hz display mode
|
static int ConfigVideo60HzMode; ///< config use 60Hz display mode
|
||||||
@ -411,6 +412,8 @@ class cMenuSetupSoft:public cMenuSetupPage
|
|||||||
/// @{
|
/// @{
|
||||||
int MakePrimary;
|
int MakePrimary;
|
||||||
int HideMainMenuEntry;
|
int HideMainMenuEntry;
|
||||||
|
uint32_t Background;
|
||||||
|
uint32_t BackgroundAlpha;
|
||||||
int SkipLines;
|
int SkipLines;
|
||||||
int StudioLevels;
|
int StudioLevels;
|
||||||
int Scaling[RESOLUTIONS];
|
int Scaling[RESOLUTIONS];
|
||||||
@ -482,6 +485,13 @@ cMenuSetupSoft::cMenuSetupSoft(void)
|
|||||||
//
|
//
|
||||||
Add(SeparatorItem(tr("Video")));
|
Add(SeparatorItem(tr("Video")));
|
||||||
|
|
||||||
|
// no unsigned int menu item supported, split background color/alpha
|
||||||
|
Background = ConfigVideoBackground >> 8;
|
||||||
|
BackgroundAlpha = ConfigVideoBackground & 0xFF;
|
||||||
|
Add(new cMenuEditIntItem(tr("video background color (RGB)"),
|
||||||
|
(int *)&Background, 0, 0x00FFFFFF));
|
||||||
|
Add(new cMenuEditIntItem(tr("video background color (Alpha)"),
|
||||||
|
(int *)&BackgroundAlpha, 0, 0xFF));
|
||||||
SkipLines = ConfigVideoSkipLines;
|
SkipLines = ConfigVideoSkipLines;
|
||||||
Add(new cMenuEditIntItem(tr("Skip lines top+bot (pixel)"), &SkipLines, 0,
|
Add(new cMenuEditIntItem(tr("Skip lines top+bot (pixel)"), &SkipLines, 0,
|
||||||
64));
|
64));
|
||||||
@ -504,10 +514,10 @@ cMenuSetupSoft::cMenuSetupSoft(void)
|
|||||||
&InverseTelecine[i], trVDR("no"), trVDR("yes")));
|
&InverseTelecine[i], trVDR("no"), trVDR("yes")));
|
||||||
Denoise[i] = ConfigVideoDenoise[i];
|
Denoise[i] = ConfigVideoDenoise[i];
|
||||||
Add(new cMenuEditIntItem(tr("Denoise (0..1000) (vdpau)"), &Denoise[i],
|
Add(new cMenuEditIntItem(tr("Denoise (0..1000) (vdpau)"), &Denoise[i],
|
||||||
0, 1000));
|
0, 1000, tr("off"), tr("max")));
|
||||||
Sharpen[i] = ConfigVideoSharpen[i];
|
Sharpen[i] = ConfigVideoSharpen[i];
|
||||||
Add(new cMenuEditIntItem(tr("Sharpen (-1000..1000) (vdpau)"),
|
Add(new cMenuEditIntItem(tr("Sharpen (-1000..1000) (vdpau)"),
|
||||||
&Sharpen[i], -1000, 1000));
|
&Sharpen[i], -1000, 1000, tr("blur max"), tr("sharpen max")));
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// audio
|
// audio
|
||||||
@ -528,7 +538,7 @@ cMenuSetupSoft::cMenuSetupSoft(void)
|
|||||||
Add(SeparatorItem(tr("Auto-crop")));
|
Add(SeparatorItem(tr("Auto-crop")));
|
||||||
AutoCropInterval = ConfigAutoCropInterval;
|
AutoCropInterval = ConfigAutoCropInterval;
|
||||||
Add(new cMenuEditIntItem(tr("autocrop interval (frames)"),
|
Add(new cMenuEditIntItem(tr("autocrop interval (frames)"),
|
||||||
&AutoCropInterval, 0, 200));
|
&AutoCropInterval, 0, 200, tr("off")));
|
||||||
AutoCropDelay = ConfigAutoCropDelay;
|
AutoCropDelay = ConfigAutoCropDelay;
|
||||||
Add(new cMenuEditIntItem(tr("autocrop delay (n * interval)"),
|
Add(new cMenuEditIntItem(tr("autocrop delay (n * interval)"),
|
||||||
&AutoCropDelay, 0, 200));
|
&AutoCropDelay, 0, 200));
|
||||||
@ -558,6 +568,9 @@ void cMenuSetupSoft::Store(void)
|
|||||||
SetupStore("HideMainMenuEntry", ConfigHideMainMenuEntry =
|
SetupStore("HideMainMenuEntry", ConfigHideMainMenuEntry =
|
||||||
HideMainMenuEntry);
|
HideMainMenuEntry);
|
||||||
|
|
||||||
|
ConfigVideoBackground = Background << 8 | (BackgroundAlpha & 0xFF);
|
||||||
|
SetupStore("Background", ConfigVideoBackground);
|
||||||
|
VideoSetBackground(ConfigVideoBackground);
|
||||||
SetupStore("SkipLines", ConfigVideoSkipLines = SkipLines);
|
SetupStore("SkipLines", ConfigVideoSkipLines = SkipLines);
|
||||||
VideoSetSkipLines(ConfigVideoSkipLines);
|
VideoSetSkipLines(ConfigVideoSkipLines);
|
||||||
SetupStore("StudioLevels", ConfigVideoStudioLevels = StudioLevels);
|
SetupStore("StudioLevels", ConfigVideoStudioLevels = StudioLevels);
|
||||||
@ -1080,8 +1093,8 @@ bool cSoftHdDevice::Flush(int timeout_ms)
|
|||||||
** Sets the video display format to the given one (only useful if this
|
** Sets the video display format to the given one (only useful if this
|
||||||
** device has an MPEG decoder).
|
** device has an MPEG decoder).
|
||||||
*/
|
*/
|
||||||
void cSoftHdDevice::
|
void cSoftHdDevice:: SetVideoDisplayFormat(eVideoDisplayFormat
|
||||||
SetVideoDisplayFormat(eVideoDisplayFormat video_display_format)
|
video_display_format)
|
||||||
{
|
{
|
||||||
static int last = -1;
|
static int last = -1;
|
||||||
|
|
||||||
@ -1487,6 +1500,10 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
|
|||||||
ConfigHideMainMenuEntry = atoi(value);
|
ConfigHideMainMenuEntry = atoi(value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (!strcasecmp(name, "Background")) {
|
||||||
|
VideoSetBackground(ConfigVideoBackground = strtoul(value, NULL, 0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!strcasecmp(name, "SkipLines")) {
|
if (!strcasecmp(name, "SkipLines")) {
|
||||||
VideoSetSkipLines(ConfigVideoSkipLines = atoi(value));
|
VideoSetSkipLines(ConfigVideoSkipLines = atoi(value));
|
||||||
return true;
|
return true;
|
||||||
|
93
video.c
93
video.c
@ -234,6 +234,7 @@ typedef struct _video_module_
|
|||||||
void (*const RenderFrame) (VideoHwDecoder *, const AVCodecContext *,
|
void (*const RenderFrame) (VideoHwDecoder *, const AVCodecContext *,
|
||||||
const AVFrame *);
|
const AVFrame *);
|
||||||
uint8_t *(*const GrabOutput)(int *, int *, int *);
|
uint8_t *(*const GrabOutput)(int *, int *, int *);
|
||||||
|
void (*const SetBackground) (uint32_t);
|
||||||
void (*const SetVideoMode) (void);
|
void (*const SetVideoMode) (void);
|
||||||
void (*const ResetAutoCrop) (void);
|
void (*const ResetAutoCrop) (void);
|
||||||
|
|
||||||
@ -293,6 +294,7 @@ static char VideoSurfaceModesChanged; ///< flag surface modes changed
|
|||||||
/// flag use transparent OSD.
|
/// flag use transparent OSD.
|
||||||
static const char VideoTransparentOsd = 1;
|
static const char VideoTransparentOsd = 1;
|
||||||
|
|
||||||
|
static uint32_t VideoBackground; ///< video background color
|
||||||
static int VideoSkipLines; ///< skip video lines top/bottom
|
static int VideoSkipLines; ///< skip video lines top/bottom
|
||||||
static char VideoStudioLevels; ///< flag use studio levels
|
static char VideoStudioLevels; ///< flag use studio levels
|
||||||
|
|
||||||
@ -2069,6 +2071,17 @@ static int VaapiInit(const char *display_name)
|
|||||||
attr.value ? _("direct mapped") : _("copied"));
|
attr.value ? _("direct mapped") : _("copied"));
|
||||||
// FIXME: handle the cases: new liba: Don't use it.
|
// FIXME: handle the cases: new liba: Don't use it.
|
||||||
|
|
||||||
|
attr.type = VADisplayAttribBackgroundColor;
|
||||||
|
attr.flags = VA_DISPLAY_ATTRIB_SETTABLE;
|
||||||
|
if (vaGetDisplayAttributes(VaDisplay, &attr, 1) != VA_STATUS_SUCCESS) {
|
||||||
|
Error(_("video/vaapi: Can't get background-color attribute\n"));
|
||||||
|
attr.value = 1;
|
||||||
|
}
|
||||||
|
Info(_("video/vaapi: background-color is %s\n"),
|
||||||
|
attr.value ? _("supported") : _("unsupported"));
|
||||||
|
|
||||||
|
// FIXME: VaapiSetBackground(VideoBackground);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
//
|
//
|
||||||
// check the chroma format
|
// check the chroma format
|
||||||
@ -4490,6 +4503,16 @@ static int64_t VaapiGetClock(const VaapiDecoder * decoder)
|
|||||||
2);
|
2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set VA-API background color.
|
||||||
|
///
|
||||||
|
/// @param rgba 32 bit RGBA color.
|
||||||
|
///
|
||||||
|
static void VaapiSetBackground( __attribute__ ((unused)) uint32_t rgba)
|
||||||
|
{
|
||||||
|
Error(_("video/vaapi: FIXME: SetBackground not supported\n"));
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set VA-API video mode.
|
/// Set VA-API video mode.
|
||||||
///
|
///
|
||||||
@ -4787,6 +4810,7 @@ static const VideoModule VaapiModule = {
|
|||||||
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
||||||
const AVCodecContext *, const AVFrame *))VaapiSyncRenderFrame,
|
const AVCodecContext *, const AVFrame *))VaapiSyncRenderFrame,
|
||||||
.GrabOutput = NULL,
|
.GrabOutput = NULL,
|
||||||
|
.SetBackground = VaapiSetBackground,
|
||||||
.SetVideoMode = VaapiSetVideoMode,
|
.SetVideoMode = VaapiSetVideoMode,
|
||||||
.ResetAutoCrop = VaapiResetAutoCrop,
|
.ResetAutoCrop = VaapiResetAutoCrop,
|
||||||
.Thread = VaapiDisplayHandlerThread,
|
.Thread = VaapiDisplayHandlerThread,
|
||||||
@ -4886,8 +4910,9 @@ static VdpGetProcAddress *VdpauGetProcAddress; ///< entry point to use
|
|||||||
/// presentation queue target
|
/// presentation queue target
|
||||||
static VdpPresentationQueueTarget VdpauQueueTarget;
|
static VdpPresentationQueueTarget VdpauQueueTarget;
|
||||||
static VdpPresentationQueue VdpauQueue; ///< presentation queue
|
static VdpPresentationQueue VdpauQueue; ///< presentation queue
|
||||||
static VdpColor VdpauBackgroundColor[1]; ///< queue background color
|
static VdpColor VdpauQueueBackgroundColor[1]; ///< queue background color
|
||||||
|
|
||||||
|
static int VdpauBackground; ///< background supported
|
||||||
static int VdpauHqScalingMax; ///< highest supported scaling level
|
static int VdpauHqScalingMax; ///< highest supported scaling level
|
||||||
static int VdpauTemporal; ///< temporal deinterlacer supported
|
static int VdpauTemporal; ///< temporal deinterlacer supported
|
||||||
static int VdpauTemporalSpatial; ///< temporal spatial deint. supported
|
static int VdpauTemporalSpatial; ///< temporal spatial deint. supported
|
||||||
@ -5157,9 +5182,10 @@ static void VdpauMixerSetup(VdpauDecoder * decoder)
|
|||||||
VdpVideoMixerFeature features[15];
|
VdpVideoMixerFeature features[15];
|
||||||
VdpBool enables[15];
|
VdpBool enables[15];
|
||||||
int feature_n;
|
int feature_n;
|
||||||
VdpVideoMixerAttribute attributes[4];
|
VdpVideoMixerAttribute attributes[5];
|
||||||
void const *attribute_value_ptrs[4];
|
void const *attribute_value_ptrs[5];
|
||||||
int attribute_n;
|
int attribute_n;
|
||||||
|
VdpColor background_color[1];
|
||||||
uint8_t skip_chroma_value;
|
uint8_t skip_chroma_value;
|
||||||
float noise_reduction_level;
|
float noise_reduction_level;
|
||||||
float sharpness_level;
|
float sharpness_level;
|
||||||
@ -5235,7 +5261,20 @@ static void VdpauMixerSetup(VdpauDecoder * decoder)
|
|||||||
VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA
|
VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA
|
||||||
VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA
|
VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
attribute_n = 0;
|
attribute_n = 0;
|
||||||
|
// none video-area background color
|
||||||
|
if (VdpauBackground) {
|
||||||
|
background_color->red = (VideoBackground >> 24) / 255.0;
|
||||||
|
background_color->green = ((VideoBackground >> 16) & 0xFF) / 255.0;
|
||||||
|
background_color->blue = ((VideoBackground >> 8) & 0xFF) / 255.0;
|
||||||
|
background_color->alpha = (VideoBackground & 0xFF) / 255.0;
|
||||||
|
attributes[attribute_n] = VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR;
|
||||||
|
attribute_value_ptrs[attribute_n++] = background_color;
|
||||||
|
Debug(3, "video/vdpau: background color %f/%f/%f/%f\n",
|
||||||
|
background_color->red, background_color->green,
|
||||||
|
background_color->blue, background_color->alpha);
|
||||||
|
}
|
||||||
if (VdpauSkipChroma) {
|
if (VdpauSkipChroma) {
|
||||||
skip_chroma_value = VideoSkipChromaDeinterlace[decoder->Resolution];
|
skip_chroma_value = VideoSkipChromaDeinterlace[decoder->Resolution];
|
||||||
attributes[attribute_n]
|
attributes[attribute_n]
|
||||||
@ -5606,11 +5645,12 @@ static void VdpauInitOutputQueue(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VdpauBackgroundColor->red = 0.01;
|
VdpauQueueBackgroundColor->red = 0.01;
|
||||||
VdpauBackgroundColor->green = 0.02;
|
VdpauQueueBackgroundColor->green = 0.02;
|
||||||
VdpauBackgroundColor->blue = 0.03;
|
VdpauQueueBackgroundColor->blue = 0.03;
|
||||||
VdpauBackgroundColor->alpha = 1.00;
|
VdpauQueueBackgroundColor->alpha = 1.00;
|
||||||
VdpauPresentationQueueSetBackgroundColor(VdpauQueue, VdpauBackgroundColor);
|
VdpauPresentationQueueSetBackgroundColor(VdpauQueue,
|
||||||
|
VdpauQueueBackgroundColor);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create display output surfaces
|
// Create display output surfaces
|
||||||
@ -5906,6 +5946,16 @@ static int VdpauInit(const char *display_name)
|
|||||||
//
|
//
|
||||||
// Cache some features
|
// Cache some features
|
||||||
//
|
//
|
||||||
|
status =
|
||||||
|
VdpauVideoMixerQueryFeatureSupport(VdpauDevice,
|
||||||
|
VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR, &flag);
|
||||||
|
if (status != VDP_STATUS_OK) {
|
||||||
|
Error(_("video/vdpau: can't query feature '%s': %s\n"),
|
||||||
|
"background-color", VdpauGetErrorString(status));
|
||||||
|
} else {
|
||||||
|
VdpauBackground = flag;
|
||||||
|
}
|
||||||
|
|
||||||
status =
|
status =
|
||||||
VdpauVideoMixerQueryFeatureSupport(VdpauDevice,
|
VdpauVideoMixerQueryFeatureSupport(VdpauDevice,
|
||||||
VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL, &flag);
|
VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL, &flag);
|
||||||
@ -5966,8 +6016,6 @@ static int VdpauInit(const char *display_name)
|
|||||||
VdpauSkipChroma = flag;
|
VdpauSkipChroma = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
// VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR
|
|
||||||
|
|
||||||
if (VdpauHqScalingMax) {
|
if (VdpauHqScalingMax) {
|
||||||
Info(_("video/vdpau: highest supported high quality scaling %d\n"),
|
Info(_("video/vdpau: highest supported high quality scaling %d\n"),
|
||||||
VdpauHqScalingMax -
|
VdpauHqScalingMax -
|
||||||
@ -7562,7 +7610,16 @@ static int VdpauPreemptionRecover(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set VA-API video mode.
|
/// Set VDPAU background color.
|
||||||
|
///
|
||||||
|
/// @param rgba 32 bit RGBA color.
|
||||||
|
///
|
||||||
|
static void VdpauSetBackground( __attribute__ ((unused)) uint32_t rgba)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set VDPAU video mode.
|
||||||
///
|
///
|
||||||
static void VdpauSetVideoMode(void)
|
static void VdpauSetVideoMode(void)
|
||||||
{
|
{
|
||||||
@ -7902,6 +7959,7 @@ static const VideoModule VdpauModule = {
|
|||||||
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
.RenderFrame = (void (*const) (VideoHwDecoder *,
|
||||||
const AVCodecContext *, const AVFrame *))VdpauSyncRenderFrame,
|
const AVCodecContext *, const AVFrame *))VdpauSyncRenderFrame,
|
||||||
.GrabOutput = VdpauGrabOutputSurface,
|
.GrabOutput = VdpauGrabOutputSurface,
|
||||||
|
.SetBackground = VdpauSetBackground,
|
||||||
.SetVideoMode = VdpauSetVideoMode,
|
.SetVideoMode = VdpauSetVideoMode,
|
||||||
.ResetAutoCrop = VdpauResetAutoCrop,
|
.ResetAutoCrop = VdpauResetAutoCrop,
|
||||||
.Thread = VdpauDisplayHandlerThread,
|
.Thread = VdpauDisplayHandlerThread,
|
||||||
@ -9202,6 +9260,19 @@ void VideoSetStudioLevels(int onoff)
|
|||||||
VideoStudioLevels = onoff;
|
VideoStudioLevels = onoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set background color.
|
||||||
|
///
|
||||||
|
/// @param rgba 32 bit RGBA color.
|
||||||
|
///
|
||||||
|
void VideoSetBackground(uint32_t rgba)
|
||||||
|
{
|
||||||
|
VideoBackground = rgba; // save for later start
|
||||||
|
if (VideoUsedModule) {
|
||||||
|
VideoUsedModule->SetBackground(rgba);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set audio delay.
|
/// Set audio delay.
|
||||||
///
|
///
|
||||||
|
3
video.h
3
video.h
@ -119,6 +119,9 @@ extern void VideoSetSkipLines(int);
|
|||||||
/// Set studio levels.
|
/// Set studio levels.
|
||||||
extern void VideoSetStudioLevels(int);
|
extern void VideoSetStudioLevels(int);
|
||||||
|
|
||||||
|
/// Set background.
|
||||||
|
extern void VideoSetBackground(uint32_t);
|
||||||
|
|
||||||
/// Set audio delay.
|
/// Set audio delay.
|
||||||
extern void VideoSetAudioDelay(int);
|
extern void VideoSetAudioDelay(int);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user