mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-23 11:39:49 +00:00
avcodec/packet: Also change av_packet_pack/unpack_dictionary to size_t
These are auxiliary side-data functions, so they should have been
switched to size_t in d79e0fe65c
,
but this has been forgotten.
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
04d001ca9b
commit
a46d781905
@ -507,7 +507,11 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FF_API_BUFFER_SIZE_T
|
||||
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
|
||||
#else
|
||||
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
|
||||
#endif
|
||||
{
|
||||
uint8_t *data = NULL;
|
||||
*size = 0;
|
||||
@ -526,7 +530,11 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
|
||||
|
||||
if (pass)
|
||||
memcpy(data + total_length, str, len);
|
||||
#if FF_API_BUFFER_SIZE_T
|
||||
else if (len > INT_MAX - total_length)
|
||||
#else
|
||||
else if (len > SIZE_MAX - total_length)
|
||||
#endif
|
||||
return NULL;
|
||||
total_length += len;
|
||||
}
|
||||
@ -542,7 +550,12 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
|
||||
return data;
|
||||
}
|
||||
|
||||
#if FF_API_BUFFER_SIZE_T
|
||||
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
|
||||
#else
|
||||
int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
|
||||
AVDictionary **dict)
|
||||
#endif
|
||||
{
|
||||
const uint8_t *end;
|
||||
int ret;
|
||||
|
@ -647,7 +647,11 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type);
|
||||
* @param size pointer to store the size of the returned data
|
||||
* @return pointer to data if successful, NULL otherwise
|
||||
*/
|
||||
#if FF_API_BUFFER_SIZE_T
|
||||
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
|
||||
#else
|
||||
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
|
||||
#endif
|
||||
/**
|
||||
* Unpack a dictionary from side_data.
|
||||
*
|
||||
@ -656,8 +660,12 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
|
||||
* @param dict the metadata storage dictionary
|
||||
* @return 0 on success, < 0 on failure
|
||||
*/
|
||||
#if FF_API_BUFFER_SIZE_T
|
||||
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
|
||||
|
||||
#else
|
||||
int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
|
||||
AVDictionary **dict);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Convenience function to free all the side data stored.
|
||||
|
@ -922,7 +922,6 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
|
||||
const char *tc = av_timecode_make_string(&tcr, tcstr, 0);
|
||||
if (tc) {
|
||||
AVDictionary* metadata_dict = NULL;
|
||||
int metadata_len;
|
||||
uint8_t* packed_metadata;
|
||||
|
||||
if (av_cmp_q(ctx->video_st->r_frame_rate, av_make_q(60, 1)) < 1) {
|
||||
@ -937,6 +936,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
|
||||
}
|
||||
|
||||
if (av_dict_set(&metadata_dict, "timecode", tc, 0) >= 0) {
|
||||
buffer_size_t metadata_len;
|
||||
packed_metadata = av_packet_pack_dictionary(metadata_dict, &metadata_len);
|
||||
av_dict_free(&metadata_dict);
|
||||
if (packed_metadata) {
|
||||
|
@ -446,7 +446,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
|
||||
|
||||
frame_metadata = frame->metadata;
|
||||
if (frame_metadata) {
|
||||
int size;
|
||||
buffer_size_t size;
|
||||
uint8_t *metadata = av_packet_pack_dictionary(frame_metadata, &size);
|
||||
|
||||
if (!metadata) {
|
||||
|
@ -626,7 +626,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
|
||||
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
|
||||
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
|
||||
if (cat->cur_file->metadata) {
|
||||
int metadata_len;
|
||||
buffer_size_t metadata_len;
|
||||
char* packed_metadata = av_packet_pack_dictionary(cat->cur_file->metadata, &metadata_len);
|
||||
if (!packed_metadata)
|
||||
return AVERROR(ENOMEM);
|
||||
|
@ -381,9 +381,10 @@ int ff_img_read_header(AVFormatContext *s1)
|
||||
* as a dictionary, so it can be used by filters like 'drawtext'.
|
||||
*/
|
||||
static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {
|
||||
int metadata_len, ret;
|
||||
AVDictionary *d = NULL;
|
||||
char *packed_metadata = NULL;
|
||||
buffer_size_t metadata_len;
|
||||
int ret;
|
||||
|
||||
av_dict_set(&d, "lavf.image2dec.source_path", filename, 0);
|
||||
av_dict_set(&d, "lavf.image2dec.source_basename", av_basename(filename), 0);
|
||||
|
@ -87,7 +87,7 @@ struct ogg_stream {
|
||||
int start_trimming; ///< set the number of packets to drop from the start
|
||||
int end_trimming; ///< set the number of packets to drop from the end
|
||||
uint8_t *new_metadata;
|
||||
unsigned int new_metadata_size;
|
||||
buffer_size_t new_metadata_size;
|
||||
void *private;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user