• 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>GstTypeFindFactory: GStreamer 1.0 Core Reference Manual</title>
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="index.html" title="GStreamer 1.0 Core Reference Manual">
8<link rel="up" href="libgstreamer.html" title="GStreamer Core Library">
9<link rel="prev" href="gstreamer-GstTypeFind.html" title="GstTypefind">
10<link rel="next" href="gstreamer-GstUri.html" title="GstUri">
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="#GstTypeFindFactory.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span19                  <a href="#GstTypeFindFactory.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
20</td>
21<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
22<td><a accesskey="u" href="libgstreamer.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
23<td><a accesskey="p" href="gstreamer-GstTypeFind.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
24<td><a accesskey="n" href="gstreamer-GstUri.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
25</tr></table>
26<div class="refentry">
27<a name="GstTypeFindFactory"></a><div class="titlepage"></div>
28<div class="refnamediv"><table width="100%"><tr>
29<td valign="top">
30<h2><span class="refentrytitle"><a name="GstTypeFindFactory.top_of_page"></a>GstTypeFindFactory</span></h2>
31<p>GstTypeFindFactory — Information about registered typefind functions</p>
32</td>
33<td class="gallery_image" valign="top" align="right"></td>
34</tr></table></div>
35<div class="refsect1">
36<a name="GstTypeFindFactory.functions"></a><h2>Functions</h2>
37<div class="informaltable"><table class="informaltable" width="100%" border="0">
38<colgroup>
39<col width="150px" class="functions_return">
40<col class="functions_name">
41</colgroup>
42<tbody>
43<tr>
44<td class="function_type">
45<a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
46</td>
47<td class="function_name">
48<a class="link" href="GstTypeFindFactory.html#gst-type-find-factory-get-list" title="gst_type_find_factory_get_list ()">gst_type_find_factory_get_list</a> <span class="c_punctuation">()</span>
49</td>
50</tr>
51<tr>
52<td class="function_type">const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * const *
53</td>
54<td class="function_name">
55<a class="link" href="GstTypeFindFactory.html#gst-type-find-factory-get-extensions" title="gst_type_find_factory_get_extensions ()">gst_type_find_factory_get_extensions</a> <span class="c_punctuation">()</span>
56</td>
57</tr>
58<tr>
59<td class="function_type">
60<a class="link" href="GstCaps.html" title="GstCaps"><span class="returnvalue">GstCaps</span></a> *
61</td>
62<td class="function_name">
63<a class="link" href="GstTypeFindFactory.html#gst-type-find-factory-get-caps" title="gst_type_find_factory_get_caps ()">gst_type_find_factory_get_caps</a> <span class="c_punctuation">()</span>
64</td>
65</tr>
66<tr>
67<td class="function_type">
68<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
69</td>
70<td class="function_name">
71<a class="link" href="GstTypeFindFactory.html#gst-type-find-factory-has-function" title="gst_type_find_factory_has_function ()">gst_type_find_factory_has_function</a> <span class="c_punctuation">()</span>
72</td>
73</tr>
74<tr>
75<td class="function_type">
76<span class="returnvalue">void</span>
77</td>
78<td class="function_name">
79<a class="link" href="GstTypeFindFactory.html#gst-type-find-factory-call-function" title="gst_type_find_factory_call_function ()">gst_type_find_factory_call_function</a> <span class="c_punctuation">()</span>
80</td>
81</tr>
82</tbody>
83</table></div>
84</div>
85<div class="refsect1">
86<a name="GstTypeFindFactory.other"></a><h2>Types and Values</h2>
87<div class="informaltable"><table class="informaltable" width="100%" border="0">
88<colgroup>
89<col width="150px" class="name">
90<col class="description">
91</colgroup>
92<tbody><tr>
93<td class="datatype_keyword"> </td>
94<td class="function_name"><a class="link" href="GstTypeFindFactory.html#GstTypeFindFactory-struct" title="GstTypeFindFactory">GstTypeFindFactory</a></td>
95</tr></tbody>
96</table></div>
97</div>
98<div class="refsect1">
99<a name="GstTypeFindFactory.object-hierarchy"></a><h2>Object Hierarchy</h2>
100<pre class="screen">    <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
101    <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
102        <span class="lineart">╰──</span> <a class="link" href="GstObject.html" title="GstObject">GstObject</a>
103            <span class="lineart">╰──</span> <a class="link" href="GstPluginFeature.html" title="GstPluginfeature">GstPluginFeature</a>
104                <span class="lineart">╰──</span> GstTypeFindFactory
105</pre>
106</div>
107<div class="refsect1">
108<a name="GstTypeFindFactory.includes"></a><h2>Includes</h2>
109<pre class="synopsis">#include &lt;gst/gst.h&gt;
110</pre>
111</div>
112<div class="refsect1">
113<a name="GstTypeFindFactory.description"></a><h2>Description</h2>
114<p>These functions allow querying information about registered typefind
115functions. How to create and register these functions is described in
116the section <GTKDOCLINK HREF="gstreamer-Writing-typefind-functions">
117"Writing typefind functions"</GTKDOCLINK>.</p>
118<p>The following example shows how to write a very simple typefinder that
119identifies the given data. You can get quite a bit more complicated than
120that though.</p>
121<div class="informalexample">
122  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
123    <tbody>
124      <tr>
125        <td class="listing_lines" align="right"><pre>1
1262
1273
1284
1295
1306
1317
1328
1339
13410
13511
13612
13713
13814
13915
14016
14117
14218
14319
14420
14521
14622
14723
14824
14925
15026
15127
15228
15329
15430
15531
15632
15733
15834
15935
16036
16137
16238
16339</pre></td>
164        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwc">typedef</span> <span class="gtkdoc kwb">struct</span> <span class="gtkdoc opt">{</span>
165  guint8 <span class="gtkdoc opt">*</span>data<span class="gtkdoc opt">;</span>
166  guint size<span class="gtkdoc opt">;</span>
167  guint probability<span class="gtkdoc opt">;</span>
168  GstCaps <span class="gtkdoc opt">*</span>data<span class="gtkdoc opt">;</span>
169<span class="gtkdoc opt">}</span> MyTypeFind<span class="gtkdoc opt">;</span>
170<span class="gtkdoc kwb">static void</span>
171<span class="function">my_peek</span> <span class="gtkdoc opt">(</span>gpointer data<span class="gtkdoc opt">,</span> gint64 offset<span class="gtkdoc opt">,</span> guint size<span class="gtkdoc opt">)</span>
172<span class="gtkdoc opt">{</span>
173  MyTypeFind <span class="gtkdoc opt">*</span>find <span class="gtkdoc opt">= (</span>MyTypeFind <span class="gtkdoc opt">*)</span> data<span class="gtkdoc opt">;</span>
174  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>offset <span class="gtkdoc opt">&gt;=</span> <span class="number">0</span> <span class="gtkdoc opt">&amp;&amp;</span> offset <span class="gtkdoc opt">+</span> size <span class="gtkdoc opt">&lt;=</span> find<span class="gtkdoc opt">-&gt;</span>size<span class="gtkdoc opt">) {</span>
175    <span class="keyword">return</span> find<span class="gtkdoc opt">-&gt;</span>data <span class="gtkdoc opt">+</span> offset<span class="gtkdoc opt">;</span>
176  <span class="gtkdoc opt">}</span>
177  <span class="keyword">return</span> NULL<span class="gtkdoc opt">;</span>
178<span class="gtkdoc opt">}</span>
179<span class="gtkdoc kwb">static void</span>
180<span class="function">my_suggest</span> <span class="gtkdoc opt">(</span>gpointer data<span class="gtkdoc opt">,</span> guint probability<span class="gtkdoc opt">,</span> GstCaps <span class="gtkdoc opt">*</span>caps<span class="gtkdoc opt">)</span>
181<span class="gtkdoc opt">{</span>
182  MyTypeFind <span class="gtkdoc opt">*</span>find <span class="gtkdoc opt">= (</span>MyTypeFind <span class="gtkdoc opt">*)</span> data<span class="gtkdoc opt">;</span>
183  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>probability <span class="gtkdoc opt">&gt;</span> find<span class="gtkdoc opt">-&gt;</span>probability<span class="gtkdoc opt">) {</span>
184    find<span class="gtkdoc opt">-&gt;</span>probability <span class="gtkdoc opt">=</span> probability<span class="gtkdoc opt">;</span>
185    <span class="function"><a href="GstCaps.html#gst-caps-replace">gst_caps_replace</a></span> <span class="gtkdoc opt">(&amp;</span>find<span class="gtkdoc opt">-&gt;</span>caps<span class="gtkdoc opt">,</span> caps<span class="gtkdoc opt">);</span>
186  <span class="gtkdoc opt">}</span>
187<span class="gtkdoc opt">}</span>
188<span class="gtkdoc kwb">static</span> GstCaps <span class="gtkdoc opt">*</span>
189<span class="function">find_type</span> <span class="gtkdoc opt">(</span>guint8 <span class="gtkdoc opt">*</span>data<span class="gtkdoc opt">,</span> guint size<span class="gtkdoc opt">)</span>
190<span class="gtkdoc opt">{</span>
191  GList <span class="gtkdoc opt">*</span>walk<span class="gtkdoc opt">, *</span>type_list<span class="gtkdoc opt">;</span>
192  MyTypeFind find <span class="gtkdoc opt">= {</span>data<span class="gtkdoc opt">,</span> size<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">};</span>
193  GstTypeFind gst_find <span class="gtkdoc opt">= {</span>my_peek<span class="gtkdoc opt">,</span> my_suggest<span class="gtkdoc opt">, &amp;</span>find<span class="gtkdoc opt">, };</span>
194  walk <span class="gtkdoc opt">=</span> type_list <span class="gtkdoc opt">=</span> <span class="function"><a href="GstTypeFindFactory.html#gst-type-find-factory-get-list">gst_type_find_factory_get_list</a></span> <span class="gtkdoc opt">();</span>
195  <span class="keyword">while</span> <span class="gtkdoc opt">(</span>walk<span class="gtkdoc opt">) {</span>
196    GstTypeFindFactory <span class="gtkdoc opt">*</span>factory <span class="gtkdoc opt">=</span> <span class="function">GST_TYPE_FIND_FACTORY</span> <span class="gtkdoc opt">(</span>walk<span class="gtkdoc opt">-&gt;</span>data<span class="gtkdoc opt">);</span>
197    walk <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#g-list-next">g_list_next</a></span> <span class="gtkdoc opt">(</span>walk<span class="gtkdoc opt">)</span>
198    <span class="function"><a href="GstTypeFindFactory.html#gst-type-find-factory-call-function">gst_type_find_factory_call_function</a></span> <span class="gtkdoc opt">(</span>factory<span class="gtkdoc opt">, &amp;</span>gst_find<span class="gtkdoc opt">);</span>
199  <span class="gtkdoc opt">}</span>
200  <span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#g-list-free">g_list_free</a></span> <span class="gtkdoc opt">(</span>type_list<span class="gtkdoc opt">);</span>
201  <span class="keyword">return</span> find<span class="gtkdoc opt">.</span>caps<span class="gtkdoc opt">;</span>
202<span class="gtkdoc opt">};</span></pre></td>
203      </tr>
204    </tbody>
205  </table>
206</div>
207
208<p></p>
209</div>
210<div class="refsect1">
211<a name="GstTypeFindFactory.functions_details"></a><h2>Functions</h2>
212<div class="refsect2">
213<a name="gst-type-find-factory-get-list"></a><h3>gst_type_find_factory_get_list ()</h3>
214<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
215gst_type_find_factory_get_list (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
216<p>Gets the list of all registered typefind factories. You must free the
217list using <a class="link" href="GstPluginFeature.html#gst-plugin-feature-list-free" title="gst_plugin_feature_list_free ()"><code class="function">gst_plugin_feature_list_free()</code></a>.</p>
218<p>The returned factories are sorted by highest rank first, and then by
219factory name.</p>
220<p>Free-function: gst_plugin_feature_list_free</p>
221<div class="refsect3">
222<a name="gst-type-find-factory-get-list.returns"></a><h4>Returns</h4>
223<p>the list of all
224registered <a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a>. </p>
225<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> Gst.TypeFindFactory]</span></p>
226</div>
227</div>
228<hr>
229<div class="refsect2">
230<a name="gst-type-find-factory-get-extensions"></a><h3>gst_type_find_factory_get_extensions ()</h3>
231<pre class="programlisting">const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * const *
232gst_type_find_factory_get_extensions (<em class="parameter"><code><a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a> *factory</code></em>);</pre>
233<p>Gets the extensions associated with a <a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a>. The returned
234array should not be changed. If you need to change stuff in it, you should
235copy it using <a href="/usr/share/gtk-doc/html/glib/glib-String-Utility-Functions.html#g-strdupv"><code class="function">g_strdupv()</code></a>.  This function may return <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to indicate
236a 0-length list.</p>
237<div class="refsect3">
238<a name="gst-type-find-factory-get-extensions.parameters"></a><h4>Parameters</h4>
239<div class="informaltable"><table class="informaltable" width="100%" border="0">
240<colgroup>
241<col width="150px" class="parameters_name">
242<col class="parameters_description">
243<col width="200px" class="parameters_annotations">
244</colgroup>
245<tbody><tr>
246<td class="parameter_name"><p>factory</p></td>
247<td class="parameter_description"><p>A <a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a></p></td>
248<td class="parameter_annotations"> </td>
249</tr></tbody>
250</table></div>
251</div>
252<div class="refsect3">
253<a name="gst-type-find-factory-get-extensions.returns"></a><h4>Returns</h4>
254<p>a <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of extensions associated with this factory. </p>
255<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8][<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></p>
256</div>
257</div>
258<hr>
259<div class="refsect2">
260<a name="gst-type-find-factory-get-caps"></a><h3>gst_type_find_factory_get_caps ()</h3>
261<pre class="programlisting"><a class="link" href="GstCaps.html" title="GstCaps"><span class="returnvalue">GstCaps</span></a> *
262gst_type_find_factory_get_caps (<em class="parameter"><code><a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a> *factory</code></em>);</pre>
263<p>Gets the <a class="link" href="GstCaps.html" title="GstCaps"><span class="type">GstCaps</span></a> associated with a typefind factory.</p>
264<div class="refsect3">
265<a name="gst-type-find-factory-get-caps.parameters"></a><h4>Parameters</h4>
266<div class="informaltable"><table class="informaltable" width="100%" border="0">
267<colgroup>
268<col width="150px" class="parameters_name">
269<col class="parameters_description">
270<col width="200px" class="parameters_annotations">
271</colgroup>
272<tbody><tr>
273<td class="parameter_name"><p>factory</p></td>
274<td class="parameter_description"><p>A <a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a></p></td>
275<td class="parameter_annotations"> </td>
276</tr></tbody>
277</table></div>
278</div>
279<div class="refsect3">
280<a name="gst-type-find-factory-get-caps.returns"></a><h4>Returns</h4>
281<p>the <a class="link" href="GstCaps.html" title="GstCaps"><span class="type">GstCaps</span></a> associated with this factory. </p>
282<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
283</div>
284</div>
285<hr>
286<div class="refsect2">
287<a name="gst-type-find-factory-has-function"></a><h3>gst_type_find_factory_has_function ()</h3>
288<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
289gst_type_find_factory_has_function (<em class="parameter"><code><a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a> *factory</code></em>);</pre>
290<p>Check whether the factory has a typefind function. Typefind factories
291without typefind functions are a last-effort fallback mechanism to
292e.g. assume a certain media type based on the file extension.</p>
293<div class="refsect3">
294<a name="gst-type-find-factory-has-function.parameters"></a><h4>Parameters</h4>
295<div class="informaltable"><table class="informaltable" width="100%" border="0">
296<colgroup>
297<col width="150px" class="parameters_name">
298<col class="parameters_description">
299<col width="200px" class="parameters_annotations">
300</colgroup>
301<tbody><tr>
302<td class="parameter_name"><p>factory</p></td>
303<td class="parameter_description"><p>A <a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a></p></td>
304<td class="parameter_annotations"> </td>
305</tr></tbody>
306</table></div>
307</div>
308<div class="refsect3">
309<a name="gst-type-find-factory-has-function.returns"></a><h4>Returns</h4>
310<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the factory has a typefind functions set, otherwise <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a></p>
311</div>
312</div>
313<hr>
314<div class="refsect2">
315<a name="gst-type-find-factory-call-function"></a><h3>gst_type_find_factory_call_function ()</h3>
316<pre class="programlisting"><span class="returnvalue">void</span>
317gst_type_find_factory_call_function (<em class="parameter"><code><a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a> *factory</code></em>,
318                                     <em class="parameter"><code><a class="link" href="gstreamer-GstTypeFind.html#GstTypeFind" title="struct GstTypeFind"><span class="type">GstTypeFind</span></a> *find</code></em>);</pre>
319<p>Calls the <a class="link" href="gstreamer-GstTypeFind.html#GstTypeFindFunction" title="GstTypeFindFunction ()"><span class="type">GstTypeFindFunction</span></a> associated with this factory.</p>
320<div class="refsect3">
321<a name="gst-type-find-factory-call-function.parameters"></a><h4>Parameters</h4>
322<div class="informaltable"><table class="informaltable" width="100%" border="0">
323<colgroup>
324<col width="150px" class="parameters_name">
325<col class="parameters_description">
326<col width="200px" class="parameters_annotations">
327</colgroup>
328<tbody>
329<tr>
330<td class="parameter_name"><p>factory</p></td>
331<td class="parameter_description"><p>A <a class="link" href="GstTypeFindFactory.html" title="GstTypeFindFactory"><span class="type">GstTypeFindFactory</span></a></p></td>
332<td class="parameter_annotations"> </td>
333</tr>
334<tr>
335<td class="parameter_name"><p>find</p></td>
336<td class="parameter_description"><p>a properly setup <a class="link" href="gstreamer-GstTypeFind.html#GstTypeFind" title="struct GstTypeFind"><span class="type">GstTypeFind</span></a> entry. The get_data
337and suggest_type members must be set. </p></td>
338<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
339</tr>
340</tbody>
341</table></div>
342</div>
343</div>
344</div>
345<div class="refsect1">
346<a name="GstTypeFindFactory.other_details"></a><h2>Types and Values</h2>
347<div class="refsect2">
348<a name="GstTypeFindFactory-struct"></a><h3>GstTypeFindFactory</h3>
349<pre class="programlisting">typedef struct _GstTypeFindFactory GstTypeFindFactory;</pre>
350<p>Opaque object that stores information about a typefind function.</p>
351</div>
352</div>
353</div>
354<div class="footer">
355<hr>Generated by GTK-Doc V1.28</div>
356</body>
357</html>