[FFmpeg-devel] [PATCH 2/2] Add av_copy_packet()

Andrey Utkin andrey.krieger.utkin at gmail.com
Thu Sep 20 16:30:03 CEST 2012


---
 libavcodec/avcodec.h  |    7 +++++++
 libavcodec/avpacket.c |    6 ++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fdfd5c4..e4bba5b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3669,6 +3669,13 @@ int av_grow_packet(AVPacket *pkt, int grow_by);
 int av_dup_packet(AVPacket *pkt);
 
 /**
+ * Copy packet, including contents
+ *
+ * @return 0 on success, negative AVERROR on fail
+ */
+int av_copy_packet(AVPacket *dst, AVPacket *src);
+
+/**
  * Free a packet.
  *
  * @param pkt packet to free
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 8989190..516f1c9 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -165,6 +165,12 @@ int av_dup_packet(AVPacket *pkt)
     return 0;
 }
 
+int av_copy_packet(AVPacket *dst, AVPacket *src)
+{
+    *dst = *src;
+    return copy_packet_data(dst, src);
+}
+
 void av_free_packet(AVPacket *pkt)
 {
     if (pkt) {
-- 
1.7.8.6



More information about the ffmpeg-devel mailing list