2 * AV1 helper functions for muxers
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef AVFORMAT_AV1_H
22 #define AVFORMAT_AV1_H
28 typedef struct AV1SequenceParameters {
34 uint8_t chroma_subsampling_x;
35 uint8_t chroma_subsampling_y;
36 uint8_t chroma_sample_position;
37 uint8_t color_description_present_flag;
38 uint8_t color_primaries;
39 uint8_t transfer_characteristics;
40 uint8_t matrix_coefficients;
42 } AV1SequenceParameters;
45 * Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write
46 * the resulting bitstream to the provided AVIOContext.
48 * @param pb pointer to the AVIOContext where the filtered bitstream shall be
50 * @param buf input data buffer
51 * @param size size of the input data buffer
53 * @return the amount of bytes written in case of success, a negative AVERROR
54 * code in case of failure
56 int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size);
59 * Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write
60 * the resulting bitstream to a newly allocated data buffer.
62 * @param pb pointer to the AVIOContext where the filtered bitstream shall be
64 * @param buf input data buffer
65 * @param out pointer to pointer that will hold the allocated data buffer
66 * @param size size of the input data buffer. The size of the resulting output
67 data buffer will be written here
69 * @return the amount of bytes written in case of success, a negative AVERROR
70 * code in case of failure. On failure, out and size are unchanged
72 int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size);
75 * Parses a Sequence Header from the the provided buffer.
77 * @param seq pointer to the AV1SequenceParameters where the parsed values will
79 * @param buf input data buffer
80 * @param size size in bytes of the input data buffer
82 * @return >= 0 in case of success, a negative AVERROR code in case of failure
84 int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size);
87 * Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided
90 * @param pb pointer to the AVIOContext where the av1C box shall be written
91 * @param buf input data buffer
92 * @param size size in bytes of the input data buffer
94 * @return >= 0 in case of success, a negative AVERROR code in case of failure
96 int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size);
98 #endif /* AVFORMAT_AV1_H */