diff options
author | James Almer <jamrial@gmail.com> | 2021-03-05 11:26:24 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2021-03-17 14:12:17 -0300 |
commit | d422b2ed87ee7d3b3014cd3fac553e6aad7d4f14 (patch) | |
tree | 06b1f9e88cfab2675afd529468f47ab851f1bab3 /libavcodec | |
parent | f7db77bd8785d1715d3e7ed7e69bd1cc991f2d07 (diff) | |
download | ffmpeg-d422b2ed87ee7d3b3014cd3fac553e6aad7d4f14.tar.gz |
avcodec/packet_internal: make avpriv_packet_list_* functions use an internal struct
The next pointer is kept at the end for backwards compatability until the
major bump, when it should ideally be moved at the front.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avpacket.c | 18 | ||||
-rw-r--r-- | libavcodec/packet_internal.h | 10 |
2 files changed, 16 insertions, 12 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 945ec2004b..6840688b15 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -737,13 +737,13 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif } -int avpriv_packet_list_put(AVPacketList **packet_buffer, - AVPacketList **plast_pktl, +int avpriv_packet_list_put(PacketList **packet_buffer, + PacketList **plast_pktl, AVPacket *pkt, int (*copy)(AVPacket *dst, const AVPacket *src), int flags) { - AVPacketList *pktl = av_mallocz(sizeof(AVPacketList)); + PacketList *pktl = av_mallocz(sizeof(PacketList)); int ret; if (!pktl) @@ -774,11 +774,11 @@ int avpriv_packet_list_put(AVPacketList **packet_buffer, return 0; } -int avpriv_packet_list_get(AVPacketList **pkt_buffer, - AVPacketList **pkt_buffer_end, +int avpriv_packet_list_get(PacketList **pkt_buffer, + PacketList **pkt_buffer_end, AVPacket *pkt) { - AVPacketList *pktl; + PacketList *pktl; if (!*pkt_buffer) return AVERROR(EAGAIN); pktl = *pkt_buffer; @@ -790,12 +790,12 @@ int avpriv_packet_list_get(AVPacketList **pkt_buffer, return 0; } -void avpriv_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end) +void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **pkt_buf_end) { - AVPacketList *tmp = *pkt_buf; + PacketList *tmp = *pkt_buf; while (tmp) { - AVPacketList *pktl = tmp; + PacketList *pktl = tmp; tmp = pktl->next; av_packet_unref(&pktl->pkt); av_freep(&pktl); diff --git a/libavcodec/packet_internal.h b/libavcodec/packet_internal.h index 832ddb4a61..b1d91f6347 100644 --- a/libavcodec/packet_internal.h +++ b/libavcodec/packet_internal.h @@ -23,6 +23,10 @@ #include "packet.h" +typedef struct PacketList { + AVPacket pkt; + struct PacketList *next; +} PacketList; /** * Append an AVPacket to the list. @@ -37,7 +41,7 @@ * @return 0 on success, negative AVERROR value on failure. On failure, the packet and the list are unchanged. */ -int avpriv_packet_list_put(AVPacketList **head, AVPacketList **tail, +int avpriv_packet_list_put(PacketList **head, PacketList **tail, AVPacket *pkt, int (*copy)(AVPacket *dst, const AVPacket *src), int flags); @@ -54,7 +58,7 @@ int avpriv_packet_list_put(AVPacketList **head, AVPacketList **tail, * @return 0 on success, and a packet is returned. AVERROR(EAGAIN) if * the list was empty. */ -int avpriv_packet_list_get(AVPacketList **head, AVPacketList **tail, +int avpriv_packet_list_get(PacketList **head, PacketList **tail, AVPacket *pkt); /** @@ -63,7 +67,7 @@ int avpriv_packet_list_get(AVPacketList **head, AVPacketList **tail, * @param head List head element * @param tail List tail element */ -void avpriv_packet_list_free(AVPacketList **head, AVPacketList **tail); +void avpriv_packet_list_free(PacketList **head, PacketList **tail); int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type); |