doc/examples: do not check NULL values for avcodec_close()

avcodec_close() does nothing in case the argument is NULL. Simplify.
This commit is contained in:
Stefano Sabatini 2013-11-21 23:29:56 +01:00
parent 98786aa2f0
commit 50a28b1393
3 changed files with 4 additions and 8 deletions

View File

@ -369,10 +369,8 @@ int main (int argc, char **argv)
}
end:
if (video_dec_ctx)
avcodec_close(video_dec_ctx);
if (audio_dec_ctx)
avcodec_close(audio_dec_ctx);
avcodec_close(video_dec_ctx);
avcodec_close(audio_dec_ctx);
avformat_close_input(&fmt_ctx);
if (video_dst_file)
fclose(video_dst_file);

View File

@ -248,8 +248,7 @@ int main(int argc, char **argv)
}
end:
avfilter_graph_free(&filter_graph);
if (dec_ctx)
avcodec_close(dec_ctx);
avcodec_close(dec_ctx);
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
av_frame_free(&filt_frame);

View File

@ -237,8 +237,7 @@ int main(int argc, char **argv)
}
end:
avfilter_graph_free(&filter_graph);
if (dec_ctx)
avcodec_close(dec_ctx);
avcodec_close(dec_ctx);
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
av_frame_free(&filt_frame);