Add configurable skip lines at video top + bottom.

This commit is contained in:
Johns 2012-01-28 01:44:50 +01:00
parent 4d74ed1bfc
commit 60a7c36fa6
6 changed files with 42 additions and 16 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Add configurable skip lines at video top and bottom.
Add auto-crop tolerance configuration. Add auto-crop tolerance configuration.
Reduces audio latency, increases audio buffer time. Reduces audio latency, increases audio buffer time.
Made video_test working again. Made video_test working again.

View File

@ -139,9 +139,14 @@ Setup: /etc/vdr/setup.conf
n each 'n' frames auto-crop is checked. n each 'n' frames auto-crop is checked.
softhddevice.AutoCrop.Delay = 0 softhddevice.AutoCrop.Delay = 0
if auto-crop is over after 'n' intervals the same, the cropping is if auto-crop is over 'n' intervals the same, the cropping is
used. used.
softhddevice.AutoCrop.Tolerance = 0
if detected crop area is too small, cut max 'n' pixels at top and
bottom.
softhddevice.Suspend.Close = 0 softhddevice.Suspend.Close = 0
1 suspend closes x11 window, connection and audio device. 1 suspend closes x11 window, connection and audio device.
(use svdrpsend plug softhddevice RESU to resume, if you have no lirc) (use svdrpsend plug softhddevice RESU to resume, if you have no lirc)

2
Todo
View File

@ -37,8 +37,8 @@ video:
grab image with hardware and better scaling support grab image with hardware and better scaling support
suspendoutput didn't show logo or black pictures suspendoutput didn't show logo or black pictures
(must detect video format to show image) (must detect video format to show image)
incomplete mpeg packets creates artefacts after channel switch
hard channel switch hard channel switch
skip line not configurable from setup menu.
vdpau: vdpau:

View File

@ -77,6 +77,7 @@ static int ConfigVideoSharpen[RESOLUTIONS];
static int ConfigVideoScaling[RESOLUTIONS]; static int ConfigVideoScaling[RESOLUTIONS];
static int ConfigVideoAudioDelay; ///< config audio delay static int ConfigVideoAudioDelay; ///< config audio delay
static int ConfigVideoSkipLines; ///< config skip lines top/bottom
static int ConfigAudioPassthrough; ///< config audio pass-through static int ConfigAudioPassthrough; ///< config audio pass-through
static int ConfigAutoCropInterval; ///< auto crop detection interval static int ConfigAutoCropInterval; ///< auto crop detection interval
@ -1203,6 +1204,10 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
} }
} }
if (!strcmp(name, "SkipLines")) {
VideoSetSkipLines(ConfigVideoSkipLines = atoi(value));
return true;
}
if (!strcmp(name, "AudioDelay")) { if (!strcmp(name, "AudioDelay")) {
VideoSetAudioDelay(ConfigVideoAudioDelay = atoi(value)); VideoSetAudioDelay(ConfigVideoAudioDelay = atoi(value));
return true; return true;

40
video.c
View File

@ -259,6 +259,8 @@ 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 int VideoSkipLines; ///< skip video lines top/bottom
/// Default deinterlace mode. /// Default deinterlace mode.
static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax]; static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax];
@ -2006,9 +2008,9 @@ static enum PixelFormat Vaapi_get_format(VaapiDecoder * decoder,
} }
decoder->CropX = 0; decoder->CropX = 0;
decoder->CropY = 0; decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width; decoder->CropWidth = video_ctx->width;
decoder->CropHeight = video_ctx->height; decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->PixFmt = video_ctx->pix_fmt; decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = video_ctx->width; decoder->InputWidth = video_ctx->width;
@ -2486,7 +2488,7 @@ static void VaapiAutoCrop(VaapiDecoder * decoder)
if (next_state) { if (next_state) {
decoder->CropX = 0; decoder->CropX = 0;
decoder->CropY = next_state == 16 ? crop16 : crop14; decoder->CropY = (next_state == 16 ? crop16 : crop14) + VideoSkipLines;
decoder->CropWidth = decoder->InputWidth; decoder->CropWidth = decoder->InputWidth;
decoder->CropHeight = decoder->InputHeight - decoder->CropY * 2; decoder->CropHeight = decoder->InputHeight - decoder->CropY * 2;
@ -2508,9 +2510,9 @@ static void VaapiAutoCrop(VaapiDecoder * decoder)
decoder->OutputHeight, decoder->OutputX, decoder->OutputY); decoder->OutputHeight, decoder->OutputX, decoder->OutputY);
} else { } else {
decoder->CropX = 0; decoder->CropX = 0;
decoder->CropY = 0; decoder->CropY = VideoSkipLines;
decoder->CropWidth = decoder->InputWidth; decoder->CropWidth = decoder->InputWidth;
decoder->CropHeight = decoder->InputHeight; decoder->CropHeight = decoder->InputHeight - VideoSkipLines * 2;
VaapiUpdateOutput(decoder); VaapiUpdateOutput(decoder);
} }
@ -3337,9 +3339,9 @@ static void VaapiRenderFrame(VaapiDecoder * decoder,
|| height != decoder->InputHeight) { || height != decoder->InputHeight) {
decoder->CropX = 0; decoder->CropX = 0;
decoder->CropY = 0; decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width; decoder->CropWidth = video_ctx->width;
decoder->CropHeight = video_ctx->height; decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->PixFmt = video_ctx->pix_fmt; decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = width; decoder->InputWidth = width;
@ -5538,9 +5540,9 @@ static enum PixelFormat Vdpau_get_format(VdpauDecoder * decoder,
} }
// FIXME: combine this with VdpauSetupOutput and software decoder part // FIXME: combine this with VdpauSetupOutput and software decoder part
decoder->CropX = 0; decoder->CropX = 0;
decoder->CropY = 0; decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width; decoder->CropWidth = video_ctx->width;
decoder->CropHeight = video_ctx->height; decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->PixFmt = video_ctx->pix_fmt; decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = video_ctx->width; decoder->InputWidth = video_ctx->width;
@ -5836,7 +5838,7 @@ static void VdpauAutoCrop(VdpauDecoder * decoder)
if (next_state) { if (next_state) {
decoder->CropX = 0; decoder->CropX = 0;
decoder->CropY = next_state == 16 ? crop16 : crop14; decoder->CropY = (next_state == 16 ? crop16 : crop14) + VideoSkipLines;
decoder->CropWidth = decoder->InputWidth; decoder->CropWidth = decoder->InputWidth;
decoder->CropHeight = decoder->InputHeight - decoder->CropY * 2; decoder->CropHeight = decoder->InputHeight - decoder->CropY * 2;
@ -5858,9 +5860,9 @@ static void VdpauAutoCrop(VdpauDecoder * decoder)
decoder->OutputHeight, decoder->OutputX, decoder->OutputY); decoder->OutputHeight, decoder->OutputX, decoder->OutputY);
} else { } else {
decoder->CropX = 0; decoder->CropX = 0;
decoder->CropY = 0; decoder->CropY = VideoSkipLines;
decoder->CropWidth = decoder->InputWidth; decoder->CropWidth = decoder->InputWidth;
decoder->CropHeight = decoder->InputHeight; decoder->CropHeight = decoder->InputHeight - VideoSkipLines * 2;
VdpauUpdateOutput(decoder); VdpauUpdateOutput(decoder);
} }
@ -6069,9 +6071,9 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
|| video_ctx->height != decoder->InputHeight) { || video_ctx->height != decoder->InputHeight) {
decoder->CropX = 0; decoder->CropX = 0;
decoder->CropY = 0; decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width; decoder->CropWidth = video_ctx->width;
decoder->CropHeight = video_ctx->height; decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->PixFmt = video_ctx->pix_fmt; decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = video_ctx->width; decoder->InputWidth = video_ctx->width;
@ -8352,6 +8354,16 @@ void VideoSetScaling(int mode[VideoResolutionMax])
VideoSurfaceModesChanged = 1; VideoSurfaceModesChanged = 1;
} }
///
/// Set skip lines.
///
/// @param lines lines in pixel
///
void VideoSetSkipLines(int lines)
{
VideoSkipLines = lines;
}
/// ///
/// Set audio delay. /// Set audio delay.
/// ///

View File

@ -97,6 +97,9 @@ extern void VideoSetDenoise(int[]);
/// Set sharpen. /// Set sharpen.
extern void VideoSetSharpen(int[]); extern void VideoSetSharpen(int[]);
/// Set skip lines.
extern void VideoSetSkipLines(int);
/// Set audio delay. /// Set audio delay.
extern void VideoSetAudioDelay(int); extern void VideoSetAudioDelay(int);