On 7/16/2019 10:42 AM, Paul B Mahol wrote: > On 7/16/19, James Almer <jamr...@gmail.com> wrote: >> On 7/16/2019 9:19 AM, Paul B Mahol wrote: >>> + ret = avcodec_receive_frame(codec_avctx, frame); >>> + if (ret < 0) >>> + return ret; >> >> avcodec_receive_frame() can return EAGAIN when the packet was consumed >> and there was no output, but you're using it within a decode2 API based >> decoder, which in that scenario must return avpkt->size with got_frame == 0. >> >> Both h264 and hevc set AV_CODEC_CAP_DELAY, but by setting threads to 1 >> you may be effectively forcing a 1:1 input/output scenario. Did you make >> sure no frames are lost at the end when decoding your samples, and that >> this function isn't returning EAGAIN at any point? > > It does not return EAGAIN for any sample that I have.
Ok, good, so by keeping threads to 1 it should be safe. > >> >>> + >>> + avctx->pix_fmt = codec_avctx->pix_fmt; >>> + avctx->width = codec_avctx->width; >>> + avctx->height = codec_avctx->height; >> >> coded_width/height as well. Or just use ff_set_dimensions(). >> >> And what about other fields like sample_aspect_ratio, bit_rate, color >> information? > > All relevant stuff should be in AVFrame itself. > I will add more of missing stuff you mentioned. > >> >>> + >>> + *got_frame = 1; >>> + >>> + return avpkt->size; >>> +} >>> + >>> +static av_cold int imm5_close(AVCodecContext *avctx) >>> +{ >>> + IMM5Context *ctx = avctx->priv_data; >>> + >>> + avcodec_free_context(&ctx->h264_avctx); >>> + avcodec_free_context(&ctx->hevc_avctx); >>> + >>> + return 0; >>> +} >>> + >>> +AVCodec ff_imm5_decoder = { >>> + .name = "imm5", >>> + .long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), >>> + .type = AVMEDIA_TYPE_VIDEO, >>> + .id = AV_CODEC_ID_IMM5, >>> + .init = imm5_init, >>> + .decode = imm5_decode_frame, >>> + .close = imm5_close, >> >> Missing a flush callback. > > And what would it do? Call avcodec_flush_buffers() on both h264 and hevc contexts. > >> >>> + .priv_data_size = sizeof(IMM5Context), >>> + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | >>> + FF_CODEC_CAP_INIT_CLEANUP, >> >> You could set DR1, and set both h264_avctx->get_buffer2 and >> hevc_avctx->get_buffer2 to avctx->get_buffer2, i think. >> > > Will try. > > >> >> >>> +}; >>> diff --git a/libavformat/riff.c b/libavformat/riff.c >>> index e755ad8d5f..610974ebf0 100644 >>> --- a/libavformat/riff.c >>> +++ b/libavformat/riff.c >>> @@ -488,6 +488,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { >>> { AV_CODEC_ID_AGM, MKTAG('A', 'G', 'M', '6') }, >>> { AV_CODEC_ID_AGM, MKTAG('A', 'G', 'M', '7') }, >>> { AV_CODEC_ID_LSCR, MKTAG('L', 'S', 'C', 'R') }, >>> + { AV_CODEC_ID_IMM5, MKTAG('I', 'M', 'M', '5') }, >>> { AV_CODEC_ID_NONE, 0 } >>> }; >>> >>> >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> To unsubscribe, visit link above, or email >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".