X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fformat.c;h=1c66afb7e6d55042088b178349be34c722f7d59b;hb=6a3520bf984560d43e6f2ea239ff48f4db690a04;hp=75951938cf054eceb0f483e312d5f1c1e3660542;hpb=9e3e9a37289c1a9cdfdb6c7389a3ece3cfa4749c;p=ffmpeg diff --git a/libavformat/format.c b/libavformat/format.c index 75951938cf0..c47490c8ebd 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -48,13 +48,12 @@ int av_match_ext(const char *filename, const char *extensions) return 0; } -AVOutputFormat *av_guess_format(const char *short_name, const char *filename, +ff_const59 AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { - AVOutputFormat *fmt = NULL, *fmt_found; -#if !FF_API_NEXT + const AVOutputFormat *fmt = NULL; + AVOutputFormat *fmt_found = NULL; void *i = 0; -#endif int score_max, score; /* specific test for image sequences */ @@ -66,15 +65,8 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename, } #endif /* Find the proper file type. */ - fmt_found = NULL; score_max = 0; -#if FF_API_NEXT -FF_DISABLE_DEPRECATION_WARNINGS - while ((fmt = av_oformat_next(fmt))) -#else - while ((fmt = av_muxer_iterate(&i))) -#endif - { + while ((fmt = av_muxer_iterate(&i))) { score = 0; if (fmt->name && short_name && av_match_name(short_name, fmt->name)) score += 100; @@ -86,21 +78,18 @@ FF_DISABLE_DEPRECATION_WARNINGS } if (score > score_max) { score_max = score; - fmt_found = fmt; + fmt_found = (AVOutputFormat*)fmt; } } -#if FF_API_NEXT -FF_ENABLE_DEPRECATION_WARNINGS -#endif return fmt_found; } -enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, +enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type) { if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) { - AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL); + ff_const59 AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL); if (fmt2) fmt = fmt2; } @@ -126,29 +115,22 @@ enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, return AV_CODEC_ID_NONE; } -AVInputFormat *av_find_input_format(const char *short_name) +ff_const59 AVInputFormat *av_find_input_format(const char *short_name) { - AVInputFormat *fmt = NULL; -#if FF_API_NEXT -FF_DISABLE_DEPRECATION_WARNINGS - while ((fmt = av_iformat_next(fmt))) - if (av_match_name(short_name, fmt->name)) - return fmt; -FF_ENABLE_DEPRECATION_WARNINGS -#else + const AVInputFormat *fmt = NULL; void *i = 0; while ((fmt = av_demuxer_iterate(&i))) if (av_match_name(short_name, fmt->name)) - return fmt; -#endif + return (AVInputFormat*)fmt; return NULL; } -AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, +ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int is_opened, int *score_ret) { AVProbeData lpd = *pd; - AVInputFormat *fmt1 = NULL, *fmt; + const AVInputFormat *fmt1 = NULL; + ff_const59 AVInputFormat *fmt = NULL; int score, score_max = 0; void *i = 0; const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE]; @@ -175,7 +157,6 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, nodat = ID3_GREATER_PROBE; } - fmt = NULL; while ((fmt1 = av_demuxer_iterate(&i))) { if (!is_opened == !(fmt1->flags & AVFMT_NOFILE) && strcmp(fmt1->name, "image2")) continue; @@ -210,7 +191,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, } if (score > score_max) { score_max = score; - fmt = fmt1; + fmt = (AVInputFormat*)fmt1; } else if (score == score_max) fmt = NULL; } @@ -221,10 +202,10 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, return fmt; } -AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max) +ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int is_opened, int *score_max) { int score_ret; - AVInputFormat *fmt = av_probe_input_format3(pd, is_opened, &score_ret); + ff_const59 AVInputFormat *fmt = av_probe_input_format3(pd, is_opened, &score_ret); if (score_ret > *score_max) { *score_max = score_ret; return fmt; @@ -232,13 +213,13 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score return NULL; } -AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened) +ff_const59 AVInputFormat *av_probe_input_format(ff_const59 AVProbeData *pd, int is_opened) { int score = 0; return av_probe_input_format2(pd, is_opened, &score); } -int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { @@ -269,14 +250,6 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, *semi = '\0'; } } -#if 0 - if (!*fmt && pb->av_class && av_opt_get(pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type) >= 0 && mime_type) { - if (!av_strcasecmp(mime_type, "audio/aacp")) { - *fmt = av_find_input_format("aac"); - } - av_freep(&mime_type); - } -#endif for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt; probe_size = FFMIN(probe_size << 1, @@ -336,7 +309,7 @@ fail: return ret < 0 ? ret : score; } -int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer(AVIOContext *pb, ff_const59 AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) {