summaryrefslogtreecommitdiff
path: root/libavformat/avformat.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-03 14:23:36 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-03 14:24:11 +0100
commit37e81996dcf3452c48dd134877bf10b5060dacb3 (patch)
tree46c9098620c5d3a73823b283e747eb23d95b8606 /libavformat/avformat.h
parent1885ffb03d0af28e6bac2bcc8725fa15b93f6ac9 (diff)
parent9221efef7968463f3e3d9ce79ea72eaca082e73f (diff)
Merge commit '9221efef7968463f3e3d9ce79ea72eaca082e73f'
* commit '9221efef7968463f3e3d9ce79ea72eaca082e73f': lavf: fix av_interleaved_write_frame() doxy. lavf: clarify the lifetime of demuxed packets. avconv: do not free muxed packet on streamcopy. crc: move doxy to the header vf_drawtext: do not use deprecated av_tree_node_size x86: Refactor PSWAPD fallback implementations and port to cpuflags Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avformat.h')
-rw-r--r--libavformat/avformat.h30
1 files changed, 18 insertions, 12 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3d99518990..61bc4a6327 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -158,9 +158,15 @@
* information will be in AVStream.time_base units, i.e. it has to be
* multiplied by the timebase to convert them to seconds.
*
- * The packet data belongs to the demuxer and is invalid after the next call to
- * av_read_frame(). The user must free the packet with av_free_packet() before
- * calling av_read_frame() again or closing the file.
+ * If AVPacket.destruct is set on the returned packet, then the packet is
+ * allocated dynamically and the user may keep it indefinitely.
+ * Otherwise, if AVPacket.destruct is NULL, the packet data is backed by a
+ * static storage somewhere inside the demuxer and the packet is only valid
+ * until the next av_read_frame() call or closing the file. If the caller
+ * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy
+ * of it.
+ * In both cases, the packet must be freed with av_free_packet() when it is no
+ * longer needed.
*
* @section lavf_decoding_seek Seeking
* @}
@@ -1550,13 +1556,13 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt);
* omit invalid data between valid frames so as to give the decoder the maximum
* information possible for decoding.
*
- * The returned packet is valid
- * until the next av_read_frame() or until av_close_input_file() and
- * must be freed with av_free_packet. For video, the packet contains
- * exactly one frame. For audio, it contains an integer number of
- * frames if each frame has a known fixed size (e.g. PCM or ADPCM
- * data). If the audio frames have a variable size (e.g. MPEG audio),
- * then it contains one frame.
+ * If pkt->destruct is NULL, then the packet is valid until the next
+ * av_read_frame() or until av_close_input_file(). Otherwise the packet is valid
+ * indefinitely. In both cases the packet must be freed with
+ * av_free_packet when it is no longer needed. For video, the packet contains
+ * exactly one frame. For audio, it contains an integer number of frames if each
+ * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames
+ * have a variable size (e.g. MPEG audio), then it contains one frame.
*
* pkt->pts, pkt->dts and pkt->duration are always set to correct
* values in AVStream.time_base units (and guessed if the format cannot
@@ -1724,10 +1730,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
* @param s media file handle
* @param pkt The packet containing the data to be written. Libavformat takes
* ownership of the data and will free it when it sees fit using the packet's
- * This can be NULL (at any time, not just at the end), to flush the
- * interleaving queues.
* @ref AVPacket.destruct "destruct" field. The caller must not access the data
* after this function returns, as it may already be freed.
+ * This can be NULL (at any time, not just at the end), to flush the
+ * interleaving queues.
* Packet's @ref AVPacket.stream_index "stream_index" field must be set to the
* index of the corresponding stream in @ref AVFormatContext.streams
* "s.streams".