History

avformat: Deprecate AVFMT_FLAG_PRIV_OPT, remove av_demuxer_open on bump

This flag was added in 492026209b9b58eaf6d2ea56423f6b1e1a8a76a5 in conjunction with av_demuxer_open() to allow to pass private options to demuxers. It worked as follows: av_open_input_stream() (the predecessor of avformat_open_input()) would not call the read_header function if this flag is set. Instead the user could set private options of the demuxer via the format's private class after avformat_open_input() and then call av_demuxer_open() which called the format's read_header function. This approach was abandoned in e37f161e66e042d6c2c7470c4d9881df9427fc4a and av_demuxer_open() deprecated; instead the AVDictionary based way of passing private options to the demuxer was choosen. Yet AVFMT_FLAG_PRIV_OPT has never been deprecated and av_demuxer_open() never removed. This commit implements the deprecation of the flag and schedules av_demuxer_open for removal on the next major bump. Given that av_demuxer_open() has been deprecated in 2012 and that this flag is useless without it, the flag will be ignored after the next major version bump.

Andreas Rheinhardt committed 5 years ago

Commit 2ff40b91 parent d29ec024 files · +29 −4Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavformat/avformat.h +8 −1
  3. libavformat/utils.c +10 −2
  4. libavformat/version.h +7 −1
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2017-10-21 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182021-03-03 - xxxxxxxxxx - lavf 58.70.100 - avformat.h
19 Deprecate AVFMT_FLAG_PRIV_OPT. It will do nothing
20 as soon as av_demuxer_open() is removed.
21
182021-02-27 - xxxxxxxxxx - lavc 58.126.100 - avcodec.h222021-02-27 - xxxxxxxxxx - lavc 58.126.100 - avcodec.h
19 Deprecated avcodec_get_frame_class().23 Deprecated avcodec_get_frame_class().
20 24
libavformat/avformat.h+8−1
@@ -1379,7 +1379,9 @@ typedef struct AVFormatContext { · 1378 unmodified lines
1379#define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Deprecated, does nothing.1379#define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Deprecated, does nothing.
1380#endif1380#endif
1381#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down)1381#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down)
1382#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted)1382#if FF_API_LAVF_PRIV_OPT
1383#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (deprecated, will do nothing once av_demuxer_open() is removed)
1384#endif
1383#if FF_API_LAVF_KEEPSIDE_FLAG1385#if FF_API_LAVF_KEEPSIDE_FLAG
1384#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Deprecated, does nothing.1386#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Deprecated, does nothing.
1385#endif1387#endif
@@ -2210,8 +2212,13 @@ int av_probe_input_buffer(AVIOContext *pb, ff_const59 AVInputFormat **fmt, · 824 unmodified lines
2210 */2212 */
2211int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options);2213int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options);
2212 2214
2215#if FF_API_DEMUXER_OPEN
2216/**
2217 * @deprecated Use an AVDictionary to pass options to a demuxer.
2218 */
2213attribute_deprecated2219attribute_deprecated
2214int av_demuxer_open(AVFormatContext *ic);2220int av_demuxer_open(AVFormatContext *ic);
2221#endif
2215 2222
2216/**2223/**
2217 * Read packets of a media file to get stream information. This2224 * Read packets of a media file to get stream information. This
libavformat/utils.c+10−2
@@ -392,6 +392,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 391 unmodified lines
392/************************************************************/392/************************************************************/
393/* input media file */393/* input media file */
394 394
395#if FF_API_DEMUXER_OPEN
395int av_demuxer_open(AVFormatContext *ic) {396int av_demuxer_open(AVFormatContext *ic) {
396 int err;397 int err;
397 398
@@ -411,7 +412,7 @@ int av_demuxer_open(AVFormatContext *ic) { · 13 unmodified lines
411 412
412 return 0;413 return 0;
413}414}
414 415#endif
415/* Open input file and probe the format if necessary. */416/* Open input file and probe the format if necessary. */
416static int init_input(AVFormatContext *s, const char *filename,417static int init_input(AVFormatContext *s, const char *filename,
417 AVDictionary **options)418 AVDictionary **options)
@@ -594,8 +595,11 @@ FF_ENABLE_DEPRECATION_WARNINGS · 176 unmodified lines
594 if (s->pb)595 if (s->pb)
595 ff_id3v2_read_dict(s->pb, &s->internal->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);596 ff_id3v2_read_dict(s->pb, &s->internal->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
596 597
597 598#if FF_API_DEMUXER_OPEN
598 if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header)599 if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header)
600#else
601 if (s->iformat->read_header)
602#endif
599 if ((ret = s->iformat->read_header(s)) < 0)603 if ((ret = s->iformat->read_header(s)) < 0)
600 goto fail;604 goto fail;
601 605
@@ -624,7 +628,11 @@ FF_ENABLE_DEPRECATION_WARNINGS · 22 unmodified lines
624 if ((ret = avformat_queue_attached_pictures(s)) < 0)628 if ((ret = avformat_queue_attached_pictures(s)) < 0)
625 goto close;629 goto close;
626 630
631#if FF_API_DEMUXER_OPEN
627 if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->pb && !s->internal->data_offset)632 if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->pb && !s->internal->data_offset)
633#else
634 if (s->pb && !s->internal->data_offset)
635#endif
628 s->internal->data_offset = avio_tell(s->pb);636 s->internal->data_offset = avio_tell(s->pb);
629 637
630 s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;638 s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
libavformat/version.h+7−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
32// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)32// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
33// Also please add any ticket numbers that you believe might be affected here33// Also please add any ticket numbers that you believe might be affected here
34#define LIBAVFORMAT_VERSION_MAJOR 5834#define LIBAVFORMAT_VERSION_MAJOR 58
35#define LIBAVFORMAT_VERSION_MINOR 6935#define LIBAVFORMAT_VERSION_MINOR 70
36#define LIBAVFORMAT_VERSION_MICRO 10036#define LIBAVFORMAT_VERSION_MICRO 100
37 37
38#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \38#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -106,6 +106,12 @@ · 67 unmodified lines
106#ifndef FF_API_AVIOFORMAT106#ifndef FF_API_AVIOFORMAT
107#define FF_API_AVIOFORMAT (LIBAVFORMAT_VERSION_MAJOR < 59)107#define FF_API_AVIOFORMAT (LIBAVFORMAT_VERSION_MAJOR < 59)
108#endif108#endif
109#ifndef FF_API_DEMUXER_OPEN
110#define FF_API_DEMUXER_OPEN (LIBAVFORMAT_VERSION_MAJOR < 59)
111#endif
112#ifndef FF_API_LAVF_PRIV_OPT
113#define FF_API_LAVF_PRIV_OPT (LIBAVFORMAT_VERSION_MAJOR < 60)
114#endif
109 115
110 116
111#ifndef FF_API_R_FRAME_RATE117#ifndef FF_API_R_FRAME_RATE

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