OSDN Git Service

Merge remote-tracking branch 'qatar/master'
[coroid/ffmpeg_saccubus.git] / libavformat / utils.c
index 3be8706..4fc74fa 100644 (file)
@@ -400,6 +400,9 @@ static AVDictionary *convert_format_parameters(AVFormatParameters *ap)
     char buf[1024];
     AVDictionary *opts = NULL;
 
+    if (!ap)
+        return NULL;
+
     if (ap->time_base.num) {
         snprintf(buf, sizeof(buf), "%d/%d", ap->time_base.den, ap->time_base.num);
         av_dict_set(&opts, "framerate", buf, 0);
@@ -567,7 +570,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
     int err;
     AVDictionary *opts = convert_format_parameters(ap);
 
-    if (!ap->prealloced_context)
+    if (!ap || !ap->prealloced_context)
         *ic_ptr = NULL;
 
     err = avformat_open_input(ic_ptr, filename, fmt, &opts);