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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Dec 3 23:26:32 CET 2012


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.
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.


More information about the ffmpeg-devel mailing list