[FFmpeg-cvslog] doc/examples: do not check NULL values for avcodec_close()

Stefano Sabatini git at videolan.org
Thu Nov 21 23:31:31 CET 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Thu Nov 21 23:29:56 2013 +0100| [50a28b13936be3e62254d5a73ab2ca6ffb001bcf] | committer: Stefano Sabatini

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

avcodec_close() does nothing in case the argument is NULL. Simplify.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=50a28b13936be3e62254d5a73ab2ca6ffb001bcf
---

 doc/examples/demuxing_decoding.c |    6 ++----
 doc/examples/filtering_audio.c   |    3 +--
 doc/examples/filtering_video.c   |    3 +--
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/doc/examples/demuxing_decoding.c b/doc/examples/demuxing_decoding.c
index 325c7b8..1b5a989 100644
--- a/doc/examples/demuxing_decoding.c
+++ b/doc/examples/demuxing_decoding.c
@@ -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);
diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c
index 35dd4e7..8a3d91f 100644
--- a/doc/examples/filtering_audio.c
+++ b/doc/examples/filtering_audio.c
@@ -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);
diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index 3a26b1a..9c98814 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -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);



More information about the ffmpeg-cvslog mailing list