Unified · Split
| @@ -813,16 +813,26 @@ int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, · 812 unmodified lines | ||
| 813 | 813 | return 0; |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | −AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, | |
| 817 | − enum AVFrameSideDataType type) | |
| 816 | +const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd, | |
| 817 | + const int nb_sd, | |
| 818 | + enum AVFrameSideDataType type) | |
| 818 | 819 | { |
| 819 | − for (int i = 0; i < frame->nb_side_data; i++) { | |
| 820 | − if (frame->side_data[i]->type == type) | |
| 821 | − return frame->side_data[i]; | |
| 820 | + for (int i = 0; i < nb_sd; i++) { | |
| 821 | + if (sd[i]->type == type) | |
| 822 | + return sd[i]; | |
| 822 | 823 | } |
| 823 | 824 | return NULL; |
| 824 | 825 | } |
| 825 | 826 | |
| 827 | +AVFrameSideData *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 | + | |
| 826 | 836 | static int frame_copy_video(AVFrame *dst, const AVFrame *src) |
| 827 | 837 | { |
| 828 | 838 | int planes; |
| @@ -1041,6 +1041,20 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, · 1040 unmodified lines | ||
| 1041 | 1041 | int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, |
| 1042 | 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 | + */ | |
| 1054 | +const 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 | */ |