summaryrefslogtreecommitdiff
path: root/libavcodec/avpacket.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-04-08 20:19:12 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-04-08 20:19:12 +0000
commitfeb993e5794b3dacb51085a9b77013495eb6dd1c (patch)
tree417d93a8a94c57b00b3552393d9355a320c32501 /libavcodec/avpacket.c
parentc81604f862a550bef5261680cfdc48deb6fce046 (diff)
Add av_shrink_packet function for use in av_get_packet that reduces pkt->size
and ensures the following padding is correctly initialized to 0. Originally committed as revision 18378 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/avpacket.c')
-rw-r--r--libavcodec/avpacket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 107afb3817..d91ee3a10d 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -62,6 +62,13 @@ int av_new_packet(AVPacket *pkt, int size)
return 0;
}
+void av_shrink_packet(AVPacket *pkt, int size)
+{
+ if (pkt->size <= size) return;
+ pkt->size = size;
+ memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+}
+
int av_dup_packet(AVPacket *pkt)
{
if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {