From 053fd53bc4048a3b615def694e415694e6ddaf01 Mon Sep 17 00:00:00 2001 From: jojo61 Date: Sat, 13 Apr 2019 11:45:17 +0200 Subject: [PATCH] improved still picture and channel switch --- codec.c | 20 +++++--------------- video.c | 13 +++++++------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/codec.c b/codec.c index b754326..fb7a550 100644 --- a/codec.c +++ b/codec.c @@ -163,28 +163,18 @@ static enum AVPixelFormat Codec_get_format(AVCodecContext * video_ctx, const enum AVPixelFormat *fmt) { VideoDecoder *decoder; - + enum AVPixelFormat fmt1; 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 if (!video_ctx->width || !video_ctx->height) { 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); + + } //static void Codec_free_buffer(void *opaque, uint8_t *data); diff --git a/video.c b/video.c index 6a58b3f..d6f6f9f 100644 --- a/video.c +++ b/video.c @@ -2679,7 +2679,10 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder * decoder, if (*fmt_idx != AV_PIX_FMT_CUDA) { 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); if (*fmt_idx == AV_PIX_FMT_CUDA ) { // HWACCEL used @@ -3622,7 +3625,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused))int lev } // Source crop 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.y0 = video_src_rect.y0; 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; } - + pl_tex_clear(p->gpu,target->fbo,(float[4]){0}); if (VideoColorBlindness) { switch(VideoColorBlindness) { @@ -3878,7 +3881,6 @@ last_time = GetusTicks(); // target.repr.bits.sample_depth = 16; // target.repr.bits.color_depth = 16; // target.repr.bits.bit_shift =0; -// pl_tex_clear(p->gpu,target.fbo,(float[4]){0}); switch (VulkanTargetColorSpace) { case 0: @@ -4947,8 +4949,7 @@ static void VideoEvent(void) break; case ConfigureNotify: //Debug(3, "video/event: ConfigureNotify\n"); - VideoSetVideoMode(event.xconfigure.x, event.xconfigure.y, - event.xconfigure.width, event.xconfigure.height); + VideoSetVideoMode(event.xconfigure.x, event.xconfigure.y,event.xconfigure.width, event.xconfigure.height); break; case ButtonPress: VideoSetFullscreen(-1);