diff mbox series

[FFmpeg-devel,1/3] avcodec/packet: add a define for the max buffer size a packet can hold

Message ID 20230621204658.2742-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] avcodec/packet: add a define for the max buffer size a packet can hold | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer June 21, 2023, 8:46 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
TODO: Version bump and APIchanges entry.

 libavcodec/packet.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Anton Khirnov June 27, 2023, 7:23 a.m. UTC | #1
Quoting James Almer (2023-06-21 22:46:56)
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> TODO: Version bump and APIchanges entry.
> 
>  libavcodec/packet.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavcodec/packet.h b/libavcodec/packet.h
> index f28e7e7011..f7dd687c23 100644
> --- a/libavcodec/packet.h
> +++ b/libavcodec/packet.h
> @@ -418,6 +418,11 @@ typedef struct AVPacket {
>      AVRational time_base;
>  } AVPacket;
>  
> +/**
> + * Max size for an AVPacket data buffer.
> + */
> +#define AV_PKT_MAX_PAYLOAD_SIZE ((size_t)(INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE))

Maybe just AV_PKT_SIZE_MAX to be consistent with other FOO_MAX in C?

Otherwise the set seems like a good idea.
James Almer June 27, 2023, 2:39 p.m. UTC | #2
On 6/27/2023 4:23 AM, Anton Khirnov wrote:
> Quoting James Almer (2023-06-21 22:46:56)
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> TODO: Version bump and APIchanges entry.
>>
>>   libavcodec/packet.h | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/libavcodec/packet.h b/libavcodec/packet.h
>> index f28e7e7011..f7dd687c23 100644
>> --- a/libavcodec/packet.h
>> +++ b/libavcodec/packet.h
>> @@ -418,6 +418,11 @@ typedef struct AVPacket {
>>       AVRational time_base;
>>   } AVPacket;
>>   
>> +/**
>> + * Max size for an AVPacket data buffer.
>> + */
>> +#define AV_PKT_MAX_PAYLOAD_SIZE ((size_t)(INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE))
> 
> Maybe just AV_PKT_SIZE_MAX to be consistent with other FOO_MAX in C?
> 
> Otherwise the set seems like a good idea.

Will apply with that change then. Thanks.
diff mbox series

Patch

diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index f28e7e7011..f7dd687c23 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -418,6 +418,11 @@  typedef struct AVPacket {
     AVRational time_base;
 } AVPacket;
 
+/**
+ * Max size for an AVPacket data buffer.
+ */
+#define AV_PKT_MAX_PAYLOAD_SIZE ((size_t)(INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE))
+
 #if FF_API_INIT_PACKET
 attribute_deprecated
 typedef struct AVPacketList {