summaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2011-12-25 11:35:18 +0100
committerJohns <johns98@gmx.net>2011-12-25 11:35:18 +0100
commit63d18ea4889d530a92b7569bb773ccc171b3ffbd (patch)
treea263ddcf8c76c8ca6a5c1aabc21bcfa77418997e /video.c
parent8b57af53b6d356cffc91542a0ce9712d1eb032fc (diff)
downloadvdr-plugin-softhddevice-63d18ea4889d530a92b7569bb773ccc171b3ffbd.tar.gz
vdr-plugin-softhddevice-63d18ea4889d530a92b7569bb773ccc171b3ffbd.tar.bz2
Fix bug: wrong aspect video size calculation.
Diffstat (limited to 'video.c')
-rw-r--r--video.c56
1 files changed, 49 insertions, 7 deletions
diff --git a/video.c b/video.c
index 5fc920c..6dc27d6 100644
--- a/video.c
+++ b/video.c
@@ -137,7 +137,7 @@ typedef enum _video_deinterlace_modes_
} VideoDeinterlaceModes;
///
-/// Video scalinng modes.
+/// Video scaleing modes.
///
typedef enum _video_scaling_modes_
{
@@ -147,6 +147,17 @@ typedef enum _video_scaling_modes_
VideoScalingAnamorphic, ///< anamorphic scaling
} VideoScalingModes;
+///
+/// Video zoom modes.
+///
+typedef enum _video_zoom_modes_
+{
+ VideoNormal, ///< normal
+ VideoStretch, ///< stretch to all edges
+ VideoZoom, ///< zoom out
+ VideoAnamorphic, ///< anamorphic scaled (unsupported)
+} VideoZoomModes;
+
//----------------------------------------------------------------------------
// Defines
//----------------------------------------------------------------------------
@@ -184,6 +195,9 @@ static VideoScalingModes VideoScaling;
/// Default audio/video delay
static int VideoAudioDelay;
+ /// Default zoom mode
+static VideoZoomModes Video4to3ZoomMode;
+
//static char VideoSoftStartSync; ///< soft start sync audio/video
static char Video60HzMode; ///< handle 60hz displays
@@ -1347,13 +1361,22 @@ static void VaapiUpdateOutput(VaapiDecoder * decoder)
display_aspect_ratio.den);
// FIXME: store different positions for the ratios
+ if (display_aspect_ratio.num == 4 && display_aspect_ratio.den == 3) {
+ switch (Video4to3ZoomMode) {
+ case VideoNormal:
+ case VideoStretch:
+ case VideoZoom:
+ case VideoAnamorphic:
+ break;
+ }
+ }
decoder->OutputX = 0;
decoder->OutputY = 0;
decoder->OutputWidth = (VideoWindowHeight * display_aspect_ratio.num)
/ display_aspect_ratio.den;
- decoder->OutputHeight = (VideoWindowWidth * display_aspect_ratio.num)
- / display_aspect_ratio.den;
+ decoder->OutputHeight = (VideoWindowWidth * display_aspect_ratio.den)
+ / display_aspect_ratio.num;
if ((unsigned)decoder->OutputWidth > VideoWindowWidth) {
decoder->OutputWidth = VideoWindowWidth;
decoder->OutputY = (VideoWindowHeight - decoder->OutputHeight) / 2;
@@ -1361,6 +1384,8 @@ static void VaapiUpdateOutput(VaapiDecoder * decoder)
decoder->OutputHeight = VideoWindowHeight;
decoder->OutputX = (VideoWindowWidth - decoder->OutputWidth) / 2;
}
+ Debug(3, "video: aspect output %dx%d+%d+%d\n", decoder->OutputWidth,
+ decoder->OutputHeight, decoder->OutputX, decoder->OutputY);
}
/**
@@ -3190,7 +3215,7 @@ static void VdpauCreateSurfaces(VdpauDecoder * decoder, int width, int height)
VdpauGetErrorString(status));
// FIXME: no fatal
}
- Debug(3, "video/vdpau: created video surface %dx%d with id 0x%08x\n",
+ Debug(4, "video/vdpau: created video surface %dx%d with id 0x%08x\n",
width, height, decoder->SurfacesFree[i]);
}
}
@@ -3950,6 +3975,8 @@ static void VdpauUpdateOutput(VdpauDecoder * decoder)
AVRational display_aspect_ratio;
input_aspect_ratio = decoder->InputAspect;
+ Debug(3, "video: input aspect %d:%d\n", input_aspect_ratio.num,
+ input_aspect_ratio.den);
if (!input_aspect_ratio.num || !input_aspect_ratio.den) {
input_aspect_ratio.num = 1;
input_aspect_ratio.den = 1;
@@ -3965,20 +3992,31 @@ static void VdpauUpdateOutput(VdpauDecoder * decoder)
display_aspect_ratio.den);
// FIXME: store different positions for the ratios
+ if (display_aspect_ratio.num == 4 && display_aspect_ratio.den == 3) {
+ switch (Video4to3ZoomMode) {
+ case VideoNormal:
+ case VideoStretch:
+ case VideoZoom:
+ case VideoAnamorphic:
+ break;
+ }
+ }
decoder->OutputX = 0;
decoder->OutputY = 0;
decoder->OutputWidth = (VideoWindowHeight * display_aspect_ratio.num)
/ display_aspect_ratio.den;
- decoder->OutputHeight = (VideoWindowWidth * display_aspect_ratio.num)
- / display_aspect_ratio.den;
+ decoder->OutputHeight = (VideoWindowWidth * display_aspect_ratio.den)
+ / display_aspect_ratio.num;
if ((unsigned)decoder->OutputWidth > VideoWindowWidth) {
decoder->OutputWidth = VideoWindowWidth;
decoder->OutputY = (VideoWindowHeight - decoder->OutputHeight) / 2;
- } else {
+ } else if ((unsigned)decoder->OutputHeight > VideoWindowHeight) {
decoder->OutputHeight = VideoWindowHeight;
decoder->OutputX = (VideoWindowWidth - decoder->OutputWidth) / 2;
}
+ Debug(3, "video: aspect output %dx%d+%d+%d\n", decoder->OutputWidth,
+ decoder->OutputHeight, decoder->OutputX, decoder->OutputY);
}
///
@@ -4063,6 +4101,10 @@ static enum PixelFormat Vdpau_get_format(VdpauDecoder * decoder,
max_refs = CODEC_SURFACES_DEFAULT;
// check profile
switch (video_ctx->codec_id) {
+ case CODEC_ID_MPEG1VIDEO:
+ max_refs = 2;
+ profile = VdpauCheckProfile(decoder, VDP_DECODER_PROFILE_MPEG1);
+ break;
case CODEC_ID_MPEG2VIDEO:
max_refs = 2;
profile =