]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mux: Remove redundant resetting
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 11 Apr 2020 11:48:50 +0000 (13:48 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 17 Apr 2020 22:41:27 +0000 (00:41 +0200)
Now that ff_interleave_add_packet() always returns blank packets, the
input packet to ff_interleave_packet_per_dts() will always be blank on
return as well (if supplied) and the same goes for interleave_packet()
in mux.c. Document these facts and remove the redundant resetting that
happened in av_interleaved_write_frame().

The last reference to the (long removed) destruct field that AVPackets
once had has been removed as well when updating the documentation of
ff_interleave_packet_per_dts().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/internal.h
libavformat/mux.c

index e9d7d6754a03ffe58228025efef49c658feda2dc..7e4284b21702fc97be088b660c29efc12a6b7aa9 100644 (file)
@@ -495,15 +495,12 @@ int ff_framehash_write_header(AVFormatContext *s);
 int ff_read_packet(AVFormatContext *s, AVPacket *pkt);
 
 /**
- * Interleave a packet per dts in an output media file.
+ * Interleave an AVPacket per dts so it can be muxed.
  *
- * Packets with pkt->destruct == av_destruct_packet will be freed inside this
- * function, so they cannot be used after it. Note that calling av_packet_unref()
- * on them is still safe.
- *
- * @param s media file handle
+ * @param s   an AVFormatContext for output. pkt resp. out will be added to
+ *            resp. taken from its packet buffer.
  * @param out the interleaved packet will be output here
- * @param pkt the input packet
+ * @param pkt the input packet; will be blank on return if not NULL
  * @param flush 1 if no further packets are available as input and all
  *              remaining packets should be output
  * @return 1 if a packet was output, 0 if no packet could be output,
index 92e5636dbede22fe72234184b73c1d138df5807c..5fc42d57b6176c7afb3a8540854ad887b55e4e24 100644 (file)
@@ -1158,7 +1158,7 @@ int ff_interleaved_peek(AVFormatContext *s, int stream,
 /**
  * Interleave an AVPacket correctly so it can be muxed.
  * @param out the interleaved packet will be output here
- * @param in the input packet
+ * @param in the input packet; will always be blank on return if not NULL
  * @param flush 1 if no further packets are available as input and all
  *              remaining packets should be output
  * @return 1 if a packet was output, 0 if no packet could be output,
@@ -1213,14 +1213,11 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
     for (;; ) {
         AVPacket opkt;
         int ret = interleave_packet(s, &opkt, pkt, flush);
-        if (pkt) {
-            memset(pkt, 0, sizeof(*pkt));
-            av_init_packet(pkt);
-            pkt = NULL;
-        }
         if (ret <= 0)
             return ret;
 
+        pkt = NULL;
+
         ret = write_packet(s, &opkt);
 
         av_packet_unref(&opkt);