]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/avpacket.c
Perform the DC prediction reversal immediately after decoding all of
[ffmpeg] / libavcodec / avpacket.c
index 107afb3817b24eb1632a14bd43a9bcc19c63e7c5..5bea639d660631ab23498a969b5377243ebb6ab8 100644 (file)
@@ -42,7 +42,7 @@ void av_init_packet(AVPacket *pkt)
     pkt->convergence_duration = 0;
     pkt->flags = 0;
     pkt->stream_index = 0;
-    pkt->destruct= av_destruct_packet_nofree;
+    pkt->destruct= NULL;
 }
 
 int av_new_packet(AVPacket *pkt, int size)
@@ -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) {
@@ -80,3 +87,11 @@ int av_dup_packet(AVPacket *pkt)
     }
     return 0;
 }
+
+void av_free_packet(AVPacket *pkt)
+{
+    if (pkt) {
+        if (pkt->destruct) pkt->destruct(pkt);
+        pkt->data = NULL; pkt->size = 0;
+    }
+}