Browse code

Make opt_audio_sample_fmt() abort in case of invalid sample format name.

Originally committed as revision 26335 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2011/01/15 05:58:51
Showing 1 changed files
... ...
@@ -2877,9 +2877,13 @@ static int opt_thread_count(const char *opt, const char *arg)
2877 2877
 
2878 2878
 static void opt_audio_sample_fmt(const char *arg)
2879 2879
 {
2880
-    if (strcmp(arg, "list"))
2880
+    if (strcmp(arg, "list")) {
2881 2881
         audio_sample_fmt = av_get_sample_fmt(arg);
2882
-    else {
2882
+        if (audio_sample_fmt == AV_SAMPLE_FMT_NONE) {
2883
+            av_log(NULL, AV_LOG_ERROR, "Invalid sample format '%s'\n", arg);
2884
+            ffmpeg_exit(1);
2885
+        }
2886
+    } else {
2883 2887
         list_fmts(av_get_sample_fmt_string, AV_SAMPLE_FMT_NB);
2884 2888
         ffmpeg_exit(0);
2885 2889
     }