• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>GstAudio meta: GStreamer Base Plugins 1.0 Library Reference Manual</title>
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="index.html" title="GStreamer Base Plugins 1.0 Library Reference Manual">
8<link rel="up" href="gstreamer-audio.html" title="Audio Library">
9<link rel="prev" href="gst-plugins-base-libs-GstAudio.html" title="GstAudio">
10<link rel="next" href="GstAudioAggregator.html" title="GstAudioAggregator">
11<meta name="generator" content="GTK-Doc V1.28 (XML mode)">
12<link rel="stylesheet" href="style.css" type="text/css">
13</head>
14<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16<td width="100%" align="left" class="shortcuts">
17<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span18                  <a href="#gst-plugins-base-libs-GstAudio-meta.description" class="shortcut">Description</a></span>
19</td>
20<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21<td><a accesskey="u" href="gstreamer-audio.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22<td><a accesskey="p" href="gst-plugins-base-libs-GstAudio.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23<td><a accesskey="n" href="GstAudioAggregator.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24</tr></table>
25<div class="refentry">
26<a name="gst-plugins-base-libs-GstAudio-meta"></a><div class="titlepage"></div>
27<div class="refnamediv"><table width="100%"><tr>
28<td valign="top">
29<h2><span class="refentrytitle"><a name="gst-plugins-base-libs-GstAudio-meta.top_of_page"></a>GstAudio meta</span></h2>
30<p>GstAudio meta — Buffer metadata for audio downmix matrix handling</p>
31</td>
32<td class="gallery_image" valign="top" align="right"></td>
33</tr></table></div>
34<div class="refsect1">
35<a name="gst-plugins-base-libs-GstAudio-meta.functions"></a><h2>Functions</h2>
36<div class="informaltable"><table class="informaltable" width="100%" border="0">
37<colgroup>
38<col width="150px" class="functions_return">
39<col class="functions_name">
40</colgroup>
41<tbody>
42<tr>
43<td class="function_type">
44<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioMeta" title="struct GstAudioMeta"><span class="returnvalue">GstAudioMeta</span></a> *
45</td>
46<td class="function_name">
47<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#gst-buffer-add-audio-meta" title="gst_buffer_add_audio_meta ()">gst_buffer_add_audio_meta</a> <span class="c_punctuation">()</span>
48</td>
49</tr>
50<tr>
51<td class="define_keyword">#define</td>
52<td class="function_name">
53<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#gst-buffer-get-audio-meta" title="gst_buffer_get_audio_meta()">gst_buffer_get_audio_meta</a><span class="c_punctuation">()</span>
54</td>
55</tr>
56<tr>
57<td class="function_type">
58<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="returnvalue">GstAudioDownmixMeta</span></a> *
59</td>
60<td class="function_name">
61<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#gst-buffer-add-audio-downmix-meta" title="gst_buffer_add_audio_downmix_meta ()">gst_buffer_add_audio_downmix_meta</a> <span class="c_punctuation">()</span>
62</td>
63</tr>
64<tr>
65<td class="define_keyword">#define</td>
66<td class="function_name">
67<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#gst-buffer-get-audio-downmix-meta" title="gst_buffer_get_audio_downmix_meta()">gst_buffer_get_audio_downmix_meta</a><span class="c_punctuation">()</span>
68</td>
69</tr>
70<tr>
71<td class="function_type">
72<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="returnvalue">GstAudioDownmixMeta</span></a> *
73</td>
74<td class="function_name">
75<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#gst-buffer-get-audio-downmix-meta-for-channels" title="gst_buffer_get_audio_downmix_meta_for_channels ()">gst_buffer_get_audio_downmix_meta_for_channels</a> <span class="c_punctuation">()</span>
76</td>
77</tr>
78<tr>
79<td class="function_type">
80<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioClippingMeta" title="struct GstAudioClippingMeta"><span class="returnvalue">GstAudioClippingMeta</span></a> *
81</td>
82<td class="function_name">
83<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#gst-buffer-add-audio-clipping-meta" title="gst_buffer_add_audio_clipping_meta ()">gst_buffer_add_audio_clipping_meta</a> <span class="c_punctuation">()</span>
84</td>
85</tr>
86<tr>
87<td class="define_keyword">#define</td>
88<td class="function_name">
89<a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#gst-buffer-get-audio-clipping-meta" title="gst_buffer_get_audio_clipping_meta()">gst_buffer_get_audio_clipping_meta</a><span class="c_punctuation">()</span>
90</td>
91</tr>
92</tbody>
93</table></div>
94</div>
95<div class="refsect1">
96<a name="gst-plugins-base-libs-GstAudio-meta.other"></a><h2>Types and Values</h2>
97<div class="informaltable"><table class="informaltable" width="100%" border="0">
98<colgroup>
99<col width="150px" class="name">
100<col class="description">
101</colgroup>
102<tbody>
103<tr>
104<td class="datatype_keyword">struct</td>
105<td class="function_name"><a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioMeta" title="struct GstAudioMeta">GstAudioMeta</a></td>
106</tr>
107<tr>
108<td class="datatype_keyword">struct</td>
109<td class="function_name"><a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta">GstAudioDownmixMeta</a></td>
110</tr>
111<tr>
112<td class="datatype_keyword">struct</td>
113<td class="function_name"><a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioClippingMeta" title="struct GstAudioClippingMeta">GstAudioClippingMeta</a></td>
114</tr>
115</tbody>
116</table></div>
117</div>
118<div class="refsect1">
119<a name="gst-plugins-base-libs-GstAudio-meta.includes"></a><h2>Includes</h2>
120<pre class="synopsis">#include &lt;gst/audio/audio.h&gt;
121</pre>
122</div>
123<div class="refsect1">
124<a name="gst-plugins-base-libs-GstAudio-meta.description"></a><h2>Description</h2>
125<p><a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="type">GstAudioDownmixMeta</span></a> defines an audio downmix matrix to be send along with
126audio buffers. These functions in this module help to create and attach the
127meta as well as extracting it.</p>
128</div>
129<div class="refsect1">
130<a name="gst-plugins-base-libs-GstAudio-meta.functions_details"></a><h2>Functions</h2>
131<div class="refsect2">
132<a name="gst-buffer-add-audio-meta"></a><h3>gst_buffer_add_audio_meta ()</h3>
133<pre class="programlisting"><a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioMeta" title="struct GstAudioMeta"><span class="returnvalue">GstAudioMeta</span></a> *
134gst_buffer_add_audio_meta (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#GstBuffer-struct"><span class="type">GstBuffer</span></a> *buffer</code></em>,
135                           <em class="parameter"><code>const <a class="link" href="gst-plugins-base-libs-GstAudio.html#GstAudioInfo"><span class="type">GstAudioInfo</span></a> *info</code></em>,
136                           <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> samples</code></em>,
137                           <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> offsets[]</code></em>);</pre>
138<p>Allocates and attaches a <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioMeta" title="struct GstAudioMeta"><span class="type">GstAudioMeta</span></a> on <em class="parameter"><code>buffer</code></em>
139, which must be writable
140for that purpose. The fields of the <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioMeta" title="struct GstAudioMeta"><span class="type">GstAudioMeta</span></a> are directly populated
141from the arguments of this function.</p>
142<p>When <em class="parameter"><code>info-&gt;layout</code></em>
143 is <a class="link" href="gst-plugins-base-libs-GstAudio.html#GST-AUDIO-LAYOUT-NON-INTERLEAVED:CAPS"><code class="literal">GST_AUDIO_LAYOUT_NON_INTERLEAVED</code></a> and <em class="parameter"><code>offsets</code></em>
144 is
145<a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the offsets are calculated with a formula that assumes the planes are
146tightly packed and in sequence:
147offsets[channel] = channel * <em class="parameter"><code>samples</code></em>
148 * sample_stride</p>
149<p>It is not allowed for channels to overlap in memory,
150i.e. for each i in [0, channels), the range
151[<em class="parameter"><code>offsets</code></em>
152[i], <em class="parameter"><code>offsets</code></em>
153[i] + <em class="parameter"><code>samples</code></em>
154 * sample_stride) must not overlap
155with any other such range. This function will assert if the parameters
156specified cause this restriction to be violated.</p>
157<p>It is, obviously, also not allowed to specify parameters that would cause
158out-of-bounds memory access on <em class="parameter"><code>buffer</code></em>
159. This is also checked, which means
160that you must add enough memory on the <em class="parameter"><code>buffer</code></em>
161 before adding this meta.</p>
162<div class="refsect3">
163<a name="gst-buffer-add-audio-meta.parameters"></a><h4>Parameters</h4>
164<div class="informaltable"><table class="informaltable" width="100%" border="0">
165<colgroup>
166<col width="150px" class="parameters_name">
167<col class="parameters_description">
168<col width="200px" class="parameters_annotations">
169</colgroup>
170<tbody>
171<tr>
172<td class="parameter_name"><p>buffer</p></td>
173<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#GstBuffer-struct"><span class="type">GstBuffer</span></a></p></td>
174<td class="parameter_annotations"> </td>
175</tr>
176<tr>
177<td class="parameter_name"><p>info</p></td>
178<td class="parameter_description"><p>the audio properties of the buffer</p></td>
179<td class="parameter_annotations"> </td>
180</tr>
181<tr>
182<td class="parameter_name"><p>samples</p></td>
183<td class="parameter_description"><p>the number of valid samples in the buffer</p></td>
184<td class="parameter_annotations"> </td>
185</tr>
186<tr>
187<td class="parameter_name"><p>offsets</p></td>
188<td class="parameter_description"><p>the offsets (in bytes) where each channel plane starts
189in the buffer or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to calculate it (see below); must be <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> also
190when <em class="parameter"><code>info-&gt;layout</code></em>
191is <a class="link" href="gst-plugins-base-libs-GstAudio.html#GST-AUDIO-LAYOUT-INTERLEAVED:CAPS"><code class="literal">GST_AUDIO_LAYOUT_INTERLEAVED</code></a>. </p></td>
192<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
193</tr>
194</tbody>
195</table></div>
196</div>
197<div class="refsect3">
198<a name="gst-buffer-add-audio-meta.returns"></a><h4>Returns</h4>
199<p>the <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioMeta" title="struct GstAudioMeta"><span class="type">GstAudioMeta</span></a> that was attached on the <em class="parameter"><code>buffer</code></em>
200. </p>
201<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
202</div>
203<p class="since">Since: <a class="link" href="ix03.html#api-index-1.16">1.16</a></p>
204</div>
205<hr>
206<div class="refsect2">
207<a name="gst-buffer-get-audio-meta"></a><h3>gst_buffer_get_audio_meta()</h3>
208<pre class="programlisting">#define             gst_buffer_get_audio_meta(b)</pre>
209</div>
210<hr>
211<div class="refsect2">
212<a name="gst-buffer-add-audio-downmix-meta"></a><h3>gst_buffer_add_audio_downmix_meta ()</h3>
213<pre class="programlisting"><a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="returnvalue">GstAudioDownmixMeta</span></a> *
214gst_buffer_add_audio_downmix_meta (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#GstBuffer-struct"><span class="type">GstBuffer</span></a> *buffer</code></em>,
215                                   <em class="parameter"><code>const <a class="link" href="gst-plugins-base-libs-Audio-channels.html#GstAudioChannelPosition" title="enum GstAudioChannelPosition"><span class="type">GstAudioChannelPosition</span></a> *from_position</code></em>,
216                                   <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> from_channels</code></em>,
217                                   <em class="parameter"><code>const <a class="link" href="gst-plugins-base-libs-Audio-channels.html#GstAudioChannelPosition" title="enum GstAudioChannelPosition"><span class="type">GstAudioChannelPosition</span></a> *to_position</code></em>,
218                                   <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> to_channels</code></em>,
219                                   <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> **matrix</code></em>);</pre>
220<p>Attaches <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="type">GstAudioDownmixMeta</span></a> metadata to <em class="parameter"><code>buffer</code></em>
221 with the given parameters.</p>
222<p><em class="parameter"><code>matrix</code></em>
223 is an two-dimensional array of <em class="parameter"><code>to_channels</code></em>
224 times <em class="parameter"><code>from_channels</code></em>
225
226coefficients, i.e. the i-th output channels is constructed by multiplicating
227the input channels with the coefficients in <em class="parameter"><code>matrix</code></em>
228[i] and taking the sum
229of the results.</p>
230<div class="refsect3">
231<a name="gst-buffer-add-audio-downmix-meta.parameters"></a><h4>Parameters</h4>
232<div class="informaltable"><table class="informaltable" width="100%" border="0">
233<colgroup>
234<col width="150px" class="parameters_name">
235<col class="parameters_description">
236<col width="200px" class="parameters_annotations">
237</colgroup>
238<tbody>
239<tr>
240<td class="parameter_name"><p>buffer</p></td>
241<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#GstBuffer-struct"><span class="type">GstBuffer</span></a></p></td>
242<td class="parameter_annotations"> </td>
243</tr>
244<tr>
245<td class="parameter_name"><p>from_position</p></td>
246<td class="parameter_description"><p>the channel positions
247of the source. </p></td>
248<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=from_channels]</span></td>
249</tr>
250<tr>
251<td class="parameter_name"><p>from_channels</p></td>
252<td class="parameter_description"><p>The number of channels of the source</p></td>
253<td class="parameter_annotations"> </td>
254</tr>
255<tr>
256<td class="parameter_name"><p>to_position</p></td>
257<td class="parameter_description"><p>the channel positions of
258the destination. </p></td>
259<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=to_channels]</span></td>
260</tr>
261<tr>
262<td class="parameter_name"><p>to_channels</p></td>
263<td class="parameter_description"><p>The number of channels of the destination</p></td>
264<td class="parameter_annotations"> </td>
265</tr>
266<tr>
267<td class="parameter_name"><p>matrix</p></td>
268<td class="parameter_description"><p>The matrix coefficients.</p></td>
269<td class="parameter_annotations"> </td>
270</tr>
271</tbody>
272</table></div>
273</div>
274<div class="refsect3">
275<a name="gst-buffer-add-audio-downmix-meta.returns"></a><h4>Returns</h4>
276<p>the <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="type">GstAudioDownmixMeta</span></a> on <em class="parameter"><code>buffer</code></em>
277. </p>
278<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
279</div>
280</div>
281<hr>
282<div class="refsect2">
283<a name="gst-buffer-get-audio-downmix-meta"></a><h3>gst_buffer_get_audio_downmix_meta()</h3>
284<pre class="programlisting">#define gst_buffer_get_audio_downmix_meta(b) ((GstAudioDownmixMeta*)gst_buffer_get_meta((b), GST_AUDIO_DOWNMIX_META_API_TYPE))
285</pre>
286</div>
287<hr>
288<div class="refsect2">
289<a name="gst-buffer-get-audio-downmix-meta-for-channels"></a><h3>gst_buffer_get_audio_downmix_meta_for_channels ()</h3>
290<pre class="programlisting"><a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="returnvalue">GstAudioDownmixMeta</span></a> *
291gst_buffer_get_audio_downmix_meta_for_channels
292                               (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#GstBuffer-struct"><span class="type">GstBuffer</span></a> *buffer</code></em>,
293                                <em class="parameter"><code>const <a class="link" href="gst-plugins-base-libs-Audio-channels.html#GstAudioChannelPosition" title="enum GstAudioChannelPosition"><span class="type">GstAudioChannelPosition</span></a> *to_position</code></em>,
294                                <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> to_channels</code></em>);</pre>
295<p>Find the <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="type">GstAudioDownmixMeta</span></a> on <em class="parameter"><code>buffer</code></em>
296 for the given destination
297channel positions.</p>
298<div class="refsect3">
299<a name="gst-buffer-get-audio-downmix-meta-for-channels.parameters"></a><h4>Parameters</h4>
300<div class="informaltable"><table class="informaltable" width="100%" border="0">
301<colgroup>
302<col width="150px" class="parameters_name">
303<col class="parameters_description">
304<col width="200px" class="parameters_annotations">
305</colgroup>
306<tbody>
307<tr>
308<td class="parameter_name"><p>buffer</p></td>
309<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#GstBuffer-struct"><span class="type">GstBuffer</span></a></p></td>
310<td class="parameter_annotations"> </td>
311</tr>
312<tr>
313<td class="parameter_name"><p>to_position</p></td>
314<td class="parameter_description"><p>the channel positions of
315the destination. </p></td>
316<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=to_channels]</span></td>
317</tr>
318<tr>
319<td class="parameter_name"><p>to_channels</p></td>
320<td class="parameter_description"><p>The number of channels of the destination</p></td>
321<td class="parameter_annotations"> </td>
322</tr>
323</tbody>
324</table></div>
325</div>
326<div class="refsect3">
327<a name="gst-buffer-get-audio-downmix-meta-for-channels.returns"></a><h4>Returns</h4>
328<p>the <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioDownmixMeta" title="struct GstAudioDownmixMeta"><span class="type">GstAudioDownmixMeta</span></a> on <em class="parameter"><code>buffer</code></em>
329. </p>
330<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
331</div>
332</div>
333<hr>
334<div class="refsect2">
335<a name="gst-buffer-add-audio-clipping-meta"></a><h3>gst_buffer_add_audio_clipping_meta ()</h3>
336<pre class="programlisting"><a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioClippingMeta" title="struct GstAudioClippingMeta"><span class="returnvalue">GstAudioClippingMeta</span></a> *
337gst_buffer_add_audio_clipping_meta (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#GstBuffer-struct"><span class="type">GstBuffer</span></a> *buffer</code></em>,
338                                    <em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/gstreamer-GstFormat.html#GstFormat"><span class="type">GstFormat</span></a> format</code></em>,
339                                    <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> start</code></em>,
340                                    <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> end</code></em>);</pre>
341<p>Attaches <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioClippingMeta" title="struct GstAudioClippingMeta"><span class="type">GstAudioClippingMeta</span></a> metadata to <em class="parameter"><code>buffer</code></em>
342 with the given parameters.</p>
343<div class="refsect3">
344<a name="gst-buffer-add-audio-clipping-meta.parameters"></a><h4>Parameters</h4>
345<div class="informaltable"><table class="informaltable" width="100%" border="0">
346<colgroup>
347<col width="150px" class="parameters_name">
348<col class="parameters_description">
349<col width="200px" class="parameters_annotations">
350</colgroup>
351<tbody>
352<tr>
353<td class="parameter_name"><p>buffer</p></td>
354<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#GstBuffer-struct"><span class="type">GstBuffer</span></a></p></td>
355<td class="parameter_annotations"> </td>
356</tr>
357<tr>
358<td class="parameter_name"><p>format</p></td>
359<td class="parameter_description"><p>GstFormat of <em class="parameter"><code>start</code></em>
360and <em class="parameter"><code>stop</code></em>
361, GST_FORMAT_DEFAULT is samples</p></td>
362<td class="parameter_annotations"> </td>
363</tr>
364<tr>
365<td class="parameter_name"><p>start</p></td>
366<td class="parameter_description"><p>Amount of audio to clip from start of buffer</p></td>
367<td class="parameter_annotations"> </td>
368</tr>
369<tr>
370<td class="parameter_name"><p>end</p></td>
371<td class="parameter_description"><p>Amount of  to clip from end of buffer</p></td>
372<td class="parameter_annotations"> </td>
373</tr>
374</tbody>
375</table></div>
376</div>
377<div class="refsect3">
378<a name="gst-buffer-add-audio-clipping-meta.returns"></a><h4>Returns</h4>
379<p>the <a class="link" href="gst-plugins-base-libs-GstAudio-meta.html#GstAudioClippingMeta" title="struct GstAudioClippingMeta"><span class="type">GstAudioClippingMeta</span></a> on <em class="parameter"><code>buffer</code></em>
380. </p>
381<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
382</div>
383<p class="since">Since: <a class="link" href="ix08.html#api-index-1.8">1.8</a></p>
384</div>
385<hr>
386<div class="refsect2">
387<a name="gst-buffer-get-audio-clipping-meta"></a><h3>gst_buffer_get_audio_clipping_meta()</h3>
388<pre class="programlisting">#define gst_buffer_get_audio_clipping_meta(b) ((GstAudioClippingMeta*)gst_buffer_get_meta((b), GST_AUDIO_CLIPPING_META_API_TYPE))
389</pre>
390</div>
391</div>
392<div class="refsect1">
393<a name="gst-plugins-base-libs-GstAudio-meta.other_details"></a><h2>Types and Values</h2>
394<div class="refsect2">
395<a name="GstAudioMeta"></a><h3>struct GstAudioMeta</h3>
396<pre class="programlisting">struct GstAudioMeta {
397  GstMeta      meta;
398
399  GstAudioInfo info;
400  gsize        samples;
401  gsize        *offsets;
402};
403</pre>
404<p>Buffer metadata describing how data is laid out inside the buffer. This
405is useful for non-interleaved (planar) buffers, where it is necessary to
406have a place to store where each plane starts and how long each plane is.</p>
407<p>It is a requirement for non-interleaved buffers to have this metadata
408attached and to be mapped with <a class="link" href="gst-plugins-base-libs-GstAudio.html#gst-audio-buffer-map" title="gst_audio_buffer_map ()"><code class="function">gst_audio_buffer_map()</code></a> in order to ensure
409correct handling of clipping and channel reordering.</p>
410<p>The different channels in <em class="parameter"><code>offsets</code></em>
411 are always in the GStreamer channel order.
412Zero-copy channel reordering can be implemented by swapping the values in
413<em class="parameter"><code>offsets</code></em>
414.</p>
415<p>It is not allowed for channels to overlap in memory,
416i.e. for each i in [0, channels), the range
417[<em class="parameter"><code>offsets</code></em>
418[i], <em class="parameter"><code>offsets</code></em>
419[i] + <em class="parameter"><code>samples</code></em>
420 * sample_stride) must not overlap
421with any other such range.</p>
422<p>It is, however, allowed to have parts of the buffer memory unused,
423by using <em class="parameter"><code>offsets</code></em>
424 and <em class="parameter"><code>samples</code></em>
425 in such a way that leave gaps on it.
426This is used to implement zero-copy clipping in non-interleaved buffers.</p>
427<p>Obviously, due to the above, it is not safe to infer the
428number of valid samples from the size of the buffer. You should always
429use the <em class="parameter"><code>samples</code></em>
430 variable of this metadata.</p>
431<p>Note that for interleaved audio it is not a requirement to have this
432metadata attached and at the moment of writing, there is actually no use
433case to do so. It is, however, allowed to attach it, for some potential
434future use case.</p>
435<div class="refsect3">
436<a name="GstAudioMeta.members"></a><h4>Members</h4>
437<div class="informaltable"><table class="informaltable" width="100%" border="0">
438<colgroup>
439<col width="300px" class="struct_members_name">
440<col class="struct_members_description">
441<col width="200px" class="struct_members_annotations">
442</colgroup>
443<tbody>
444<tr>
445<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/gstreamer-1.0/gstreamer-GstMeta.html#GstMeta"><span class="type">GstMeta</span></a> <em class="structfield"><code><a name="GstAudioMeta.meta"></a>meta</code></em>;</p></td>
446<td class="struct_member_description"><p>parent <a href="/usr/share/gtk-doc/html/gstreamer-1.0/gstreamer-GstMeta.html#GstMeta"><span class="type">GstMeta</span></a></p></td>
447<td class="struct_member_annotations"> </td>
448</tr>
449<tr>
450<td class="struct_member_name"><p><a class="link" href="gst-plugins-base-libs-GstAudio.html#GstAudioInfo"><span class="type">GstAudioInfo</span></a> <em class="structfield"><code><a name="GstAudioMeta.info"></a>info</code></em>;</p></td>
451<td class="struct_member_description"><p>the audio properties of the buffer</p></td>
452<td class="struct_member_annotations"> </td>
453</tr>
454<tr>
455<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> <em class="structfield"><code><a name="GstAudioMeta.samples"></a>samples</code></em>;</p></td>
456<td class="struct_member_description"><p>the number of valid samples in the buffer</p></td>
457<td class="struct_member_annotations"> </td>
458</tr>
459<tr>
460<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *<em class="structfield"><code><a name="GstAudioMeta.offsets"></a>offsets</code></em>;</p></td>
461<td class="struct_member_description"><p>the offsets (in bytes) where each channel plane starts in the
462buffer or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the buffer has interleaved layout; if not <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, this
463is guaranteed to be an array of <em class="parameter"><code>info.channels</code></em>
464elements</p></td>
465<td class="struct_member_annotations"> </td>
466</tr>
467</tbody>
468</table></div>
469</div>
470<p class="since">Since: <a class="link" href="ix03.html#api-index-1.16">1.16</a></p>
471</div>
472<hr>
473<div class="refsect2">
474<a name="GstAudioDownmixMeta"></a><h3>struct GstAudioDownmixMeta</h3>
475<pre class="programlisting">struct GstAudioDownmixMeta {
476  GstMeta      meta;
477
478  GstAudioChannelPosition *from_position;
479  GstAudioChannelPosition *to_position;
480  gint        from_channels, to_channels;
481  gfloat       **matrix;
482};
483</pre>
484<p>Extra buffer metadata describing audio downmixing matrix. This metadata is
485attached to audio buffers and contains a matrix to downmix the buffer number
486of channels to <em class="parameter"><code>channels</code></em>
487.</p>
488<p><em class="parameter"><code>matrix</code></em>
489 is an two-dimensional array of <em class="parameter"><code>to_channels</code></em>
490 times <em class="parameter"><code>from_channels</code></em>
491
492coefficients, i.e. the i-th output channels is constructed by multiplicating
493the input channels with the coefficients in <em class="parameter"><code>matrix</code></em>
494[i] and taking the sum
495of the results.</p>
496<div class="refsect3">
497<a name="GstAudioDownmixMeta.members"></a><h4>Members</h4>
498<div class="informaltable"><table class="informaltable" width="100%" border="0">
499<colgroup>
500<col width="300px" class="struct_members_name">
501<col class="struct_members_description">
502<col width="200px" class="struct_members_annotations">
503</colgroup>
504<tbody>
505<tr>
506<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/gstreamer-1.0/gstreamer-GstMeta.html#GstMeta"><span class="type">GstMeta</span></a> <em class="structfield"><code><a name="GstAudioDownmixMeta.meta"></a>meta</code></em>;</p></td>
507<td class="struct_member_description"><p>parent <a href="/usr/share/gtk-doc/html/gstreamer-1.0/gstreamer-GstMeta.html#GstMeta"><span class="type">GstMeta</span></a></p></td>
508<td class="struct_member_annotations"> </td>
509</tr>
510<tr>
511<td class="struct_member_name"><p><a class="link" href="gst-plugins-base-libs-Audio-channels.html#GstAudioChannelPosition" title="enum GstAudioChannelPosition"><span class="type">GstAudioChannelPosition</span></a> *<em class="structfield"><code><a name="GstAudioDownmixMeta.from-position"></a>from_position</code></em>;</p></td>
512<td class="struct_member_description"><p>the channel positions of the source</p></td>
513<td class="struct_member_annotations"> </td>
514</tr>
515<tr>
516<td class="struct_member_name"><p><a class="link" href="gst-plugins-base-libs-Audio-channels.html#GstAudioChannelPosition" title="enum GstAudioChannelPosition"><span class="type">GstAudioChannelPosition</span></a> *<em class="structfield"><code><a name="GstAudioDownmixMeta.to-position"></a>to_position</code></em>;</p></td>
517<td class="struct_member_description"><p>the channel positions of the destination</p></td>
518<td class="struct_member_annotations"> </td>
519</tr>
520<tr>
521<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GstAudioDownmixMeta.from-channels"></a>from_channels</code></em>;</p></td>
522<td class="struct_member_description"><p>the number of channels of the source</p></td>
523<td class="struct_member_annotations"> </td>
524</tr>
525<tr>
526<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GstAudioDownmixMeta.to-channels"></a>to_channels</code></em>;</p></td>
527<td class="struct_member_description"><p>the number of channels of the destination</p></td>
528<td class="struct_member_annotations"> </td>
529</tr>
530<tr>
531<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> **<em class="structfield"><code><a name="GstAudioDownmixMeta.matrix"></a>matrix</code></em>;</p></td>
532<td class="struct_member_description"><p>the matrix coefficients.</p></td>
533<td class="struct_member_annotations"> </td>
534</tr>
535</tbody>
536</table></div>
537</div>
538</div>
539<hr>
540<div class="refsect2">
541<a name="GstAudioClippingMeta"></a><h3>struct GstAudioClippingMeta</h3>
542<pre class="programlisting">struct GstAudioClippingMeta {
543  GstMeta   meta;
544
545  GstFormat format;
546  guint64   start;
547  guint64   end;
548};
549</pre>
550<p>Extra buffer metadata describing how much audio has to be clipped from
551the start or end of a buffer. This is used for compressed formats, where
552the first frame usually has some additional samples due to encoder and
553decoder delays, and the last frame usually has some additional samples to
554be able to fill the complete last frame.</p>
555<p>This is used to ensure that decoded data in the end has the same amount of
556samples, and multiply decoded streams can be gaplessly concatenated.</p>
557<p>Note: If clipping of the start is done by adjusting the segment, this meta
558has to be dropped from buffers as otherwise clipping could happen twice.</p>
559<div class="refsect3">
560<a name="GstAudioClippingMeta.members"></a><h4>Members</h4>
561<div class="informaltable"><table class="informaltable" width="100%" border="0">
562<colgroup>
563<col width="300px" class="struct_members_name">
564<col class="struct_members_description">
565<col width="200px" class="struct_members_annotations">
566</colgroup>
567<tbody>
568<tr>
569<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/gstreamer-1.0/gstreamer-GstMeta.html#GstMeta"><span class="type">GstMeta</span></a> <em class="structfield"><code><a name="GstAudioClippingMeta.meta"></a>meta</code></em>;</p></td>
570<td class="struct_member_description"><p>parent <a href="/usr/share/gtk-doc/html/gstreamer-1.0/gstreamer-GstMeta.html#GstMeta"><span class="type">GstMeta</span></a></p></td>
571<td class="struct_member_annotations"> </td>
572</tr>
573<tr>
574<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/gstreamer-1.0/gstreamer-GstFormat.html#GstFormat"><span class="type">GstFormat</span></a> <em class="structfield"><code><a name="GstAudioClippingMeta.format"></a>format</code></em>;</p></td>
575<td class="struct_member_description"><p>GstFormat of <em class="parameter"><code>start</code></em>
576and <em class="parameter"><code>stop</code></em>
577, GST_FORMAT_DEFAULT is samples</p></td>
578<td class="struct_member_annotations"> </td>
579</tr>
580<tr>
581<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="GstAudioClippingMeta.start"></a>start</code></em>;</p></td>
582<td class="struct_member_description"><p>Amount of audio to clip from start of buffer</p></td>
583<td class="struct_member_annotations"> </td>
584</tr>
585<tr>
586<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="GstAudioClippingMeta.end"></a>end</code></em>;</p></td>
587<td class="struct_member_description"><p>Amount of  to clip from end of buffer</p></td>
588<td class="struct_member_annotations"> </td>
589</tr>
590</tbody>
591</table></div>
592</div>
593<p class="since">Since: <a class="link" href="ix08.html#api-index-1.8">1.8</a></p>
594</div>
595</div>
596</div>
597<div class="footer">
598<hr>Generated by GTK-Doc V1.28</div>
599</body>
600</html>