summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavutil/frame.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /media/ffvpx/libavutil/frame.h
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--media/ffvpx/libavutil/frame.h184
1 files changed, 123 insertions, 61 deletions
diff --git a/media/ffvpx/libavutil/frame.h b/media/ffvpx/libavutil/frame.h
index c0c1b23db7..3b6d746a16 100644
--- a/media/ffvpx/libavutil/frame.h
+++ b/media/ffvpx/libavutil/frame.h
@@ -180,6 +180,10 @@ enum AVFrameSideDataType {
/**
* Film grain parameters for a frame, described by AVFilmGrainParams.
* Must be present for every frame which should have film grain applied.
+ *
+ * May be present multiple times, for example when there are multiple
+ * alternative parameter sets for different video signal characteristics.
+ * The user should select the most appropriate set for the application.
*/
AV_FRAME_DATA_FILM_GRAIN_PARAMS,
@@ -251,6 +255,37 @@ typedef struct AVFrameSideData {
AVBufferRef *buf;
} AVFrameSideData;
+enum AVSideDataProps {
+ /**
+ * The side data type can be used in stream-global structures.
+ * Side data types without this property are only meaningful on per-frame
+ * basis.
+ */
+ AV_SIDE_DATA_PROP_GLOBAL = (1 << 0),
+
+ /**
+ * Multiple instances of this side data type can be meaningfully present in
+ * a single side data array.
+ */
+ AV_SIDE_DATA_PROP_MULTI = (1 << 1),
+};
+
+/**
+ * This struct describes the properties of a side data type. Its instance
+ * corresponding to a given type can be obtained from av_frame_side_data_desc().
+ */
+typedef struct AVSideDataDescriptor {
+ /**
+ * Human-readable side data description.
+ */
+ const char *name;
+
+ /**
+ * Side data property flags, a combination of AVSideDataProps values.
+ */
+ unsigned props;
+} AVSideDataDescriptor;
+
/**
* Structure describing a single Region Of Interest.
*
@@ -466,19 +501,6 @@ typedef struct AVFrame {
*/
AVRational time_base;
-#if FF_API_FRAME_PICTURE_NUMBER
- /**
- * picture number in bitstream order
- */
- attribute_deprecated
- int coded_picture_number;
- /**
- * picture number in display order
- */
- attribute_deprecated
- int display_picture_number;
-#endif
-
/**
* quality (between 1 (good) and FF_LAMBDA_MAX (bad))
*/
@@ -546,35 +568,11 @@ typedef struct AVFrame {
int palette_has_changed;
#endif
-#if FF_API_REORDERED_OPAQUE
- /**
- * reordered opaque 64 bits (generally an integer or a double precision float
- * PTS but can be anything).
- * The user sets AVCodecContext.reordered_opaque to represent the input at
- * that time,
- * the decoder reorders values as needed and sets AVFrame.reordered_opaque
- * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
- *
- * @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
- */
- attribute_deprecated
- int64_t reordered_opaque;
-#endif
-
/**
* Sample rate of the audio data.
*/
int sample_rate;
-#if FF_API_OLD_CHANNEL_LAYOUT
- /**
- * Channel layout of the audio data.
- * @deprecated use ch_layout instead
- */
- attribute_deprecated
- uint64_t channel_layout;
-#endif
-
/**
* AVBuffer references backing the data for this frame. All the pointers in
* data and extended_data must point inside one of the buffers in buf or
@@ -687,19 +685,6 @@ typedef struct AVFrame {
int64_t pkt_pos;
#endif
-#if FF_API_PKT_DURATION
- /**
- * duration of the corresponding packet, expressed in
- * AVStream->time_base units, 0 if unknown.
- * - encoding: unused
- * - decoding: Read by user.
- *
- * @deprecated use duration instead
- */
- attribute_deprecated
- int64_t pkt_duration;
-#endif
-
/**
* metadata.
* - encoding: Set by user.
@@ -720,17 +705,6 @@ typedef struct AVFrame {
#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
#define FF_DECODE_ERROR_DECODE_SLICES 8
-#if FF_API_OLD_CHANNEL_LAYOUT
- /**
- * number of audio channels, only used for audio.
- * - encoding: unused
- * - decoding: Read by user.
- * @deprecated use ch_layout instead
- */
- attribute_deprecated
- int channels;
-#endif
-
#if FF_API_FRAME_PKT
/**
* size of the corresponding packet containing the compressed
@@ -1050,6 +1024,94 @@ int av_frame_apply_cropping(AVFrame *frame, int flags);
const char *av_frame_side_data_name(enum AVFrameSideDataType type);
/**
+ * @return side data descriptor corresponding to a given side data type, NULL
+ * when not available.
+ */
+const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type);
+
+/**
+ * Free all side data entries and their contents, then zeroes out the
+ * values which the pointers are pointing to.
+ *
+ * @param sd pointer to array of side data to free. Will be set to NULL
+ * upon return.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ * the array. Will be set to 0 upon return.
+ */
+void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
+
+#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE (1 << 0)
+
+/**
+ * Add new side data entry to an array.
+ *
+ * @param sd pointer to array of side data to which to add another entry,
+ * or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ * the array.
+ * @param type type of the added side data
+ * @param size size of the side data
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return newly added side data on success, NULL on error. In case of
+ * AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching
+ * AVFrameSideDataType will be removed before the addition is
+ * attempted.
+ */
+AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
+ enum AVFrameSideDataType type,
+ size_t size, unsigned int flags);
+
+/**
+ * Add a new side data entry to an array based on existing side data, taking
+ * a reference towards the contained AVBufferRef.
+ *
+ * @param sd pointer to array of side data to which to add another entry,
+ * or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ * the array.
+ * @param src side data to be cloned, with a new reference utilized
+ * for the buffer.
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return negative error code on failure, >=0 on success. In case of
+ * AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching
+ * AVFrameSideDataType will be removed before the addition is
+ * attempted.
+ */
+int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
+ const AVFrameSideData *src, unsigned int flags);
+
+/**
+ * Get a side data entry of a specific type from an array.
+ *
+ * @param sd array of side data.
+ * @param nb_sd integer containing the number of entries in the array.
+ * @param type type of side data to be queried
+ *
+ * @return a pointer to the side data of a given type on success, NULL if there
+ * is no side data with such type in this set.
+ */
+const AVFrameSideData *av_frame_side_data_get_c(const AVFrameSideData * const *sd,
+ const int nb_sd,
+ enum AVFrameSideDataType type);
+
+/**
+ * Wrapper around av_frame_side_data_get_c() to workaround the limitation
+ * that for any type T the conversion from T * const * to const T * const *
+ * is not performed automatically in C.
+ * @see av_frame_side_data_get_c()
+ */
+static inline
+const AVFrameSideData *av_frame_side_data_get(AVFrameSideData * const *sd,
+ const int nb_sd,
+ enum AVFrameSideDataType type)
+{
+ return av_frame_side_data_get_c((const AVFrameSideData * const *)sd,
+ nb_sd, type);
+}
+
+/**
* @}
*/