Am 17.01.2018 um 06:12 schrieb Yogender Gupta:
Please find attached a patch for setting key frames."-force_key_frames" can then use this option. Thanks, Yogender
> diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c > index c23033c..54f6cb7 100644 > --- a/libavcodec/cuviddec.c > +++ b/libavcodec/cuviddec.c > @@ -74,6 +74,8 @@ typedef struct CuvidContext > int internal_error; > int decoder_flushing; > > + int key_frame[32]; Isn't it a bit risky to hardcode this to 32?CurrPicIdx can be as large as ctx->nb_surfaces, which is 25 by default but can be user-set to any value up to INT_MAX.
So this needs allocation after nb_surfaces is known. > + > cudaVideoCodec codec_type; > cudaVideoChromaFormat chroma_format; >> @@ -340,6 +342,8 @@ static int CUDAAPI cuvid_handle_picture_decode(void *opaque, CUVIDPICPARAMS* pic
> > av_log(avctx, AV_LOG_TRACE, "pfnDecodePicture\n"); > > + ctx->key_frame[picparams->CurrPicIdx] = picparams->intra_pic_flag; > +> ctx->internal_error = CHECK_CU(ctx->cvdl->cuvidDecodePicture(ctx->cudecoder, picparams));
> if (ctx->internal_error < 0) > return 0;> @@ -590,6 +594,7 @@ static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame)
> goto error; > } >> + frame->key_frame = ctx->key_frame[parsed_frame.dispinfo.picture_index];
> frame->width = avctx->width; > frame->height = avctx->height; > if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) > -- > 2.10.1.windows.1 > > Otherwise this looks sensible to me. Thanks, Timo
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel