[FFmpeg-devel] [PATCH 1/4] lavf: add write_uncoded_frame() API.

Ramiro Polla ramiro.polla at gmail.com
Sat Jan 4 07:16:03 CET 2014


On Wed, Jan 1, 2014 at 10:27 AM, Nicolas George <george at nsup.org> wrote:
>
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  libavformat/avformat.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
>  libavformat/mux.c      |   43 ++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 86 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 6d719d7..9b25bff 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -453,6 +453,14 @@ typedef struct AVOutputFormat {
>
>      void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
>                                   int64_t *dts, int64_t *wall);
> +
> +    /**
> +     * Write an uncoded AVFrame
> +     *
> +     * See av_write_uncoded_frame() for details.
> +     */
> +    int (*write_uncoded_frame)(struct AVFormatContext *, int stream_index,
> +                               AVFrame *frame, unsigned flags);
>  } AVOutputFormat;
>  /**
>   * @}
> @@ -1908,6 +1916,42 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
>  int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
>
>  /**
> + * Write a uncoded frame to an output media file
> + *
> + * If the muxer supports it, this function allows to write an AVFrame
> + * structure directly, without encoding it into a packet.
> + * It is mostly useful for devices and similar special muxers that use raw
> + * video or PCM data and will not serialize it into a byte stream.
> + *
> + * To test whether it is possible to use it with a given muxer and stream,
> + * use the AV_WRITE_UNCODED_FRAME_QUERY flag with frame = NULL.
> + *
> + * The caller keeps ownership of the frame and is responsible for freeing
> + * it.
> + *
> + * @return  >=0 for success, a negative code on error
> + */
> +int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
> +                           AVFrame *frame, unsigned flags);
> +
> +enum AVWriteUncodedFrameFlags {
> +
> +    /**
> +     * Query whether the feature is possible on this stream.
> +     * The frame argument is ignored.
> +     */
> +    AV_WRITE_UNCODED_FRAME_QUERY           = 0x0001,

> +    /**
> +     * Do not queue packets for interleaving.
> +     * If this flag is set, the application is responsible for interleaving.
> +     */
> +    AV_WRITE_UNCODED_FRAME_NO_INTERLEAVE   = 0x0002,

Why not av_write_uncoded_frame and av_interleaved_write_uncoded_frame
instead of using this flag?


More information about the ffmpeg-devel mailing list