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
14 14
15API changes, most recent first:15API changes, most recent first:
16 16
172021-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
172021-11-12 - xxxxxxxxxx - lavu 57.8.100 - hwcontext_vulkan.h212021-11-12 - xxxxxxxxxx - lavu 57.8.100 - hwcontext_vulkan.h
18 Added AVFrame.sem_value, AVVulkanDeviceContext.queue_family_encode_index,22 Added AVFrame.sem_value, AVVulkanDeviceContext.queue_family_encode_index,
19 nb_encode_queues, queue_family_decode_index, and nb_decode_queues.23 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
909 * sizeof(AVStream) must not be used outside libav*.909 * sizeof(AVStream) must not be used outside libav*.
910 */910 */
911typedef struct AVStream {911typedef 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
912 int index; /**< stream index in AVFormatContext */919 int index; /**< stream index in AVFormatContext */
913 /**920 /**
914 * Format-specific stream ID.921 * Format-specific stream ID.
@@ -1864,6 +1871,14 @@ void avformat_free_context(AVFormatContext *s); · 949 unmodified lines
1864 */1871 */
1865const AVClass *avformat_get_class(void);1872const AVClass *avformat_get_class(void);
1866 1873
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 */
1880const AVClass *av_stream_get_class(void);
1881
1867/**1882/**
1868 * Add a new stream to a media file.1883 * Add a new stream to a media file.
1869 *1884 *
libavformat/utils.c+15−0
@@ -721,6 +721,17 @@ void avformat_free_context(AVFormatContext *s) · 720 unmodified lines
721 av_free(s);721 av_free(s);
722}722}
723 723
724static const AVClass stream_class = {
725 .class_name = "AVStream",
726 .item_name = av_default_item_name,
727 .version = LIBAVUTIL_VERSION_INT,
728};
729
730const AVClass *av_stream_get_class(void)
731{
732 return &stream_class;
733}
734
724AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)735AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
725{736{
726 FFFormatContext *const si = ffformatcontext(s);737 FFFormatContext *const si = ffformatcontext(s);
@@ -745,6 +756,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) · 18 unmodified lines
745 return NULL;756 return NULL;
746 st = &sti->pub;757 st = &sti->pub;
747 758
759#if FF_API_AVSTREAM_CLASS
760 st->av_class = &stream_class;
761#endif
762
748 st->codecpar = avcodec_parameters_alloc();763 st->codecpar = avcodec_parameters_alloc();
749 if (!st->codecpar)764 if (!st->codecpar)
750 goto fail;765 goto fail;
libavformat/version.h+2−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 5934#define LIBAVFORMAT_VERSION_MAJOR 59
35#define LIBAVFORMAT_VERSION_MINOR 835#define LIBAVFORMAT_VERSION_MINOR 9
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, \
@@ -58,6 +58,7 @@ · 19 unmodified lines
58#define FF_API_LAVF_PRIV_OPT (LIBAVFORMAT_VERSION_MAJOR < 60)58#define FF_API_LAVF_PRIV_OPT (LIBAVFORMAT_VERSION_MAJOR < 60)
59#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 60)59#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 60)
60#define FF_API_AVIOCONTEXT_WRITTEN (LIBAVFORMAT_VERSION_MAJOR < 60)60#define FF_API_AVIOCONTEXT_WRITTEN (LIBAVFORMAT_VERSION_MAJOR < 60)
61#define FF_API_AVSTREAM_CLASS (LIBAVFORMAT_VERSION_MAJOR > 59)
61 62
62 63
63#define FF_API_R_FRAME_RATE 164#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