author | sheepluva |
Fri, 16 Sep 2016 00:22:05 +0200 | |
changeset 11853 | 6a0d6b00dac8 |
parent 7813 | 7ac83d79b897 |
permissions | -rw-r--r-- |
7813
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
1 |
/* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
2 |
* This file is part of Libav. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
3 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
4 |
* Libav is free software; you can redistribute it and/or |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
5 |
* modify it under the terms of the GNU Lesser General Public |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
6 |
* License as published by the Free Software Foundation; either |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
7 |
* version 2.1 of the License, or (at your option) any later version. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
8 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
9 |
* Libav is distributed in the hope that it will be useful, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
12 |
* Lesser General Public License for more details. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
13 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU Lesser General Public |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
15 |
* License along with Libav; if not, write to the Free Software |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
17 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
18 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
19 |
#ifndef AVUTIL_SAMPLEFMT_H |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
20 |
#define AVUTIL_SAMPLEFMT_H |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
21 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
22 |
#include <stdint.h> |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
23 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
24 |
#include "avutil.h" |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
25 |
#include "attributes.h" |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
26 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
27 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
28 |
* Audio Sample Formats |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
29 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
30 |
* @par |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
31 |
* The data described by the sample format is always in native-endian order. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
32 |
* Sample values can be expressed by native C types, hence the lack of a signed |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
33 |
* 24-bit sample format even though it is a common raw audio data format. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
34 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
35 |
* @par |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
36 |
* The floating-point formats are based on full volume being in the range |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
37 |
* [-1.0, 1.0]. Any values outside this range are beyond full volume level. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
38 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
39 |
* @par |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
40 |
* The data layout as used in av_samples_fill_arrays() and elsewhere in Libav |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
41 |
* (such as AVFrame in libavcodec) is as follows: |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
42 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
43 |
* For planar sample formats, each audio channel is in a separate data plane, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
44 |
* and linesize is the buffer size, in bytes, for a single plane. All data |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
45 |
* planes must be the same size. For packed sample formats, only the first data |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
46 |
* plane is used, and samples for each channel are interleaved. In this case, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
47 |
* linesize is the buffer size, in bytes, for the 1 plane. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
48 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
49 |
enum AVSampleFormat { |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
50 |
AV_SAMPLE_FMT_NONE = -1, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
51 |
AV_SAMPLE_FMT_U8, ///< unsigned 8 bits |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
52 |
AV_SAMPLE_FMT_S16, ///< signed 16 bits |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
53 |
AV_SAMPLE_FMT_S32, ///< signed 32 bits |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
54 |
AV_SAMPLE_FMT_FLT, ///< float |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
55 |
AV_SAMPLE_FMT_DBL, ///< double |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
56 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
57 |
AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
58 |
AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
59 |
AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
60 |
AV_SAMPLE_FMT_FLTP, ///< float, planar |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
61 |
AV_SAMPLE_FMT_DBLP, ///< double, planar |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
62 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
63 |
AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
64 |
}; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
65 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
66 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
67 |
* Return the name of sample_fmt, or NULL if sample_fmt is not |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
68 |
* recognized. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
69 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
70 |
const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
71 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
72 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
73 |
* Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
74 |
* on error. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
75 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
76 |
enum AVSampleFormat av_get_sample_fmt(const char *name); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
77 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
78 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
79 |
* Get the packed alternative form of the given sample format. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
80 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
81 |
* If the passed sample_fmt is already in packed format, the format returned is |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
82 |
* the same as the input. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
83 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
84 |
* @return the packed alternative form of the given sample format or |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
85 |
AV_SAMPLE_FMT_NONE on error. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
86 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
87 |
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
88 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
89 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
90 |
* Get the planar alternative form of the given sample format. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
91 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
92 |
* If the passed sample_fmt is already in planar format, the format returned is |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
93 |
* the same as the input. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
94 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
95 |
* @return the planar alternative form of the given sample format or |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
96 |
AV_SAMPLE_FMT_NONE on error. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
97 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
98 |
enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
99 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
100 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
101 |
* Generate a string corresponding to the sample format with |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
102 |
* sample_fmt, or a header if sample_fmt is negative. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
103 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
104 |
* @param buf the buffer where to write the string |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
105 |
* @param buf_size the size of buf |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
106 |
* @param sample_fmt the number of the sample format to print the |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
107 |
* corresponding info string, or a negative value to print the |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
108 |
* corresponding header. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
109 |
* @return the pointer to the filled buffer or NULL if sample_fmt is |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
110 |
* unknown or in case of other errors |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
111 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
112 |
char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
113 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
114 |
#if FF_API_GET_BITS_PER_SAMPLE_FMT |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
115 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
116 |
* @deprecated Use av_get_bytes_per_sample() instead. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
117 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
118 |
attribute_deprecated |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
119 |
int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
120 |
#endif |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
121 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
122 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
123 |
* Return number of bytes per sample. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
124 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
125 |
* @param sample_fmt the sample format |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
126 |
* @return number of bytes per sample or zero if unknown for the given |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
127 |
* sample format |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
128 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
129 |
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
130 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
131 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
132 |
* Check if the sample format is planar. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
133 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
134 |
* @param sample_fmt the sample format to inspect |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
135 |
* @return 1 if the sample format is planar, 0 if it is interleaved |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
136 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
137 |
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
138 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
139 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
140 |
* Get the required buffer size for the given audio parameters. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
141 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
142 |
* @param[out] linesize calculated linesize, may be NULL |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
143 |
* @param nb_channels the number of channels |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
144 |
* @param nb_samples the number of samples in a single channel |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
145 |
* @param sample_fmt the sample format |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
146 |
* @param align buffer size alignment (0 = default, 1 = no alignment) |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
147 |
* @return required buffer size, or negative error code on failure |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
148 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
149 |
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
150 |
enum AVSampleFormat sample_fmt, int align); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
151 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
152 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
153 |
* Fill channel data pointers and linesize for samples with sample |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
154 |
* format sample_fmt. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
155 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
156 |
* The pointers array is filled with the pointers to the samples data: |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
157 |
* for planar, set the start point of each channel's data within the buffer, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
158 |
* for packed, set the start point of the entire buffer only. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
159 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
160 |
* The linesize array is filled with the aligned size of each channel's data |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
161 |
* buffer for planar layout, or the aligned size of the buffer for all channels |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
162 |
* for packed layout. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
163 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
164 |
* @see enum AVSampleFormat |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
165 |
* The documentation for AVSampleFormat describes the data layout. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
166 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
167 |
* @param[out] audio_data array to be filled with the pointer for each channel |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
168 |
* @param[out] linesize calculated linesize, may be NULL |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
169 |
* @param buf the pointer to a buffer containing the samples |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
170 |
* @param nb_channels the number of channels |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
171 |
* @param nb_samples the number of samples in a single channel |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
172 |
* @param sample_fmt the sample format |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
173 |
* @param align buffer size alignment (0 = default, 1 = no alignment) |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
174 |
* @return 0 on success or a negative error code on failure |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
175 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
176 |
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
177 |
const uint8_t *buf, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
178 |
int nb_channels, int nb_samples, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
179 |
enum AVSampleFormat sample_fmt, int align); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
180 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
181 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
182 |
* Allocate a samples buffer for nb_samples samples, and fill data pointers and |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
183 |
* linesize accordingly. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
184 |
* The allocated samples buffer can be freed by using av_freep(&audio_data[0]) |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
185 |
* Allocated data will be initialized to silence. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
186 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
187 |
* @see enum AVSampleFormat |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
188 |
* The documentation for AVSampleFormat describes the data layout. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
189 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
190 |
* @param[out] audio_data array to be filled with the pointer for each channel |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
191 |
* @param[out] linesize aligned size for audio buffer(s), may be NULL |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
192 |
* @param nb_channels number of audio channels |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
193 |
* @param nb_samples number of samples per channel |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
194 |
* @param align buffer size alignment (0 = default, 1 = no alignment) |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
195 |
* @return 0 on success or a negative error code on failure |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
196 |
* @see av_samples_fill_arrays() |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
197 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
198 |
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
199 |
int nb_samples, enum AVSampleFormat sample_fmt, int align); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
200 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
201 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
202 |
* Copy samples from src to dst. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
203 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
204 |
* @param dst destination array of pointers to data planes |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
205 |
* @param src source array of pointers to data planes |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
206 |
* @param dst_offset offset in samples at which the data will be written to dst |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
207 |
* @param src_offset offset in samples at which the data will be read from src |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
208 |
* @param nb_samples number of samples to be copied |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
209 |
* @param nb_channels number of audio channels |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
210 |
* @param sample_fmt audio sample format |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
211 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
212 |
int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
213 |
int src_offset, int nb_samples, int nb_channels, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
214 |
enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
215 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
216 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
217 |
* Fill an audio buffer with silence. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
218 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
219 |
* @param audio_data array of pointers to data planes |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
220 |
* @param offset offset in samples at which to start filling |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
221 |
* @param nb_samples number of samples to fill |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
222 |
* @param nb_channels number of audio channels |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
223 |
* @param sample_fmt audio sample format |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
224 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
225 |
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
226 |
int nb_channels, enum AVSampleFormat sample_fmt); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
227 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
228 |
#endif /* AVUTIL_SAMPLEFMT_H */ |