Makes OSD size configurable.

This commit is contained in:
Johns 2012-05-21 15:34:33 +02:00
parent 57bbd02c57
commit 32527f832e
6 changed files with 112 additions and 13 deletions

View File

@ -2,6 +2,7 @@ User johns
Date: Date:
Release Version 0.5.1 Release Version 0.5.1
Makes OSD size configurable.
Support display with non-square pixels. Support display with non-square pixels.
Initial ADTS (AAC+) support. Initial ADTS (AAC+) support.
Fix bug #959: log flooded with service messages. Fix bug #959: log flooded with service messages.

View File

@ -108,12 +108,17 @@ Setup: /etc/vdr/setup.conf
------ ------
Following is supported: Following is supported:
softhddevice.MakePrimary = 1 softhddevice.MakePrimary = 0
0 = no change, 1 make softhddevice primary at start 0 = no change, 1 make softhddevice primary at start
softhddevice.HideMainMenuEntry = 0 softhddevice.HideMainMenuEntry = 0
0 = show softhddevice main menu entry, 1 = hide entry 0 = show softhddevice main menu entry, 1 = hide entry
softhddevice.Osd.Width = 0
0 = auto (=display, unscaled) n = fixed osd size scaled for display
softhddevice.Osd.Height = 0
0 = auto (=display, unscaled) n = fixed osd size scaled for display
<res> of the next parameters is 576i, 720p, 1080i_fake or 1080i. <res> of the next parameters is 576i, 720p, 1080i_fake or 1080i.
1080i_fake is 1280x1080 or 1440x1080 1080i_fake is 1280x1080 or 1440x1080
1080i is "real" 1920x1080 1080i is "real" 1920x1080

1
Todo
View File

@ -38,6 +38,7 @@ video:
starting with radio and own X11 server, shows no video starting with radio and own X11 server, shows no video
some low-bandwidth tv channels have hiccups. some low-bandwidth tv channels have hiccups.
check start with 24Hz display rate check start with 24Hz display rate
crash with ffmpeg without vaapi and vdpau.
vdpau: vdpau:
software decoder path not working software decoder path not working

View File

@ -81,6 +81,8 @@ static char ConfigSuspendClose; ///< suspend should close devices
static char ConfigSuspendX11; ///< suspend should stop x11 static char ConfigSuspendX11; ///< suspend should stop x11
static uint32_t ConfigVideoBackground; ///< config video background color static uint32_t ConfigVideoBackground; ///< config video background color
static int ConfigOsdWidth; ///< config OSD width
static int ConfigOsdHeight; ///< config OSD height
static char ConfigVideoStudioLevels; ///< config use studio levels static char ConfigVideoStudioLevels; ///< config use studio levels
static char ConfigVideo60HzMode; ///< config use 60Hz display mode static char ConfigVideo60HzMode; ///< config use 60Hz display mode
static char ConfigVideoSoftStartSync; ///< config use softstart sync static char ConfigVideoSoftStartSync; ///< config use softstart sync
@ -483,6 +485,9 @@ class cMenuSetupSoft:public cMenuSetupPage
int General; int General;
int MakePrimary; int MakePrimary;
int HideMainMenuEntry; int HideMainMenuEntry;
int OsdSize;
int OsdWidth;
int OsdHeight;
int SuspendClose; int SuspendClose;
int SuspendX11; int SuspendX11;
@ -572,6 +577,9 @@ inline cOsdItem *cMenuSetupSoft::CollapsedItem(const char *label, int &flag,
*/ */
void cMenuSetupSoft::Create(void) void cMenuSetupSoft::Create(void)
{ {
static const char *const osd_size[] = {
"auto", "1920x1080", "1280x720", "custom",
};
static const char *const video_display_formats_4_3[] = { static const char *const video_display_formats_4_3[] = {
"pan&scan", "letterbox", "center cut-out", "pan&scan", "letterbox", "center cut-out",
}; };
@ -614,6 +622,14 @@ void cMenuSetupSoft::Create(void)
Add(new cMenuEditBoolItem(tr("Hide main menu entry"), Add(new cMenuEditBoolItem(tr("Hide main menu entry"),
&HideMainMenuEntry, trVDR("no"), trVDR("yes"))); &HideMainMenuEntry, trVDR("no"), trVDR("yes")));
// //
// osd
//
Add(new cMenuEditStraItem(tr("Osd size"), &OsdSize, 4, osd_size));
if (OsdSize == 3) {
Add(new cMenuEditIntItem(tr("Osd width"), &OsdWidth, 0, 4096));
Add(new cMenuEditIntItem(tr("Osd height"), &OsdHeight, 0, 4096));
}
//
// suspend // suspend
// //
Add(SeparatorItem(tr("Suspend"))); Add(SeparatorItem(tr("Suspend")));
@ -729,6 +745,7 @@ eOSState cMenuSetupSoft::ProcessKey(eKeys key)
int old_general; int old_general;
int old_video; int old_video;
int old_audio; int old_audio;
int old_osd_size;
int old_video_format; int old_video_format;
int old_resolution_shown[RESOLUTIONS]; int old_resolution_shown[RESOLUTIONS];
int i; int i;
@ -736,15 +753,16 @@ eOSState cMenuSetupSoft::ProcessKey(eKeys key)
old_general = General; old_general = General;
old_video = Video; old_video = Video;
old_audio = Audio; old_audio = Audio;
old_osd_size = OsdSize;
old_video_format = VideoFormat; old_video_format = VideoFormat;
memcpy(old_resolution_shown, ResolutionShown, sizeof(ResolutionShown)); memcpy(old_resolution_shown, ResolutionShown, sizeof(ResolutionShown));
state = cMenuSetupPage::ProcessKey(key); state = cMenuSetupPage::ProcessKey(key);
if (key != kNone) { if (key != kNone) {
// update menu only, if something on the structure has changed // update menu only, if something on the structure has changed
// this needed because VDR menus are evil slow // this is needed because VDR menus are evil slow
if (old_general != General || old_video != Video || old_audio != Audio if (old_general != General || old_video != Video || old_audio != Audio
|| old_video_format != VideoFormat) { || old_osd_size != OsdSize || old_video_format != VideoFormat) {
Create(); // update menu Create(); // update menu
} else { } else {
for (i = 0; i < RESOLUTIONS; ++i) { for (i = 0; i < RESOLUTIONS; ++i) {
@ -775,6 +793,20 @@ cMenuSetupSoft::cMenuSetupSoft(void)
MakePrimary = ConfigMakePrimary; MakePrimary = ConfigMakePrimary;
HideMainMenuEntry = ConfigHideMainMenuEntry; HideMainMenuEntry = ConfigHideMainMenuEntry;
// //
// osd
//
OsdWidth = ConfigOsdWidth;
OsdHeight = ConfigOsdHeight;
if (!OsdWidth && !OsdHeight) {
OsdSize = 0;
} else if (OsdWidth == 1920 && OsdHeight == 1080) {
OsdSize = 1;
} else if (OsdWidth == 1280 && OsdHeight == 720) {
OsdSize = 2;
} else {
OsdSize = 3;
}
//
// suspend // suspend
// //
SuspendClose = ConfigSuspendClose; SuspendClose = ConfigSuspendClose;
@ -842,6 +874,28 @@ void cMenuSetupSoft::Store(void)
SetupStore("MakePrimary", ConfigMakePrimary = MakePrimary); SetupStore("MakePrimary", ConfigMakePrimary = MakePrimary);
SetupStore("HideMainMenuEntry", ConfigHideMainMenuEntry = SetupStore("HideMainMenuEntry", ConfigHideMainMenuEntry =
HideMainMenuEntry); HideMainMenuEntry);
switch (OsdSize) {
case 0:
OsdWidth = 0;
OsdHeight = 0;
break;
case 1:
OsdWidth = 1920;
OsdHeight = 1080;
break;
case 2:
OsdWidth = 1280;
OsdHeight = 720;
default:
break;
}
if (ConfigOsdWidth != OsdWidth || ConfigOsdHeight != OsdHeight) {
VideoSetOsdSize(ConfigOsdWidth = OsdWidth, ConfigOsdHeight =
OsdHeight);
}
SetupStore("Osd.Width", ConfigOsdWidth);
SetupStore("Osd.Height", ConfigOsdHeight);
SetupStore("Suspend.Close", ConfigSuspendClose = SuspendClose); SetupStore("Suspend.Close", ConfigSuspendClose = SuspendClose);
SetupStore("Suspend.X11", ConfigSuspendX11 = SuspendX11); SetupStore("Suspend.X11", ConfigSuspendX11 = SuspendX11);
// FIXME: this is also in VDR-DVB setup // FIXME: this is also in VDR-DVB setup
@ -1923,6 +1977,16 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
ConfigHideMainMenuEntry = atoi(value); ConfigHideMainMenuEntry = atoi(value);
return true; return true;
} }
if (!strcasecmp(name, "Osd.Width")) {
ConfigOsdWidth = atoi(value);
VideoSetOsdSize(ConfigOsdWidth, ConfigOsdHeight);
return true;
}
if (!strcasecmp(name, "Osd.Height")) {
ConfigOsdHeight = atoi(value);
VideoSetOsdSize(ConfigOsdWidth, ConfigOsdHeight);
return true;
}
if (!strcasecmp(name, "Suspend.Close")) { if (!strcasecmp(name, "Suspend.Close")) {
ConfigSuspendClose = atoi(value); ConfigSuspendClose = atoi(value);
return true; return true;
@ -2132,7 +2196,7 @@ bool cPluginSoftHdDevice::Service(const char *id, void *data)
** FIXME: translation? ** FIXME: translation?
*/ */
static const char *SVDRPHelpText[] = { static const char *SVDRPHelpText[] = {
"SUSP\n" " Suspend plugin.\n\n" "SUSP\n" "\040 Suspend plugin.\n\n"
" The plugin is suspended to save energie. Depending on the setup\n" " The plugin is suspended to save energie. Depending on the setup\n"
" 'softhddevice.Suspend.Close = 0' only the video and audio output\n" " 'softhddevice.Suspend.Close = 0' only the video and audio output\n"
" is stopped or with 'softhddevice.Suspend.Close = 1' the video\n" " is stopped or with 'softhddevice.Suspend.Close = 1' the video\n"
@ -2140,15 +2204,15 @@ static const char *SVDRPHelpText[] = {
" If 'softhddevice.Suspend.X11 = 1' is set and the X11 server was\n" " If 'softhddevice.Suspend.X11 = 1' is set and the X11 server was\n"
" started by the plugin, the X11 server would also be closed.\n" " started by the plugin, the X11 server would also be closed.\n"
" (Stopping X11 while suspended isn't supported yet)\n", " (Stopping X11 while suspended isn't supported yet)\n",
"RESU\n" " Resume plugin.\n\n" "RESU\n" "\040 Resume plugin.\n\n"
" Resume the suspended plugin. The plugin could be suspended by\n" " Resume the suspended plugin. The plugin could be suspended by\n"
" the command line option '-s' or by a previous SUSP command.\n" " the command line option '-s' or by a previous SUSP command.\n"
" If the x11 server was stopped by the plugin, it will be\n" " If the x11 server was stopped by the plugin, it will be\n"
" restarted.", " restarted.",
"DETA\n" " Detach plugin.\n\n" "DETA\n" "\040 Detach plugin.\n\n"
" The plugin will be detached from the audio, video and DVB\n" " The plugin will be detached from the audio, video and DVB\n"
" devices. Other programs or plugins can use them now.\n", " devices. Other programs or plugins can use them now.\n",
"ATTA <-d display>\n" " Attach plugin.\n\n" "ATTA <-d display>\n" " Attach plugin.\n\n"
" Attach the plugin to audio, video and DVB devices.\n" " Attach the plugin to audio, video and DVB devices.\n"
" Use -d display (f.e. -d :0.0) to use another X11 display.\n", " Use -d display (f.e. -d :0.0) to use another X11 display.\n",
"PRIM <n>\n" " Make <n> the primary device.\n\n" "PRIM <n>\n" " Make <n> the primary device.\n\n"
@ -2163,14 +2227,14 @@ static const char *SVDRPHelpText[] = {
" 12: toggle audio pass-through\n" " 12: toggle audio pass-through\n"
" 13: decrease audio delay by 10ms\n" " 13: decrease audio delay by 10ms\n"
" 14: increase audio delay by 10ms\n" " 14: increase audio delay by 10ms\n"
" 20: disable fullscreen\n 21: enable fullscreen\n" " 20: disable fullscreen\n\040 21: enable fullscreen\n"
" 22: toggle fullscreen\n" " 22: toggle fullscreen\n"
" 23: disable auto-crop\n 24: enable auto-crop\n" " 23: disable auto-crop\n\040 24: enable auto-crop\n"
" 25: toggle auto-crop\n" " 25: toggle auto-crop\n"
" 30: stretch 4:3 to 16:9\n 31: pillar box 4:3 in 16:9\n" " 30: stretch 4:3 to 16:9\n\040 31: pillar box 4:3 in 16:9\n"
" 32: center cut-out 4:3 to 16:9\n" " 32: center cut-out 4:3 to 16:9\n"
" 39: rotate 4:3 to 16:9 zoom mode\n", " 39: rotate 4:3 to 16:9 zoom mode\n",
"STAT\n" " Display SuspendMode of the plugin.\n\n" "STAT\n" "\040 Display SuspendMode of the plugin.\n\n"
" reply code is 910 + SuspendMode\n" " reply code is 910 + SuspendMode\n"
" SUSPEND_EXTERNAL == -1 (909)\n" " SUSPEND_EXTERNAL == -1 (909)\n"
" NOT_SUSPENDED == 0 (910)\n" " NOT_SUSPENDED == 0 (910)\n"

29
video.c
View File

@ -370,6 +370,8 @@ static pthread_mutex_t VideoLockMutex; ///< video lock mutex
#endif #endif
static int OsdConfigWidth; ///< osd configured width
static int OsdConfigHeight; ///< osd configured height
static char OsdShown; ///< flag show osd static char OsdShown; ///< flag show osd
static int OsdWidth; ///< osd width static int OsdWidth; ///< osd width
static int OsdHeight; ///< osd height static int OsdHeight; ///< osd height
@ -8667,6 +8669,9 @@ void VideoOsdDrawARGB(int x, int y, int width, int height,
/// ///
/// Get OSD size. /// Get OSD size.
/// ///
/// @param[out] width OSD width
/// @param[out] height OSD height
///
void VideoGetOsdSize(int *width, int *height) void VideoGetOsdSize(int *width, int *height)
{ {
*width = 1920; *width = 1920;
@ -8677,6 +8682,21 @@ void VideoGetOsdSize(int *width, int *height)
} }
} }
/// Set OSD Size.
///
/// @param width OSD width
/// @param height OSD height
///
void VideoSetOsdSize(int width, int height)
{
if (OsdConfigWidth != width || OsdConfigHeight != height) {
VideoOsdExit();
OsdConfigWidth = width;
OsdConfigHeight = height;
VideoOsdInit();
}
}
/// ///
/// Setup osd. /// Setup osd.
/// ///
@ -8685,8 +8705,13 @@ void VideoGetOsdSize(int *width, int *height)
/// ///
void VideoOsdInit(void) void VideoOsdInit(void)
{ {
OsdWidth = VideoWindowWidth; // FIXME: must be configured if (OsdConfigWidth && OsdConfigHeight) {
OsdHeight = VideoWindowHeight; OsdWidth = OsdConfigWidth;
OsdHeight = OsdConfigHeight;
} else {
OsdWidth = VideoWindowWidth;
OsdHeight = VideoWindowHeight;
}
#ifdef USE_GLX #ifdef USE_GLX
// FIXME: make an extra function for this // FIXME: make an extra function for this

View File

@ -150,6 +150,9 @@ extern void VideoOsdDrawARGB(int, int, int, int, const uint8_t *);
/// Get OSD size. /// Get OSD size.
extern void VideoGetOsdSize(int *, int *); extern void VideoGetOsdSize(int *, int *);
/// Set OSD size.
extern void VideoSetOsdSize(int, int);
/// Set video clock. /// Set video clock.
extern void VideoSetClock(VideoHwDecoder *, int64_t); extern void VideoSetClock(VideoHwDecoder *, int64_t);