diff avpacket.c @ 9360:66e270967340 libavcodec

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.
author reimar
date Wed, 08 Apr 2009 20:19:12 +0000
parents 2108342734cc
children d322325fc00e
line wrap: on
line diff
--- a/avpacket.c	Wed Apr 08 01:45:44 2009 +0000
+++ b/avpacket.c	Wed Apr 08 20:19:12 2009 +0000
@@ -62,6 +62,13 @@
     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) {