History

avcodec/packet: change side data related public function and struct size types to size_t

av_packet_add_side_data() already defines size as a size_t, so this makes it consistent across all side data functions

James Almer committed 5 years ago

Commit d79e0fe1 parent dbd47b74 files · +28 −4Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavcodec/avpacket.c +7 −3
  3. libavcodec/packet.h +16 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2017-10-21 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182021-03-10 - xxxxxxxxxx - lavc 58.130.100 - packet.h
19 Change AVBufferRef related AVPacket function and struct size
20 parameter and fields type to size_t at next major bump.
21
182021-03-10 - xxxxxxxxxx - lavu 56.68.100 - buffer.h frame.h222021-03-10 - xxxxxxxxxx - lavu 56.68.100 - buffer.h frame.h
19 Change AVBufferRef and relevant AVFrame function and struct size23 Change AVBufferRef and relevant AVFrame function and struct size
20 parameter and fields type to size_t at next major bump.24 parameter and fields type to size_t at next major bump.
libavcodec/avpacket.c+7−3
@@ -330,12 +330,16 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 329 unmodified lines
330 330
331 331
332uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,332uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
333 int size)333 buffer_size_t size)
334{334{
335 int ret;335 int ret;
336 uint8_t *data;336 uint8_t *data;
337 337
338#if FF_API_BUFFER_SIZE_T
338 if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)339 if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
340#else
341 if (size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
342#endif
339 return NULL;343 return NULL;
340 data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);344 data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
341 if (!data)345 if (!data)
@@ -351,7 +355,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 9 unmodified lines
351}355}
352 356
353uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,357uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
354 int *size)358 buffer_size_t *size)
355{359{
356 int i;360 int i;
357 361
@@ -554,7 +558,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **di · 196 unmodified lines
554}558}
555 559
556int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,560int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
557 int size)561 buffer_size_t size)
558{562{
559 int i;563 int i;
560 564
libavcodec/packet.h+16−0
@@ -305,7 +305,11 @@ enum AVPacketSideDataType { · 304 unmodified lines
305 305
306typedef struct AVPacketSideData {306typedef struct AVPacketSideData {
307 uint8_t *data;307 uint8_t *data;
308#if FF_API_BUFFER_SIZE_T
308 int size;309 int size;
310#else
311 size_t size;
312#endif
309 enum AVPacketSideDataType type;313 enum AVPacketSideDataType type;
310} AVPacketSideData;314} AVPacketSideData;
311 315
@@ -559,7 +563,11 @@ void av_free_packet(AVPacket *pkt); · 247 unmodified lines
559 * @return pointer to fresh allocated data or NULL otherwise563 * @return pointer to fresh allocated data or NULL otherwise
560 */564 */
561uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,565uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
566#if FF_API_BUFFER_SIZE_T
562 int size);567 int size);
568#else
569 size_t size);
570#endif
563 571
564/**572/**
565 * Wrap an existing array as a packet side data.573 * Wrap an existing array as a packet side data.
@@ -586,7 +594,11 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 20 unmodified lines
586 * @return 0 on success, < 0 on failure594 * @return 0 on success, < 0 on failure
587 */595 */
588int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,596int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
597#if FF_API_BUFFER_SIZE_T
589 int size);598 int size);
599#else
600 size_t size);
601#endif
590 602
591/**603/**
592 * Get side information from packet.604 * Get side information from packet.
@@ -598,7 +610,11 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 5 unmodified lines
598 * @return pointer to data if present or NULL otherwise610 * @return pointer to data if present or NULL otherwise
599 */611 */
600uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,612uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
613#if FF_API_BUFFER_SIZE_T
601 int *size);614 int *size);
615#else
616 size_t *size);
617#endif
602 618
603#if FF_API_MERGE_SD_API619#if FF_API_MERGE_SD_API
604attribute_deprecated620attribute_deprecated
libavcodec/version.h+1−1
@@ -28,7 +28,7 @@ · 27 unmodified lines
28#include "libavutil/version.h"28#include "libavutil/version.h"
29 29
30#define LIBAVCODEC_VERSION_MAJOR 5830#define LIBAVCODEC_VERSION_MAJOR 58
31#define LIBAVCODEC_VERSION_MINOR 12931#define LIBAVCODEC_VERSION_MINOR 130
32#define LIBAVCODEC_VERSION_MICRO 10032#define LIBAVCODEC_VERSION_MICRO 100
33 33
34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

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