@@ -15,6 +15,10 @@ libavutil: 2017-10-21
API changes, most recent first:
+2020-03-01 - xxxxxxxxxx - lavf 58.40.100 - avformat.h
+ avformat_alloc_output_context2() and av_guess_codec() now accept
+ pointer to const AVOutputFormat.
+
2020-02-21 - xxxxxxxxxx - lavc 58.73.101 - avcodec.h
Add AV_CODEC_EXPORT_DATA_PRFT.
@@ -2224,7 +2224,7 @@ AVProgram *av_new_program(AVFormatContext *s, int id);
* @return >= 0 in case of success, a negative AVERROR code in case of
* failure
*/
-int avformat_alloc_output_context2(AVFormatContext **ctx, ff_const59 AVOutputFormat *oformat,
+int avformat_alloc_output_context2(AVFormatContext **ctx, const AVOutputFormat *oformat,
const char *format_name, const char *filename);
/**
@@ -2707,7 +2707,7 @@ ff_const59 AVOutputFormat *av_guess_format(const char *short_name,
/**
* Guess the codec ID based upon muxer and filename.
*/
-enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name,
+enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name,
const char *filename, const char *mime_type,
enum AVMediaType type);
@@ -441,7 +441,7 @@ static void *fifo_consumer_thread(void *data)
return NULL;
}
-static int fifo_mux_init(AVFormatContext *avf, ff_const59 AVOutputFormat *oformat,
+static int fifo_mux_init(AVFormatContext *avf, const AVOutputFormat *oformat,
const char *filename)
{
FifoContext *fifo = avf->priv_data;
@@ -480,7 +480,7 @@ static int fifo_mux_init(AVFormatContext *avf, ff_const59 AVOutputFormat *oforma
static int fifo_init(AVFormatContext *avf)
{
FifoContext *fifo = avf->priv_data;
- ff_const59 AVOutputFormat *oformat;
+ const AVOutputFormat *oformat;
int ret = 0;
if (fifo->recovery_wait_streamtime && !fifo->drop_pkts_on_overflow) {
@@ -84,12 +84,12 @@ ff_const59 AVOutputFormat *av_guess_format(const char *short_name, const char *f
return fmt_found;
}
-enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name,
+enum AVCodecID av_guess_codec(const 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)) {
- ff_const59 AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL);
+ const AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL);
if (fmt2)
fmt = fmt2;
}
@@ -113,8 +113,8 @@ typedef struct VariantStream {
unsigned var_stream_idx;
unsigned number;
int64_t sequence;
- ff_const59 AVOutputFormat *oformat;
- ff_const59 AVOutputFormat *vtt_oformat;
+ const AVOutputFormat *oformat;
+ const AVOutputFormat *vtt_oformat;
AVIOContext *out;
int packets_written;
int init_range_length;
@@ -145,7 +145,7 @@ enum AVChromaLocation ff_choose_chroma_location(AVFormatContext *s, AVStream *st
}
-int avformat_alloc_output_context2(AVFormatContext **avctx, ff_const59 AVOutputFormat *oformat,
+int avformat_alloc_output_context2(AVFormatContext **avctx, const AVOutputFormat *oformat,
const char *format, const char *filename)
{
AVFormatContext *s = avformat_alloc_context();
@@ -174,7 +174,7 @@ int avformat_alloc_output_context2(AVFormatContext **avctx, ff_const59 AVOutputF
}
}
- s->oformat = oformat;
+ s->oformat = (ff_const59 AVOutputFormat *)oformat;
if (s->oformat->priv_data_size > 0) {
s->priv_data = av_mallocz(s->oformat->priv_data_size);
if (!s->priv_data)
@@ -72,7 +72,7 @@ typedef struct SegmentContext {
int segment_idx_wrap; ///< number after which the index wraps
int segment_idx_wrap_nb; ///< number of time the index has wraped
int segment_count; ///< number of segment files already written
- ff_const59 AVOutputFormat *oformat;
+ const AVOutputFormat *oformat;
AVFormatContext *avf;
char *format; ///< format to use for output segment files
AVDictionary *format_options;
@@ -32,8 +32,8 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 58
-#define LIBAVFORMAT_VERSION_MINOR 39
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 40
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
@@ -53,7 +53,7 @@ typedef struct WebMChunkContext {
char *http_method;
uint64_t duration_written;
int64_t prev_pts;
- ff_const59 AVOutputFormat *oformat;
+ const AVOutputFormat *oformat;
AVFormatContext *avf;
} WebMChunkContext;
9461e4bc made preparations to constify the various AVOutputFormat pointers because the underlying AVOutputFormats should not be changed. To do this, a preprocessor directive (ff_const59) is used that will add const to certain AVOutputFormat * after the next major version bump. This approach has the drawback that it does not allow users to write future-proof code now (if one needs to use av_guess_format(), e.g. because of the mime_type parameter). Yet this is possible: Currently both avformat_alloc_output_context2() and av_guess_codec() have a pointer to AVOutputFormat as function parameter. They can also accept a pointer to const AVOutputFormat without imparing ABI/API compability. Users can then already write future-proof code now by using const. This also makes it possible to already use const now in certain parts of our own code. For the time being, avformat_alloc_output_context2() will have to cast the const away internally until the next major version bump. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- doc/APIchanges | 4 ++++ libavformat/avformat.h | 4 ++-- libavformat/fifo.c | 4 ++-- libavformat/format.c | 4 ++-- libavformat/hlsenc.c | 4 ++-- libavformat/mux.c | 4 ++-- libavformat/segment.c | 2 +- libavformat/version.h | 4 ++-- libavformat/webm_chunk.c | 2 +- 9 files changed, 18 insertions(+), 14 deletions(-)