[vlc-commits] [Git][videolan/vlc][master] 12 commits: meson: add missing vlc_ancillary.h
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Mon May 19 07:04:45 UTC 2025
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
dfb9bd20 by Thomas Guillem at 2025-05-19T06:48:38+00:00
meson: add missing vlc_ancillary.h
- - - - -
cddff122 by Thomas Guillem at 2025-05-19T06:48:38+00:00
ancillary: use a vlc_vector to hold ancillaries
Simpler code (no more triple pointer), easier to maintain but the
block_t, vlc_frame_t and picture_t are now larger by 2 size_t.
- - - - -
fdf5b41b by Thomas Guillem at 2025-05-19T06:48:38+00:00
ancillary: don't clear dst array from Dup()
But append new ancillaries.
- - - - -
03eef74e by Thomas Guillem at 2025-05-19T06:48:38+00:00
ancillary: add missing documentation
- - - - -
249cc74a by Thomas Guillem at 2025-05-19T06:48:38+00:00
ancillary: add documentation groups
- - - - -
1b8b62a7 by Thomas Guillem at 2025-05-19T06:48:38+00:00
ancillary: expose the array API
This be used by decoder modules to forward all ancillaries from the
input to the output.
- - - - -
a62d266e by Thomas Guillem at 2025-05-19T06:48:38+00:00
ancillary: add VLC_ANCILLARY_ARRAY_INITIALIZER
- - - - -
92f1634e by Thomas Guillem at 2025-05-19T06:48:38+00:00
ancillary: rename vlc_ancillary_array_Dup
And update the documentation.
- - - - -
fe4e03b9 by Thomas Guillem at 2025-05-19T06:48:38+00:00
ancillary: add vlc_ancillary_array_MergeAndClear
- - - - -
947e897a by Thomas Guillem at 2025-05-19T06:48:38+00:00
frame: move ancillary functions to static inline helpers
- - - - -
3e986441 by Thomas Guillem at 2025-05-19T06:48:38+00:00
frame: add MergeAncillaries() and MergeAndClearAncillaries()
- - - - -
09dc8b44 by Thomas Guillem at 2025-05-19T06:48:38+00:00
picture: add MergeAncillaries() and MergeAndClearAncillaries()
- - - - -
11 changed files:
- include/meson.build
- include/vlc_ancillary.h
- include/vlc_frame.h
- include/vlc_picture.h
- src/Makefile.am
- src/libvlccore.sym
- src/misc/ancillary.c
- − src/misc/ancillary.h
- src/misc/frame.c
- src/misc/picture.c
- src/misc/picture.h
Changes:
=====================================
include/meson.build
=====================================
@@ -21,6 +21,7 @@ install_headers(
'vlc_access.h',
'vlc_actions.h',
'vlc_addons.h',
+ 'vlc_ancillary.h',
'vlc_aout.h',
'vlc_aout_volume.h',
'vlc_arrays.h',
=====================================
include/vlc_ancillary.h
=====================================
@@ -21,6 +21,7 @@
#ifndef VLC_ANCILLARY_H
#define VLC_ANCILLARY_H 1
+#include <vlc_vector.h>
#include <stdint.h>
/**
@@ -52,6 +53,8 @@
* @{
* \file
* Ancillary definition and functions
+ * \defgroup ancillary_api Ancillary API
+ * @{
*/
/**
@@ -60,6 +63,9 @@
*/
struct vlc_ancillary;
+typedef struct VLC_VECTOR(struct vlc_ancillary *) vlc_ancillary_array;
+#define VLC_ANCILLARY_ARRAY_INITIALIZER VLC_VECTOR_INITIALIZER
+
/**
* ID of an ancillary. Each ancillary user can create its own unique ID via
* VLC_ANCILLARY_ID.
@@ -113,9 +119,106 @@ vlc_ancillary_Release(struct vlc_ancillary *ancillary);
VLC_API struct vlc_ancillary *
vlc_ancillary_Hold(struct vlc_ancillary *ancillary);
+/**
+ * Get the data of the ancillary
+ *
+ * @param ancillary ancillary to get data from
+ * @return data used when created the ancillary, same lifetime than the ancillary
+ */
VLC_API void *
vlc_ancillary_GetData(const struct vlc_ancillary *ancillary);
+/**
+ * @}
+ * \defgroup ancillary_array Ancillary array API
+ * @{
+ */
+
+/**
+ * Init an ancillary array
+ *
+ * @param array pointer to the ancillary array to initialize
+ */
+static inline void
+vlc_ancillary_array_Init(vlc_ancillary_array *array)
+{
+ vlc_vector_init(array);
+}
+
+/**
+ * Clear an ancillary array
+ *
+ * This will release the refcount on all ancillaries and free the vector data
+ *
+ * @param array pointer to the ancillary array to clear
+ */
+VLC_API void
+vlc_ancillary_array_Clear(vlc_ancillary_array *array);
+
+/**
+ * Merge two ancillary arrays
+ *
+ * Copy all ancillaries from src_array to dst_array, preserving all previous
+ * ancillaries. In case of ancillary id conflict, the one from src_array will
+ * have precedence.
+ *
+ * @param dst_array pointer to an initialized ancillary array, if not empty,
+ * previous ancillaries will be preserved.
+ * @param src_array pointer to the source ancillary array
+ * @return VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error
+ */
+VLC_API int
+vlc_ancillary_array_Merge(vlc_ancillary_array *dst_array,
+ const vlc_ancillary_array *src_array);
+
+/**
+ * Merge and clear two ancillary arrays
+ *
+ * The src array will be moved to the dst array if the dst array is empty (fast
+ * path). Otherwise, both arrays will be merged into dst_array and the
+ * src_array will be cleared afterward.
+ *
+ * @param dst_array pointer to a valid ancillary array, if not empty, previous
+ * ancillaries will be preserved.
+ * @param src_array pointer to the source ancillary array, will point to empty
+ * data after this call.
+ * @return VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error
+ */
+VLC_API int
+vlc_ancillary_array_MergeAndClear(vlc_ancillary_array *dst_array,
+ vlc_ancillary_array *src_array);
+
+/**
+ * Insert a new ancillary in the array
+ *
+ * @note Several ancillaries can be attached to an array, but if two ancillaries
+ * are identified by the same ID, only the last one take precedence.
+ *
+ * @param array pointer to the ancillary array
+ * @param ancillary pointer to the ancillary to add
+ * @return VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error
+ */
+VLC_API int
+vlc_ancillary_array_Insert(vlc_ancillary_array *array,
+ struct vlc_ancillary *ancillary);
+
+/**
+ * Get a specific ancillary from the array
+ *
+ * @param array pointer to the ancillary array
+ * @param id id of the ancillary
+ * @return a valid ancillary or NULL if not found, no need to release it.
+ */
+VLC_API struct vlc_ancillary *
+vlc_ancillary_array_Get(const vlc_ancillary_array *array,
+ vlc_ancillary_id id);
+
+/**
+ * @}
+ * \defgroup ancillary_data Ancillary IDs and data
+ * @{
+ */
+
/**
* Dolby Vision metadata description
*/
@@ -229,5 +332,8 @@ typedef struct vlc_vpx_alpha_t
uint8_t *data;
} vlc_vpx_alpha_t;
-/** @} */
+/**
+ * @}
+ * @}
+ */
#endif /* VLC_ANCILLARY_H */
=====================================
include/vlc_frame.h
=====================================
@@ -24,9 +24,8 @@
#define VLC_FRAME_H 1
#include <vlc_tick.h>
+#include <vlc_ancillary.h>
-struct vlc_ancillary;
-typedef uint32_t vlc_ancillary_id;
/**
* \defgroup frame Frames
@@ -134,9 +133,7 @@ struct vlc_frame_t
vlc_tick_t i_dts;
vlc_tick_t i_length;
- /** Private ancillary struct. Don't use it directly, but use it via
- * vlc_frame_AttachAncillary() and vlc_frame_GetAncillary(). */
- struct vlc_ancillary **priv_ancillaries;
+ vlc_ancillary_array ancillaries;
const struct vlc_frame_callbacks *cbs;
};
@@ -232,6 +229,35 @@ vlc_frame_Realloc(vlc_frame_t *frame, ssize_t pre, size_t body) VLC_USED;
*/
VLC_API void vlc_frame_Release(vlc_frame_t *frame);
+/**
+ * Merge two ancillary arrays
+ *
+ * @param frame the frame that hold the destination ancillary array
+ * @param src_array pointer to an ancillary array
+ * @return VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error
+ */
+static inline int
+vlc_frame_MergeAncillaries(vlc_frame_t *frame,
+ const vlc_ancillary_array *src_array)
+{
+ return vlc_ancillary_array_Merge(&frame->ancillaries, src_array);
+}
+
+/**
+ * Merge and clear two ancillary arrays
+ *
+ * @param frame the frame that hold the destination ancillary array
+ * @param src_array pointer to the source ancillary array, will point to empty
+ * data after this call.
+ * @return VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error
+ */
+static inline int
+vlc_frame_MergeAndClearAncillaries(vlc_frame_t *frame,
+ vlc_ancillary_array *src_array)
+{
+ return vlc_ancillary_array_MergeAndClear(&frame->ancillaries, src_array);
+}
+
/**
* Attach an ancillary to the frame
*
@@ -245,8 +271,11 @@ VLC_API void vlc_frame_Release(vlc_frame_t *frame);
* @param ancillary ancillary that will be held by the frame, can't be NULL
* @return VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error
*/
-VLC_API int
-vlc_frame_AttachAncillary(vlc_frame_t *frame, struct vlc_ancillary *ancillary);
+static inline int
+vlc_frame_AttachAncillary(vlc_frame_t *frame, struct vlc_ancillary *ancillary)
+{
+ return vlc_ancillary_array_Insert(&frame->ancillaries, ancillary);
+}
/**
* Return the ancillary identified by an ID
@@ -256,8 +285,11 @@ vlc_frame_AttachAncillary(vlc_frame_t *frame, struct vlc_ancillary *ancillary);
* @return the ancillary or NULL if the ancillary for that particular id is
* not present
*/
-VLC_API struct vlc_ancillary *
-vlc_frame_GetAncillary(vlc_frame_t *frame, vlc_ancillary_id id);
+static inline struct vlc_ancillary *
+vlc_frame_GetAncillary(vlc_frame_t *frame, vlc_ancillary_id id)
+{
+ return vlc_ancillary_array_Get(&frame->ancillaries, id);
+}
/**
* Copy frame properties from src to dst
=====================================
include/vlc_picture.h
=====================================
@@ -28,14 +28,12 @@
#include <assert.h>
#include <vlc_atomic.h>
#include <vlc_es.h>
+#include <vlc_ancillary.h>
#ifdef __cplusplus
extern "C" {
#endif
-struct vlc_ancillary;
-typedef uint32_t vlc_ancillary_id;
-
/**
* \defgroup picture Generic picture API
* \ingroup output
@@ -417,6 +415,27 @@ VLC_API void picture_Copy( picture_t *p_dst, const picture_t *p_src );
*/
VLC_API picture_t *picture_Clone(picture_t *pic);
+/**
+ * Merge two ancillary arrays
+ *
+ * @param picture the picture that hold the destination ancillary array
+ * @param src_array pointer to an ancillary array
+ * @return VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error
+ */
+VLC_API int
+picture_MergeAncillaries(picture_t *pic, const vlc_ancillary_array *src_array);
+
+/**
+ * Merge and clear two ancillary arrays
+ *
+ * @param picture the picture that hold the destination ancillary array
+ * @param src_array pointer to the source ancillary array, will point to empty
+ * data after this call.
+ * @return VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error
+ */
+VLC_API int
+picture_MergeAndClearAncillaries(picture_t *pic, vlc_ancillary_array *src_array);
+
/**
* Attach an ancillary to the picture
*
=====================================
src/Makefile.am
=====================================
@@ -381,7 +381,6 @@ libvlccore_la_SOURCES = \
text/iso_lang.c \
text/iso-639_def.h \
misc/actions.c \
- misc/ancillary.h \
misc/ancillary.c \
misc/chroma_probe.c \
misc/executor.c \
=====================================
src/libvlccore.sym
=====================================
@@ -33,6 +33,11 @@ vlc_ancillary_CreateWithFreeCb
vlc_ancillary_Release
vlc_ancillary_Hold
vlc_ancillary_GetData
+vlc_ancillary_array_Clear
+vlc_ancillary_array_Merge
+vlc_ancillary_array_MergeAndClear
+vlc_ancillary_array_Insert
+vlc_ancillary_array_Get
vlc_audio_meter_Init
vlc_audio_meter_Destroy
vlc_audio_meter_Reset
@@ -45,11 +50,9 @@ vlc_fifo_New
vlc_fifo_Delete
vlc_fifo_Show
vlc_frame_Alloc
-vlc_frame_AttachAncillary
vlc_frame_CopyProperties
vlc_frame_File
vlc_frame_FilePath
-vlc_frame_GetAncillary
vlc_frame_heap_Alloc
vlc_frame_Init
vlc_frame_mmap_Alloc
@@ -315,6 +318,8 @@ net_Read
net_SetCSCov
net_Write
picture_AttachAncillary
+picture_MergeAncillaries
+picture_MergeAndClearAncillaries
picture_AttachNewAncillary
picture_BlendSubpicture
picture_Clone
=====================================
src/misc/ancillary.c
=====================================
@@ -25,7 +25,7 @@
#include <vlc_common.h>
#include <vlc_atomic.h>
-#include "ancillary.h"
+#include <vlc_ancillary.h>
struct vlc_ancillary
{
@@ -79,123 +79,79 @@ vlc_ancillary_GetData(const struct vlc_ancillary *ancillary)
}
void
-vlc_ancillary_array_Clear(struct vlc_ancillary ***array)
+vlc_ancillary_array_Clear(vlc_ancillary_array *array)
{
- if (*array != NULL)
- {
- for (struct vlc_ancillary **ancillary = *array;
- *ancillary != NULL; ancillary++)
- {
- vlc_ancillary_Release(*ancillary);
- }
-
- free(*array);
- *array = NULL;
- }
-}
-
-static size_t
-vlc_ancillary_array_Count(struct vlc_ancillary **array)
-{
- size_t count = 0;
- for (struct vlc_ancillary **ancillary = array;
- *ancillary != NULL; ancillary++)
- {
- count++;
- }
-
- return count;
+ struct vlc_ancillary *ancillary;
+ vlc_vector_foreach(ancillary, array)
+ vlc_ancillary_Release(ancillary);
+ vlc_vector_clear(array);
}
int
-vlc_ancillary_array_Dup(struct vlc_ancillary ***dst_arrayp,
- struct vlc_ancillary ** const*src_arrayp)
+vlc_ancillary_array_Merge(vlc_ancillary_array *dst_array,
+ const vlc_ancillary_array *src_array)
{
- if (unlikely(*dst_arrayp != NULL))
- vlc_ancillary_array_Clear(dst_arrayp);
-
- if (*src_arrayp == NULL)
+ if (src_array->size == 0)
return VLC_SUCCESS;
- struct vlc_ancillary **src_array = *src_arrayp;
- size_t count = vlc_ancillary_array_Count(src_array);
-
- struct vlc_ancillary **dst_array =
- vlc_alloc(count + 1, sizeof(struct vlc_ancillary *));
- if (dst_array == NULL)
- return VLC_ENOMEM;
-
- for (size_t i = 0; i < count; ++i)
- {
- dst_array[i] = vlc_ancillary_Hold(src_array[i]);
- assert(dst_array[i] != NULL);
- }
- dst_array[count] = NULL;
- *dst_arrayp = dst_array;
+ int ret = VLC_SUCCESS;
+ for (size_t i = 0; i < src_array->size && ret == VLC_SUCCESS; ++i)
+ ret = vlc_ancillary_array_Insert(dst_array, src_array->data[i]);
return VLC_SUCCESS;
}
int
-vlc_ancillary_array_Insert(struct vlc_ancillary ***arrayp,
- struct vlc_ancillary *ancillary)
+vlc_ancillary_array_MergeAndClear(vlc_ancillary_array *dst_array,
+ vlc_ancillary_array *src_array)
{
- /* First case: the array is empty */
- if (*arrayp == NULL)
+ if (dst_array->size == 0)
{
- struct vlc_ancillary **array = vlc_alloc(2, sizeof(struct vlc_ancillary *));
- if (array == NULL)
- return VLC_ENOMEM;
-
- array[0] = vlc_ancillary_Hold(ancillary);
- array[1] = NULL;
-
- *arrayp = array;
-
+ *dst_array = *src_array;
+ vlc_ancillary_array_Init(src_array);
return VLC_SUCCESS;
}
- struct vlc_ancillary **array = *arrayp;
- size_t count = vlc_ancillary_array_Count(array);
+ int ret = vlc_ancillary_array_Merge(dst_array, src_array);
+ if (ret == VLC_SUCCESS)
+ vlc_ancillary_array_Clear(src_array);
+ return ret;
+}
- /* Second case: the array has already an ancillary of the same id (very
- * unlikely) */
- for (size_t i = 0; i < count; ++i)
+int
+vlc_ancillary_array_Insert(vlc_ancillary_array *array,
+ struct vlc_ancillary *ancillary)
+{
+ assert(ancillary != NULL);
+
+ for (size_t i = 0; i < array->size; ++i)
{
- if (array[i]->id == ancillary->id)
+ struct vlc_ancillary *ancillary_it = array->data[i];
+ if (ancillary_it->id == ancillary->id)
{
- vlc_ancillary_Release(array[i]);
- array[i] = vlc_ancillary_Hold(ancillary);
+ vlc_ancillary_Release(ancillary_it);
+ array->data[i] = vlc_ancillary_Hold(ancillary);
return VLC_SUCCESS;
}
}
- /* Third case: realloc the array to add the new ancillary */
- array = vlc_reallocarray(array, count + 2, sizeof(struct vlc_ancillary *));
- if (array == NULL)
+ bool success = vlc_vector_push(array, ancillary);
+ if (!success)
return VLC_ENOMEM;
-
- array[count] = vlc_ancillary_Hold(ancillary);
- array[count + 1] = NULL;
-
- *arrayp = array;
+ vlc_ancillary_Hold(ancillary);
return VLC_SUCCESS;
}
struct vlc_ancillary *
-vlc_ancillary_array_Get(struct vlc_ancillary ** const*arrayp,
+vlc_ancillary_array_Get(const vlc_ancillary_array *array,
vlc_ancillary_id id)
{
- if (*arrayp == NULL)
- return NULL;
-
- struct vlc_ancillary **array = *arrayp;
- for (struct vlc_ancillary **ancillary = array;
- *ancillary != NULL; ancillary++)
+ struct vlc_ancillary *ancillary_it;
+ vlc_vector_foreach(ancillary_it, array)
{
- if ((*ancillary)->id == id)
- return *ancillary;
+ if (ancillary_it->id == id)
+ return ancillary_it;
}
return NULL;
}
=====================================
src/misc/ancillary.h deleted
=====================================
@@ -1,55 +0,0 @@
-/*****************************************************************************
- * ancillary.h: helpers to manage ancillaries from a frame or a picture
- *****************************************************************************
- * Copyright (C) 2021 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef VLC_ANCILLARY_INTERNAL_H
-#define VLC_ANCILLARY_INTERNAL_H 1
-
-#include <vlc_ancillary.h>
-
-/*
- * A NULL terminated array of struct vlc_ancillary *. We don't use a
- * vlc_vector here in orer to gain few bytes (2 * size_t) for each
- * ancillary users (each vlc_frame_t/picture_t). Users will likely have one
- * or zero ancillary so the optimisations of the vlc_vector are not
- * important here.
- */
-
-static inline void
-vlc_ancillary_array_Init(struct vlc_ancillary ***array)
-{
- *array = NULL;
-}
-
-void
-vlc_ancillary_array_Clear(struct vlc_ancillary ***array);
-
-int
-vlc_ancillary_array_Dup(struct vlc_ancillary ***dst_array,
- struct vlc_ancillary ** const*src_array);
-
-int
-vlc_ancillary_array_Insert(struct vlc_ancillary ***array,
- struct vlc_ancillary *ancillary);
-
-struct vlc_ancillary *
-vlc_ancillary_array_Get(struct vlc_ancillary ** const*array,
- vlc_ancillary_id id);
-
-#endif /* VLC_ANCILLARY_INTERNAL_H */
=====================================
src/misc/frame.c
=====================================
@@ -39,7 +39,7 @@
#include <vlc_frame.h>
#include <vlc_fs.h>
-#include "ancillary.h"
+#include <vlc_ancillary.h>
#ifndef NDEBUG
static void vlc_frame_Check (vlc_frame_t *frame)
@@ -65,8 +65,8 @@ static void vlc_frame_Check (vlc_frame_t *frame)
void vlc_frame_CopyProperties(vlc_frame_t *restrict dst, const vlc_frame_t *src)
{
- vlc_ancillary_array_Dup(&dst->priv_ancillaries,
- &src->priv_ancillaries);
+ vlc_ancillary_array_Merge(&dst->ancillaries,
+ &src->ancillaries);
dst->i_flags = src->i_flags;
dst->i_nb_samples = src->i_nb_samples;
@@ -99,7 +99,7 @@ vlc_frame_t *vlc_frame_Init(vlc_frame_t *restrict f, const struct vlc_frame_call
f->i_pts =
f->i_dts = VLC_TICK_INVALID;
f->i_length = 0;
- vlc_ancillary_array_Init(&f->priv_ancillaries);
+ vlc_ancillary_array_Init(&f->ancillaries);
f->cbs = cbs;
return f;
}
@@ -161,7 +161,7 @@ void vlc_frame_Release(vlc_frame_t *frame)
frame->p_next = NULL;
vlc_frame_Check (frame);
#endif
- vlc_ancillary_array_Clear(&frame->priv_ancillaries);
+ vlc_ancillary_array_Clear(&frame->ancillaries);
frame->cbs->free(frame);
}
@@ -558,15 +558,3 @@ vlc_frame_t *vlc_frame_FilePath(const char *path, bool write)
vlc_close (fd);
return frame;
}
-
-int
-vlc_frame_AttachAncillary(vlc_frame_t *frame, struct vlc_ancillary *ancillary)
-{
- return vlc_ancillary_array_Insert(&frame->priv_ancillaries, ancillary);
-}
-
-struct vlc_ancillary *
-vlc_frame_GetAncillary(vlc_frame_t *frame, vlc_ancillary_id id)
-{
- return vlc_ancillary_array_Get(&frame->priv_ancillaries, id);
-}
=====================================
src/misc/picture.c
=====================================
@@ -39,7 +39,7 @@
#include <vlc_image.h>
#include <vlc_block.h>
-#include "ancillary.h"
+#include <vlc_ancillary.h>
static void PictureDestroyContext( picture_t *p_picture )
{
@@ -414,7 +414,7 @@ void picture_CopyProperties( picture_t *p_dst, const picture_t *p_src )
const picture_priv_t *src_priv = container_of(p_src, picture_priv_t, picture);
picture_priv_t *dst_priv = container_of(p_dst, picture_priv_t, picture);
- vlc_ancillary_array_Dup(&dst_priv->ancillaries, &src_priv->ancillaries);
+ vlc_ancillary_array_Merge(&dst_priv->ancillaries, &src_priv->ancillaries);
}
void picture_CopyPixels( picture_t *p_dst, const picture_t *p_src )
@@ -480,10 +480,24 @@ picture_t *picture_Clone(picture_t *picture)
const picture_priv_t *priv = container_of(picture, picture_priv_t, picture);
picture_priv_t *clone_priv = container_of(clone, picture_priv_t, picture);
- vlc_ancillary_array_Dup(&clone_priv->ancillaries, &priv->ancillaries);
+ vlc_ancillary_array_Merge(&clone_priv->ancillaries, &priv->ancillaries);
return clone;
}
+int
+picture_MergeAncillaries(picture_t *pic, const vlc_ancillary_array *src_array)
+{
+ picture_priv_t *priv = container_of(pic, picture_priv_t, picture);
+ return vlc_ancillary_array_Merge(&priv->ancillaries, src_array);
+}
+
+int
+picture_MergeAndClearAncillaries(picture_t *pic, vlc_ancillary_array *src_array)
+{
+ picture_priv_t *priv = container_of(pic, picture_priv_t, picture);
+ return vlc_ancillary_array_MergeAndClear(&priv->ancillaries, src_array);
+}
+
int
picture_AttachAncillary(picture_t *pic, struct vlc_ancillary *ancillary)
{
=====================================
src/misc/picture.h
=====================================
@@ -23,7 +23,7 @@
#include <vlc_picture.h>
#include <vlc_list.h>
-struct vlc_ancillary;
+#include <vlc_ancillary.h>
typedef struct
{
@@ -37,9 +37,7 @@ typedef struct
void *pool; /* Only used by picture_pool.c */
struct vlc_list pool_node; /* Only used by picture_pool.c */
- /** Private ancillary struct. Don't use it directly, but use it via
- * picture_AttachAncillary() and picture_GetAncillary(). */
- struct vlc_ancillary **ancillaries;
+ vlc_ancillary_array ancillaries;
} picture_priv_t;
void *picture_Allocate(int *, size_t);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ac37bcc89d6a0b7293168350f7c2c022b37bcd9d...09dc8b44f9b7b3b98ba62be58939185be4e532e6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ac37bcc89d6a0b7293168350f7c2c022b37bcd9d...09dc8b44f9b7b3b98ba62be58939185be4e532e6
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list