---
 libavcodec/avcodec.h  |    2 ++
 libavcodec/avpacket.c |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index df4e617..907fbb3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1060,6 +1060,7 @@ typedef struct AVPacket {
     int   size;
     int   stream_index;
     int   flags;
+#if LIBAVCODEC_VERSION_MAJOR > 52
     /**
      * Additional packet data that can be provided by the container.
      * Packet can contain several types of side information.
@@ -1070,6 +1071,7 @@ typedef struct AVPacket {
         enum AVPacketSideDataType type;
     } *side_data;
     int side_data_elems;
+#endif
 
     /**
      * Duration of this packet in AVStream->time_base units, 0 if unknown.
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index e0e4df4..ca99e44 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -26,8 +26,10 @@
 void av_destruct_packet_nofree(AVPacket *pkt)
 {
     pkt->data = NULL; pkt->size = 0;
+#if LIBAVCODEC_VERSION_MAJOR > 52
     pkt->side_data       = NULL;
     pkt->side_data_elems = 0;
+#endif
 }
 
 void av_destruct_packet(AVPacket *pkt)
@@ -37,10 +39,12 @@ void av_destruct_packet(AVPacket *pkt)
     av_free(pkt->data);
     pkt->data = NULL; pkt->size = 0;
 
+#if LIBAVCODEC_VERSION_MAJOR > 52
     for (i = 0; i < pkt->side_data_elems; i++)
         av_free(pkt->side_data[i].data);
     av_freep(&pkt->side_data);
     pkt->side_data_elems = 0;
+#endif
 }
 
 void av_init_packet(AVPacket *pkt)
@@ -53,8 +57,10 @@ void av_init_packet(AVPacket *pkt)
     pkt->flags = 0;
     pkt->stream_index = 0;
     pkt->destruct= NULL;
+#if LIBAVCODEC_VERSION_MAJOR > 52
     pkt->side_data       = NULL;
     pkt->side_data_elems = 0;
+#endif
 }
 
 int av_new_packet(AVPacket *pkt, int size)
@@ -126,10 +132,13 @@ int av_dup_packet(AVPacket *pkt)
         tmp_pkt = *pkt;
 
         pkt->data      = NULL;
+#if LIBAVCODEC_VERSION_MAJOR > 52
         pkt->side_data = NULL;
+#endif
         DUP_DATA(pkt->data, tmp_pkt.data, pkt->size, 1);
         pkt->destruct = av_destruct_packet;
 
+#if LIBAVCODEC_VERSION_MAJOR > 52
         if (pkt->side_data_elems) {
             int i;
 
@@ -141,6 +150,7 @@ int av_dup_packet(AVPacket *pkt)
                          pkt->side_data[i].size, 1);
             }
         }
+#endif
     }
     return 0;
 failed_alloc:
@@ -153,11 +163,14 @@ void av_free_packet(AVPacket *pkt)
     if (pkt) {
         if (pkt->destruct) pkt->destruct(pkt);
         pkt->data = NULL; pkt->size = 0;
+#if LIBAVCODEC_VERSION_MAJOR > 52
         pkt->side_data       = NULL;
         pkt->side_data_elems = 0;
+#endif
     }
 }
 
+#if LIBAVCODEC_VERSION_MAJOR > 52
 uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
                                  int size)
 {
@@ -196,3 +209,4 @@ uint8_t* av_packet_get_side_data(AVPacket *pkt, enum 
AVPacketSideDataType type,
     }
     return NULL;
 }
+#endif
-- 
1.7.0.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to