History

avutil/frame: add helper for getting side data from array

Jan Ekström committed 3 years ago

Commit f287a281 parent 3c52f732 files · +29 −5Browse files

Unified · Split

2 files
  1. libavutil/frame.c +15 −5
  2. libavutil/frame.h +14 −0
libavutil/frame.c+15−5
@@ -813,16 +813,26 @@ int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, · 812 unmodified lines
813 return 0;813 return 0;
814}814}
815 815
816AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,816const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd,
817 enum AVFrameSideDataType type)817 const int nb_sd,
818 enum AVFrameSideDataType type)
818{819{
819 for (int i = 0; i < frame->nb_side_data; i++) {820 for (int i = 0; i < nb_sd; i++) {
820 if (frame->side_data[i]->type == type)821 if (sd[i]->type == type)
821 return frame->side_data[i];822 return sd[i];
822 }823 }
823 return NULL;824 return NULL;
824}825}
825 826
827AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
828 enum AVFrameSideDataType type)
829{
830 return (AVFrameSideData *)av_frame_side_data_get(
831 (const AVFrameSideData **)frame->side_data, frame->nb_side_data,
832 type
833 );
834}
835
826static int frame_copy_video(AVFrame *dst, const AVFrame *src)836static int frame_copy_video(AVFrame *dst, const AVFrame *src)
827{837{
828 int planes;838 int planes;
libavutil/frame.h+14−0
@@ -1041,6 +1041,20 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, · 1040 unmodified lines
1041int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,1041int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
1042 const AVFrameSideData *src, unsigned int flags);1042 const AVFrameSideData *src, unsigned int flags);
1043 1043
1044/**
1045 * Get a side data entry of a specific type from an array.
1046 *
1047 * @param sd array of side data.
1048 * @param nb_sd integer containing the number of entries in the array.
1049 * @param type type of side data to be queried
1050 *
1051 * @return a pointer to the side data of a given type on success, NULL if there
1052 * is no side data with such type in this set.
1053 */
1054const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd,
1055 const int nb_sd,
1056 enum AVFrameSideDataType type);
1057
1044/**1058/**
1045 * @}1059 * @}
1046 */1060 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t