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

Function av_guess_format

libavformat/format.c:79–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79const AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
80 const char *mime_type)
81{
82 const AVOutputFormat *fmt = NULL;
83 const AVOutputFormat *fmt_found = NULL;
84 void *i = 0;
85 int score_max, score;
86
87 /* specific test for image sequences */
88#if CONFIG_IMAGE2_MUXER
89 if (!short_name && filename &&
90 av_filename_number_test(filename) &&
91 ff_guess_image2_codec(filename) != AV_CODEC_ID_NONE) {
92 return av_guess_format("image2", NULL, NULL);
93 }
94#endif
95 /* Find the proper file type. */
96 score_max = 0;
97 while ((fmt = av_muxer_iterate(&i))) {
98 if (fmt->flags & AVFMT_EXPERIMENTAL && !short_name)
99 continue;
100 score = 0;
101 if (fmt->name && short_name && av_match_name(short_name, fmt->name))
102 score += 100;
103 if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type))
104 score += 10;
105 if (filename && fmt->extensions &&
106 av_match_ext(filename, fmt->extensions)) {
107 score += 5;
108 }
109 if (score > score_max) {
110 score_max = score;
111 fmt_found = fmt;
112 }
113 }
114 return fmt_found;
115}
116
117enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name,
118 const char *filename, const char *mime_type,

Callers 10

seg_initFunction · 0.85
ff_rtp_chain_mux_openFunction · 0.85
fifo_initFunction · 0.85
mpegts_initFunction · 0.85
dash_initFunction · 0.85
av_guess_codecFunction · 0.85
init_fpsFunction · 0.85
show_help_muxerFunction · 0.85
open_output_fileFunction · 0.85

Calls 5

av_filename_number_testFunction · 0.85
ff_guess_image2_codecFunction · 0.85
av_muxer_iterateFunction · 0.85
av_match_nameFunction · 0.85
av_match_extFunction · 0.85

Tested by 1

init_fpsFunction · 0.68