1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

improved still picture and channel switch

This commit is contained in:
jojo61 2019-04-13 11:45:17 +02:00
parent de7311d233
commit 053fd53bc4
2 changed files with 12 additions and 21 deletions

18
codec.c
View File

@ -163,28 +163,18 @@ static enum AVPixelFormat Codec_get_format(AVCodecContext * video_ctx,
const enum AVPixelFormat *fmt) const enum AVPixelFormat *fmt)
{ {
VideoDecoder *decoder; VideoDecoder *decoder;
enum AVPixelFormat fmt1;
decoder = video_ctx->opaque; decoder = video_ctx->opaque;
#if LIBAVCODEC_VERSION_INT == AV_VERSION_INT(54,86,100)
// this begins to stink, 1.1.2 calls get_format for each frame
// 1.1.3 has the same version, but works again
if (decoder->GetFormatDone) {
if (decoder->GetFormatDone < 10) {
++decoder->GetFormatDone;
Error
("codec/video: ffmpeg/libav buggy: get_format called again\n");
}
return *fmt; // FIXME: this is hack
}
#endif
// bug in ffmpeg 1.1.1, called with zero width or height // bug in ffmpeg 1.1.1, called with zero width or height
if (!video_ctx->width || !video_ctx->height) { if (!video_ctx->width || !video_ctx->height) {
Error("codec/video: ffmpeg/libav buggy: width or height zero\n"); Error("codec/video: ffmpeg/libav buggy: width or height zero\n");
} }
decoder->GetFormatDone = 1; // decoder->GetFormatDone = 1;
return Video_get_format(decoder->HwDecoder, video_ctx, fmt); return Video_get_format(decoder->HwDecoder, video_ctx, fmt);
} }
//static void Codec_free_buffer(void *opaque, uint8_t *data); //static void Codec_free_buffer(void *opaque, uint8_t *data);

13
video.c
View File

@ -2679,7 +2679,10 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder * decoder,
if (*fmt_idx != AV_PIX_FMT_CUDA) { if (*fmt_idx != AV_PIX_FMT_CUDA) {
Fatal(_("video: no valid profile found\n")); Fatal(_("video: no valid profile found\n"));
} }
# if (ist->GetFormatDone)
return AV_PIX_FMT_CUDA;
ist->GetFormatDone = 1;
Debug(3, "video: create decoder 16bit?=%d %dx%d old %d %d\n",bitformat16, video_ctx->width, video_ctx->height,decoder->InputWidth,decoder->InputHeight); Debug(3, "video: create decoder 16bit?=%d %dx%d old %d %d\n",bitformat16, video_ctx->width, video_ctx->height,decoder->InputWidth,decoder->InputHeight);
if (*fmt_idx == AV_PIX_FMT_CUDA ) { // HWACCEL used if (*fmt_idx == AV_PIX_FMT_CUDA ) { // HWACCEL used
@ -3622,7 +3625,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused))int lev
} }
// Source crop // Source crop
if (VideoScalerTest) { // right side defnied scaler if (VideoScalerTest) { // right side defnied scaler
pl_tex_clear(p->gpu,target->fbo,(float[4]){0}); // clear frame // pl_tex_clear(p->gpu,target->fbo,(float[4]){0}); // clear frame
img->src_rect.x0 = video_src_rect.x1/2+1; img->src_rect.x0 = video_src_rect.x1/2+1;
img->src_rect.y0 = video_src_rect.y0; img->src_rect.y0 = video_src_rect.y0;
img->src_rect.x1 = video_src_rect.x1; img->src_rect.x1 = video_src_rect.x1;
@ -3646,7 +3649,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused))int lev
target->dst_rect.y1 = dst_video_rect.y1; target->dst_rect.y1 = dst_video_rect.y1;
} }
pl_tex_clear(p->gpu,target->fbo,(float[4]){0});
if (VideoColorBlindness) { if (VideoColorBlindness) {
switch(VideoColorBlindness) { switch(VideoColorBlindness) {
@ -3878,7 +3881,6 @@ last_time = GetusTicks();
// target.repr.bits.sample_depth = 16; // target.repr.bits.sample_depth = 16;
// target.repr.bits.color_depth = 16; // target.repr.bits.color_depth = 16;
// target.repr.bits.bit_shift =0; // target.repr.bits.bit_shift =0;
// pl_tex_clear(p->gpu,target.fbo,(float[4]){0});
switch (VulkanTargetColorSpace) { switch (VulkanTargetColorSpace) {
case 0: case 0:
@ -4947,8 +4949,7 @@ static void VideoEvent(void)
break; break;
case ConfigureNotify: case ConfigureNotify:
//Debug(3, "video/event: ConfigureNotify\n"); //Debug(3, "video/event: ConfigureNotify\n");
VideoSetVideoMode(event.xconfigure.x, event.xconfigure.y, VideoSetVideoMode(event.xconfigure.x, event.xconfigure.y,event.xconfigure.width, event.xconfigure.height);
event.xconfigure.width, event.xconfigure.height);
break; break;
case ButtonPress: case ButtonPress:
VideoSetFullscreen(-1); VideoSetFullscreen(-1);