GStreamer Base Plugins 0.10 Plugins Reference Manual | ||||
---|---|---|---|---|
GObject +----GstObject +----GstElement +----GstBaseSink +----GstGioBaseSink +----GstGioStreamSink
This plugin writes incoming data to a custom GIO GOutputStream.
It can, for example, be used to write a stream to memory with a GMemoryOuputStream or to write to a file with a GFileOuputStream.
The following example writes the received data to a GMemoryOutputStream.
#include <gst/gst.h> #include <gio/gio.h> ... GstElement *sink; GMemoryOuputStream *stream; // out_data will contain the received data guint8 *out_data; ... stream = G_MEMORY_OUTPUT_STREAM (g_memory_output_stream_new (NULL, 0, (GReallocFunc) g_realloc, (GDestroyNotify) g_free)); sink = gst_element_factory_make ("giostreamsink", "sink"); g_object_set (G_OBJECT (sink), "stream", stream, NULL); ... // after processing get the written data out_data = g_memory_ouput_stream_get_data (G_MEMORY_OUTPUT_STREAM (stream)); ...