summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavutil/frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'media/ffvpx/libavutil/frame.c')
-rw-r--r--media/ffvpx/libavutil/frame.c400
1 files changed, 194 insertions, 206 deletions
diff --git a/media/ffvpx/libavutil/frame.c b/media/ffvpx/libavutil/frame.c
index a3f07ca089..930f01dc19 100644
--- a/media/ffvpx/libavutil/frame.c
+++ b/media/ffvpx/libavutil/frame.c
@@ -28,12 +28,35 @@
#include "samplefmt.h"
#include "hwcontext.h"
-#if FF_API_OLD_CHANNEL_LAYOUT
-#define CHECK_CHANNELS_CONSISTENCY(frame) \
- av_assert2(!(frame)->channel_layout || \
- (frame)->channels == \
- av_get_channel_layout_nb_channels((frame)->channel_layout))
-#endif
+static const AVSideDataDescriptor sd_props[] = {
+ [AV_FRAME_DATA_PANSCAN] = { "AVPanScan" },
+ [AV_FRAME_DATA_A53_CC] = { "ATSC A53 Part 4 Closed Captions" },
+ [AV_FRAME_DATA_MATRIXENCODING] = { "AVMatrixEncoding" },
+ [AV_FRAME_DATA_DOWNMIX_INFO] = { "Metadata relevant to a downmix procedure" },
+ [AV_FRAME_DATA_AFD] = { "Active format description" },
+ [AV_FRAME_DATA_MOTION_VECTORS] = { "Motion vectors" },
+ [AV_FRAME_DATA_SKIP_SAMPLES] = { "Skip samples" },
+ [AV_FRAME_DATA_GOP_TIMECODE] = { "GOP timecode" },
+ [AV_FRAME_DATA_S12M_TIMECODE] = { "SMPTE 12-1 timecode" },
+ [AV_FRAME_DATA_DYNAMIC_HDR_PLUS] = { "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)" },
+ [AV_FRAME_DATA_DYNAMIC_HDR_VIVID] = { "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)" },
+ [AV_FRAME_DATA_REGIONS_OF_INTEREST] = { "Regions Of Interest" },
+ [AV_FRAME_DATA_VIDEO_ENC_PARAMS] = { "Video encoding parameters" },
+ [AV_FRAME_DATA_FILM_GRAIN_PARAMS] = { "Film grain parameters" },
+ [AV_FRAME_DATA_DETECTION_BBOXES] = { "Bounding boxes for object detection and classification" },
+ [AV_FRAME_DATA_DOVI_RPU_BUFFER] = { "Dolby Vision RPU Data" },
+ [AV_FRAME_DATA_DOVI_METADATA] = { "Dolby Vision Metadata" },
+ [AV_FRAME_DATA_STEREO3D] = { "Stereo 3D", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_REPLAYGAIN] = { "AVReplayGain", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_DISPLAYMATRIX] = { "3x3 displaymatrix", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_AUDIO_SERVICE_TYPE] = { "Audio service type", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_MASTERING_DISPLAY_METADATA] = { "Mastering display metadata", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_CONTENT_LIGHT_LEVEL] = { "Content light level metadata", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT] = { "Ambient viewing environment", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_SPHERICAL] = { "Spherical Mapping", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_ICC_PROFILE] = { "ICC profile", AV_SIDE_DATA_PROP_GLOBAL },
+ [AV_FRAME_DATA_SEI_UNREGISTERED] = { "H.26[45] User Data Unregistered SEI message", AV_SIDE_DATA_PROP_MULTI },
+};
static void get_frame_defaults(AVFrame *frame)
{
@@ -43,11 +66,6 @@ static void get_frame_defaults(AVFrame *frame)
frame->pkt_dts = AV_NOPTS_VALUE;
frame->best_effort_timestamp = AV_NOPTS_VALUE;
frame->duration = 0;
-#if FF_API_PKT_DURATION
-FF_DISABLE_DEPRECATION_WARNINGS
- frame->pkt_duration = 0;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
#if FF_API_FRAME_PKT
FF_DISABLE_DEPRECATION_WARNINGS
frame->pkt_pos = -1;
@@ -75,14 +93,56 @@ static void free_side_data(AVFrameSideData **ptr_sd)
av_freep(ptr_sd);
}
-static void wipe_side_data(AVFrame *frame)
+static void wipe_side_data(AVFrameSideData ***sd, int *nb_side_data)
{
- for (int i = 0; i < frame->nb_side_data; i++) {
- free_side_data(&frame->side_data[i]);
+ for (int i = 0; i < *nb_side_data; i++) {
+ free_side_data(&((*sd)[i]));
}
- frame->nb_side_data = 0;
+ *nb_side_data = 0;
+
+ av_freep(sd);
+}
- av_freep(&frame->side_data);
+static void frame_side_data_wipe(AVFrame *frame)
+{
+ wipe_side_data(&frame->side_data, &frame->nb_side_data);
+}
+
+void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd)
+{
+ wipe_side_data(sd, nb_sd);
+}
+
+static void remove_side_data(AVFrameSideData ***sd, int *nb_side_data,
+ const enum AVFrameSideDataType type)
+{
+ for (int i = *nb_side_data - 1; i >= 0; i--) {
+ AVFrameSideData *entry = ((*sd)[i]);
+ if (entry->type != type)
+ continue;
+
+ free_side_data(&entry);
+
+ ((*sd)[i]) = ((*sd)[*nb_side_data - 1]);
+ (*nb_side_data)--;
+ }
+}
+
+static void remove_side_data_by_entry(AVFrameSideData ***sd, int *nb_sd,
+ const AVFrameSideData *target)
+{
+ for (int i = *nb_sd - 1; i >= 0; i--) {
+ AVFrameSideData *entry = ((*sd)[i]);
+ if (entry != target)
+ continue;
+
+ free_side_data(&entry);
+
+ ((*sd)[i]) = ((*sd)[*nb_sd - 1]);
+ (*nb_sd)--;
+
+ return;
+ }
}
AVFrame *av_frame_alloc(void)
@@ -181,21 +241,6 @@ static int get_audio_buffer(AVFrame *frame, int align)
int channels, planes;
int ret;
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
- if (!frame->ch_layout.nb_channels) {
- if (frame->channel_layout) {
- av_channel_layout_from_mask(&frame->ch_layout, frame->channel_layout);
- } else {
- frame->ch_layout.nb_channels = frame->channels;
- frame->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
- }
- }
- frame->channels = frame->ch_layout.nb_channels;
- frame->channel_layout = frame->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
- frame->ch_layout.u.mask : 0;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
channels = frame->ch_layout.nb_channels;
planes = planar ? channels : 1;
if (!frame->linesize[0]) {
@@ -245,17 +290,11 @@ int av_frame_get_buffer(AVFrame *frame, int align)
if (frame->format < 0)
return AVERROR(EINVAL);
-FF_DISABLE_DEPRECATION_WARNINGS
if (frame->width > 0 && frame->height > 0)
return get_video_buffer(frame, align);
else if (frame->nb_samples > 0 &&
- (av_channel_layout_check(&frame->ch_layout)
-#if FF_API_OLD_CHANNEL_LAYOUT
- || frame->channel_layout || frame->channels > 0
-#endif
- ))
+ (av_channel_layout_check(&frame->ch_layout)))
return get_audio_buffer(frame, align);
-FF_ENABLE_DEPRECATION_WARNINGS
return AVERROR(EINVAL);
}
@@ -298,25 +337,9 @@ FF_DISABLE_DEPRECATION_WARNINGS
dst->pkt_size = src->pkt_size;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
-#if FF_API_PKT_DURATION
-FF_DISABLE_DEPRECATION_WARNINGS
- dst->pkt_duration = src->pkt_duration;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
dst->time_base = src->time_base;
-#if FF_API_REORDERED_OPAQUE
-FF_DISABLE_DEPRECATION_WARNINGS
- dst->reordered_opaque = src->reordered_opaque;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
dst->quality = src->quality;
dst->best_effort_timestamp = src->best_effort_timestamp;
-#if FF_API_FRAME_PICTURE_NUMBER
-FF_DISABLE_DEPRECATION_WARNINGS
- dst->coded_picture_number = src->coded_picture_number;
- dst->display_picture_number = src->display_picture_number;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
dst->flags = src->flags;
dst->decode_error_flags = src->decode_error_flags;
dst->color_primaries = src->color_primaries;
@@ -337,7 +360,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
sd_dst = av_frame_new_side_data(dst, sd_src->type,
sd_src->size);
if (!sd_dst) {
- wipe_side_data(dst);
+ frame_side_data_wipe(dst);
return AVERROR(ENOMEM);
}
memcpy(sd_dst->data, sd_src->data, sd_src->size);
@@ -346,7 +369,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref);
if (!sd_dst) {
av_buffer_unref(&ref);
- wipe_side_data(dst);
+ frame_side_data_wipe(dst);
return AVERROR(ENOMEM);
}
}
@@ -363,11 +386,6 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src)
int ret = 0;
av_assert1(dst->width == 0 && dst->height == 0);
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
- av_assert1(dst->channels == 0);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
av_assert1(dst->ch_layout.nb_channels == 0 &&
dst->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC);
@@ -375,31 +393,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
dst->width = src->width;
dst->height = src->height;
dst->nb_samples = src->nb_samples;
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
- dst->channels = src->channels;
- dst->channel_layout = src->channel_layout;
- if (!av_channel_layout_check(&src->ch_layout)) {
- if (src->channel_layout)
- av_channel_layout_from_mask(&dst->ch_layout, src->channel_layout);
- else {
- dst->ch_layout.nb_channels = src->channels;
- dst->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
- }
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
ret = frame_copy_props(dst, src, 0);
if (ret < 0)
goto fail;
- // this check is needed only until FF_API_OLD_CHANNEL_LAYOUT is out
- if (av_channel_layout_check(&src->ch_layout)) {
- ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
- if (ret < 0)
- goto fail;
- }
+ ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
+ if (ret < 0)
+ goto fail;
/* duplicate the frame data if it's not refcounted */
if (!src->buf[0]) {
@@ -503,29 +504,12 @@ int av_frame_replace(AVFrame *dst, const AVFrame *src)
dst->width = src->width;
dst->height = src->height;
dst->nb_samples = src->nb_samples;
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
- dst->channels = src->channels;
- dst->channel_layout = src->channel_layout;
- if (!av_channel_layout_check(&src->ch_layout)) {
- av_channel_layout_uninit(&dst->ch_layout);
- if (src->channel_layout)
- av_channel_layout_from_mask(&dst->ch_layout, src->channel_layout);
- else {
- dst->ch_layout.nb_channels = src->channels;
- dst->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
- }
- } else {
-#endif
+
ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
if (ret < 0)
goto fail;
-#if FF_API_OLD_CHANNEL_LAYOUT
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
- wipe_side_data(dst);
+ frame_side_data_wipe(dst);
av_dict_free(&dst->metadata);
ret = frame_copy_props(dst, src, 0);
if (ret < 0)
@@ -624,7 +608,7 @@ void av_frame_unref(AVFrame *frame)
if (!frame)
return;
- wipe_side_data(frame);
+ frame_side_data_wipe(frame);
for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
av_buffer_unref(&frame->buf[i]);
@@ -649,11 +633,6 @@ void av_frame_unref(AVFrame *frame)
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
{
av_assert1(dst->width == 0 && dst->height == 0);
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
- av_assert1(dst->channels == 0);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
av_assert1(dst->ch_layout.nb_channels == 0 &&
dst->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC);
@@ -692,12 +671,6 @@ int av_frame_make_writable(AVFrame *frame)
tmp.format = frame->format;
tmp.width = frame->width;
tmp.height = frame->height;
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
- tmp.channels = frame->channels;
- tmp.channel_layout = frame->channel_layout;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
tmp.nb_samples = frame->nb_samples;
ret = av_channel_layout_copy(&tmp.ch_layout, &frame->ch_layout);
if (ret < 0) {
@@ -745,15 +718,6 @@ AVBufferRef *av_frame_get_plane_buffer(const AVFrame *frame, int plane)
if (frame->nb_samples) {
int channels = frame->ch_layout.nb_channels;
-
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
- if (!channels) {
- channels = frame->channels;
- CHECK_CHANNELS_CONSISTENCY(frame);
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
if (!channels)
return NULL;
planes = av_sample_fmt_is_planar(frame->format) ? channels : 1;
@@ -777,38 +741,57 @@ FF_ENABLE_DEPRECATION_WARNINGS
return NULL;
}
-AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
- enum AVFrameSideDataType type,
- AVBufferRef *buf)
+static AVFrameSideData *add_side_data_from_buf_ext(AVFrameSideData ***sd,
+ int *nb_sd,
+ enum AVFrameSideDataType type,
+ AVBufferRef *buf, uint8_t *data,
+ size_t size)
{
AVFrameSideData *ret, **tmp;
- if (!buf)
- return NULL;
-
- if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
+ // *nb_sd + 1 needs to fit into an int and a size_t.
+ if ((unsigned)*nb_sd >= FFMIN(INT_MAX, SIZE_MAX))
return NULL;
- tmp = av_realloc(frame->side_data,
- (frame->nb_side_data + 1) * sizeof(*frame->side_data));
+ tmp = av_realloc_array(*sd, sizeof(**sd), *nb_sd + 1);
if (!tmp)
return NULL;
- frame->side_data = tmp;
+ *sd = tmp;
ret = av_mallocz(sizeof(*ret));
if (!ret)
return NULL;
ret->buf = buf;
- ret->data = ret->buf->data;
- ret->size = buf->size;
+ ret->data = data;
+ ret->size = size;
ret->type = type;
- frame->side_data[frame->nb_side_data++] = ret;
+ (*sd)[(*nb_sd)++] = ret;
return ret;
}
+static AVFrameSideData *add_side_data_from_buf(AVFrameSideData ***sd,
+ int *nb_sd,
+ enum AVFrameSideDataType type,
+ AVBufferRef *buf)
+{
+ if (!buf)
+ return NULL;
+
+ return add_side_data_from_buf_ext(sd, nb_sd, type, buf, buf->data, buf->size);
+}
+
+AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
+ enum AVFrameSideDataType type,
+ AVBufferRef *buf)
+{
+ return
+ add_side_data_from_buf(
+ &frame->side_data, &frame->nb_side_data, type, buf);
+}
+
AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
enum AVFrameSideDataType type,
size_t size)
@@ -821,16 +804,76 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
return ret;
}
-AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
- enum AVFrameSideDataType type)
+AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
+ enum AVFrameSideDataType type,
+ size_t size, unsigned int flags)
+{
+ AVBufferRef *buf = av_buffer_alloc(size);
+ AVFrameSideData *ret = NULL;
+
+ if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE)
+ remove_side_data(sd, nb_sd, type);
+
+ ret = add_side_data_from_buf(sd, nb_sd, type, buf);
+ if (!ret)
+ av_buffer_unref(&buf);
+
+ return ret;
+}
+
+int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
+ const AVFrameSideData *src, unsigned int flags)
+{
+ AVBufferRef *buf = NULL;
+ AVFrameSideData *sd_dst = NULL;
+ int ret = AVERROR_BUG;
+
+ if (!sd || !src || !nb_sd || (*nb_sd && !*sd))
+ return AVERROR(EINVAL);
+
+ buf = av_buffer_ref(src->buf);
+ if (!buf)
+ return AVERROR(ENOMEM);
+
+ if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE)
+ remove_side_data(sd, nb_sd, src->type);
+
+ sd_dst = add_side_data_from_buf_ext(sd, nb_sd, src->type, buf,
+ src->data, src->size);
+ if (!sd_dst) {
+ av_buffer_unref(&buf);
+ return AVERROR(ENOMEM);
+ }
+
+ ret = av_dict_copy(&sd_dst->metadata, src->metadata, 0);
+ if (ret < 0) {
+ remove_side_data_by_entry(sd, nb_sd, sd_dst);
+ return ret;
+ }
+
+ return 0;
+}
+
+const AVFrameSideData *av_frame_side_data_get_c(const AVFrameSideData * const *sd,
+ const int nb_sd,
+ enum AVFrameSideDataType type)
{
- for (int i = 0; i < frame->nb_side_data; i++) {
- if (frame->side_data[i]->type == type)
- return frame->side_data[i];
+ for (int i = 0; i < nb_sd; i++) {
+ if (sd[i]->type == type)
+ return sd[i];
}
return NULL;
}
+AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
+ enum AVFrameSideDataType type)
+{
+ return (AVFrameSideData *)av_frame_side_data_get(
+ frame->side_data, frame->nb_side_data,
+ type
+ );
+}
+
static int frame_copy_video(AVFrame *dst, const AVFrame *src)
{
int planes;
@@ -860,30 +903,8 @@ static int frame_copy_audio(AVFrame *dst, const AVFrame *src)
int channels = dst->ch_layout.nb_channels;
int planes = planar ? channels : 1;
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
- if (!channels || !src->ch_layout.nb_channels) {
- if (dst->channels != src->channels ||
- dst->channel_layout != src->channel_layout)
- return AVERROR(EINVAL);
- CHECK_CHANNELS_CONSISTENCY(src);
- }
- if (!channels) {
- channels = dst->channels;
- planes = planar ? channels : 1;
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
if (dst->nb_samples != src->nb_samples ||
-#if FF_API_OLD_CHANNEL_LAYOUT
- (av_channel_layout_check(&dst->ch_layout) &&
- av_channel_layout_check(&src->ch_layout) &&
-#endif
av_channel_layout_compare(&dst->ch_layout, &src->ch_layout))
-#if FF_API_OLD_CHANNEL_LAYOUT
- )
-#endif
return AVERROR(EINVAL);
for (int i = 0; i < planes; i++)
@@ -901,67 +922,34 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src)
if (dst->format != src->format || dst->format < 0)
return AVERROR(EINVAL);
-FF_DISABLE_DEPRECATION_WARNINGS
if (dst->width > 0 && dst->height > 0)
return frame_copy_video(dst, src);
else if (dst->nb_samples > 0 &&
- (av_channel_layout_check(&dst->ch_layout)
-#if FF_API_OLD_CHANNEL_LAYOUT
- || dst->channels > 0
-#endif
- ))
+ (av_channel_layout_check(&dst->ch_layout)))
return frame_copy_audio(dst, src);
-FF_ENABLE_DEPRECATION_WARNINGS
return AVERROR(EINVAL);
}
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
{
- for (int i = frame->nb_side_data - 1; i >= 0; i--) {
- AVFrameSideData *sd = frame->side_data[i];
- if (sd->type == type) {
- free_side_data(&frame->side_data[i]);
- frame->side_data[i] = frame->side_data[frame->nb_side_data - 1];
- frame->nb_side_data--;
- }
- }
+ remove_side_data(&frame->side_data, &frame->nb_side_data, type);
}
-const char *av_frame_side_data_name(enum AVFrameSideDataType type)
+const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type)
{
- switch(type) {
- case AV_FRAME_DATA_PANSCAN: return "AVPanScan";
- case AV_FRAME_DATA_A53_CC: return "ATSC A53 Part 4 Closed Captions";
- case AV_FRAME_DATA_STEREO3D: return "Stereo 3D";
- case AV_FRAME_DATA_MATRIXENCODING: return "AVMatrixEncoding";
- case AV_FRAME_DATA_DOWNMIX_INFO: return "Metadata relevant to a downmix procedure";
- case AV_FRAME_DATA_REPLAYGAIN: return "AVReplayGain";
- case AV_FRAME_DATA_DISPLAYMATRIX: return "3x3 displaymatrix";
- case AV_FRAME_DATA_AFD: return "Active format description";
- case AV_FRAME_DATA_MOTION_VECTORS: return "Motion vectors";
- case AV_FRAME_DATA_SKIP_SAMPLES: return "Skip samples";
- case AV_FRAME_DATA_AUDIO_SERVICE_TYPE: return "Audio service type";
- case AV_FRAME_DATA_MASTERING_DISPLAY_METADATA: return "Mastering display metadata";
- case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL: return "Content light level metadata";
- case AV_FRAME_DATA_GOP_TIMECODE: return "GOP timecode";
- case AV_FRAME_DATA_S12M_TIMECODE: return "SMPTE 12-1 timecode";
- case AV_FRAME_DATA_SPHERICAL: return "Spherical Mapping";
- case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";
- case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
- case AV_FRAME_DATA_DYNAMIC_HDR_VIVID: return "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)";
- case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
- case AV_FRAME_DATA_VIDEO_ENC_PARAMS: return "Video encoding parameters";
- case AV_FRAME_DATA_SEI_UNREGISTERED: return "H.26[45] User Data Unregistered SEI message";
- case AV_FRAME_DATA_FILM_GRAIN_PARAMS: return "Film grain parameters";
- case AV_FRAME_DATA_DETECTION_BBOXES: return "Bounding boxes for object detection and classification";
- case AV_FRAME_DATA_DOVI_RPU_BUFFER: return "Dolby Vision RPU Data";
- case AV_FRAME_DATA_DOVI_METADATA: return "Dolby Vision Metadata";
- case AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT: return "Ambient viewing environment";
- }
+ unsigned t = type;
+ if (t < FF_ARRAY_ELEMS(sd_props) && sd_props[t].name)
+ return &sd_props[t];
return NULL;
}
+const char *av_frame_side_data_name(enum AVFrameSideDataType type)
+{
+ const AVSideDataDescriptor *desc = av_frame_side_data_desc(type);
+ return desc ? desc->name : NULL;
+}
+
static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame,
const AVPixFmtDescriptor *desc)
{