Browse code

Get rid of av_destruct_packet_nofree and use NULL instead. It is still used in comparisons to keep ABI compatibility.

Originally committed as revision 18431 to svn://svn.ffmpeg.org/ffmpeg/trunk

Reimar Döffinger authored on 2009/04/11 21:42:29
Showing 3 changed files
... ...
@@ -2630,7 +2630,10 @@ typedef struct AVSubtitle {
2630 2630
 
2631 2631
 /* packet functions */
2632 2632
 
2633
-void av_destruct_packet_nofree(AVPacket *pkt);
2633
+/**
2634
+ * @deprecated use NULL instead
2635
+ */
2636
+attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt);
2634 2637
 
2635 2638
 /**
2636 2639
  * Default packet destructor.
... ...
@@ -2675,8 +2678,9 @@ int av_dup_packet(AVPacket *pkt);
2675 2675
  */
2676 2676
 static inline void av_free_packet(AVPacket *pkt)
2677 2677
 {
2678
-    if (pkt && pkt->destruct) {
2679
-        pkt->destruct(pkt);
2678
+    if (pkt) {
2679
+        if (pkt->destruct) pkt->destruct(pkt);
2680
+        pkt->data = NULL; pkt->size = 0;
2680 2681
     }
2681 2682
 }
2682 2683
 
... ...
@@ -42,7 +42,7 @@ void av_init_packet(AVPacket *pkt)
42 42
     pkt->convergence_duration = 0;
43 43
     pkt->flags = 0;
44 44
     pkt->stream_index = 0;
45
-    pkt->destruct= av_destruct_packet_nofree;
45
+    pkt->destruct= NULL;
46 46
 }
47 47
 
48 48
 int av_new_packet(AVPacket *pkt, int size)
... ...
@@ -923,7 +923,7 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
923 923
                     pkt->pts = st->parser->pts;
924 924
                     pkt->dts = st->parser->dts;
925 925
                     pkt->pos = st->parser->pos;
926
-                    pkt->destruct = av_destruct_packet_nofree;
926
+                    pkt->destruct = NULL;
927 927
                     compute_pkt_fields(s, st, st->parser, pkt);
928 928
 
929 929
                     if((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & PKT_FLAG_KEY){