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);
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);