mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-28 10:04:37 +08:00
avfilter/buffersink: add support for chroma locations
Lets the caller read back the negotiated chroma location and constrain the sink to a list of accepted ones. Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
1 parent
f3d2f99263
commit
30e7a93bee
4 files changed
+19
-4
No files matched your search
+3
-2
@@ -2,8 +2,9 @@ The last version increases of all libraries were on 2026-06-23.
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2026-09-xx - xxxxxxxxxx - lavfi 12.4.102 - avfilter.h buffersrc.h
|
||||
Add AVFilterLink.chroma_location and AVBufferSrcParameters.chroma_location.
|
||||
2026-09-xx - xxxxxxxxxx - lavfi 12.5.100 - avfilter.h buffersrc.h buffersink.h
|
||||
Add AVFilterLink.chroma_location, AVBufferSrcParameters.chroma_location and
|
||||
av_buffersink_get_chroma_location().
|
||||
|
||||
2026-09-xx - xxxxxxxxxx - lavc 63.16.100 - avcodec.h
|
||||
Add AV_CODEC_CONFIG_CHROMA_LOCATION.
|
||||
|
||||
@@ -58,6 +58,9 @@ typedef struct BufferSinkContext {
|
||||
int *alphamodes;
|
||||
unsigned nb_alphamodes;
|
||||
|
||||
int *chromalocations;
|
||||
unsigned nb_chromalocations;
|
||||
|
||||
/* only used for audio */
|
||||
enum AVSampleFormat *sample_formats;
|
||||
unsigned nb_sample_formats;
|
||||
@@ -169,6 +172,7 @@ static int init_video(AVFilterContext *ctx)
|
||||
TERMINATE_ARRAY(colorranges, -1);
|
||||
TERMINATE_ARRAY(colorspaces, -1);
|
||||
TERMINATE_ARRAY(alphamodes, -1);
|
||||
TERMINATE_ARRAY(chromalocations, -1);
|
||||
|
||||
return common_init(ctx);
|
||||
}
|
||||
@@ -248,6 +252,7 @@ MAKE_AVFILTERLINK_ACCESSOR(AVRational , sample_aspect_ratio)
|
||||
MAKE_AVFILTERLINK_ACCESSOR(enum AVColorSpace, colorspace)
|
||||
MAKE_AVFILTERLINK_ACCESSOR(enum AVColorRange, color_range)
|
||||
MAKE_AVFILTERLINK_ACCESSOR(enum AVAlphaMode , alpha_mode)
|
||||
MAKE_AVFILTERLINK_ACCESSOR(enum AVChromaLocation, chroma_location)
|
||||
|
||||
MAKE_AVFILTERLINK_ACCESSOR(int , sample_rate )
|
||||
|
||||
@@ -314,6 +319,11 @@ static int vsink_query_formats(const AVFilterContext *ctx,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if (buf->nb_chromalocations) {
|
||||
ret = ff_set_common_chroma_locations_from_list2(ctx, cfg_in, cfg_out, buf->chromalocations);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if (buf->nb_alphamodes) {
|
||||
ret = ff_set_common_alpha_modes_from_list2(ctx, cfg_in, cfg_out, buf->alphamodes);
|
||||
if (ret < 0)
|
||||
@@ -358,6 +368,8 @@ static const AVOption buffersink_options[] = {
|
||||
AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
|
||||
{ "colorranges", "array of supported color ranges", OFFSET(colorranges),
|
||||
AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
|
||||
{ "chromalocations", "array of supported chroma locations", OFFSET(chromalocations),
|
||||
AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
|
||||
{ "alphamodes", "array of supported color ranges", OFFSET(alphamodes),
|
||||
AV_OPT_TYPE_INT | AV_OPT_TYPE_FLAG_ARRAY, .max = INT_MAX, .flags = FLAGS },
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
* - colorspaces (array of int),
|
||||
* - colorranges (array of int),
|
||||
* - alphamodes (array of int),
|
||||
* - chromalocations (array of int),
|
||||
* - sample_formats (array of sample formats),
|
||||
* - samplerates (array of int),
|
||||
* - channel_layouts (array of channel layouts)
|
||||
@@ -117,6 +118,7 @@ AVRational av_buffersink_get_sample_aspect_ratio (const AVFilterContext *c
|
||||
enum AVColorSpace av_buffersink_get_colorspace (const AVFilterContext *ctx);
|
||||
enum AVColorRange av_buffersink_get_color_range (const AVFilterContext *ctx);
|
||||
enum AVAlphaMode av_buffersink_get_alpha_mode (const AVFilterContext *ctx);
|
||||
enum AVChromaLocation av_buffersink_get_chroma_location(const AVFilterContext *ctx);
|
||||
|
||||
int av_buffersink_get_channels (const AVFilterContext *ctx);
|
||||
int av_buffersink_get_ch_layout (const AVFilterContext *ctx,
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVFILTER_VERSION_MINOR 4
|
||||
#define LIBAVFILTER_VERSION_MICRO 102
|
||||
#define LIBAVFILTER_VERSION_MINOR 5
|
||||
#define LIBAVFILTER_VERSION_MICRO 100
|
||||
|
||||
|
||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||
|
||||
Reference in new issue
Block a user