54 const void *payload,
size_t size,
int marker)
78 return e ? e->
value :
"none";
83 printf(
"%s: n=%d\n", label,
s->nb_sd);
84 for (
int i = 0;
i <
s->nb_sd;
i++)
85 printf(
" [%d] %s marker=%s\n",
i,
97 printf(
"%s: n=%d\n", label,
s->nb_sd);
98 for (
size_t i = 0;
i < nb_types;
i++) {
113 printf(
"Testing av_frame_side_data_desc() / av_frame_side_data_name()\n");
126 printf(
" type=%d name_match=%s props=0x%x\n", known[
i],
127 d && n && !strcmp(d->
name, n) ?
"yes" :
"no",
134 printf(
" invalid type desc=%s name=%s\n",
141 size_t stereo3d_size, spherical_size;
145 uint8_t udu[16 + 8] = {
146 0x9a, 0x21, 0xf3, 0x4d, 0x6b, 0x1c, 0x47, 0x8e,
147 0xa5, 0x30, 0xc2, 0x7f, 0x11, 0x8d, 0x46, 0x02,
148 'p',
'a',
'y',
'l',
'o',
'a',
'd',
'1',
153 { .source = -1, .w = 16, .h = 16, .src_x = 32, .src_y = 48,
154 .dst_x = 40, .dst_y = 48, .motion_x = -8, .motion_y = 0,
156 { .source = 1, .w = 8, .h = 8, .src_x = 64, .src_y = 64,
157 .dst_x = 64, .dst_y = 72, .motion_x = 0, .motion_y = -8,
163 .center_mix_level = 0.5,
164 .center_mix_level_ltrt = 0.625,
165 .surround_mix_level = 0.25,
166 .surround_mix_level_ltrt = 0.375,
167 .lfe_mix_level = 0.125,
178 spherical->
yaw = 90 << 16;
188 udu[
sizeof(udu) - 1] =
'2';
206 printf(
"\nTesting av_frame_side_data_get()\n");
210 printf(
" stereo3d: %s marker=%s payload_match=%s\n",
211 got ?
"found" :
"missing", got ?
entry_marker(got) :
"none",
212 got && got->
size == stereo3d_size &&
213 !memcmp(got->
data, stereo3d, stereo3d_size) ?
"yes" :
"no");
216 printf(
" mastering (absent): %s\n", got ?
"FAIL" :
"null");
220 printf(
"\nTesting av_frame_side_data_remove()\n");
227 printf(
"\nTesting av_frame_side_data_remove_by_props()\n");
234 printf(
"\nTesting av_frame_side_data_clone()\n");
239 printf(
" clone into empty: ret=%d nb=%d marker=%s\n", ret,
dst.nb_sd,
244 printf(
" clone duplicate no REPLACE: ret==AVERROR(EEXIST)=%s\n",
245 ret ==
AVERROR(EEXIST) ?
"yes" :
"no");
250 printf(
" clone REPLACE: ret=%d nb=%d\n", ret,
dst.nb_sd);
254 printf(
" clone NULL sd: ret==AVERROR(EINVAL)=%s\n",
255 ret ==
AVERROR(EINVAL) ?
"yes" :
"no");
259 printf(
"\nTesting av_frame_side_data_add()\n");
267 printf(
" add (move): added=%s pbuf_nulled=%s\n",
268 sd_added ?
"yes" :
"no", buf ==
NULL ?
"yes" :
"no");
277 printf(
" add (NEW_REF): added=%s caller_ref_kept=%s nb_mvs=%d\n",
278 sd_added ?
"yes" :
"no", keep ?
"yes" :
"no",
297 printf(
" add (REPLACE existing): added=%s marker=%s"
298 " payload_match=%s\n",
299 sd_added ?
"yes" :
"no",
301 after && after->
size ==
sizeof(replacement) &&
302 !memcmp(after->
data, replacement,
sizeof(replacement)) ?
309 printf(
"\nTesting av_frame_side_data_clone() UNIQUE\n");
311 int before =
dst.nb_sd;
314 printf(
" clone UNIQUE: ret=%d before=%d after=%d\n",
315 ret, before,
dst.nb_sd);
322 printf(
"\nfree: set_nb=%d dst_nb=%d\n",
set.nb_sd,
dst.nb_sd);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
refcounted data buffer API
#define i(width, name, range_min, range_max)
__device__ int printf(const char *,...)
reference-counted frame API
@ AV_DOWNMIX_TYPE_LTRT
Lt/Rt 2-channel downmix, Dolby Surround compatible.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
AVFrameSideData * av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, size_t size, unsigned int flags)
Add new side data entry to an array.
void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd)
Free all side data entries and their contents, then zeroes out the values which the pointers are poin...
#define AV_FRAME_SIDE_DATA_FLAG_REPLACE
Don't add a new entry if another of the same type exists.
#define AV_FRAME_SIDE_DATA_FLAG_NEW_REF
Create a new reference to the passed in buffer instead of taking ownership of it.
AVFrameSideData * av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, AVBufferRef **pbuf, unsigned int flags)
Add a new side data entry to an array from an existing AVBufferRef.
void av_frame_side_data_remove_by_props(AVFrameSideData ***sd, int *nb_sd, int props)
Remove and free all side data instances that match any of the given side data properties.
void av_frame_side_data_remove(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type from an array.
const AVSideDataDescriptor * av_frame_side_data_desc(enum AVFrameSideDataType type)
int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, const AVFrameSideData *src, unsigned int flags)
Add a new side data entry to an array based on existing side data, taking a reference towards the con...
#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE
Remove existing entries before adding new ones.
static const AVFrameSideData * av_frame_side_data_get(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 conver...
const char * av_frame_side_data_name(enum AVFrameSideDataType type)
@ AV_SIDE_DATA_PROP_GLOBAL
The side data type can be used in stream-global structures.
@ AV_FRAME_DATA_SPHERICAL
The data represents the AVSphericalMapping structure defined in libavutil/spherical....
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
@ AV_FRAME_DATA_SEI_UNREGISTERED
User data unregistered metadata associated with a video frame.
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
@ AV_FRAME_DATA_DOWNMIX_INFO
Metadata relevant to a downmix procedure.
@ AV_FRAME_DATA_STEREO3D
Stereoscopic 3d metadata.
@ AV_FRAME_DATA_MOTION_VECTORS
Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec A...
void av_display_rotation_set(int32_t matrix[9], double angle)
Initialize a transformation matrix describing a pure clockwise rotation by the specified angle (in de...
AVSphericalMapping * av_spherical_alloc(size_t *size)
Allocate a AVSphericalVideo structure and initialize its fields to default values.
@ AV_SPHERICAL_EQUIRECTANGULAR
Video represents a sphere mapped on a flat surface using equirectangular projection.
AVStereo3D * av_stereo3d_alloc_size(size_t *size)
Allocate an AVStereo3D structure and set its fields to default values.
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
@ AV_PRIMARY_EYE_LEFT
Left eye.
@ AV_STEREO3D_VIEW_PACKED
Frame contains two packed views.
static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
Utility Preprocessor macros.
Memory handling functions.
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
uint8_t * data
The data buffer.
This structure describes optional metadata relevant to a downmix procedure.
Structure to hold side data for an AVFrame.
This struct describes the properties of a side data type.
unsigned props
Side data property flags, a combination of AVSideDataProps values.
const char * name
Human-readable side data description.
This structure describes how to handle spherical videos, outlining information about projection,...
enum AVSphericalProjection projection
Projection type.
int32_t yaw
Rotation around the up vector [-180, 180].
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
enum AVStereo3DType type
How views are packed within the video.
uint32_t baseline
The distance between the centres of the lenses of the camera system, in micrometers.
enum AVStereo3DPrimaryEye primary_eye
Which eye is the primary eye when rendering in 2D.
enum AVStereo3DView view
Determines which views are packed.
static const char * entry_marker(const AVFrameSideData *sd)
static AVFrameSideData * new_entry(Set *s, enum AVFrameSideDataType type, const void *payload, size_t size, int marker)
static void print_lookup(const char *label, const Set *s, const enum AVFrameSideDataType *types, size_t nb_types)
static void print_set(const char *label, const Set *s)
static AVBufferRef * payload_buffer(const void *payload, size_t size)
static void set_marker(AVFrameSideData *sd, int marker)
static void set(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f, double v)