[FFmpeg-devel] Access to previous packet in muxer
Tue Sep 7 20:36:46 CEST 2010
On Fri, Aug 27, 2010 at 09:08:30AM +0200, Tobias Bindhammer wrote:
> >> is there any easy way to access the previous packet of AVPacket *pkt
> >> inside the muxer's write_packet(), or do i need to clone it on my own
> >> via the av_new_packet (and further functions) and hold it within my
> >> muxer context?
> > please elaborate on what you are trying to do and why
> i try to interleave contents of a current and a previous AVPacket in a
> muxer. Therefore i am in need of the current and ahm, well, the previous
> AVPacket :-)
> The case i have is:
> The encoder delivers a packet with a charset and 4 frames coresponding
> to the charset, so i have:
> AVPacket 1:
> AVPacket 2:
> now the muxer shall interleave all that like the following:
> Thus when the resulting content is streamed to the decoding machine, it
> can receive same sized blocks all way long. Without interleaving the
> loading of frame1 would take way more time, compared to the other
> frames, as the whole charset needs to be preloaded first. Alternatively
> one could of course buffer 1 charset and 4 frames to RAM first before
> displaying. But that would mean, copying all data from the NIC's buffer
> to RAM first and then rereading it from RAM for decoding. That would be
> too costly to achive a nice framerate.
> In case of interleaving, loading of each frame takes exact the same
> amount of cycles, and the frames can be decoded to their desired
> locations directly when read from the NIC's buffer.
> Hooray for very limited platforms :-)
> At the moment i solve this, by having an AVPacket prev_pkt in my
> MuxerContext, and i just copy contents of the current packet to this
> prev_pkt after use. So i have all teh previoud data ready on the next
> turn. But thought there might be an easier solution and hoped on things
> like pkt->prev, but a look into avcodec.h destroyed my hope :-)
dont forget av_dup_packet()
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel