[FFmpeg-devel] [PATCH] avformat: Support merging side data before the muxer

wm4 nfxjfg at googlemail.com
Sun Sep 21 21:20:23 CEST 2014


On Sun, 21 Sep 2014 21:15:11 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:

> This allows applications which interface through AVIOContext or URLProtocol
> to access side data.
> 
> Based-on patch by: Thomas Volkert <silvo at gmx.net>
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavformat/avformat.h |    1 +
>  libavformat/mux.c      |    6 ++++++
>  libavformat/version.h  |    4 ++--
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 78054de..48af2ba 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1315,6 +1315,7 @@ typedef struct AVFormatContext {
>  #define AVFMT_FLAG_SORT_DTS    0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down)
>  #define AVFMT_FLAG_PRIV_OPT    0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted)
>  #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate.
> +#define AVFMT_FLAG_MERGE_SIDE_DATA 0x80000 ///< Merge side data in packets before passing them to the muxer
>  
>      /**
>       * @deprecated deprecated in favor of probesize2
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 55add43..17cb537 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -586,6 +586,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
>      }
>  
>      did_split = av_packet_split_side_data(pkt);
> +
> +    if (did_split && s->flags & AVFMT_FLAG_MERGE_SIDE_DATA) {
> +        av_packet_merge_side_data(pkt);
> +        did_split = 0;
> +    }
> +
>      if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) {
>          AVFrame *frame = (AVFrame *)pkt->data;
>          av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE);
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 61decb9..b1dde2c 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -30,8 +30,8 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVFORMAT_VERSION_MAJOR 56
> -#define LIBAVFORMAT_VERSION_MINOR  4
> -#define LIBAVFORMAT_VERSION_MICRO 103
> +#define LIBAVFORMAT_VERSION_MINOR  5
> +#define LIBAVFORMAT_VERSION_MICRO 100
>  
>  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
>                                                 LIBAVFORMAT_VERSION_MINOR, \


Does this mean it would write side data into files? That sounds like a
terrible idea?


More information about the ffmpeg-devel mailing list