[FFmpeg-devel] [PATCH] lavf: split packets before muxing.

Clément Bœsch ubitux at gmail.com
Mon Dec 3 23:36:02 CET 2012


On Mon, Dec 03, 2012 at 11:26:32PM +0100, Reimar Döffinger wrote:
> On Mon, Dec 03, 2012 at 11:15:40PM +0100, Clément Bœsch wrote:
> > After demuxing, data and side are merged. Before decoding, they are
> > split. Encoder will perform with data and side split. This means that a
> > muxer can receive split data (after encoding) but also merged data (if
> > called directly after demuxing). This commit makes sure data and side
> > are split for the muxer.
> > ---
> >  libavformat/mux.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavformat/mux.c b/libavformat/mux.c
> > index 9bcee99..ce7a067 100644
> > --- a/libavformat/mux.c
> > +++ b/libavformat/mux.c
> > @@ -484,13 +484,19 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
> >      return 0;
> >  }
> >  
> > +static inline int split_write_packet(AVFormatContext *s, AVPacket *pkt)
> > +{
> > +    av_packet_split_side_data(pkt);
> > +    return s->oformat->write_packet(s, pkt);
> > +}
> 
> And if the muxer can't handle side data it will get lost.

In what situation do you need to actually mux these side data?

> IMHO to do this properly you need to know what side data the
> muxer supports, and those that are supported (or make no sense)
> should be split and the rest should not.

That will require quite some changes… IMO the situation where some files
are badly muxed (any muxer receiving merged side data will write
data+magic+side_data in the payload, which will likely produce bad files;
no muxer at the moment split the packet to extract the side data because
the AVPacket is considered RO afaik) is worse than skipping the
information…

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121203/6595e91b/attachment.asc>


More information about the ffmpeg-devel mailing list