summaryrefslogtreecommitdiff
path: root/libavcodec/avpacket.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-10-18 17:02:08 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-10-19 20:06:42 +0200
commit4d33d316a131c201c3737f6be621013f66f6bd8a (patch)
tree6ffd8252dba7af2ed17af1ae27e612d84ec211b9 /libavcodec/avpacket.c
parent7a5e6b37aa18fedf1f1faf617589f547689bb029 (diff)
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/avpacket.c')
-rw-r--r--libavcodec/avpacket.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index cec5bf89c3..01a250a872 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -46,6 +46,26 @@ FF_ENABLE_DEPRECATION_WARNINGS
pkt->side_data_elems = 0;
}
+AVPacket *av_packet_alloc(void)
+{
+ AVPacket *pkt = av_mallocz(sizeof(AVPacket));
+ if (!pkt)
+ return pkt;
+
+ av_packet_unref(pkt);
+
+ return pkt;
+}
+
+void av_packet_free(AVPacket **pkt)
+{
+ if (!pkt || !*pkt)
+ return;
+
+ av_packet_unref(*pkt);
+ av_freep(pkt);
+}
+
static int packet_alloc(AVBufferRef **buf, int size)
{
int ret;