History

lavf: add an AVClass to AVStream on next major bump

Also add a function to retrieve that class, analogously to avformat_get_class(). This will be useful for adding an AVOption for dispositions.

Anton Khirnov committed 5 years ago

Commit ed75a081 parent 85433fb4 files · +36 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavformat/avformat.h +15 −0
  3. libavformat/utils.c +15 −0
  4. libavformat/version.h +2 −1
doc/APIchanges+4−0
@@ -14,6 +14,10 @@ libavutil: 2021-04-27 · 13 unmodified lines
1414
1515 API changes, most recent first:
1616
17+2021-11-xx - xxxxxxxxxx - lavf 59.9.100 - avformat.h
18+ Add av_stream_get_class(). Schedule adding AVStream.av_class at libavformat
19+ major version 60.
20+
1721 2021-11-12 - xxxxxxxxxx - lavu 57.8.100 - hwcontext_vulkan.h
1822 Added AVFrame.sem_value, AVVulkanDeviceContext.queue_family_encode_index,
1923 nb_encode_queues, queue_family_decode_index, and nb_decode_queues.
libavformat/avformat.h+15−0
@@ -909,6 +909,13 @@ typedef struct AVIndexEntry { · 908 unmodified lines
909909 * sizeof(AVStream) must not be used outside libav*.
910910 */
911911 typedef struct AVStream {
912+#if FF_API_AVSTREAM_CLASS
913+ /**
914+ * A class for @ref avoptions. Set on stream creation.
915+ */
916+ const AVClass *av_class;
917+#endif
918+
912919 int index; /**< stream index in AVFormatContext */
913920 /**
914921 * Format-specific stream ID.
@@ -1864,6 +1871,14 @@ void avformat_free_context(AVFormatContext *s); · 949 unmodified lines
18641871 */
18651872 const AVClass *avformat_get_class(void);
18661873
1874+/**
1875+ * Get the AVClass for AVStream. It can be used in combination with
1876+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
1877+ *
1878+ * @see av_opt_find().
1879+ */
1880+const AVClass *av_stream_get_class(void);
1881+
18671882 /**
18681883 * Add a new stream to a media file.
18691884 *
libavformat/utils.c+15−0
@@ -721,6 +721,17 @@ void avformat_free_context(AVFormatContext *s) · 720 unmodified lines
721721 av_free(s);
722722 }
723723
724+static const AVClass stream_class = {
725+ .class_name = "AVStream",
726+ .item_name = av_default_item_name,
727+ .version = LIBAVUTIL_VERSION_INT,
728+};
729+
730+const AVClass *av_stream_get_class(void)
731+{
732+ return &stream_class;
733+}
734+
724735 AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
725736 {
726737 FFFormatContext *const si = ffformatcontext(s);
@@ -745,6 +756,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) · 18 unmodified lines
745756 return NULL;
746757 st = &sti->pub;
747758
759+#if FF_API_AVSTREAM_CLASS
760+ st->av_class = &stream_class;
761+#endif
762+
748763 st->codecpar = avcodec_parameters_alloc();
749764 if (!st->codecpar)
750765 goto fail;
libavformat/version.h+2−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
3333 // Also please add any ticket numbers that you believe might be affected here
3434 #define LIBAVFORMAT_VERSION_MAJOR 59
35−#define LIBAVFORMAT_VERSION_MINOR 8
35+#define LIBAVFORMAT_VERSION_MINOR 9
3636 #define LIBAVFORMAT_VERSION_MICRO 100
3737
3838 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -58,6 +58,7 @@ · 19 unmodified lines
5858 #define FF_API_LAVF_PRIV_OPT (LIBAVFORMAT_VERSION_MAJOR < 60)
5959 #define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 60)
6060 #define FF_API_AVIOCONTEXT_WRITTEN (LIBAVFORMAT_VERSION_MAJOR < 60)
61+#define FF_API_AVSTREAM_CLASS (LIBAVFORMAT_VERSION_MAJOR > 59)
6162
6263
6364 #define FF_API_R_FRAME_RATE 1

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