mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-05 14:30:00 +01:00
avcodec/avcodec: add helpers to convert between packet and frame side data
They will be used in following commits. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2025-10-30 - xxxxxxxxxx - lavc 62.17.100 - packet.h
|
||||||
|
Add av_packet_side_data_from_frame() and av_packet_side_data_to_frame().
|
||||||
|
|
||||||
2025-10-xx - xxxxxxxxxx - lavu 60.16.100 - pixfmt.h
|
2025-10-xx - xxxxxxxxxx - lavu 60.16.100 - pixfmt.h
|
||||||
Add AVCOL_TRC_EXT_BASE, AVCOL_TRC_V_LOG,
|
Add AVCOL_TRC_EXT_BASE, AVCOL_TRC_V_LOG,
|
||||||
AVCOL_PRI_EXT_BASE and AVCOL_PRI_V_GAMUT.
|
AVCOL_PRI_EXT_BASE and AVCOL_PRI_V_GAMUT.
|
||||||
|
|||||||
@@ -815,3 +815,53 @@ int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *cod
|
|||||||
return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num);
|
return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int av_packet_side_data_from_frame(AVPacketSideData **psd, int *pnb_sd,
|
||||||
|
const AVFrameSideData *src, unsigned int flags)
|
||||||
|
{
|
||||||
|
AVPacketSideData *sd = NULL;
|
||||||
|
|
||||||
|
for (unsigned j = 0; ff_sd_global_map[j].packet < AV_PKT_DATA_NB; j++) {
|
||||||
|
if (ff_sd_global_map[j].frame != src->type)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sd = av_packet_side_data_new(psd, pnb_sd, ff_sd_global_map[j].packet,
|
||||||
|
src->size, 0);
|
||||||
|
|
||||||
|
if (!sd)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
|
memcpy(sd->data, src->data, src->size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sd)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int av_packet_side_data_to_frame(AVFrameSideData ***psd, int *pnb_sd,
|
||||||
|
const AVPacketSideData *src, unsigned int flags)
|
||||||
|
{
|
||||||
|
AVFrameSideData *sd = NULL;
|
||||||
|
|
||||||
|
for (unsigned j = 0; ff_sd_global_map[j].packet < AV_PKT_DATA_NB; j++) {
|
||||||
|
if (ff_sd_global_map[j].packet != src->type)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sd = av_frame_side_data_new(psd, pnb_sd, ff_sd_global_map[j].frame,
|
||||||
|
src->size, flags);
|
||||||
|
|
||||||
|
if (!sd)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
|
memcpy(sd->data, src->data, src->size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sd)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -489,6 +489,36 @@ void av_packet_side_data_remove(AVPacketSideData *sd, int *nb_sd,
|
|||||||
*/
|
*/
|
||||||
void av_packet_side_data_free(AVPacketSideData **sd, int *nb_sd);
|
void av_packet_side_data_free(AVPacketSideData **sd, int *nb_sd);
|
||||||
|
|
||||||
|
struct AVFrameSideData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new packet side data entry to an array based on existing frame
|
||||||
|
* side data, if a matching type exists for packet side data.
|
||||||
|
*
|
||||||
|
* @param flags Currently unused. Must be 0.
|
||||||
|
* @retval >= 0 Success
|
||||||
|
* @retval AVERROR(EINVAL) The frame side data type does not have a matching
|
||||||
|
* packet side data type.
|
||||||
|
* @retval AVERROR(ENOMEM) Failed to add a side data entry to the array, or
|
||||||
|
* similar.
|
||||||
|
*/
|
||||||
|
int av_packet_side_data_from_frame(AVPacketSideData **sd, int *nb_sd,
|
||||||
|
const struct AVFrameSideData *src, unsigned int flags);
|
||||||
|
/**
|
||||||
|
* Add a new frame side data entry to an array based on existing packet
|
||||||
|
* side data, if a matching type exists for frame side data.
|
||||||
|
*
|
||||||
|
* @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags,
|
||||||
|
* or 0.
|
||||||
|
* @retval >= 0 Success
|
||||||
|
* @retval AVERROR(EINVAL) The packet side data type does not have a matching
|
||||||
|
* frame side data type.
|
||||||
|
* @retval AVERROR(ENOMEM) Failed to add a side data entry to the array, or
|
||||||
|
* similar.
|
||||||
|
*/
|
||||||
|
int av_packet_side_data_to_frame(struct AVFrameSideData ***sd, int *nb_sd,
|
||||||
|
const AVPacketSideData *src, unsigned int flags);
|
||||||
|
|
||||||
const char *av_packet_side_data_name(enum AVPacketSideDataType type);
|
const char *av_packet_side_data_name(enum AVPacketSideDataType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "version_major.h"
|
#include "version_major.h"
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MINOR 16
|
#define LIBAVCODEC_VERSION_MINOR 17
|
||||||
#define LIBAVCODEC_VERSION_MICRO 100
|
#define LIBAVCODEC_VERSION_MICRO 100
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
|
|||||||
Reference in New Issue
Block a user