FFmpeg
Loading...
Searching...
No Matches
av1.h
Go to the documentation of this file.
1/*
2 * AV1 helper functions for muxers
3 *
4 * This file is part of FFmpeg.
5 *
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.
10 *
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.
15 *
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
19 */
20
21#ifndef AVFORMAT_AV1_H
22#define AVFORMAT_AV1_H
23
24#include <stdint.h>
25
26#include "avio.h"
27
43
44/**
45 * Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write
46 * the resulting bitstream to the provided AVIOContext.
47 *
48 * @param pb pointer to the AVIOContext where the filtered bitstream shall be
49 * written; may be NULL, in which case nothing is written.
50 * @param buf input data buffer
51 * @param size size of the input data buffer
52 *
53 * @return the amount of bytes written (or would have been written in case
54 * pb had been supplied) in case of success, a negative AVERROR
55 * code in case of failure
56 * @note One can use NULL for pb to just get the output size.
57 */
58int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size);
59
60/**
61 * Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and return
62 * the result in a data buffer, avoiding allocations and copies if possible.
63 *
64 * @param in input data buffer
65 * @param out pointer to pointer for the returned buffer. In case of success,
66 * it is independently allocated if and only if `*out` differs from in.
67 * @param size size of the input data buffer. The size of the resulting output
68 * data buffer will be written here
69 * @param offset offset of the returned data inside `*out`: It runs from
70 * `*out + offset` (inclusive) to `*out + offset + size`
71 * (exclusive); is zero if `*out` is independently allocated.
72 *
73 * @return 0 in case of success, a negative AVERROR code in case of failure.
74 * On failure, *out and *size are unchanged
75 * @note *out will be treated as uninitialized on input and will not be freed.
76 */
77int ff_av1_filter_obus_buf(const uint8_t *in, uint8_t **out,
78 int *size, int *offset);
79
80/**
81 * Parses a Sequence Header from the the provided buffer.
82 *
83 * @param seq pointer to the AV1SequenceParameters where the parsed values will
84 * be written
85 * @param buf input data buffer
86 * @param size size in bytes of the input data buffer
87 *
88 * @return >= 0 in case of success, a negative AVERROR code in case of failure
89 */
90int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size);
91
92/**
93 * Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided
94 * AVIOContext.
95 *
96 * @param pb pointer to the AVIOContext where the av1C box shall be written
97 * @param buf input data buffer
98 * @param size size in bytes of the input data buffer
99 * @param write_seq_header If 1, Sequence Header OBU will be written inside the
100 * av1C box. Otherwise, Sequence Header OBU will be omitted.
101 *
102 * @return >= 0 in case of success, a negative AVERROR code in case of failure
103 */
104int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, int write_seq_header);
105
106#endif /* AVFORMAT_AV1_H */
Buffered I/O operations.
unsigned offset
Definition libaomenc.c:763
int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size)
Parses a Sequence Header from the the provided buffer.
Definition av1.c:336
int ff_av1_filter_obus_buf(const uint8_t *in, uint8_t **out, int *size, int *offset)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and return the result in a data bu...
Definition av1.c:88
int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, int write_seq_header)
Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided AVIOContext.
Definition av1.c:399
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 ...
Definition av1.c:83
uint8_t monochrome
Definition av1.h:33
uint8_t color_description_present_flag
Definition av1.h:37
uint8_t chroma_sample_position
Definition av1.h:36
uint8_t color_range
Definition av1.h:41
uint8_t transfer_characteristics
Definition av1.h:39
uint8_t level
Definition av1.h:30
uint8_t color_primaries
Definition av1.h:38
uint8_t chroma_subsampling_x
Definition av1.h:34
uint8_t profile
Definition av1.h:29
uint8_t chroma_subsampling_y
Definition av1.h:35
uint8_t matrix_coefficients
Definition av1.h:40
uint8_t bitdepth
Definition av1.h:32
Bytestream IO Context.
Definition avio.h:160
static FILE * out
Definition movenc.c:55
int size