Add support to change OSD for 3d SBS/TB streams.

This commit is contained in:
maverick-me 2012-10-30 16:50:31 +01:00 committed by Johns
parent 6e9e641453
commit 0286c434b4
5 changed files with 99 additions and 4 deletions

View File

@ -2,6 +2,15 @@ User johns
Date:
Pre Release Version 0.5.2
User maverick-me
Date: Tue Oct 30 16:50:25 CET 2012
Add support to change the OSD for 3d SBS/TB streams.
User johns
Date: Tue Oct 30 12:11:25 CEST 2012
Use software decoder for still-pictures.
Add Feature #1103: change audio devices without vdr restart.
Fix bug #1089: Vdpau decoder used wrong number of mpeg reference frames.

View File

@ -134,9 +134,9 @@ static int ConfigAudioMaxCompression; ///< config max volume compression
static int ConfigAudioStereoDescent; ///< config reduce stereo loudness
int ConfigAudioBufferTime; ///< config size ms of audio buffer
static char * ConfigX11Display; ///< config x11 display
static char * ConfigAudioDevice; ///< config audio stereo device
static char * ConfigAC3Device; ///< config audio passthrough device
static char *ConfigX11Display; ///< config x11 display
static char *ConfigAudioDevice; ///< config audio stereo device
static char *ConfigAC3Device; ///< config audio passthrough device
static volatile int DoMakePrimary; ///< switch primary device to this
@ -2311,6 +2311,14 @@ bool cPluginSoftHdDevice::Service(const char *id, void *data)
{
//dsyslog("[softhddev]%s: id %s\n", __FUNCTION__, id);
if (strcmp(id, OSD_3DMODE_SERVICE) == 0) {
SoftHDDevice_Osd3DModeService_v1_0_t *r;
r = (SoftHDDevice_Osd3DModeService_v1_0_t *) data;
VideoSetOsd3DMode(r->Mode);
return true;
}
if (strcmp(id, ATMO_GRAB_SERVICE) == 0) {
int width;
int height;
@ -2374,7 +2382,7 @@ static const char *SVDRPHelpText[] = {
"ATTA <-d display> <-a audio> <-p pass>\n" " Attach plugin.\n\n"
" Attach the plugin to audio, video and DVB devices. Use:\n"
" -d display\tdisplay of x11 server (fe. :0.0)\n"
" -a audio\taudio device (fe. alsa: hw:0,0 oss: /dev/dsp)\n"
" -a audio\taudio device (fe. alsa: hw:0,0 oss: /dev/dsp)\n"
" -p pass\t\taudio device for pass-through (hw:0,1 or /dev/dsp1)\n",
"PRIM <n>\n" " Make <n> the primary device.\n\n"
" <n> is the number of device. Without number softhddevice becomes\n"
@ -2401,6 +2409,9 @@ static const char *SVDRPHelpText[] = {
" NOT_SUSPENDED == 0 (910)\n"
" SUSPEND_NORMAL == 1 (911)\n"
" SUSPEND_DETACHED == 2 (912)\n",
"3DOF\n" "\040 3D OSD off.\n",
"3DTB\n" "\040 3D OSD Top and Bottom.\n",
"3DSB\n" "\040 3D OSD Side by Side.\n",
NULL
};
@ -2568,6 +2579,19 @@ cString cPluginSoftHdDevice::SVDRPCommand(const char *command,
DoMakePrimary = primary;
return "switching primary device requested";
}
if (!strcasecmp(command, "3DOF")) {
VideoSetOsd3DMode(0);
return "3d off";
}
if (!strcasecmp(command, "3DSB")) {
VideoSetOsd3DMode(1);
return "3d sbs";
}
if (!strcasecmp(command, "3DTB")) {
VideoSetOsd3DMode(2);
return "3d tb";
}
return NULL;
}

View File

@ -23,6 +23,7 @@
#pragma once
#define ATMO_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.0"
#define OSD_3DMODE_SERVICE "SoftHDDevice-Osd3DModeService-v1.0"
enum
{ GRAB_IMG_RGBA_FORMAT_B8G8R8A8 };
@ -42,3 +43,8 @@ typedef struct
int height;
void *img;
} SoftHDDevice_AtmoGrabService_v1_0_t;
typedef struct
{
int Mode;
} SoftHDDevice_Osd3DModeService_v1_0_t;

53
video.c
View File

@ -374,6 +374,7 @@ static pthread_mutex_t VideoLockMutex; ///< video lock mutex
static int OsdConfigWidth; ///< osd configured width
static int OsdConfigHeight; ///< osd configured height
static char OsdShown; ///< flag show osd
static char Osd3DMode; ///< 3D OSD mode
static int OsdWidth; ///< osd width
static int OsdHeight; ///< osd height
static int OsdDirtyX; ///< osd dirty area x
@ -7439,6 +7440,7 @@ static void VdpauMixOsd(void)
VdpOutputSurfaceRenderBlendState blend_state;
VdpRect source_rect;
VdpRect output_rect;
VdpRect output_double_rect;
VdpStatus status;
//uint32_t start;
@ -7486,6 +7488,21 @@ static void VdpauMixOsd(void)
output_rect.y1 = VideoWindowHeight;
}
output_double_rect = output_rect;
switch (Osd3DMode) {
case 1:
output_rect.x1 = output_rect.x1 / 2;
output_double_rect.x0 = output_rect.x1;
break;
case 2:
output_rect.y1 = output_rect.y1 / 2;
output_double_rect.y0 = output_rect.y1;
break;
default:
break;
}
//start = GetMsTicks();
// FIXME: double buffered osd disabled
@ -7501,6 +7518,19 @@ static void VdpauMixOsd(void)
Error(_("video/vdpau: can't render bitmap surface: %s\n"),
VdpauGetErrorString(status));
}
if (Osd3DMode > 0) {
status =
VdpauOutputSurfaceRenderBitmapSurface(VdpauSurfacesRb
[VdpauSurfaceIndex], &output_double_rect,
VdpauOsdOutputSurface[!VdpauOsdSurfaceIndex], &source_rect, NULL,
VideoTransparentOsd ? &blend_state : NULL,
VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
if (status != VDP_STATUS_OK) {
Error(_("video/vdpau: can't render output surface: %s\n"),
VdpauGetErrorString(status));
}
}
#else
status =
VdpauOutputSurfaceRenderOutputSurface(VdpauSurfacesRb
@ -7512,6 +7542,19 @@ static void VdpauMixOsd(void)
Error(_("video/vdpau: can't render output surface: %s\n"),
VdpauGetErrorString(status));
}
if (Osd3DMode > 0) {
status =
VdpauOutputSurfaceRenderOutputSurface(VdpauSurfacesRb
[VdpauSurfaceIndex], &output_double_rect,
VdpauOsdOutputSurface[!VdpauOsdSurfaceIndex], &source_rect, NULL,
VideoTransparentOsd ? &blend_state : NULL,
VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
if (status != VDP_STATUS_OK) {
Error(_("video/vdpau: can't render output surface: %s\n"),
VdpauGetErrorString(status));
}
}
#endif
//end = GetMsTicks();
/*
@ -8835,6 +8878,16 @@ void VideoSetOsdSize(int width, int height)
}
}
///
/// Set the 3d OSD mode.
///
/// @pram mode OSD mode (0=off, 1=SBS, 2=Top Bottom)
///
void VideoSetOsd3DMode(int mode)
{
Osd3DMode = mode;
}
///
/// Setup osd.
///

View File

@ -169,6 +169,9 @@ extern void VideoGetOsdSize(int *, int *);
/// Set OSD size.
extern void VideoSetOsdSize(int, int);
/// Set Osd 3D Mode
extern void VideoSetOsd3DMode(int);
/// Set video clock.
extern void VideoSetClock(VideoHwDecoder *, int64_t);