#endif
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 17, 0)
+FFMPEG_INLINE
+void avformat_close_input(AVFormatContext **ctx)
+{
+ av_close_input_file(*ctx);
+ *ctx = NULL;
+}
+#endif
+
#endif
}
if (avformat_find_stream_info(pFormatCtx, NULL) < 0) {
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return -1;
}
}
if (videoStream == -1) {
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return -1;
}
/* Find the decoder for the video stream */
pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
if (pCodec == NULL) {
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return -1;
}
pCodecCtx->workaround_bugs = 1;
if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0) {
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return -1;
}
fprintf(stderr,
"ffmpeg has changed alloc scheme ... ARGHHH!\n");
avcodec_close(anim->pCodecCtx);
- av_close_input_file(anim->pFormatCtx);
+ avformat_close_input(&anim->pFormatCtx);
av_free(anim->pFrameRGB);
av_free(anim->pFrameDeinterlaced);
av_free(anim->pFrame);
fprintf(stderr,
"Can't transform color space??? Bailing out...\n");
avcodec_close(anim->pCodecCtx);
- av_close_input_file(anim->pFormatCtx);
+ avformat_close_input(&anim->pFormatCtx);
av_free(anim->pFrameRGB);
av_free(anim->pFrameDeinterlaced);
av_free(anim->pFrame);
if (anim->pCodecCtx) {
avcodec_close(anim->pCodecCtx);
- av_close_input_file(anim->pFormatCtx);
+ avformat_close_input(&anim->pFormatCtx);
av_free(anim->pFrameRGB);
av_free(anim->pFrame);
}
if (avformat_find_stream_info(context->iFormatCtx, NULL) < 0) {
- av_close_input_file(context->iFormatCtx);
+ avformat_close_input(&context->iFormatCtx);
MEM_freeN(context);
return NULL;
}
}
if (context->videoStream == -1) {
- av_close_input_file(context->iFormatCtx);
+ avformat_close_input(&context->iFormatCtx);
MEM_freeN(context);
return NULL;
}
context->iCodec = avcodec_find_decoder(context->iCodecCtx->codec_id);
if (context->iCodec == NULL) {
- av_close_input_file(context->iFormatCtx);
+ avformat_close_input(&context->iFormatCtx);
MEM_freeN(context);
return NULL;
}
context->iCodecCtx->workaround_bugs = 1;
if (avcodec_open2(context->iCodecCtx, context->iCodec, NULL) < 0) {
- av_close_input_file(context->iFormatCtx);
+ avformat_close_input(&context->iFormatCtx);
MEM_freeN(context);
return NULL;
}
if (avformat_find_stream_info(pFormatCtx, NULL) < 0) {
if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: avformat_find_stream_info failed\n");
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return 0;
}
}
if (videoStream == -1) {
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return 0;
}
/* Find the decoder for the video stream */
pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
if (pCodec == NULL) {
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return 0;
}
if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0) {
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return 0;
}
avcodec_close(pCodecCtx);
- av_close_input_file(pFormatCtx);
+ avformat_close_input(&pFormatCtx);
return 1;
}
}
if (m_formatCtx)
{
- av_close_input_file(m_formatCtx);
+ avformat_close_input(&m_formatCtx);
m_formatCtx = NULL;
}
if (m_frame)
if (avformat_find_stream_info(formatCtx, NULL) < 0)
{
- av_close_input_file(formatCtx);
+ avformat_close_input(&formatCtx);
return -1;
}
if (videoStream==-1)
{
- av_close_input_file(formatCtx);
+ avformat_close_input(&formatCtx);
return -1;
}
codec=avcodec_find_decoder(codecCtx->codec_id);
if (codec==NULL)
{
- av_close_input_file(formatCtx);
+ avformat_close_input(&formatCtx);
return -1;
}
codecCtx->workaround_bugs = 1;
if (avcodec_open2(codecCtx, codec, NULL) < 0)
{
- av_close_input_file(formatCtx);
+ avformat_close_input(&formatCtx);
return -1;
}
if (!m_imgConvertCtx) {
avcodec_close(m_codecCtx);
m_codecCtx = NULL;
- av_close_input_file(m_formatCtx);
+ avformat_close_input(&m_formatCtx);
m_formatCtx = NULL;
av_free(m_frame);
m_frame = NULL;