avutil/frame: add helper for getting side data from array
This commit is contained in:
parent
3c52f73e25
commit
f287a285d9
@ -813,14 +813,24 @@ int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd,
|
||||||
|
const int nb_sd,
|
||||||
|
enum AVFrameSideDataType type)
|
||||||
|
{
|
||||||
|
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,
|
AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
|
||||||
enum AVFrameSideDataType type)
|
enum AVFrameSideDataType type)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < frame->nb_side_data; i++) {
|
return (AVFrameSideData *)av_frame_side_data_get(
|
||||||
if (frame->side_data[i]->type == type)
|
(const AVFrameSideData **)frame->side_data, frame->nb_side_data,
|
||||||
return frame->side_data[i];
|
type
|
||||||
}
|
);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int frame_copy_video(AVFrame *dst, const AVFrame *src)
|
static int frame_copy_video(AVFrame *dst, const AVFrame *src)
|
||||||
|
@ -1041,6 +1041,20 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
|
|||||||
int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
|
int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
|
||||||
const AVFrameSideData *src, unsigned int flags);
|
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(const AVFrameSideData **sd,
|
||||||
|
const int nb_sd,
|
||||||
|
enum AVFrameSideDataType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user