mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 17:18:15 +00:00
inlined more doc comments, added missing comments and fixed comments fixed typos
Original commit message from CVS: * docs/gst/gstreamer-sections.txt: * docs/gst/tmpl/.cvsignore: * docs/gst/tmpl/gstbin.sgml: * docs/gst/tmpl/gstbuffer.sgml: * gst/base/gstbasesrc.c: * gst/gstbin.c: (gst_bin_get_type), (gst_bin_class_init): * gst/gstbuffer.c: * gst/gstbuffer.h: * tools/gst-launch.1.in: inlined more doc comments, added missing comments and fixed comments fixed typos
This commit is contained in:
parent
4b0a255e95
commit
3e1c4a2c42
11 changed files with 342 additions and 634 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2005-08-23 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* docs/gst/gstreamer-sections.txt:
|
||||
* docs/gst/tmpl/.cvsignore:
|
||||
* docs/gst/tmpl/gstbin.sgml:
|
||||
* docs/gst/tmpl/gstbuffer.sgml:
|
||||
* gst/base/gstbasesrc.c:
|
||||
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_class_init):
|
||||
* gst/gstbuffer.c:
|
||||
* gst/gstbuffer.h:
|
||||
* tools/gst-launch.1.in:
|
||||
inlined more doc comments, added missing comments and fixed comments
|
||||
fixed typos
|
||||
|
||||
2005-08-23 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/gstbuffer.c: (gst_buffer_new_and_alloc):
|
||||
|
|
|
@ -85,6 +85,7 @@ GST_BUFFER_DATA
|
|||
GST_BUFFER_SIZE
|
||||
GST_BUFFER_TIMESTAMP
|
||||
GST_BUFFER_DURATION
|
||||
GST_BUFFER_CAPS
|
||||
GST_BUFFER_OFFSET
|
||||
GST_BUFFER_OFFSET_END
|
||||
|
||||
|
@ -109,17 +110,20 @@ GST_BUFFER_DURATION_IS_VALID
|
|||
GST_BUFFER_TIMESTAMP_IS_VALID
|
||||
GST_BUFFER_OFFSET_IS_VALID
|
||||
GST_BUFFER_OFFSET_END_IS_VALID
|
||||
GST_BUFFER_MALLOCDATA
|
||||
|
||||
<SUBSECTION>
|
||||
gst_buffer_stamp
|
||||
gst_buffer_join
|
||||
gst_buffer_merge
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GST_BUFFER
|
||||
GST_BUFFER_CLASS
|
||||
GST_IS_BUFFER
|
||||
GST_IS_BUFFER_CLASS
|
||||
GST_TYPE_BUFFER
|
||||
GST_TYPE_BUFFER_FLAG
|
||||
GST_BUFFER_CAST
|
||||
<SUBSECTION Private>
|
||||
gst_buffer_get_type
|
||||
gst_buffer_flag_get_type
|
||||
|
|
4
docs/gst/tmpl/.gitignore
vendored
4
docs/gst/tmpl/.gitignore
vendored
|
@ -1,10 +1,14 @@
|
|||
*.bak
|
||||
unused-build.stamp
|
||||
gst.sgml
|
||||
gstadapter.sgml
|
||||
gstbasesink.sgml
|
||||
gstbasesrc.sgml
|
||||
gstbasetransform.sgml
|
||||
gstbin.sgml
|
||||
gstbuffer.sgml
|
||||
gstcollectpads.sgml
|
||||
gstevent.sgml
|
||||
gstfakesrc.sgml
|
||||
gstfakesink.sgml
|
||||
gstfilesrc.sgml
|
||||
|
|
|
@ -1,219 +0,0 @@
|
|||
<!-- ##### SECTION Title ##### -->
|
||||
GstBin
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Base class for elements that contain other elements
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
GstBin is the simplest of the container elements, allowing elements to
|
||||
become children of itself. Pads from the child elements can be ghosted to
|
||||
the bin, making the bin itself look transparently like any other element,
|
||||
allowing for deep nesting of predefined sub-pipelines.
|
||||
</para>
|
||||
<para>
|
||||
A new GstBin is created with gst_bin_new(). Use a #GstPipeline instead if you want
|
||||
to create a toplevel bin because a normal bin doesn't have a scheduler of its
|
||||
own.
|
||||
</para>
|
||||
<para>
|
||||
After the bin has been created you will typically add elements to it with
|
||||
gst_bin_add(). You can remove elements with gst_bin_remove().
|
||||
</para>
|
||||
<para>
|
||||
An element can be retrieved from a bin with gst_bin_get_by_name(), using the
|
||||
elements name. gst_bin_get_by_name_recurse_up() is mainly used for internal
|
||||
purposes and will query the parent bins when the element is not found in the
|
||||
current bin.
|
||||
</para>
|
||||
<para>
|
||||
The list of elements in a bin can be retrieved with gst_bin_get_list().
|
||||
</para>
|
||||
<para>
|
||||
After the bin has been set to the PLAYING state (with gst_element_set_state()),
|
||||
gst_bin_iterate() is used to process the elements in the bin.
|
||||
</para>
|
||||
<para>
|
||||
The "element_added" signal is fired whenever a new element is added to the bin.
|
||||
</para>
|
||||
<para>
|
||||
The "element_removed" signal is fired whenever an element is removed from the bin.
|
||||
</para>
|
||||
<para>
|
||||
gst_bin_destroy() is used to destroy the bin.
|
||||
</para>
|
||||
<para>
|
||||
To control the selection of the clock in a bin, you can use the following methods:
|
||||
gst_bin_auto_clock() to let the bin select a clock automatically, gst_bin_get_clock() to
|
||||
get the current clock of the bin and gst_bin_use_clock() to specify a clock explicitly.
|
||||
Note that the default behaviour is to automatically select a clock from one of the
|
||||
clock providers in the bin.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GstBin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@numchildren:
|
||||
@children:
|
||||
@children_cookie:
|
||||
@child_bus:
|
||||
@eosed:
|
||||
|
||||
<!-- ##### SIGNAL GstBin::element-added ##### -->
|
||||
<para>
|
||||
Will be emitted if a new element was removed/added to this bin.
|
||||
</para>
|
||||
|
||||
@gstbin: the object which received the signal.
|
||||
@arg1: the element that was added to the bin.
|
||||
|
||||
<!-- ##### SIGNAL GstBin::element-removed ##### -->
|
||||
<para>
|
||||
Will be emitted if an element was removed from this bin.
|
||||
</para>
|
||||
|
||||
@gstbin: the object which received the signal.
|
||||
@arg1: the element that was removed from the bin.
|
||||
|
||||
<!-- ##### STRUCT GstBinClass ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@parent_class:
|
||||
@add_element:
|
||||
@remove_element:
|
||||
|
||||
<!-- ##### ENUM GstBinFlags ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GST_BIN_FLAG_LAST:
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_add ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@element:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_remove ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@element:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_get_by_name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_get_by_name_recurse_up ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_get_by_interface ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@interface:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_iterate_elements ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_iterate_recurse ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_iterate_sinks ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_iterate_all_by_interface ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@interface:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_add_many ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@element_1:
|
||||
@Varargs:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_bin_remove_many ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@bin:
|
||||
@element_1:
|
||||
@Varargs:
|
||||
|
||||
|
|
@ -1,407 +0,0 @@
|
|||
<!-- ##### SECTION Title ##### -->
|
||||
GstBuffer
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Data-passing buffer type, supporting sub-buffers.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
Buffers are the basic unit of data transfer in GStreamer. The GstBuffer type
|
||||
provides all the state necessary to define a region of memory as part of a
|
||||
stream. Sub-buffers are also supported, allowing a smaller region of a
|
||||
buffer to become its own buffer, with mechanisms in place to ensure that
|
||||
neither memory space goes away.
|
||||
</para>
|
||||
<para>
|
||||
Buffers are usually created with gst_buffer_new(). After a buffer has been
|
||||
created one will typically allocate memory for it and set the size of the
|
||||
buffer data. The following example creates a buffer that can hold a given
|
||||
video frame with a given width, height and bits per plane.
|
||||
<example>
|
||||
<title>Creating a buffer for a video frame</title>
|
||||
<programlisting>
|
||||
GstBuffer *buffer;
|
||||
gint size, width, height, bpp;
|
||||
|
||||
...
|
||||
|
||||
size = width * height * bpp;
|
||||
|
||||
buffer = gst_buffer_new ();
|
||||
GST_BUFFER_SIZE (buffer) = size;
|
||||
GST_BUFFER_MALLOCDATA (buffer) = g_alloc (size);
|
||||
GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
|
||||
...
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Alternatively, use gst_buffer_new_and_alloc()
|
||||
to create a buffer with preallocated data of a given size.
|
||||
</para>
|
||||
<para>
|
||||
If an element knows what pad you will push the buffer out on, it should use
|
||||
gst_pad_alloc_buffer() instead to create a buffer. This allows downstream
|
||||
elements to provide special buffers to write in, like hardware buffers.
|
||||
</para>
|
||||
<para>
|
||||
gst_buffer_ref() is used to increase the refcount of a buffer. This must be
|
||||
done when you want to keep a handle to the buffer after pushing it to the
|
||||
next element.
|
||||
</para>
|
||||
<para>
|
||||
To efficiently create a smaller buffer out of an existing one, you can
|
||||
use gst_buffer_create_sub().
|
||||
</para>
|
||||
<para>
|
||||
If the plug-in wants to modify the buffer in-place, it should first obtain
|
||||
a buffer that is safe to modify by using gst_buffer_make_writable(). This
|
||||
function is optimized so that a copy will only be made when it is necessary.
|
||||
</para>
|
||||
<para>
|
||||
Several flags of the buffer can be set and unset with the GST_BUFFER_FLAG_SET()
|
||||
and GST_BUFFER_FLAG_UNSET() macros. Use GST_BUFFER_FLAG_IS_SET() to test it
|
||||
a certain #GstBufferFlag is set.
|
||||
</para>
|
||||
<para>
|
||||
Buffers can be efficiently merged into a larger buffer with gst_buffer_merge() and
|
||||
gst_buffer_span() if the gst_buffer_is_span_fast() function returns TRUE.
|
||||
</para>
|
||||
<para>
|
||||
An element should either unref the buffer or push it out on a src pad
|
||||
using gst_pad_push() (see #GstPad).
|
||||
|
||||
Buffers usually are freed by unreffing them with gst_buffer_unref().
|
||||
Do not use gst_buffer_free() : this function effectively frees the buffer
|
||||
regardless of the refcount, which is dangerous.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Last reviewed on August 12th, 2004 (0.8.5)
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GstPad, #GstMiniObject
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GstBuffer ##### -->
|
||||
<para>
|
||||
The basic structure of a buffer.
|
||||
</para>
|
||||
|
||||
@mini_object:
|
||||
@data:
|
||||
@size:
|
||||
@timestamp:
|
||||
@duration:
|
||||
@caps:
|
||||
@offset:
|
||||
@offset_end:
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_new_and_alloc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### ENUM GstBufferFlag ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GST_BUFFER_FLAG_READONLY:
|
||||
@GST_BUFFER_FLAG_ORIGINAL:
|
||||
@GST_BUFFER_FLAG_PREROLL:
|
||||
@GST_BUFFER_FLAG_DISCONT:
|
||||
@GST_BUFFER_FLAG_IN_CAPS:
|
||||
@GST_BUFFER_FLAG_GAP:
|
||||
@GST_BUFFER_FLAG_DELTA_UNIT:
|
||||
@GST_BUFFER_FLAG_LAST:
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_FLAGS ##### -->
|
||||
<para>
|
||||
Gets the flags from this buffer.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to retrieve the flags from.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_FLAG_IS_SET ##### -->
|
||||
<para>
|
||||
Gives the status of a given flag of a buffer.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to query flags of.
|
||||
@flag: the #GstBufferFlag to check.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_FLAG_SET ##### -->
|
||||
<para>
|
||||
Sets a buffer flag.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to modify flags of.
|
||||
@flag: the #GstBufferFlag to set.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_FLAG_UNSET ##### -->
|
||||
<para>
|
||||
Clears a buffer flag.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to modify flags of.
|
||||
@flag: the #GstBufferFlag to clear.
|
||||
|
||||
|
||||
<!-- ##### MACRO gst_buffer_set_data ##### -->
|
||||
<para>
|
||||
A convenience function to set the data and size on a buffer
|
||||
</para>
|
||||
|
||||
@buf: The buffer to modify
|
||||
@data: The data to set on the buffer
|
||||
@size: The size to set on the buffer
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_DATA ##### -->
|
||||
<para>
|
||||
Retrieves a pointer to the data element of this buffer.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to get data pointer of.
|
||||
@Returns: the pointer to the actual data contents of the buffer.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_SIZE ##### -->
|
||||
<para>
|
||||
Gets the size of the data in this buffer.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to get data size of.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_TIMESTAMP ##### -->
|
||||
<para>
|
||||
Gets the timestamp for this buffer.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to get timestamp of.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_DURATION ##### -->
|
||||
<para>
|
||||
Gets the duration in nanoseconds of the data in the buffer.
|
||||
Value will be GST_CLOCK_TIME_NONE if the duration is unknown.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to get the duration from.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_OFFSET ##### -->
|
||||
<para>
|
||||
Gets the offset in the source file of the beinning of this buffer.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to get offset of.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_OFFSET_END ##### -->
|
||||
<para>
|
||||
Gets the offset in the source file of the end of this buffer.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to get offset of.
|
||||
|
||||
|
||||
<!-- ##### MACRO gst_buffer_ref ##### -->
|
||||
<para>
|
||||
Increases the refcount of the given buffer by one.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to increase the refcount of.
|
||||
|
||||
|
||||
<!-- ##### MACRO gst_buffer_unref ##### -->
|
||||
<para>
|
||||
Decreases the refcount of the buffer. If the refcount reaches 0, the buffer
|
||||
will be freed.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to unref.
|
||||
|
||||
|
||||
<!-- ##### MACRO gst_buffer_copy ##### -->
|
||||
<para>
|
||||
Copies the given buffer using the copy function of the parent GstData structure.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to copy.
|
||||
@Returns: a new #GstBuffer copy of the buffer.
|
||||
|
||||
|
||||
<!-- ##### MACRO gst_buffer_is_writable ##### -->
|
||||
<para>
|
||||
Tests if you can safely write data into a buffer's data array.
|
||||
</para>
|
||||
|
||||
@buf: a #GstBuffer to check
|
||||
|
||||
|
||||
<!-- ##### MACRO gst_buffer_make_writable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buf:
|
||||
|
||||
|
||||
<!-- ##### MACRO gst_buffer_replace ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@obuf:
|
||||
@nbuf:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_get_caps ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_set_caps ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@caps:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_create_sub ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@parent:
|
||||
@offset:
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_is_span_fast ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buf1:
|
||||
@buf2:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_span ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buf1:
|
||||
@offset:
|
||||
@buf2:
|
||||
@len:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_TRACE_NAME ##### -->
|
||||
<para>
|
||||
The name used for tracing memory allocations
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_OFFSET_NONE ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_DURATION_IS_VALID ##### -->
|
||||
<para>
|
||||
Tests if the duration is known.
|
||||
</para>
|
||||
|
||||
@buffer: the #GstBuffer to check for the duration
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_TIMESTAMP_IS_VALID ##### -->
|
||||
<para>
|
||||
Tests if the timestamp is known.
|
||||
</para>
|
||||
|
||||
@buffer: the #GstBuffer to check for the timestamp
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_OFFSET_IS_VALID ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BUFFER_OFFSET_END_IS_VALID ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_stamp ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dest:
|
||||
@src:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_join ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buf1:
|
||||
@buf2:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_buffer_merge ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buf1:
|
||||
@buf2:
|
||||
@Returns:
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ gst_base_src_set_live (GstBaseSrc * src, gboolean live)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_base_src_get_live:
|
||||
* gst_base_src_is_live:
|
||||
* @src: base source instance
|
||||
*
|
||||
* Check if an element is in live mode.
|
||||
|
|
56
gst/gstbin.c
56
gst/gstbin.c
|
@ -22,6 +22,46 @@
|
|||
*
|
||||
* MT safe.
|
||||
*/
|
||||
/**
|
||||
* SECTION:gstbin
|
||||
* @short_description: Base class for elements that contain other elements
|
||||
*
|
||||
* GstBin is the simplest of the container elements, allowing elements to
|
||||
* become children of itself. Pads from the child elements can be ghosted to
|
||||
* the bin, making the bin itself look transparently like any other element,
|
||||
* allowing for deep nesting of predefined sub-pipelines.
|
||||
*
|
||||
* A new GstBin is created with gst_bin_new(). Use a #GstPipeline instead if you
|
||||
* want to create a toplevel bin because a normal bin doesn't have a scheduler
|
||||
* of its own.
|
||||
*
|
||||
* After the bin has been created you will typically add elements to it with
|
||||
* gst_bin_add(). You can remove elements with gst_bin_remove().
|
||||
*
|
||||
* An element can be retrieved from a bin with gst_bin_get_by_name(), using the
|
||||
* elements name. gst_bin_get_by_name_recurse_up() is mainly used for internal
|
||||
* purposes and will query the parent bins when the element is not found in the
|
||||
* current bin.
|
||||
*
|
||||
* The list of elements in a bin can be retrieved with gst_bin_get_list().
|
||||
*
|
||||
* After the bin has been set to the PLAYING state (with gst_element_set_state()),
|
||||
* gst_bin_iterate() is used to process the elements in the bin.
|
||||
*
|
||||
* The "element_added" signal is fired whenever a new element is added to the
|
||||
* bin. Likewise the "element_removed" signal is fired whenever an element is
|
||||
* removed from the bin.
|
||||
*
|
||||
* gst_bin_destroy() is used to destroy the bin.
|
||||
*
|
||||
* To control the selection of the clock in a bin, you can use the following
|
||||
* methods:
|
||||
* gst_bin_auto_clock() to let the bin select a clock automatically,
|
||||
* gst_bin_get_clock() to get the current clock of the bin and
|
||||
* gst_bin_use_clock() to specify a clock explicitly.
|
||||
* Note that the default behaviour is to automatically select a clock from one
|
||||
* of the clock providers in the bin.
|
||||
*/
|
||||
|
||||
#include "gst_private.h"
|
||||
|
||||
|
@ -183,10 +223,24 @@ gst_bin_class_init (GstBinClass * klass)
|
|||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
/**
|
||||
* GstBin::element-added:
|
||||
* @bin: the object which emitted the signal.
|
||||
* @element: the element that was added to the bin
|
||||
*
|
||||
* Will be emitted if a new element was removed/added to this bin.
|
||||
*/
|
||||
gst_bin_signals[ELEMENT_ADDED] =
|
||||
g_signal_new ("element-added", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GstBinClass, element_added), NULL,
|
||||
NULL, gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT);
|
||||
/**
|
||||
* GstBin::element-removed:
|
||||
* @bin: the object which emitted the signal.
|
||||
* @element: the element that was removed from the bin
|
||||
*
|
||||
* Will be emitted if an element was removed from this bin.
|
||||
*/
|
||||
gst_bin_signals[ELEMENT_REMOVED] =
|
||||
g_signal_new ("element-removed", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GstBinClass, element_removed), NULL,
|
||||
|
@ -1688,7 +1742,7 @@ gst_bin_get_by_interface (GstBin * bin, GType interface)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_bin_get_all_by_interface:
|
||||
* gst_bin_iterate_all_by_interface:
|
||||
* @bin: bin to find elements in
|
||||
* @interface: interface to be implemented by interface
|
||||
*
|
||||
|
|
|
@ -19,7 +19,74 @@
|
|||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gstbuffer
|
||||
* @short_description: Data-passing buffer type, supporting sub-buffers.
|
||||
* @see_also: #GstPad, #GstMiniObject
|
||||
*
|
||||
* Buffers are the basic unit of data transfer in GStreamer. The GstBuffer type
|
||||
* provides all the state necessary to define a region of memory as part of a
|
||||
* stream. Sub-buffers are also supported, allowing a smaller region of a
|
||||
* buffer to become its own buffer, with mechanisms in place to ensure that
|
||||
* neither memory space goes away.
|
||||
*
|
||||
* Buffers are usually created with gst_buffer_new(). After a buffer has been
|
||||
* created one will typically allocate memory for it and set the size of the
|
||||
* buffer data. The following example creates a buffer that can hold a given
|
||||
* video frame with a given width, height and bits per plane.
|
||||
* <example>
|
||||
* <title>Creating a buffer for a video frame</title>
|
||||
* <programlisting>
|
||||
* GstBuffer *buffer;
|
||||
* gint size, width, height, bpp;
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* size = width * height * bpp;
|
||||
*
|
||||
* buffer = gst_buffer_new ();
|
||||
* GST_BUFFER_SIZE (buffer) = size;
|
||||
* GST_BUFFER_MALLOCDATA (buffer) = g_alloc (size);
|
||||
* GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
|
||||
* ...
|
||||
* </programlisting>
|
||||
* </example>
|
||||
*
|
||||
* Alternatively, use gst_buffer_new_and_alloc()
|
||||
* to create a buffer with preallocated data of a given size.
|
||||
*
|
||||
* If an element knows what pad you will push the buffer out on, it should use
|
||||
* gst_pad_alloc_buffer() instead to create a buffer. This allows downstream
|
||||
* elements to provide special buffers to write in, like hardware buffers.
|
||||
*
|
||||
* gst_buffer_ref() is used to increase the refcount of a buffer. This must be
|
||||
* done when you want to keep a handle to the buffer after pushing it to the
|
||||
* next element.
|
||||
*
|
||||
* To efficiently create a smaller buffer out of an existing one, you can
|
||||
* use gst_buffer_create_sub().
|
||||
*
|
||||
* If the plug-in wants to modify the buffer in-place, it should first obtain
|
||||
* a buffer that is safe to modify by using gst_buffer_make_writable(). This
|
||||
* function is optimized so that a copy will only be made when it is necessary.
|
||||
*
|
||||
* Several flags of the buffer can be set and unset with the GST_BUFFER_FLAG_SET()
|
||||
* and GST_BUFFER_FLAG_UNSET() macros. Use GST_BUFFER_FLAG_IS_SET() to test it
|
||||
* a certain #GstBufferFlag is set.
|
||||
*
|
||||
* Buffers can be efficiently merged into a larger buffer with gst_buffer_merge()
|
||||
* and gst_buffer_span() if the gst_buffer_is_span_fast() function returns TRUE.
|
||||
*
|
||||
* An element should either unref the buffer or push it out on a src pad
|
||||
* using gst_pad_push() (see #GstPad).
|
||||
*
|
||||
* Buffers usually are freed by unreffing them with gst_buffer_unref().
|
||||
* Do not use gst_buffer_free() : this function effectively frees the buffer
|
||||
* regardless of the refcount, which is dangerous.
|
||||
*
|
||||
* Last reviewed on August 12th, 2004 (0.8.5)
|
||||
*
|
||||
*/
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gstbuffer.h"
|
||||
|
@ -320,7 +387,7 @@ gst_subbuffer_init (GTypeInstance * instance, gpointer g_class)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_create_subbuffer:
|
||||
* gst_buffer_create_sub:
|
||||
* @parent: a parent #GstBuffer to create a subbuffer from.
|
||||
* @offset: the offset into parent #GstBuffer.
|
||||
* @size: the size of the new #GstBuffer sub-buffer (with size > 0).
|
||||
|
|
193
gst/gstbuffer.h
193
gst/gstbuffer.h
|
@ -33,6 +33,11 @@ G_BEGIN_DECLS
|
|||
typedef struct _GstBuffer GstBuffer;
|
||||
typedef struct _GstBufferClass GstBufferClass;
|
||||
|
||||
/**
|
||||
* GST_BUFFER_TRACE_NAME:
|
||||
*
|
||||
* The name used for tracing memory allocations.
|
||||
*/
|
||||
#define GST_BUFFER_TRACE_NAME "GstBuffer"
|
||||
|
||||
#define GST_TYPE_BUFFER (gst_buffer_get_type())
|
||||
|
@ -43,25 +48,157 @@ typedef struct _GstBufferClass GstBufferClass;
|
|||
#define GST_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BUFFER, GstBufferClass))
|
||||
#define GST_BUFFER_CAST(obj) ((GstBuffer *)(obj))
|
||||
|
||||
/**
|
||||
* GST_BUFFER_FLAGS:
|
||||
* @buf: a #GstBuffer to retrieve the flags from.
|
||||
*
|
||||
* Gets the flags from this buffer.
|
||||
*
|
||||
* Returns: the set of #GstBufferFlag items
|
||||
*/
|
||||
#define GST_BUFFER_FLAGS(buf) GST_MINI_OBJECT_FLAGS(buf)
|
||||
/**
|
||||
* GST_BUFFER_FLAG_IS_SET:
|
||||
* @buf: a #GstBuffer to query flags of.
|
||||
* @flag: the #GstBufferFlag to check.
|
||||
*
|
||||
* Gives the status of a given flag of a buffer.
|
||||
*
|
||||
* Returns: %TRUE if flag is set.
|
||||
*/
|
||||
#define GST_BUFFER_FLAG_IS_SET(buf,flag) GST_MINI_OBJECT_FLAG_IS_SET (buf, flag)
|
||||
/**
|
||||
* GST_BUFFER_FLAG_SET:
|
||||
* @buf: a #GstBuffer to modify flags of.
|
||||
* @flag: the #GstBufferFlag to set.
|
||||
*
|
||||
* Sets a buffer flag.
|
||||
*/
|
||||
#define GST_BUFFER_FLAG_SET(buf,flag) GST_MINI_OBJECT_FLAG_SET (buf, flag)
|
||||
/**
|
||||
* GST_BUFFER_FLAG_UNSET:
|
||||
* @buf: a #GstBuffer to modify flags of.
|
||||
* @flag: the #GstBufferFlag to clear.
|
||||
*
|
||||
* Clears a buffer flag.
|
||||
*/
|
||||
#define GST_BUFFER_FLAG_UNSET(buf,flag) GST_MINI_OBJECT_FLAG_UNSET (buf, flag)
|
||||
|
||||
/**
|
||||
* GST_BUFFER_DATA:
|
||||
* @buf: a #GstBuffer to get data pointer of.
|
||||
*
|
||||
* Retrieves a pointer to the data element of this buffer.
|
||||
*
|
||||
* Returns: the pointer to the actual data contents of the buffer.
|
||||
*/
|
||||
#define GST_BUFFER_DATA(buf) (GST_BUFFER_CAST(buf)->data)
|
||||
/**
|
||||
* GST_BUFFER_SIZE:
|
||||
* @buf: a #GstBuffer to get data size of.
|
||||
*
|
||||
* Gets the size of the data in this buffer.
|
||||
*
|
||||
* Returns: the buffer size in bytes
|
||||
*/
|
||||
#define GST_BUFFER_SIZE(buf) (GST_BUFFER_CAST(buf)->size)
|
||||
/**
|
||||
* GST_BUFFER_TIMESTAMP:
|
||||
* @buf: a #GstBuffer to get the timestamp of.:
|
||||
*
|
||||
* Gets the timestamp for this buffer.
|
||||
*
|
||||
* Returns: the timestamp for this buffer
|
||||
*/
|
||||
#define GST_BUFFER_TIMESTAMP(buf) (GST_BUFFER_CAST(buf)->timestamp)
|
||||
/**
|
||||
* GST_BUFFER_DURATION:
|
||||
* @buf: a #GstBuffer to get the duration from.
|
||||
*
|
||||
* Gets the duration in nanoseconds of the data in the buffer.
|
||||
* Value will be %GST_CLOCK_TIME_NONE if the duration is unknown.
|
||||
*
|
||||
* Returns: the duration of the buffer
|
||||
*/
|
||||
#define GST_BUFFER_DURATION(buf) (GST_BUFFER_CAST(buf)->duration)
|
||||
/**
|
||||
* GST_BUFFER_CAPS:
|
||||
* @buf: a #GstBuffer to get the caps of.
|
||||
*
|
||||
* Gets the caps for this buffer.
|
||||
*
|
||||
* Returns: the #GstCaps for this buffer
|
||||
*/
|
||||
#define GST_BUFFER_CAPS(buf) (GST_BUFFER_CAST(buf)->caps)
|
||||
/**
|
||||
* GST_BUFFER_OFFSET:
|
||||
* @buf: a #GstBuffer to get the offset of.
|
||||
*
|
||||
* Gets the offset in the source file of the beginning of this buffer.
|
||||
*
|
||||
* Returns: the start offset for this buffer
|
||||
*/
|
||||
#define GST_BUFFER_OFFSET(buf) (GST_BUFFER_CAST(buf)->offset)
|
||||
/**
|
||||
* GST_BUFFER_OFFSET_END:
|
||||
* @buf: a #GstBuffer to get the offset of.
|
||||
*
|
||||
* Gets the offset in the source file of the end of this buffer.
|
||||
*
|
||||
* Returns: the end offset for this buffer
|
||||
*/
|
||||
#define GST_BUFFER_OFFSET_END(buf) (GST_BUFFER_CAST(buf)->offset_end)
|
||||
/**
|
||||
* GST_BUFFER_MALLOCDATA:
|
||||
* @buf: a #GstBuffer to get access to the malloc_data field
|
||||
*
|
||||
* If the buffers data should be automatically freed by buffer management at the
|
||||
* end of the buffers lifecycle, also set the data to the mallocdata field.
|
||||
*/
|
||||
#define GST_BUFFER_MALLOCDATA(buf) (GST_BUFFER_CAST(buf)->malloc_data)
|
||||
|
||||
/**
|
||||
* GST_BUFFER_OFFSET_NONE:
|
||||
*
|
||||
* Constant for no-offset return results.
|
||||
*/
|
||||
#define GST_BUFFER_OFFSET_NONE ((guint64)-1)
|
||||
|
||||
/**
|
||||
* GST_BUFFER_DURATION_IS_VALID:
|
||||
* @buffer: the #GstBuffer to check for the duration
|
||||
*
|
||||
* Tests if the duration is known.
|
||||
*
|
||||
* Returns: %TRUE for success
|
||||
*/
|
||||
#define GST_BUFFER_DURATION_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)))
|
||||
/**
|
||||
* GST_BUFFER_TIMESTAMP_IS_VALID:
|
||||
* @buffer: the #GstBuffer to check for the timestamp
|
||||
*
|
||||
* Tests if the timestamp is known.
|
||||
*
|
||||
* Returns: %TRUE for success
|
||||
*/
|
||||
#define GST_BUFFER_TIMESTAMP_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)))
|
||||
/**
|
||||
* GST_BUFFER_OFFSET_IS_VALID:
|
||||
* @buffer: the #GstBuffer to check for the start offset
|
||||
*
|
||||
* Tests if the start offset is known.
|
||||
*
|
||||
* Returns: %TRUE for success
|
||||
*/
|
||||
#define GST_BUFFER_OFFSET_IS_VALID(buffer) (GST_BUFFER_OFFSET (buffer) != GST_BUFFER_OFFSET_NONE)
|
||||
/**
|
||||
* GST_BUFFER_OFFSET_END_IS_VALID:
|
||||
* @buffer: the #GstBuffer to check for the end offset
|
||||
*
|
||||
* Tests if the end offset is known.
|
||||
*
|
||||
* Returns: %TRUE for success
|
||||
*/
|
||||
#define GST_BUFFER_OFFSET_END_IS_VALID(buffer) (GST_BUFFER_OFFSET_END (buffer) != GST_BUFFER_OFFSET_NONE)
|
||||
|
||||
/**
|
||||
|
@ -115,9 +252,9 @@ struct _GstBuffer {
|
|||
guint64 offset;
|
||||
guint64 offset_end;
|
||||
|
||||
/*< private >*/
|
||||
guint8 *malloc_data;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
|
@ -131,6 +268,14 @@ GType gst_buffer_get_type (void);
|
|||
GstBuffer* gst_buffer_new (void);
|
||||
GstBuffer* gst_buffer_new_and_alloc (guint size);
|
||||
|
||||
/**
|
||||
* gst_buffer_set_data:
|
||||
* @buf: The buffer to modify
|
||||
* @data: The data to set on the buffer
|
||||
* @size: The size to set on the buffer
|
||||
*
|
||||
* A convenience function to set the data and size on a buffer.
|
||||
*/
|
||||
#define gst_buffer_set_data(buf, data, size) \
|
||||
G_STMT_START { \
|
||||
GST_BUFFER_DATA (buf) = data; \
|
||||
|
@ -138,13 +283,59 @@ G_STMT_START { \
|
|||
} G_STMT_END
|
||||
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_buffer_ref:
|
||||
* @buf: a #GstBuffer to increase the refcount of.
|
||||
*
|
||||
* Increases the refcount of the given buffer by one.
|
||||
*/
|
||||
#define gst_buffer_ref(buf) GST_BUFFER_CAST (gst_mini_object_ref (GST_MINI_OBJECT (buf)))
|
||||
/**
|
||||
* gst_buffer_unref:
|
||||
* @buf: a #GstBuffer to decrease the refcount of.
|
||||
*
|
||||
* Decreases the refcount of the buffer. If the refcount reaches 0, the buffer
|
||||
* will be freed.
|
||||
*/
|
||||
#define gst_buffer_unref(buf) gst_mini_object_unref (GST_MINI_OBJECT (buf))
|
||||
|
||||
/* copy buffer */
|
||||
/**
|
||||
* gst_buffer_copy:
|
||||
* @buf: a #GstBuffer to copy.
|
||||
*
|
||||
* Copies the given buffer using the copy function of the parent #GstData
|
||||
* structure.
|
||||
*
|
||||
* Returns: a new #GstBuffer copy of the buffer.
|
||||
*/
|
||||
#define gst_buffer_copy(buf) GST_BUFFER_CAST (gst_mini_object_copy (GST_MINI_OBJECT (buf)))
|
||||
/**
|
||||
* gst_buffer_is_writable:
|
||||
* @buf: a #GstBuffer to check
|
||||
*
|
||||
* Tests if you can safely write data into a buffer's data array.
|
||||
*
|
||||
* Returns: %TRUE if buffer is writable
|
||||
*/
|
||||
#define gst_buffer_is_writable(buf) gst_mini_object_is_writable (GST_MINI_OBJECT (buf))
|
||||
/**
|
||||
* gst_buffer_make_writable:
|
||||
* @buf: a #GstBuffer to make writable
|
||||
*
|
||||
* Makes a buffer writable.
|
||||
*
|
||||
* Returns: a #GstBuffer that is writable
|
||||
*/
|
||||
#define gst_buffer_make_writable(buf) GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT (buf)))
|
||||
|
||||
/**
|
||||
* gst_buffer_replace:
|
||||
* @obuf: a #GstBuffer to receive the data
|
||||
* @nbuf: a #GstBuffer to take the data from
|
||||
*
|
||||
* Replaces the data in @obuf with the one in @nbuf
|
||||
*/
|
||||
#define gst_buffer_replace(obuf,nbuf) gst_mini_object_replace ((GstMiniObject **)(obuf), GST_MINI_OBJECT (nbuf))
|
||||
|
||||
GstCaps* gst_buffer_get_caps (GstBuffer *buffer);
|
||||
|
|
|
@ -251,7 +251,7 @@ gst_base_src_set_live (GstBaseSrc * src, gboolean live)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_base_src_get_live:
|
||||
* gst_base_src_is_live:
|
||||
* @src: base source instance
|
||||
*
|
||||
* Check if an element is in live mode.
|
||||
|
|
|
@ -135,7 +135,7 @@ set. Every element between the braces is put into the bin. Using curly braces
|
|||
(second line) is a short cut for using the first line and "thread" as the
|
||||
BINTYPE.
|
||||
.br
|
||||
Please not the dot that has to be used after the BINTYPE.
|
||||
Please note the dot that has to be used after the BINTYPE.
|
||||
|
||||
.B Links
|
||||
|
||||
|
|
Loading…
Reference in a new issue