]> git.sesse.net Git - ffmpeg/blob - libavformat/av1.h
Merge commit 'e22ffb3805f6994bd1fd7ab73e6297f36a53f915'
[ffmpeg] / libavformat / av1.h
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
28 /**
29  * Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write
30  * the resulting bitstream to the provided AVIOContext.
31  *
32  * @param pb pointer to the AVIOContext where the filtered bitstream shall be
33  *           written
34  * @param buf input data buffer
35  * @param size size of the input data buffer
36  *
37  * @return the amount of bytes written in case of success, a negative AVERROR
38  *         code in case of failure
39  */
40 int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size);
41
42 /**
43  * Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write
44  * the resulting bitstream to a newly allocated data buffer.
45  *
46  * @param pb pointer to the AVIOContext where the filtered bitstream shall be
47  *           written
48  * @param buf input data buffer
49  * @param out pointer to pointer that will hold the allocated data buffer
50  * @param size size of the input data buffer. The size of the resulting output
51                data buffer will be written here
52  *
53  * @return the amount of bytes written in case of success, a negative AVERROR
54  *         code in case of failure. On failure, out and size are unchanged
55  */
56 int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size);
57
58 /**
59  * Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided
60  * AVIOContext.
61  *
62  * @param pb pointer to the AVIOContext where the hvcC shall be written
63  * @param buf input data buffer
64  * @param size size in bytes of the input data buffer
65  *
66  * @return >= 0 in case of success, a negative AVERROR code in case of failure
67  */
68 int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size);
69
70 #endif /* AVFORMAT_AV1_H */