[FFmpeg-devel] [PATCH] Make opt_audio_sample_fmt() abort in case of invalid sample format name.

Stefano Sabatini stefano.sabatini-lala
Fri Jan 14 16:06:37 CET 2011


---
 ffmpeg.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index f92b81c..c2cd718 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2891,9 +2891,13 @@ static int opt_thread_count(const char *opt, const char *arg)
 
 static void opt_audio_sample_fmt(const char *arg)
 {
-    if (strcmp(arg, "list"))
+    if (strcmp(arg, "list")) {
         audio_sample_fmt = av_get_sample_fmt(arg);
-    else {
+        if (audio_sample_fmt == AV_SAMPLE_FMT_NONE) {
+            av_log(NULL, AV_LOG_ERROR, "Invalid sample format '%s'\n", arg);
+            ffmpeg_exit(1);
+        }
+    } else {
         list_fmts(av_get_sample_fmt_string, AV_SAMPLE_FMT_NB);
         ffmpeg_exit(0);
     }
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list