[Libav-user] [Livav-user] Questions about reference counting and av_[interleaved_]write_frame
Massimo Battistel
battistel at gmail.com
Sun Dec 22 12:49:10 CET 2013
Hello!
Some questions:
1a. I would like to know where I can find documentation about ffmpeg
reference counting. Is this the starting point or there are other
resources?
"http://www.ffmpeg.org/doxygen/2.0/group__lavu__buffer.html".
1b. Is this the official url for examples code?
"http://www.ffmpeg.org/doxygen/2.0/examples.html"
2. I would like to know if the following code is safe if result==TRUE and r
==1.
There are additional questions on the code comments.
AVPacket pkt;
...
pkt.buf = NULL; // no ref count. Does it matter?
// pkt was properly initialized and data filed != null.
...
BOOL result = (av_write_frame(oc, &pkt) == 0);
if (result)
{
int r = av_write_frame(oc, NULL); // flush
if (r == 1)
{
av_free_packet(&pkt); // now pkt can be safely reused? <======
}
}
3. I would like to know if the following code is safe if result==TRUE.
There are additional questions on the code comments.
AVPacket pkt;
...
// now pkt is ref counted and properly filled.
...
BOOL result = (av_interleaved_write_frame(oc, &pkt) == 0);
if (result)
{
// From doc: "...Libavformat takes ownership of this reference..."
// so...
// I dont need to free packet, muxer will do that at right time. Correct?
// so now pkt can be safely reused? <======
}
4. From doc: "...If the packets are already correctly interleaved, the
application should call av_write_frame() instead as it is slightly
faster...".
4a. If av_interleaved_write_frame is fed with an already interleaved packet
list, is this performance difference still notable?
4b. if av_interleaved_write_frame puts the packet in a private list, the
function call should take less time compared to av_write_frame, correct?
The muxer I'm using is ASF.
thanks,
MB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131222/73981516/attachment.html>
More information about the Libav-user
mailing list