MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / opt_input_file

Function opt_input_file

ffmpeg.c:2949–3147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2947}
2948
2949static void opt_input_file(const char *filename)
2950{
2951 AVFormatContext *ic;
2952 AVFormatParameters params, *ap = &params;
2953 AVInputFormat *file_iformat = NULL;
2954 int err, i, ret, rfps, rfps_base;
2955 int64_t timestamp;
2956
2957 if (last_asked_format) {
2958 if (!(file_iformat = av_find_input_format(last_asked_format))) {
2959 fprintf(stderr, "Unknown input format: '%s'\n", last_asked_format);
2960 av_exit(1);
2961 }
2962 last_asked_format = NULL;
2963 }
2964
2965 if (!strcmp(filename, "-"))
2966 filename = "pipe:";
2967
2968 using_stdin |= !strncmp(filename, "pipe:", 5) ||
2969 !strcmp(filename, "/dev/stdin");
2970
2971 /* get default parameters from command line */
2972 ic = avformat_alloc_context();
2973 if (!ic) {
2974 print_error(filename, AVERROR(ENOMEM));
2975 av_exit(1);
2976 }
2977
2978 memset(ap, 0, sizeof(*ap));
2979 ap->prealloced_context = 1;
2980 ap->sample_rate = audio_sample_rate;
2981 ap->channels = audio_channels;
2982 ap->time_base.den = frame_rate.num;
2983 ap->time_base.num = frame_rate.den;
2984 ap->width = frame_width + frame_padleft + frame_padright;
2985 ap->height = frame_height + frame_padtop + frame_padbottom;
2986 ap->pix_fmt = frame_pix_fmt;
2987 // ap->sample_fmt = audio_sample_fmt; //FIXME:not implemented in libavformat
2988 ap->channel = video_channel;
2989 ap->standard = video_standard;
2990
2991 set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM);
2992
2993 ic->video_codec_id =
2994 find_codec_or_die(video_codec_name , AVMEDIA_TYPE_VIDEO , 0,
2995 avcodec_opts[AVMEDIA_TYPE_VIDEO ]->strict_std_compliance);
2996 ic->audio_codec_id =
2997 find_codec_or_die(audio_codec_name , AVMEDIA_TYPE_AUDIO , 0,
2998 avcodec_opts[AVMEDIA_TYPE_AUDIO ]->strict_std_compliance);
2999 ic->subtitle_codec_id=
3000 find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0,
3001 avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
3002 ic->flags |= AVFMT_FLAG_NONBLOCK;
3003
3004 if(pgmyuv_compatibility_hack)
3005 ic->video_codec_id= CODEC_ID_PGMYUV;
3006

Callers

nothing calls this directly

Calls 14

av_find_input_formatFunction · 0.85
av_exitFunction · 0.85
avformat_alloc_contextFunction · 0.85
print_errorFunction · 0.85
set_context_optsFunction · 0.85
find_codec_or_dieFunction · 0.85
av_open_input_fileFunction · 0.85
av_find_stream_infoFunction · 0.85
av_seek_frameFunction · 0.85
av_q2dFunction · 0.85
dump_formatFunction · 0.85

Tested by

no test coverage detected