FFmpeg
vvc.h
Go to the documentation of this file.
1 /*
2  * H.266 / VVC 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 /**
22  * @file
23  * internal header for H.266/VVC (de)muxer utilities
24  */
25 
26 #ifndef AVFORMAT_VVC_H
27 #define AVFORMAT_VVC_H
28 
29 #include <stdint.h>
30 #include "avio.h"
31 
32 /**
33  * Writes Annex B formatted H.266/VVC NAL units to the provided AVIOContext.
34  *
35  * The NAL units are converted to an MP4-compatible format (start code prefixes
36  * are replaced by 4-byte size fields, as per ISO/IEC 14496-15).
37  *
38  * If filter_ps is non-zero, any VVC parameter sets found in the input will be
39  * discarded, and *ps_count will be set to the number of discarded PS NAL units.
40  *
41  * @param pb address of the AVIOContext where the data shall be written
42  * @param buf_in address of the buffer holding the input data
43  * @param size size (in bytes) of the input buffer
44  * @param filter_ps whether to write parameter set NAL units to the output (0)
45  * or to discard them (non-zero)
46  * @param ps_count address of the variable where the number of discarded
47  * parameter set NAL units shall be written, may be NULL
48  * @return the amount (in bytes) of data written in case of success, a negative
49  * value corresponding to an AVERROR code in case of failure
50  */
51 int ff_vvc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in,
52  int size, int filter_ps, int *ps_count);
53 
54 /**
55  * Writes Annex B formatted H.266/VVC NAL units to a data buffer.
56  *
57  * The NAL units are converted to an MP4-compatible format (start code prefixes
58  * are replaced by 4-byte size fields, as per ISO/IEC 14496-15).
59  *
60  * If filter_ps is non-zero, any VVC parameter sets found in the input will be
61  * discarded, and *ps_count will be set to the number of discarded PS NAL units.
62  *
63  * On success, *size holds the size (in bytes) of the output data buffer.
64  *
65  * @param buf_in address of the buffer holding the input data
66  * @param size address of the variable holding the size (in bytes) of the input
67  * buffer (on input) and of the output buffer (on success)
68  * @param buf_out on success, address of the variable holding the address of
69  * the output buffer
70  * @param filter_ps whether to write parameter set NAL units to the output (0)
71  * or to discard them (non-zero)
72  * @param ps_count address of the variable where the number of discarded
73  * parameter set NAL units shall be written, may be NULL
74  * @return 0 in case of success, a negative value corresponding to an AVERROR
75  * code in case of failure
76  * @note *buf_out will be treated as uninitialized on input and won't be freed.
77  */
78 int ff_vvc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out,
79  int *size, int filter_ps, int *ps_count);
80 
81 /**
82  * Writes H.266/VVC extradata (parameter sets, declarative SEI NAL units) to
83  * the provided AVIOContext.
84  *
85  * If the extradata is Annex B format, it gets converted to vvcC format before
86  * writing.
87  *
88  * @param pb address of the AVIOContext where the vvcC shall be written
89  * @param data address of the buffer holding the data needed to write the vvcC
90  * @param size size (in bytes) of the data buffer
91  * @param ps_array_completeness whether all parameter sets are in the vvcC (1)
92  * or there may be additional parameter sets in the bitstream (0)
93  * @return >=0 in case of success, a negative value corresponding to an AVERROR
94  * code in case of failure
95  */
96 int ff_isom_write_vvcc(AVIOContext *pb, const uint8_t *data,
97  int size, int ps_array_completeness);
98 
99 #endif /* AVFORMAT_VVC_H */
data
const char data[16]
Definition: mxf.c:148
ff_vvc_annexb2mp4_buf
int ff_vvc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count)
Writes Annex B formatted H.266/VVC NAL units to a data buffer.
Definition: vvc.c:858
ff_isom_write_vvcc
int ff_isom_write_vvcc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes H.266/VVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext.
Definition: vvc.c:879
ff_vvc_annexb2mp4
int ff_vvc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in, int size, int filter_ps, int *ps_count)
Writes Annex B formatted H.266/VVC NAL units to the provided AVIOContext.
Definition: vvc.c:810
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
size
int size
Definition: twinvq_data.h:10344
avio.h