Also add a function to retrieve that class, analogously to avformat_get_class(). This will be useful for adding an AVOption for dispositions.
Unified · Split
| @@ -14,6 +14,10 @@ libavutil: 2021-04-27 · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | API changes, most recent first: |
| 16 | 16 | |
| 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 | + | |
| 17 | 21 | 2021-11-12 - xxxxxxxxxx - lavu 57.8.100 - hwcontext_vulkan.h |
| 18 | 22 | Added AVFrame.sem_value, AVVulkanDeviceContext.queue_family_encode_index, |
| 19 | 23 | nb_encode_queues, queue_family_decode_index, and nb_decode_queues. |
| @@ -909,6 +909,13 @@ typedef struct AVIndexEntry { · 908 unmodified lines | ||
| 909 | 909 | * sizeof(AVStream) must not be used outside libav*. |
| 910 | 910 | */ |
| 911 | 911 | 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 | + | |
| 912 | 919 | int index; /**< stream index in AVFormatContext */ |
| 913 | 920 | /** |
| 914 | 921 | * Format-specific stream ID. |
| @@ -1864,6 +1871,14 @@ void avformat_free_context(AVFormatContext *s); · 949 unmodified lines | ||
| 1864 | 1871 | */ |
| 1865 | 1872 | const 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 | + */ | |
| 1880 | +const AVClass *av_stream_get_class(void); | |
| 1881 | + | |
| 1867 | 1882 | /** |
| 1868 | 1883 | * Add a new stream to a media file. |
| 1869 | 1884 | * |
| @@ -721,6 +721,17 @@ void avformat_free_context(AVFormatContext *s) · 720 unmodified lines | ||
| 721 | 721 | av_free(s); |
| 722 | 722 | } |
| 723 | 723 | |
| 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 | + | |
| 724 | 735 | AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) |
| 725 | 736 | { |
| 726 | 737 | FFFormatContext *const si = ffformatcontext(s); |
| @@ -745,6 +756,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) · 18 unmodified lines | ||
| 745 | 756 | return NULL; |
| 746 | 757 | st = &sti->pub; |
| 747 | 758 | |
| 759 | +#if FF_API_AVSTREAM_CLASS | |
| 760 | + st->av_class = &stream_class; | |
| 761 | +#endif | |
| 762 | + | |
| 748 | 763 | st->codecpar = avcodec_parameters_alloc(); |
| 749 | 764 | if (!st->codecpar) |
| 750 | 765 | goto fail; |
| @@ -32,7 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) |
| 33 | 33 | // Also please add any ticket numbers that you believe might be affected here |
| 34 | 34 | #define LIBAVFORMAT_VERSION_MAJOR 59 |
| 35 | −#define LIBAVFORMAT_VERSION_MINOR 8 | |
| 35 | +#define LIBAVFORMAT_VERSION_MINOR 9 | |
| 36 | 36 | #define LIBAVFORMAT_VERSION_MICRO 100 |
| 37 | 37 | |
| 38 | 38 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| @@ -58,6 +58,7 @@ · 19 unmodified lines | ||
| 58 | 58 | #define FF_API_LAVF_PRIV_OPT (LIBAVFORMAT_VERSION_MAJOR < 60) |
| 59 | 59 | #define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 60) |
| 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 | 64 | #define FF_API_R_FRAME_RATE 1 |