diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2015-10-23 11:11:34 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-10-26 18:00:55 +0100 |
commit | a9a60106370f862e191dea58e748626da6a8fe97 (patch) | |
tree | 0bfbeefe8c036d171cec28af34cdeaf21ecb85b6 /libavcodec/avcodec.h | |
parent | 9b56d5c11488656254e9aed8d964ef2b7c2ff5e6 (diff) | |
download | ffmpeg-a9a60106370f862e191dea58e748626da6a8fe97.tar.gz |
avpacket: Provide an alloc and a free function for the struct
Pave the way for having the size of the AVPacket struct not part
of the ABI.
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 9eaa2c6ffb..b47aafaac3 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3426,6 +3426,40 @@ void avsubtitle_free(AVSubtitle *sub); */ /** + * Allocate an AVPacket and set its fields to default values. The resulting + * struct must be freed using av_packet_free(). + * + * @return An AVPacket filled with default values or NULL on failure. + * + * @note this only allocates the AVPacket itself, not the data buffers. Those + * must be allocated through other means such as av_new_packet. + * + * @see av_new_packet + */ +AVPacket *av_packet_alloc(void); + +/** + * Create a new packet that references the same data as src. + * + * This is a shortcut for av_packet_alloc()+av_packet_ref(). + * + * @return newly created AVPacket on success, NULL on error. + * + * @see av_packet_alloc + * @see av_packet_ref + */ +AVPacket *av_packet_clone(AVPacket *src); + +/** + * Free the packet, if the packet is reference counted, it will be + * unreferenced first. + * + * @param packet packet to be freed. The pointer will be set to NULL. + * @note passing NULL is a no-op. + */ +void av_packet_free(AVPacket **pkt); + +/** * Initialize optional fields of a packet with default values. * * Note, this does not touch the data and size members, which have to be |