History

avformat: Constify the API wrt AV(In|Out)putFormat

Also constify AVProbeData.

Andreas Rheinhardt committed 5 years ago

Commit 56450a01 parent f0c7fa229 files · +84 −78Browse files

Unified · Split

29 files
  1. doc/APIchanges +11 −0
  2. doc/examples/muxing.c +1 −1
  3. doc/examples/remuxing.c +1 −1
  4. fftools/ffmpeg_opt.c +7 −5
  5. fftools/ffplay.c +4 −3
  6. fftools/ffprobe.c +1 −1
  7. libavdevice/internal.h +1 −1
  8. libavdevice/utils.c +1 −1
  9. libavfilter/lavfutils.c +1 −1
  10. libavfilter/src_movie.c +1 −1
  11. libavformat/avformat.h +19 −25
  12. libavformat/avidec.c +1 −1
  13. libavformat/dashdec.c +1 −1
  14. libavformat/fifo.c +2 −2
  15. libavformat/format.c +17 −16
  16. libavformat/hdsenc.c +1 −1
  17. libavformat/hls.c +1 −1
  18. libavformat/hlsenc.c +2 −2
  19. libavformat/mpeg.c +1 −1
  20. libavformat/mux.c +1 −1
  21. libavformat/rtpdec_asf.c +1 −1
  22. libavformat/rtpenc_chain.c +1 −1
  23. libavformat/rtpenc_mpegts.c +2 −2
  24. libavformat/sapdec.c +1 −1
  25. libavformat/segment.c +1 −1
  26. libavformat/smoothstreamingenc.c +1 −1
  27. libavformat/utils.c +1 −1
  28. libavformat/version.h +0 −3
  29. libavformat/webm_chunk.c +1 −1
doc/APIchanges+11−0
@@ -14,6 +14,17 @@ libavutil: 2017-10-21 · 13 unmodified lines
14 14
15 15
16API changes, most recent first:16API changes, most recent first:
17
182021-04-27 - xxxxxxxxxx - lavf yyyyyyyyy - avformat.h
19 Constified the pointers to AVInputFormats and AVOutputFormats
20 in AVFormatContext, avformat_alloc_output_context2(),
21 av_find_input_format(), av_probe_input_format(),
22 av_probe_input_format2(), av_probe_input_format3(),
23 av_probe_input_buffer2(), av_probe_input_buffer(),
24 avformat_open_input(), av_guess_format() and av_guess_codec().
25 Furthermore, constified the AVProbeData in av_probe_input_format(),
26 av_probe_input_format2() and av_probe_input_format3().
27
172021-04-19 - xxxxxxxxxx - lavu 56.74.100 - tx.h282021-04-19 - xxxxxxxxxx - lavu 56.74.100 - tx.h
18 Add AV_TX_FULL_IMDCT and AV_TX_UNALIGNED.29 Add AV_TX_FULL_IMDCT and AV_TX_UNALIGNED.
19 30
doc/examples/muxing.c+1−1
@@ -536,8 +536,8 @@ static void close_stream(AVFormatContext *oc, OutputStream *ost) · 535 unmodified lines
536int main(int argc, char **argv)536int main(int argc, char **argv)
537{537{
538 OutputStream video_st = { 0 }, audio_st = { 0 };538 OutputStream video_st = { 0 }, audio_st = { 0 };
539 const AVOutputFormat *fmt;
539 const char *filename;540 const char *filename;
540 AVOutputFormat *fmt;
541 AVFormatContext *oc;541 AVFormatContext *oc;
542 AVCodec *audio_codec, *video_codec;542 AVCodec *audio_codec, *video_codec;
543 int ret;543 int ret;
doc/examples/remuxing.c+1−1
@@ -45,7 +45,7 @@ static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, cons · 44 unmodified lines
45 45
46int main(int argc, char **argv)46int main(int argc, char **argv)
47{47{
48 AVOutputFormat *ofmt = NULL;48 const AVOutputFormat *ofmt = NULL;
49 AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;49 AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
50 AVPacket pkt;50 AVPacket pkt;
51 const char *in_filename, *out_filename;51 const char *in_filename, *out_filename;
fftools/ffmpeg_opt.c+7−5
@@ -1068,7 +1068,7 @@ static int open_input_file(OptionsContext *o, const char *filename) · 1067 unmodified lines
1068{1068{
1069 InputFile *f;1069 InputFile *f;
1070 AVFormatContext *ic;1070 AVFormatContext *ic;
1071 AVInputFormat *file_iformat = NULL;1071 const AVInputFormat *file_iformat = NULL;
1072 int err, i, ret;1072 int err, i, ret;
1073 int64_t timestamp;1073 int64_t timestamp;
1074 AVDictionary *unused_opts = NULL;1074 AVDictionary *unused_opts = NULL;
@@ -1117,20 +1117,22 @@ static int open_input_file(OptionsContext *o, const char *filename) · 42 unmodified lines
1117 av_dict_set_int(&o->g->format_opts, "sample_rate", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i, 0);1117 av_dict_set_int(&o->g->format_opts, "sample_rate", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i, 0);
1118 }1118 }
1119 if (o->nb_audio_channels) {1119 if (o->nb_audio_channels) {
1120 const AVClass *priv_class;
1120 /* because we set audio_channels based on both the "ac" and1121 /* because we set audio_channels based on both the "ac" and
1121 * "channel_layout" options, we need to check that the specified1122 * "channel_layout" options, we need to check that the specified
1122 * demuxer actually has the "channels" option before setting it */1123 * demuxer actually has the "channels" option before setting it */
1123 if (file_iformat && file_iformat->priv_class &&1124 if (file_iformat && (priv_class = file_iformat->priv_class) &&
1124 av_opt_find(&file_iformat->priv_class, "channels", NULL, 0,1125 av_opt_find(&priv_class, "channels", NULL, 0,
1125 AV_OPT_SEARCH_FAKE_OBJ)) {1126 AV_OPT_SEARCH_FAKE_OBJ)) {
1126 av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);1127 av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
1127 }1128 }
1128 }1129 }
1129 if (o->nb_frame_rates) {1130 if (o->nb_frame_rates) {
1131 const AVClass *priv_class;
1130 /* set the format-level framerate option;1132 /* set the format-level framerate option;
1131 * this is important for video grabbers, e.g. x11 */1133 * this is important for video grabbers, e.g. x11 */
1132 if (file_iformat && file_iformat->priv_class &&1134 if (file_iformat && (priv_class = file_iformat->priv_class) &&
1133 av_opt_find(&file_iformat->priv_class, "framerate", NULL, 0,1135 av_opt_find(&priv_class, "framerate", NULL, 0,
1134 AV_OPT_SEARCH_FAKE_OBJ)) {1136 AV_OPT_SEARCH_FAKE_OBJ)) {
1135 av_dict_set(&o->g->format_opts, "framerate",1137 av_dict_set(&o->g->format_opts, "framerate",
1136 o->frame_rates[o->nb_frame_rates - 1].u.str, 0);1138 o->frame_rates[o->nb_frame_rates - 1].u.str, 0);
fftools/ffplay.c+4−3
@@ -203,7 +203,7 @@ typedef struct Decoder { · 202 unmodified lines
203 203
204typedef struct VideoState {204typedef struct VideoState {
205 SDL_Thread *read_tid;205 SDL_Thread *read_tid;
206 AVInputFormat *iformat;206 const AVInputFormat *iformat;
207 int abort_request;207 int abort_request;
208 int force_refresh;208 int force_refresh;
209 int paused;209 int paused;
@@ -308,7 +308,7 @@ typedef struct VideoState { · 98 unmodified lines
308} VideoState;308} VideoState;
309 309
310/* options specified by the user */310/* options specified by the user */
311static AVInputFormat *file_iformat;311static const AVInputFormat *file_iformat;
312static const char *input_filename;312static const char *input_filename;
313static const char *window_title;313static const char *window_title;
314static int default_width = 640;314static int default_width = 640;
@@ -3075,7 +3075,8 @@ static int read_thread(void *arg) · 2760 unmodified lines
3075 return 0;3075 return 0;
3076}3076}
3077 3077
3078static VideoState *stream_open(const char *filename, AVInputFormat *iformat)3078static VideoState *stream_open(const char *filename,
3079 const AVInputFormat *iformat)
3079{3080{
3080 VideoState *is;3081 VideoState *is;
3081 3082
fftools/ffprobe.c+1−1
@@ -257,7 +257,7 @@ static const OptionDef *options; · 256 unmodified lines
257/* FFprobe context */257/* FFprobe context */
258static const char *input_filename;258static const char *input_filename;
259static const char *print_input_filename;259static const char *print_input_filename;
260static AVInputFormat *iformat = NULL;260static const AVInputFormat *iformat = NULL;
261 261
262static struct AVHashContext *hash;262static struct AVHashContext *hash;
263 263
libavdevice/internal.h+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
22#include "libavformat/avformat.h"22#include "libavformat/avformat.h"
23 23
24av_warn_unused_result24av_warn_unused_result
25int ff_alloc_input_device_context(struct AVFormatContext **avctx, struct AVInputFormat *iformat,25int ff_alloc_input_device_context(struct AVFormatContext **avctx, const AVInputFormat *iformat,
26 const char *format);26 const char *format);
27 27
28#endif28#endif
libavdevice/utils.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20#include "libavutil/opt.h"20#include "libavutil/opt.h"
21#include "libavformat/avformat.h"21#include "libavformat/avformat.h"
22 22
23int ff_alloc_input_device_context(AVFormatContext **avctx, AVInputFormat *iformat, const char *format)23int ff_alloc_input_device_context(AVFormatContext **avctx, const AVInputFormat *iformat, const char *format)
24{24{
25 AVFormatContext *s;25 AVFormatContext *s;
26 int ret = 0;26 int ret = 0;
libavfilter/lavfutils.c+1−1
@@ -26,7 +26,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], · 25 unmodified lines
26 int *w, int *h, enum AVPixelFormat *pix_fmt,26 int *w, int *h, enum AVPixelFormat *pix_fmt,
27 const char *filename, void *log_ctx)27 const char *filename, void *log_ctx)
28{28{
29 AVInputFormat *iformat = NULL;29 const AVInputFormat *iformat = NULL;
30 AVFormatContext *format_ctx = NULL;30 AVFormatContext *format_ctx = NULL;
31 const AVCodec *codec;31 const AVCodec *codec;
32 AVCodecContext *codec_ctx = NULL;32 AVCodecContext *codec_ctx = NULL;
libavfilter/src_movie.c+1−1
@@ -205,7 +205,7 @@ static int guess_channel_layout(MovieStream *st, int st_index, void *log_ctx) · 204 unmodified lines
205static av_cold int movie_common_init(AVFilterContext *ctx)205static av_cold int movie_common_init(AVFilterContext *ctx)
206{206{
207 MovieContext *movie = ctx->priv;207 MovieContext *movie = ctx->priv;
208 AVInputFormat *iformat = NULL;208 const AVInputFormat *iformat = NULL;
209 int64_t timestamp;209 int64_t timestamp;
210 int nb_streams = 1, ret, i;210 int nb_streams = 1, ret, i;
211 char default_streams[16], *stream_specs, *spec, *cursor;211 char default_streams[16], *stream_specs, *spec, *cursor;
libavformat/avformat.h+19−25
@@ -525,15 +525,6 @@ typedef struct AVOutputFormat { · 524 unmodified lines
525 * New public fields should be added right above.525 * New public fields should be added right above.
526 *****************************************************************526 *****************************************************************
527 */527 */
528 /**
529 * The ff_const59 define is not part of the public API and will
530 * be removed without further warning.
531 */
532#if FF_API_AVIOFORMAT
533#define ff_const59
534#else
535#define ff_const59 const
536#endif
537 /**528 /**
538 * size of private data so that it can be allocated in the wrapper529 * size of private data so that it can be allocated in the wrapper
539 */530 */
@@ -1235,14 +1226,14 @@ typedef struct AVFormatContext { · 695 unmodified lines
1235 *1226 *
1236 * Demuxing only, set by avformat_open_input().1227 * Demuxing only, set by avformat_open_input().
1237 */1228 */
1238 ff_const59 struct AVInputFormat *iformat;1229 const struct AVInputFormat *iformat;
1239 1230
1240 /**1231 /**
1241 * The output container format.1232 * The output container format.
1242 *1233 *
1243 * Muxing only, must be set by the caller before avformat_write_header().1234 * Muxing only, must be set by the caller before avformat_write_header().
1244 */1235 */
1245 ff_const59 struct AVOutputFormat *oformat;1236 const struct AVOutputFormat *oformat;
1246 1237
1247 /**1238 /**
1248 * Format private data. This is an AVOptions-enabled struct1239 * Format private data. This is an AVOptions-enabled struct
@@ -2088,7 +2079,7 @@ AVProgram *av_new_program(AVFormatContext *s, int id); · 839 unmodified lines
2088 * @return >= 0 in case of success, a negative AVERROR code in case of2079 * @return >= 0 in case of success, a negative AVERROR code in case of
2089 * failure2080 * failure
2090 */2081 */
2091int avformat_alloc_output_context2(AVFormatContext **ctx, ff_const59 AVOutputFormat *oformat,2082int avformat_alloc_output_context2(AVFormatContext **ctx, const AVOutputFormat *oformat,
2092 const char *format_name, const char *filename);2083 const char *format_name, const char *filename);
2093 2084
2094/**2085/**
@@ -2099,7 +2090,7 @@ int avformat_alloc_output_context2(AVFormatContext **ctx, ff_const59 AVOutputFor · 4 unmodified lines
2099/**2090/**
2100 * Find AVInputFormat based on the short name of the input format.2091 * Find AVInputFormat based on the short name of the input format.
2101 */2092 */
2102ff_const59 AVInputFormat *av_find_input_format(const char *short_name);2093const AVInputFormat *av_find_input_format(const char *short_name);
2103 2094
2104/**2095/**
2105 * Guess the file format.2096 * Guess the file format.
@@ -2108,7 +2099,7 @@ ff_const59 AVInputFormat *av_find_input_format(const char *short_name); · 2 unmodified lines
2108 * @param is_opened Whether the file is already opened; determines whether2099 * @param is_opened Whether the file is already opened; determines whether
2109 * demuxers with or without AVFMT_NOFILE are probed.2100 * demuxers with or without AVFMT_NOFILE are probed.
2110 */2101 */
2111ff_const59 AVInputFormat *av_probe_input_format(ff_const59 AVProbeData *pd, int is_opened);2102const AVInputFormat *av_probe_input_format(const AVProbeData *pd, int is_opened);
2112 2103
2113/**2104/**
2114 * Guess the file format.2105 * Guess the file format.
@@ -2122,7 +2113,8 @@ ff_const59 AVInputFormat *av_probe_input_format(ff_const59 AVProbeData *pd, int · 7 unmodified lines
2122 * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended2113 * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended
2123 * to retry with a larger probe buffer.2114 * to retry with a larger probe buffer.
2124 */2115 */
2125ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int is_opened, int *score_max);2116const AVInputFormat *av_probe_input_format2(const AVProbeData *pd,
2117 int is_opened, int *score_max);
2126 2118
2127/**2119/**
2128 * Guess the file format.2120 * Guess the file format.
@@ -2131,7 +2123,8 @@ ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int · 2 unmodified lines
2131 * demuxers with or without AVFMT_NOFILE are probed.2123 * demuxers with or without AVFMT_NOFILE are probed.
2132 * @param score_ret The score of the best detection.2124 * @param score_ret The score of the best detection.
2133 */2125 */
2134ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int is_opened, int *score_ret);2126const AVInputFormat *av_probe_input_format3(const AVProbeData *pd,
2127 int is_opened, int *score_ret);
2135 2128
2136/**2129/**
2137 * Probe a bytestream to determine the input format. Each time a probe returns2130 * Probe a bytestream to determine the input format. Each time a probe returns
@@ -2149,14 +2142,14 @@ ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int · 11 unmodified lines
2149 * the maximal score is AVPROBE_SCORE_MAX2142 * the maximal score is AVPROBE_SCORE_MAX
2150 * AVERROR code otherwise2143 * AVERROR code otherwise
2151 */2144 */
2152int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt,2145int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt,
2153 const char *url, void *logctx,2146 const char *url, void *logctx,
2154 unsigned int offset, unsigned int max_probe_size);2147 unsigned int offset, unsigned int max_probe_size);
2155 2148
2156/**2149/**
2157 * Like av_probe_input_buffer2() but returns 0 on success2150 * Like av_probe_input_buffer2() but returns 0 on success
2158 */2151 */
2159int av_probe_input_buffer(AVIOContext *pb, ff_const59 AVInputFormat **fmt,2152int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt,
2160 const char *url, void *logctx,2153 const char *url, void *logctx,
2161 unsigned int offset, unsigned int max_probe_size);2154 unsigned int offset, unsigned int max_probe_size);
2162 2155
@@ -2179,7 +2172,8 @@ int av_probe_input_buffer(AVIOContext *pb, ff_const59 AVInputFormat **fmt, · 16 unmodified lines
2179 *2172 *
2180 * @note If you want to use custom IO, preallocate the format context and set its pb field.2173 * @note If you want to use custom IO, preallocate the format context and set its pb field.
2181 */2174 */
2182int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options);2175int avformat_open_input(AVFormatContext **ps, const char *url,
2176 const AVInputFormat *fmt, AVDictionary **options);
2183 2177
2184#if FF_API_DEMUXER_OPEN2178#if FF_API_DEMUXER_OPEN
2185/**2179/**
@@ -2570,16 +2564,16 @@ int av_write_trailer(AVFormatContext *s); · 384 unmodified lines
2570 * @param mime_type if non-NULL checks if mime_type matches with the2564 * @param mime_type if non-NULL checks if mime_type matches with the
2571 * MIME type of the registered formats2565 * MIME type of the registered formats
2572 */2566 */
2573ff_const59 AVOutputFormat *av_guess_format(const char *short_name,2567const AVOutputFormat *av_guess_format(const char *short_name,
2574 const char *filename,2568 const char *filename,
2575 const char *mime_type);2569 const char *mime_type);
2576 2570
2577/**2571/**
2578 * Guess the codec ID based upon muxer and filename.2572 * Guess the codec ID based upon muxer and filename.
2579 */2573 */
2580enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name,2574enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name,
2581 const char *filename, const char *mime_type,2575 const char *filename, const char *mime_type,
2582 enum AVMediaType type);2576 enum AVMediaType type);
2583 2577
2584/**2578/**
2585 * Get timing information for the data currently output.2579 * Get timing information for the data currently output.
libavformat/avidec.c+1−1
@@ -1092,7 +1092,7 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt) · 1091 unmodified lines
1092 uint8_t desc[256];1092 uint8_t desc[256];
1093 int score = AVPROBE_SCORE_EXTENSION, ret;1093 int score = AVPROBE_SCORE_EXTENSION, ret;
1094 AVIStream *ast = st->priv_data;1094 AVIStream *ast = st->priv_data;
1095 ff_const59 AVInputFormat *sub_demuxer;1095 const AVInputFormat *sub_demuxer;
1096 AVRational time_base;1096 AVRational time_base;
1097 int size;1097 int size;
1098 AVProbeData pd;1098 AVProbeData pd;
libavformat/dashdec.c+1−1
@@ -1879,7 +1879,7 @@ static void close_demux_for_component(struct representation *pls) · 1878 unmodified lines
1879static int reopen_demux_for_component(AVFormatContext *s, struct representation *pls)1879static int reopen_demux_for_component(AVFormatContext *s, struct representation *pls)
1880{1880{
1881 DASHContext *c = s->priv_data;1881 DASHContext *c = s->priv_data;
1882 ff_const59 AVInputFormat *in_fmt = NULL;1882 const AVInputFormat *in_fmt = NULL;
1883 AVDictionary *in_fmt_opts = NULL;1883 AVDictionary *in_fmt_opts = NULL;
1884 uint8_t *avio_ctx_buffer = NULL;1884 uint8_t *avio_ctx_buffer = NULL;
1885 int ret = 0, i;1885 int ret = 0, i;
libavformat/fifo.c+2−2
@@ -469,7 +469,7 @@ static void *fifo_consumer_thread(void *data) · 468 unmodified lines
469 return NULL;469 return NULL;
470}470}
471 471
472static int fifo_mux_init(AVFormatContext *avf, ff_const59 AVOutputFormat *oformat,472static int fifo_mux_init(AVFormatContext *avf, const AVOutputFormat *oformat,
473 const char *filename)473 const char *filename)
474{474{
475 FifoContext *fifo = avf->priv_data;475 FifoContext *fifo = avf->priv_data;
@@ -508,7 +508,7 @@ static int fifo_mux_init(AVFormatContext *avf, ff_const59 AVOutputFormat *oforma · 32 unmodified lines
508static int fifo_init(AVFormatContext *avf)508static int fifo_init(AVFormatContext *avf)
509{509{
510 FifoContext *fifo = avf->priv_data;510 FifoContext *fifo = avf->priv_data;
511 ff_const59 AVOutputFormat *oformat;511 const AVOutputFormat *oformat;
512 int ret = 0;512 int ret = 0;
513 513
514 if (fifo->recovery_wait_streamtime && !fifo->drop_pkts_on_overflow) {514 if (fifo->recovery_wait_streamtime && !fifo->drop_pkts_on_overflow) {
libavformat/format.c+17−16
@@ -48,8 +48,8 @@ int av_match_ext(const char *filename, const char *extensions) · 47 unmodified lines
48 return 0;48 return 0;
49}49}
50 50
51ff_const59 AVOutputFormat *av_guess_format(const char *short_name, const char *filename,51const AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
52 const char *mime_type)52 const char *mime_type)
53{53{
54 const AVOutputFormat *fmt = NULL;54 const AVOutputFormat *fmt = NULL;
55 AVOutputFormat *fmt_found = NULL;55 AVOutputFormat *fmt_found = NULL;
@@ -84,12 +84,12 @@ ff_const59 AVOutputFormat *av_guess_format(const char *short_name, const char *f · 28 unmodified lines
84 return fmt_found;84 return fmt_found;
85}85}
86 86
87enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name,87enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name,
88 const char *filename, const char *mime_type,88 const char *filename, const char *mime_type,
89 enum AVMediaType type)89 enum AVMediaType type)
90{90{
91 if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) {91 if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) {
92 ff_const59 AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL);92 const AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL);
93 if (fmt2)93 if (fmt2)
94 fmt = fmt2;94 fmt = fmt2;
95 }95 }
@@ -115,7 +115,7 @@ enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_ · 19 unmodified lines
115 return AV_CODEC_ID_NONE;115 return AV_CODEC_ID_NONE;
116}116}
117 117
118ff_const59 AVInputFormat *av_find_input_format(const char *short_name)118const AVInputFormat *av_find_input_format(const char *short_name)
119{119{
120 const AVInputFormat *fmt = NULL;120 const AVInputFormat *fmt = NULL;
121 void *i = 0;121 void *i = 0;
@@ -125,12 +125,12 @@ ff_const59 AVInputFormat *av_find_input_format(const char *short_name) · 3 unmodified lines
125 return NULL;125 return NULL;
126}126}
127 127
128ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int is_opened,128const AVInputFormat *av_probe_input_format3(const AVProbeData *pd,
129 int *score_ret)129 int is_opened, int *score_ret)
130{130{
131 AVProbeData lpd = *pd;131 AVProbeData lpd = *pd;
132 const AVInputFormat *fmt1 = NULL;132 const AVInputFormat *fmt1 = NULL;
133 ff_const59 AVInputFormat *fmt = NULL;133 const AVInputFormat *fmt = NULL;
134 int score, score_max = 0;134 int score, score_max = 0;
135 void *i = 0;135 void *i = 0;
136 const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE];136 const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE];
@@ -191,7 +191,7 @@ ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int · 54 unmodified lines
191 }191 }
192 if (score > score_max) {192 if (score > score_max) {
193 score_max = score;193 score_max = score;
194 fmt = (AVInputFormat*)fmt1;194 fmt = fmt1;
195 } else if (score == score_max)195 } else if (score == score_max)
196 fmt = NULL;196 fmt = NULL;
197 }197 }
@@ -202,10 +202,11 @@ ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int · 4 unmodified lines
202 return fmt;202 return fmt;
203}203}
204 204
205ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int is_opened, int *score_max)205const AVInputFormat *av_probe_input_format2(const AVProbeData *pd,
206 int is_opened, int *score_max)
206{207{
207 int score_ret;208 int score_ret;
208 ff_const59 AVInputFormat *fmt = av_probe_input_format3(pd, is_opened, &score_ret);209 const AVInputFormat *fmt = av_probe_input_format3(pd, is_opened, &score_ret);
209 if (score_ret > *score_max) {210 if (score_ret > *score_max) {
210 *score_max = score_ret;211 *score_max = score_ret;
211 return fmt;212 return fmt;
@@ -213,15 +214,15 @@ ff_const59 AVInputFormat *av_probe_input_format2(ff_const59 AVProbeData *pd, int · 1 unmodified line
213 return NULL;214 return NULL;
214}215}
215 216
216ff_const59 AVInputFormat *av_probe_input_format(ff_const59 AVProbeData *pd, int is_opened)217const AVInputFormat *av_probe_input_format(const AVProbeData *pd, int is_opened)
217{218{
218 int score = 0;219 int score = 0;
219 return av_probe_input_format2(pd, is_opened, &score);220 return av_probe_input_format2(pd, is_opened, &score);
220}221}
221 222
222int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt,223int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt,
223 const char *filename, void *logctx,224 const char *filename, void *logctx,
224 unsigned int offset, unsigned int max_probe_size)225 unsigned int offset, unsigned int max_probe_size)
225{226{
226 AVProbeData pd = { filename ? filename : "" };227 AVProbeData pd = { filename ? filename : "" };
227 uint8_t *buf = NULL;228 uint8_t *buf = NULL;
@@ -309,7 +310,7 @@ fail: · 81 unmodified lines
309 return ret < 0 ? ret : score;310 return ret < 0 ? ret : score;
310}311}
311 312
312int av_probe_input_buffer(AVIOContext *pb, ff_const59 AVInputFormat **fmt,313int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt,
313 const char *filename, void *logctx,314 const char *filename, void *logctx,
314 unsigned int offset, unsigned int max_probe_size)315 unsigned int offset, unsigned int max_probe_size)
315{316{
libavformat/hdsenc.c+1−1
@@ -313,8 +313,8 @@ static void close_file(AVFormatContext *s, OutputStream *os) · 312 unmodified lines
313static int hds_write_header(AVFormatContext *s)313static int hds_write_header(AVFormatContext *s)
314{314{
315 HDSContext *c = s->priv_data;315 HDSContext *c = s->priv_data;
316 const AVOutputFormat *oformat;
316 int ret = 0, i;317 int ret = 0, i;
317 ff_const59 AVOutputFormat *oformat;
318 318
319 if (mkdir(s->url, 0777) == -1 && errno != EEXIST) {319 if (mkdir(s->url, 0777) == -1 && errno != EEXIST) {
320 av_log(s, AV_LOG_ERROR , "Failed to create directory %s\n", s->url);320 av_log(s, AV_LOG_ERROR , "Failed to create directory %s\n", s->url);
libavformat/hls.c+1−1
@@ -1957,8 +1957,8 @@ static int hls_read_header(AVFormatContext *s) · 1956 unmodified lines
1957 /* Open the demuxer for each playlist */1957 /* Open the demuxer for each playlist */
1958 for (i = 0; i < c->n_playlists; i++) {1958 for (i = 0; i < c->n_playlists; i++) {
1959 struct playlist *pls = c->playlists[i];1959 struct playlist *pls = c->playlists[i];
1960 const AVInputFormat *in_fmt = NULL;
1960 char *url;1961 char *url;
1961 ff_const59 AVInputFormat *in_fmt = NULL;
1962 1962
1963 if (!(pls->ctx = avformat_alloc_context())) {1963 if (!(pls->ctx = avformat_alloc_context())) {
1964 ret = AVERROR(ENOMEM);1964 ret = AVERROR(ENOMEM);
libavformat/hlsenc.c+2−2
@@ -119,8 +119,8 @@ typedef struct VariantStream { · 118 unmodified lines
119 unsigned var_stream_idx;119 unsigned var_stream_idx;
120 unsigned number;120 unsigned number;
121 int64_t sequence;121 int64_t sequence;
122 ff_const59 AVOutputFormat *oformat;122 const AVOutputFormat *oformat;
123 ff_const59 AVOutputFormat *vtt_oformat;123 const AVOutputFormat *vtt_oformat;
124 AVIOContext *out;124 AVIOContext *out;
125 AVIOContext *out_single_file;125 AVIOContext *out_single_file;
126 int packets_written;126 int packets_written;
libavformat/mpeg.c+1−1
@@ -732,6 +732,7 @@ static int vobsub_read_header(AVFormatContext *s) · 731 unmodified lines
732{732{
733 int i, ret = 0, header_parsed = 0, langidx = 0;733 int i, ret = 0, header_parsed = 0, langidx = 0;
734 VobSubDemuxContext *vobsub = s->priv_data;734 VobSubDemuxContext *vobsub = s->priv_data;
735 const AVInputFormat *iformat;
735 size_t fname_len;736 size_t fname_len;
736 AVBPrint header;737 AVBPrint header;
737 int64_t delay = 0;738 int64_t delay = 0;
@@ -739,7 +740,6 @@ static int vobsub_read_header(AVFormatContext *s) · 1 unmodified line
739 int stream_id = -1;740 int stream_id = -1;
740 char id[64] = {0};741 char id[64] = {0};
741 char alt[MAX_LINE_SIZE] = {0};742 char alt[MAX_LINE_SIZE] = {0};
742 ff_const59 AVInputFormat *iformat;
743 743
744 if (!vobsub->sub_name) {744 if (!vobsub->sub_name) {
745 char *ext;745 char *ext;
libavformat/mux.c+1−1
@@ -133,7 +133,7 @@ enum AVChromaLocation ff_choose_chroma_location(AVFormatContext *s, AVStream *st · 132 unmodified lines
133 133
134}134}
135 135
136int avformat_alloc_output_context2(AVFormatContext **avctx, ff_const59 AVOutputFormat *oformat,136int avformat_alloc_output_context2(AVFormatContext **avctx, const AVOutputFormat *oformat,
137 const char *format, const char *filename)137 const char *format, const char *filename)
138{138{
139 AVFormatContext *s = avformat_alloc_context();139 AVFormatContext *s = avformat_alloc_context();
libavformat/rtpdec_asf.c+1−1
@@ -106,7 +106,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) · 105 unmodified lines
106 AVDictionary *opts = NULL;106 AVDictionary *opts = NULL;
107 int len = strlen(p) * 6 / 8;107 int len = strlen(p) * 6 / 8;
108 char *buf = av_mallocz(len);108 char *buf = av_mallocz(len);
109 ff_const59 AVInputFormat *iformat;109 const AVInputFormat *iformat;
110 110
111 if (!buf)111 if (!buf)
112 return AVERROR(ENOMEM);112 return AVERROR(ENOMEM);
libavformat/rtpenc_chain.c+1−1
@@ -31,7 +31,7 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s, · 30 unmodified lines
31{31{
32 AVFormatContext *rtpctx = NULL;32 AVFormatContext *rtpctx = NULL;
33 int ret;33 int ret;
34 ff_const59 AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);34 const AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
35 uint8_t *rtpflags;35 uint8_t *rtpflags;
36 AVDictionary *opts = NULL;36 AVDictionary *opts = NULL;
37 37
libavformat/rtpenc_mpegts.c+2−2
@@ -56,8 +56,8 @@ static int rtp_mpegts_write_header(AVFormatContext *s) · 55 unmodified lines
56{56{
57 MuxChain *chain = s->priv_data;57 MuxChain *chain = s->priv_data;
58 AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL;58 AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL;
59 ff_const59 AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL);59 const AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL);
60 ff_const59 AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);60 const AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
61 int i, ret = AVERROR(ENOMEM);61 int i, ret = AVERROR(ENOMEM);
62 AVStream *st;62 AVStream *st;
63 AVDictionary *mpegts_muxer_options = NULL;63 AVDictionary *mpegts_muxer_options = NULL;
libavformat/sapdec.c+1−1
@@ -65,9 +65,9 @@ static int sap_read_header(AVFormatContext *s) · 64 unmodified lines
65 struct SAPState *sap = s->priv_data;65 struct SAPState *sap = s->priv_data;
66 char host[1024], path[1024], url[1024];66 char host[1024], path[1024], url[1024];
67 uint8_t recvbuf[RTP_MAX_PACKET_LENGTH];67 uint8_t recvbuf[RTP_MAX_PACKET_LENGTH];
68 const AVInputFormat *infmt;
68 int port;69 int port;
69 int ret, i;70 int ret, i;
70 ff_const59 AVInputFormat* infmt;
71 71
72 if (!ff_network_init())72 if (!ff_network_init())
73 return AVERROR(EIO);73 return AVERROR(EIO);
libavformat/segment.c+1−1
@@ -72,7 +72,7 @@ typedef struct SegmentContext { · 71 unmodified lines
72 int segment_idx_wrap; ///< number after which the index wraps72 int segment_idx_wrap; ///< number after which the index wraps
73 int segment_idx_wrap_nb; ///< number of time the index has wraped73 int segment_idx_wrap_nb; ///< number of time the index has wraped
74 int segment_count; ///< number of segment files already written74 int segment_count; ///< number of segment files already written
75 ff_const59 AVOutputFormat *oformat;75 const AVOutputFormat *oformat;
76 AVFormatContext *avf;76 AVFormatContext *avf;
77 char *format; ///< format to use for output segment files77 char *format; ///< format to use for output segment files
78 AVDictionary *format_options;78 AVDictionary *format_options;
libavformat/smoothstreamingenc.c+1−1
@@ -283,7 +283,7 @@ static int ism_write_header(AVFormatContext *s) · 282 unmodified lines
283{283{
284 SmoothStreamingContext *c = s->priv_data;284 SmoothStreamingContext *c = s->priv_data;
285 int ret = 0, i;285 int ret = 0, i;
286 ff_const59 AVOutputFormat *oformat;286 const AVOutputFormat *oformat;
287 287
288 if (mkdir(s->url, 0777) == -1 && errno != EEXIST) {288 if (mkdir(s->url, 0777) == -1 && errno != EEXIST) {
289 av_log(s, AV_LOG_ERROR, "mkdir failed\n");289 av_log(s, AV_LOG_ERROR, "mkdir failed\n");
libavformat/utils.c+1−1
@@ -545,7 +545,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 544 unmodified lines
545 545
546 546
547int avformat_open_input(AVFormatContext **ps, const char *filename,547int avformat_open_input(AVFormatContext **ps, const char *filename,
548 ff_const59 AVInputFormat *fmt, AVDictionary **options)548 const AVInputFormat *fmt, AVDictionary **options)
549{549{
550 AVFormatContext *s = *ps;550 AVFormatContext *s = *ps;
551 int i, ret = 0;551 int i, ret = 0;
libavformat/version.h+0−3
@@ -97,9 +97,6 @@ · 96 unmodified lines
97#ifndef FF_API_LAVF_MP4A_LATM97#ifndef FF_API_LAVF_MP4A_LATM
98#define FF_API_LAVF_MP4A_LATM (LIBAVFORMAT_VERSION_MAJOR < 59)98#define FF_API_LAVF_MP4A_LATM (LIBAVFORMAT_VERSION_MAJOR < 59)
99#endif99#endif
100#ifndef FF_API_AVIOFORMAT
101#define FF_API_AVIOFORMAT (LIBAVFORMAT_VERSION_MAJOR < 59)
102#endif
103#ifndef FF_API_DEMUXER_OPEN100#ifndef FF_API_DEMUXER_OPEN
104#define FF_API_DEMUXER_OPEN (LIBAVFORMAT_VERSION_MAJOR < 59)101#define FF_API_DEMUXER_OPEN (LIBAVFORMAT_VERSION_MAJOR < 59)
105#endif102#endif
libavformat/webm_chunk.c+1−1
@@ -50,7 +50,7 @@ typedef struct WebMChunkContext { · 49 unmodified lines
50static int webm_chunk_init(AVFormatContext *s)50static int webm_chunk_init(AVFormatContext *s)
51{51{
52 WebMChunkContext *wc = s->priv_data;52 WebMChunkContext *wc = s->priv_data;
53 ff_const59 AVOutputFormat *oformat;53 const AVOutputFormat *oformat;
54 AVFormatContext *oc;54 AVFormatContext *oc;
55 AVStream *st, *ost = s->streams[0];55 AVStream *st, *ost = s->streams[0];
56 AVDictionary *dict = NULL;56 AVDictionary *dict = NULL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t