OSDN Git Service

id3v2: Check malloc result. ID3v2 tags can be very large.
[coroid/ffmpeg_saccubus.git] / cmdutils.c
index d15aba0..feeea69 100644 (file)
@@ -88,6 +88,7 @@ void uninit_opts(void)
     }
     av_freep(&opt_names);
     av_freep(&opt_values);
+    opt_name_count = 0;
 }
 
 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
@@ -106,6 +107,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
         error= "The value for %s was %s which is not within %f - %f\n";
     else if(type == OPT_INT64 && (int64_t)d != d)
         error= "Expected int64 for %s but found %s\n";
+    else if (type == OPT_INT && (int)d != d)
+        error= "Expected int for %s but found %s\n";
     else
         return d;
     fprintf(stderr, error, context, numstr, min, max);
@@ -278,8 +281,8 @@ unknown_opt:
                     fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
                     exit(1);
                 }
-            } else {
-                po->u.func_arg(arg);
+            } else if (po->u.func_arg) {
+                    po->u.func_arg(arg);
             }
             if(po->flags & OPT_EXIT)
                 exit(0);
@@ -570,16 +573,6 @@ void show_license(void)
     );
 }
 
-void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
-{
-    int i;
-    char fmt_str[128];
-    for (i=-1; i < nb_fmts; i++) {
-        get_fmt_string (fmt_str, sizeof(fmt_str), i);
-        fprintf(stdout, "%s\n", fmt_str);
-    }
-}
-
 void show_formats(void)
 {
     AVInputFormat *ifmt=NULL;
@@ -922,6 +915,8 @@ int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
     memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
     frame->interlaced_frame = picref->video->interlaced;
     frame->top_field_first  = picref->video->top_field_first;
+    frame->key_frame        = picref->video->key_frame;
+    frame->pict_type        = picref->video->pict_type;
 
     return 1;
 }