4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>giostreamsink</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7
7
<link rel="home" href="index.html" title="GStreamer Base Plugins 0.10 Plugins Reference Manual">
8
8
<link rel="up" href="ch01.html" title="gst-plugins-base Elements">
9
9
<link rel="prev" href="gst-plugins-base-plugins-giosrc.html" title="giosrc">
10
10
<link rel="next" href="gst-plugins-base-plugins-giostreamsrc.html" title="giostreamsrc">
11
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
14
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
64
64
<div class="refsect1">
65
65
<a name="gst-plugins-base-plugins-giostreamsink.description"></a><h2>Description</h2>
67
This plugin writes incoming data to a custom GIO <a href="http://library.gnome.org/devel/gio/unstable/GOutputStream.html"><span class="type">GOutputStream</span></a>.
70
It can, for example, be used to write a stream to memory with a
71
<span class="type">GMemoryOuputStream</span> or to write to a file with a <span class="type">GFileOuputStream</span>.
75
<div class="refsect2">
76
<a name="idp11080288"></a><h3>Example code</h3>
78
The following example writes the received data to a <a href="http://library.gnome.org/devel/gio/unstable/GMemoryOutputStream.html"><span class="type">GMemoryOutputStream</span></a>.
80
<div class="informalexample">
81
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
84
<td class="listing_lines" align="right"><pre>1
107
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include <gst/gst.h></span>
108
<span class="gtkdoc ppc">#include <gio/gio.h></span>
110
<span class="gtkdoc opt">...</span>
112
GstElement <span class="gtkdoc opt">*</span>sink<span class="gtkdoc opt">;</span>
113
GMemoryOuputStream <span class="gtkdoc opt">*</span>stream<span class="gtkdoc opt">;</span>
114
<span class="gtkdoc slc">// out_data will contain the received data</span>
115
guint8 <span class="gtkdoc opt">*</span>out_data<span class="gtkdoc opt">;</span>
117
<span class="gtkdoc opt">...</span>
119
stream <span class="gtkdoc opt">=</span> <span class="function">G_MEMORY_OUTPUT_STREAM</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://library.gnome.org/devel/gio/unstable/GMemoryOutputStream.html#g-memory-output-stream-new">g_memory_output_stream_new</a></span> <span class="gtkdoc opt">(</span>NULL<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span>
120
<span class="gtkdoc opt">(</span>GReallocFunc<span class="gtkdoc opt">)</span> g_realloc<span class="gtkdoc opt">, (</span>GDestroyNotify<span class="gtkdoc opt">)</span> g_free<span class="gtkdoc opt">));</span>
121
sink <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-make">gst_element_factory_make</a></span> <span class="gtkdoc opt">(</span><span class="string">"giostreamsink"</span><span class="gtkdoc opt">,</span> <span class="string">"sink"</span><span class="gtkdoc opt">);</span>
122
<span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-set">g_object_set</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#G-OBJECT:CAPS">G_OBJECT</a></span> <span class="gtkdoc opt">(</span>sink<span class="gtkdoc opt">),</span> <span class="string">"stream"</span><span class="gtkdoc opt">,</span> stream<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
124
<span class="gtkdoc opt">...</span>
126
<span class="gtkdoc slc">// after processing get the written data</span>
127
out_data <span class="gtkdoc opt">=</span> <span class="function">g_memory_ouput_stream_get_data</span> <span class="gtkdoc opt">(</span><span class="function">G_MEMORY_OUTPUT_STREAM</span> <span class="gtkdoc opt">(</span>stream<span class="gtkdoc opt">));</span>
129
<span class="gtkdoc opt">...</span></pre></td>
140
66
<div class="refsynopsisdiv">
142
68
<div class="refsect2">
143
<a name="idp11084752"></a><h3>Element Information</h3>
69
<a name="idp7444832"></a><h3>Element Information</h3>
144
70
<div class="variablelist"><table border="0">
145
71
<col align="left" valign="top">