1 /*
2 * generic encoding-related code
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 AVCODEC_ENCODE_H
22 #define AVCODEC_ENCODE_H
23
25
28
29 /**
30 * Used by some encoders as upper bound for the length of headers.
31 * TODO: Use proper codec-specific upper bounds.
32 */
33 #define FF_INPUT_BUFFER_MIN_SIZE 16384
34
35 /**
36 * Called by encoders to get the next frame for encoding.
37 *
38 * @param frame An empty frame to be filled with data.
39 * @return 0 if a new reference has been successfully written to frame
40 * AVERROR(EAGAIN) if no data is currently available
41 * AVERROR_EOF if end of stream has been reached, so no more data
42 * will be available
43 */
45
46 /**
47 * Get a buffer for a packet. This is a wrapper around
48 * AVCodecContext.get_encode_buffer() and should be used instead calling get_encode_buffer()
49 * directly.
50 */
52
53 /**
54 * Allocate buffers for a frame. Encoder equivalent to ff_get_buffer().
55 */
57
58 /**
59 * Check AVPacket size and allocate data.
60 *
61 * Encoders of type FF_CODEC_CB_TYPE_ENCODE can use this as a convenience to
62 * obtain a big enough buffer for the encoded bitstream.
63 *
64 * @param avctx the AVCodecContext of the encoder
65 * @param avpkt The AVPacket: on success, avpkt->data will point to a buffer
66 * of size at least `size`; the packet will not be refcounted.
67 * This packet must be initially blank.
68 * @param size an upper bound of the size of the packet to encode
69 * @return non negative on success, negative error code on failure
70 */
72
73 /**
74 * Propagate user opaque values from the frame to avctx/pkt as needed.
75 */
78
81
82 /**
83 * Add a CPB properties side data to an encoding context.
84 */
86
89
90 /**
91 * Rescale from sample rate to AVCodecContext.time_base.
92 */
95 {
100 }
101
102 /**
103 * Check if the elements of codec context matrices (intra_matrix, inter_matrix or
104 * chroma_intra_matrix) are within the specified range.
105 */
106 #define FF_MATRIX_TYPE_INTRA (1U << 0)
107 #define FF_MATRIX_TYPE_INTER (1U << 1)
108 #define FF_MATRIX_TYPE_CHROMA_INTRA (1U << 2)
110
111 #endif /* AVCODEC_ENCODE_H */