AVPacket pkt;
AVDictionary *opt=NULL;
- av_init_packet(&pkt);
-
iformat = av_find_input_format("image2pipe");
if ((ret = avformat_open_input(&format_ctx, filename, iformat, NULL)) < 0) {
av_log(log_ctx, AV_LOG_ERROR,
}
ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt);
+ av_packet_unref(&pkt);
if (ret < 0 || !frame_decoded) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to decode image from file\n");
if (ret >= 0)
av_image_copy(data, linesize, (const uint8_t **)frame->data, frame->linesize, *pix_fmt, *w, *h);
end:
- av_packet_unref(&pkt);
avcodec_free_context(&codec_ctx);
avformat_close_input(&format_ctx);
av_frame_free(&frame);