[FFmpeg-devel] [PATCH 5/5] avformat/movenc: add support for AV1 streams

Michael Niedermayer michael at niedermayer.cc
Tue Jul 10 00:08:34 EEST 2018


On Mon, Jul 09, 2018 at 03:26:54PM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> ff_av1_filter_obus() could eventually be replaced by an autoinserted
> filter_units bsf, assuming it doesn't slow down the muxing process
> too much (CBS is fast reading packets, but not so much assembling and
> writing packets).
> ff_isom_write_av1c() however can't be replaced given filter_units
> doesn't handle extradata (either codecpar or packet side data).
> 
[...]
> diff --git a/libavformat/av1.h b/libavformat/av1.h
> new file mode 100644
> index 0000000000..733034c12d
> --- /dev/null
> +++ b/libavformat/av1.h
> @@ -0,0 +1,70 @@
> +/*
> + * AV1 helper functions for muxers
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifndef AVFORMAT_AV1_H
> +#define AVFORMAT_AV1_H
> +
> +#include <stdint.h>
> +
> +#include "avio.h"
> +
> +/**
> + * Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write
> + * the resulting bitstream to the provided AVIOContext.
> + *
> + * @param pb pointer to the AVIOContext where the filtered bitstream shall be
> + *           written
> + * @param buf input data buffer
> + * @param size size of the input data buffer
> + *
> + * @return the amount of bytes written in case of success, a negative AVERROR
> + *         code in case of failure
> + */
> +int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size);
> +
> +/**
> + * Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write
> + * the resulting bitstream to a newly allocated data buffer.
> + *
> + * @param pb pointer to the AVIOContext where the filtered bitstream shall be
> + *           written
> + * @param buf input data buffer

> + * @param out pointer to pointer that will hold the allocated data buffer
> + * @param size size of the input data buffer. The size of the resulting output
> +               data buffer will be written here
> + *
> + * @return the amount of bytes written in case of success, a negative AVERROR
> + *         code in case of failure

this leaves it unspecified what happens to out/size in case of errors
are they 0/null are they undefined, left as before ?


> + */
> +int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size);
> +
> +/**
> + * Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided
> + * AVIOContext.
> + *
> + * @param pb pointer to the AVIOContext where the hvcC shall be written
> + * @param buf input data buffer

> + * @param size size of the input data buffer

very minor nitpick but you could add "in bytes"


> + *
> + * @return 0 in case of success, a negative AVERROR code in case of failure

if >= 0 is defined as success then its possible to use this in the future
for some additional information without the need to review all callers

i guess most of this doesnt matter much as its not public API ...



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180709/e2879a61/attachment.sig>


More information about the ffmpeg-devel mailing list