[FFmpeg-devel,v1,06/12] avutil/frame: add helper for getting side data from set
Checks
Context |
Check |
Description |
andriy/make_x86 |
success
|
Make finished
|
andriy/make_fate_x86 |
success
|
Make fate finished
|
Commit Message
---
libavutil/frame.c | 22 +++++++++++++++++-----
libavutil/frame.h | 10 ++++++++++
2 files changed, 27 insertions(+), 5 deletions(-)
@@ -720,16 +720,28 @@ AVFrameSideData *av_new_side_data_to_set(AVFrameSideDataSet *set,
return ret;
}
-AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
- enum AVFrameSideDataType type)
+AVFrameSideData *av_get_side_data_from_set(const AVFrameSideDataSet set,
+ 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 < set.nb_side_data; i++) {
+ if (set.side_data[i]->type == type)
+ return set.side_data[i];
}
return NULL;
}
+AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
+ enum AVFrameSideDataType type)
+{
+ return av_get_side_data_from_set(
+ (const AVFrameSideDataSet){
+ .side_data = frame->side_data,
+ .nb_side_data = frame->nb_side_data
+ },
+ type
+ );
+}
+
static int frame_copy_video(AVFrame *dst, const AVFrame *src)
{
const uint8_t *src_data[4];
@@ -1011,6 +1011,16 @@ AVFrameSideData *av_new_side_data_to_set(AVFrameSideDataSet *set,
enum AVFrameSideDataType type,
size_t size);
+/**
+ * @param set a set to which the side data should be added
+ * @param type type of the added side data
+ *
+ * @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.
+ */
+AVFrameSideData *av_get_side_data_from_set(const AVFrameSideDataSet set,
+ enum AVFrameSideDataType type);
+
/**
* @}
*/