5. gstreamer插件所用函数整理
来源:互联网 发布:zknu教务网络管理系统 编辑:程序博客网 时间:2024/06/17 18:08
gstreamer插件所用函数整理
2016-10-06 08:30:46
(一)设置插件属性相关的函数:
(1) g_param_spec_boolean ()
函数链接如下:
https://developer.gnome.org/gobject/stable/gobject-Standard-Parameter-and-Value-Types.html
GParamSpec *
g_param_spec_boolean (const gchar *name,
constgchar *nick,
constgchar *blurb,
gboolean default_value,
GParamFlags flags);
Createsa new GParamSpecBooleaninstance specifying a G_TYPE_BOOLEAN property. In many cases,it may be more appropriate to use an enum withg_param_spec_enum(), both to improvecode clarity by using explicitly named values, and to allow for more values tobe added in future without breaking API.
See g_param_spec_internal() for details on property names.
Parameters
name
canonical name of the property specified
nick
nick name for the property specified
blurb
description of the property specified
default_value
default value for the property specified
flags
flags for the property specified
Returns
anewly created parameter specification.
(2) g_param_spec_internal ()
上个函数中标红的 g_param_spec_internal函数的解释,链接如下:
https://developer.gnome.org/gobject/stable/gobject-GParamSpec.html#g-param-spec-internal
gpointer
g_param_spec_internal (GType param_type,
const gchar *name,
constgchar *nick,
constgchar *blurb,
GParamFlags flags);
Createsa new GParamSpecinstance.
Aproperty name consists of segments consisting of ASCII letters and digits,separated by either the '-' or '_' character. The first character of a propertyname must be a letter. Names which violate these rules lead to undefinedbehaviour.
Whencreating and looking up a GParamSpec, either separator can be used, but theycannot be mixed. Using '-' is considerably more efficient and in fact requiredwhen using property names as detail strings for signals.
Beyondthe name, GParamSpecs have two more descriptive stringsassociated with them, the nick , which should be suitable for use as alabel for the property in a property editor, and the blurb , which should be a somewhat longer description,suitable for e.g. a tooltip. The nick and blurb should ideally be localized.
[skip]
Parameters
param_type
the GType for the property; must be derived fromG_TYPE_PARAM
name
the canonical name of the property
nick
the nickname of the property
blurb
a short description of the property
flags
a combination of GParamFlags
Returns
anewly allocated GParamSpec instance.
(3) enum GparamFlags
上面 g_param_spec_internal函数中标红的GParamFlags, 链接如下:
https://developer.gnome.org/gobject/stable/gobject-GParamSpec.html#GParamFlags
Throughthe GParamFlagsflag values, certain aspects of parameters can be configured. See alsoG_PARAM_STATIC_STRINGS.
Members
G_PARAM_READABLE
the parameter is readable
G_PARAM_WRITABLE
the parameter is writable
G_PARAM_READWRITE
alias for G_PARAM_READABLE | G_PARAM_WRITABLE
G_PARAM_CONSTRUCT
the parameter will be set upon object construction
G_PARAM_CONSTRUCT_ONLY
the parameter can only be set upon object construction
G_PARAM_LAX_VALIDATION
upon parameter conversion (see g_param_value_convert()) strict validation is not required
G_PARAM_STATIC_NAME
the string used as name when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter. Since 2.8
G_PARAM_PRIVATE
internal
G_PARAM_STATIC_NICK
the string used as nick when constructing the parameter is guaranteed to remain valid and unmmodified for the lifetime of the parameter. Since 2.8
G_PARAM_STATIC_BLURB
the string used as blurb when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter. Since 2.8
G_PARAM_EXPLICIT_NOTIFY
calls to g_object_set_property() for this property will not automatically result in a "notify" signal being emitted: the implementation must callg_object_notify() themselves in case the property actually changes. Since: 2.42.
G_PARAM_DEPRECATED
the parameter is deprecated and will be removed in a future version. A warning will be generated if it is used while running with G_ENABLE_DIAGNOSTIC=1. Since 2.26
平时在使用过程中,flags参数有一个G_PARAM_STATIC_STRINGS,但是在上面的表格中并没有发现这个参数,继续在这个页面中向下查看,可以看到:
G_PARAM_STATIC_STRINGS
#defineG_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |G_PARAM_STATIC_BLURB)
GParamFlags value alias forG_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB.
Since2.13.0
(4) g_param_spec_boolean ()
链接如下:
https://developer.gnome.org/gobject/stable/gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-boolean
GParamSpec *
g_param_spec_boolean (const gchar *name,
constgchar *nick,
const gchar *blurb,
gboolean default_value,
GParamFlags flags);
Createsa new GParamSpecBooleaninstance specifying a G_TYPE_BOOLEAN property. In many cases,it may be more appropriate to use an enum withg_param_spec_enum(), both to improvecode clarity by using explicitly named values, and to allow for more values tobe added in future without breaking API.
See g_param_spec_internal() for details on property names.
Parameters
name
canonical name of the property specified
nick
nick name for the property specified
blurb
description of the property specified
default_value
default value for the property specified
flags
flags for the property specified
Returns
anewly created parameter specification.
(5) g_param_spec_uint ()
链接如下:
https://developer.gnome.org/gobject/stable/gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-boolean
GParamSpec *
g_param_spec_uint (const gchar *name,
const gchar *nick,
const gchar *blurb,
guint minimum,
guint maximum,
guint default_value,
GParamFlags flags);
Createsa new GParamSpecUIntinstance specifying a G_TYPE_UINT property.
See g_param_spec_internal() for details on property names.
Parameters
name
canonical name of the property specified
nick
nick name for the property specified
blurb
description of the property specified
minimum
minimum value for the property specified
maximum
maximum value for the property specified
default_value
default value for the property specified
flags
flags for the property specified
Returns
anewly created parameter specification.
(6) g_object_class_install_property()
链接如下:
https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-class-install-property
void
g_object_class_install_property (GObjectClass *oclass,
guint property_id,
GParamSpec *pspec);
Installsa new property.
Allproperties should be installed during the class initializer. It is possible toinstall properties after that, but doing so is not recommend, and specifically,is not guaranteed to be thread-safe vs. use of properties on the same type onother threads.
Notethat it is possible to redefine a property in a derived class, by installing aproperty with the same name. This can be useful at times, e.g. to change therange of allowed values or the default value.
Parameters
oclass
a GObjectClass
property_id
the id for the new property
pspec
the GParamSpec for the new property
(7) g_value_set_string ()
void
g_value_set_string (GValue *value,
const gchar *v_string);
Setthe contents of a G_TYPE_STRING GValue to v_string .
Parameters
value
a valid GValue of type G_TYPE_STRING
v_string
caller-owned string to be duplicated for the GValue.
[allow-none]
(8) g_value_set_boolean ()
void
g_value_set_boolean (GValue *value,
gboolean v_boolean);
Setthe contents of a G_TYPE_BOOLEAN GValue to v_boolean .
Parameters
value
a valid GValue of type G_TYPE_BOOLEAN
v_boolean
boolean value to be set
(9) g_value_set_uint ()
void
g_value_set_uint (GValue *value,
guint v_uint);
Setthe contents of a G_TYPE_UINT GValue to v_uint .
Parameters
value
a valid GValue of type G_TYPE_UINT
v_uint
unsigned integer value to be set
(10) G_OBJECT_WARN_INVALID_PROPERTY_ID()
https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html
#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec)
Thismacro should be used to emit a standard warning about unexpected properties in set_property() and get_property() implementations.
Parameters
object
the GObject on which set_property() or get_property() was called
property_id
the numeric id of the property
pspec
the GParamSpec of the property
(11) g_value_dup_string ()
gchar *
g_value_dup_string(const GValue *value);
Get acopy the contents of a G_TYPE_STRING GValue.
Parameters
value
a valid GValue of type G_TYPE_STRING
Returns
anewly allocated copy of the string content of value
(12) g_value_get_boolean ()
gboolean
g_value_get_boolean(const GValue *value);
Getthe contents of a G_TYPE_BOOLEAN GValue.
Parameters
value
a valid GValue of type G_TYPE_BOOLEAN
Returns
booleancontents of value
(13) g_value_get_uint ()
guint
g_value_get_uint(const GValue *value);
Get thecontents of a G_TYPE_UINT GValue.
Parameters
value
a valid GValue of type G_TYPE_UINT
Returns
unsignedinteger contents of value
(二) 设置衬垫(Pad)相关的函数
(1) gst_element_class_add_pad_template()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-class-add-pad-template
gst_element_class_add_pad_template()
void
gst_element_class_add_pad_template (GstElementClass *klass,
GstPadTemplate *templ);
Adds apadtemplate to an element class. This is mainly used in the _class_initfunctions of classes. If a pad template with the same name as an alreadyexisting one is added the old one is replaced by the new one.
Parameters
klass
the GstElementClass to add the pad template to.
templ
a GstPadTemplate to add to the element class.
(2)gst_pad_template_new ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPadTemplate.html#gst-pad-template-new
GstPadTemplate *
gst_pad_template_new (const gchar *name_template,
GstPadDirection direction,
GstPadPresence presence,
GstCaps *caps);
Createsa new pad template with a name according to the given template and with thegiven arguments.
Parameters
name_template
the name template.
direction
the GstPadDirection of the template.
presence
the GstPadPresence of the pad.
caps
a GstCaps set for the template.
[transfer none]
Returns
a new GstPadTemplate.
其中的第一个参数:
enumGstPadDirection
Thedirection of a pad.
Members
GST_PAD_UNKNOWN
direction is unknown.
GST_PAD_SRC
the pad is a source pad.
GST_PAD_SINK
the pad is a sink pad.
其中的第二个参数:
enumGstPadPresence
Indicateswhen this pad will become available.
Members
GST_PAD_ALWAYS
the pad is always available
GST_PAD_SOMETIMES
the pad will become available depending on the media stream
GST_PAD_REQUEST
the pad is only available on request with gst_element_request_pad().
其中的第三个参数是GstCaps,它需要设置进行性能协商,有关性能协商的链接如下:
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html
所以,最后一个参数只能确定是一个(GstCaps *)类型的,具体的话还需要看代码。它最终需要调用GstCaps相关的函数来完成。
(三) 设置元数据(metadata)相关的函数
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-class-set-static-metadata
gst_element_class_set_static_metadata()
void
gst_element_class_set_static_metadata (GstElementClass *klass,
const gchar *longname,
const gchar *classification,
const gchar *description,
const gchar *author);
Setsthe detailed information for a GstElementClass.
Thisfunction is for use in _class_init functions only.
Sameas gst_element_class_set_metadata(), but longname , classification , description , and author must be static strings or inlined strings,as they will not be copied. (GStreamer plugins will be made resident onceloaded, so this function can be used even from dynamically loaded plugins.)
Parameters
klass
class to set metadata for
longname
The long English name of the element. E.g. "File Sink"
classification
String describing the type of element, as an unordered list separated with slashes ('/'). See draft-klass.txt of the design docs for more details and common types. E.g: "Sink/File"
description
Sentence describing the purpose of the element. E.g: "Write stream to a file"
author
Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"
(四) GST_DEBUG_FUNCPTR
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-DEBUG-FUNCPTR:CAPS
GST_DEBUG_FUNCPTR()
#define GST_DEBUG_FUNCPTR(ptr)
Registera pointer to a function with its name, so it can later be used by GST_DEBUG_FUNCPTR_NAME().
Parameters
ptr
pointer to the function to register
Returns
thevalue passed to ptr .
GST_DEBUG_FUNCPTR_NAME()
#define GST_DEBUG_FUNCPTR_NAME(ptr)
Retrievesthe name of the function, if it was previously registered with GST_DEBUG_FUNCPTR(). If not, it returns a description of thepointer.
Thismacro returns a constant string which must not be modified or freed by thecaller.
Parameters
ptr
address of the function of which to look up the name
(五) GstBaseSrcClass结构体和其中的相关方法
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSrc.html#GstBaseSrcClass
Typesand Values
struct GstBaseSrc
structGstBaseSrc;
Theopaque GstBaseSrc data structure.
struct GstBaseSrcClass
struct GstBaseSrcClass {
GstElementClassparent_class;
/* virtual methodsfor subclasses */
/* get caps fromsubclass */
GstCaps* (*get_caps) (GstBaseSrc *src, GstCaps *filter);
/* decide on caps*/
gboolean (*negotiate) (GstBaseSrc *src);
/* called if, innegotiation, caps need fixating */
GstCaps * (*fixate) (GstBaseSrc *src, GstCaps *caps);
/* notify thesubclass of new caps */
gboolean (*set_caps) (GstBaseSrc *src, GstCaps *caps);
/* setup allocationquery */
gboolean (*decide_allocation) (GstBaseSrc *src, GstQuery *query);
/* start and stopprocessing, ideal for opening/closing the resource */
gboolean (*start) (GstBaseSrc *src);
gboolean (*stop) (GstBaseSrc *src);
/* given a buffer,return start and stop time when it should be pushed
* out. The baseclass will sync on the clock using these times. */
void (*get_times) (GstBaseSrc *src, GstBuffer *buffer,
GstClockTime*start, GstClockTime *end);
/* get the totalsize of the resource in the format set by
*gst_base_src_set_format() */
gboolean (*get_size) (GstBaseSrc *src, guint64 *size);
/* check if theresource is seekable */
gboolean (*is_seekable) (GstBaseSrc *src);
/* Prepare thesegment on which to perform do_seek(), converting to the
* current basesrcformat. */
gboolean (*prepare_seek_segment) (GstBaseSrc *src,GstEvent *seek,
GstSegment *segment);
/* notifysubclasses of a seek */
gboolean (*do_seek) (GstBaseSrc *src, GstSegment *segment);
/* unlock anypending access to the resource. subclasses should unlock
* any functionASAP. */
gboolean (*unlock) (GstBaseSrc *src);
/* Clear anypending unlock request, as we succeeded in unlocking */
gboolean (*unlock_stop) (GstBaseSrc *src);
/* notify subclassesof a query */
gboolean (*query) (GstBaseSrc *src, GstQuery *query);
/* notifysubclasses of an event */
gboolean (*event) (GstBaseSrc *src, GstEvent *event);
/* ask the subclassto create a buffer with offset and size, the default
* implementationwill call alloc and fill. */
GstFlowReturn(*create) (GstBaseSrc *src, guint64offset, guint size,
GstBuffer**buf);
/* ask the subclassto allocate an output buffer. The default implementation
* will use thenegotiated allocator. */
GstFlowReturn(*alloc) (GstBaseSrc *src, guint64offset, guint size,
GstBuffer**buf);
/* ask the subclassto fill the buffer with data from offset and size */
GstFlowReturn(*fill) (GstBaseSrc *src, guint64offset, guint size,
GstBuffer*buf);
};
Subclassescan override any of the available virtual methods or not, as needed. At theminimum, the create method should be overridden to producebuffers.
Members
get_caps ()
Called to get the caps to report
negotiate ()
Negotiated the caps with the peer.
fixate ()
Called during negotiation if caps need fixating. Implement instead of setting a fixate function on the source pad.
set_caps ()
Notify subclass of changed output caps
decide_allocation ()
configure the allocation query
start ()
Start processing. Subclasses should open resources and prepare to produce data. Implementation should callgst_base_src_start_complete() when the operation completes, either from the current thread or any other thread that finishes the start operation asynchronously.
stop ()
Stop processing. Subclasses should use this to close resources.
get_times ()
Given a buffer, return the start and stop time when it should be pushed out. The base class will sync on the clock using these times.
get_size ()
Return the total size of the resource, in the format set by gst_base_src_set_format().
is_seekable ()
Check if the source can seek
prepare_seek_segment ()
Prepare the GstSegment that will be passed to the GstBaseSrcClass.do_seek() vmethod for executing a seek request. Sub-classes should override this if they support seeking in formats other than the configured native format. By default, it tries to convert the seek arguments to the configured native format and prepare a segment in that format.
do_seek ()
Perform seeking on the resource to the indicated segment.
unlock ()
Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP. In particular, any create() function in progress should be unblocked and should return GST_FLOW_FLUSHING. Any futureGstBaseSrcClass.create() function call should also return GST_FLOW_FLUSHING until theGstBaseSrcClass.unlock_stop() function has been called.
unlock_stop ()
Clear the previous unlock request. Subclasses should clear any state they set duringGstBaseSrcClass.unlock(), such as clearing command queues.
query ()
Handle a requested query.
event ()
Override this to implement custom event handling.
create ()
Ask the subclass to create a buffer with offset and size. When the subclass returns GST_FLOW_OK, it MUST return a buffer of the requested size unless fewer bytes are available because an EOS condition is near. No buffer should be returned when the return value is different from GST_FLOW_OK. A return value of GST_FLOW_EOS signifies that the end of stream is reached. The default implementation will callGstBaseSrcClass.alloc() and then call GstBaseSrcClass.fill().
alloc ()
Ask the subclass to allocate a buffer with for offset and size. The default implementation will create a new buffer from the negotiated allocator.
fill ()
Ask the subclass to fill the buffer with data for offset and size. The passed buffer is guaranteed to hold the requested amount of bytes.
enum GstBaseSrcFlags
The GstElement flags that a basesrc element may have.
Members
GST_BASE_SRC_FLAG_STARTING
has source is starting
GST_BASE_SRC_FLAG_STARTED
has source been started
GST_BASE_SRC_FLAG_LAST
offset to define more flags
(5.1) g_slice_alloc函数
gpointer
g_slice_alloc(gsize block_size);
Allocatesa block of memory from the slice allocator. The block adress handed out can beexpected to be aligned to at least 1 * sizeof (void*), though in general slicesare 2 * sizeof (void*) bytes aligned, if a malloc() fallback implementation is used instead,the alignment may be reduced in a libc dependent fashion. Note that theunderlying slice allocation mechanism can be changed with theG_SLICE=always-malloc environmentvariable.
Parameters
block_size
the number of bytes to allocate
Returns
apointer to the allocated memory block, which will be NULL if and only if mem_size is 0
Since:2.10
(5.3)gst_pad_get_pad_template_caps函数
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#gst-pad-get-pad-template-caps
GstCaps *
gst_pad_get_pad_template_caps(GstPad *pad);
Getsthe capabilities for pad 's template.
Parameters
pad
a GstPad to get the template capabilities from.
Returns
the GstCaps of this pad template. Unref after usage.
gst_caps_new_empty ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html#gst-caps-new-empty
GstCaps *
gst_caps_new_empty(void);
Createsa new GstCaps that is empty. That is, the returnedGstCaps contains no media formats. The GstCaps is guaranteed to be writable. Caller isresponsible for unreffing the returned caps.
Returns
thenew GstCaps.
gst_structure_set ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstStructure.html#gst-structure-set
void
gst_structure_set (GstStructure *structure,
const gchar *fieldname,
...);
Parsesthe variable arguments and sets fields accordingly. Fields that weren't alreadypart of the structure are added as needed. Variable arguments should be in theform field name, field type (as a GType), value(s). The last variable argumentshould beNULL.
Parameters
structure
a GstStructure
fieldname
the name of the field to set
...
variable arguments
gst_caps_append_structure ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html#gst-caps-append-structure
void
gst_caps_append_structure (GstCaps *caps,
GstStructure *structure);
Appendsstructure to caps . The structure is not copied; caps becomes the owner of structure .
Parameters
caps
the GstCaps that will be appended to
structure
the GstStructure to append.
gst_caps_simplify ()
GstCaps *
gst_caps_simplify(GstCaps *caps);
Convertsthe given caps into a representation that represents thesame set of formats, but in a simpler form. Component structures that areidentical are merged. Component structures that have values that can be mergedare also merged.
Thisfunction takes ownership of caps and will call gst_caps_make_writable() on it if necessary, so you must not use caps afterwards unless you keep an additionalreference to it withgst_caps_ref().
Thismethod does not preserve the original order of caps .
Parameters
caps
a GstCaps to simplify.
[transfer full]
Returns
Thesimplified caps.
gst_caps_ref ()
GstCaps *
gst_caps_ref(GstCaps *caps);
Add areference to a GstCaps object.
Fromthis point on, until the caller calls gst_caps_unref() or gst_caps_make_writable(), it is guaranteed that the caps objectwill not change. This means its structures won't change, etc. To use aGstCaps object, you must always have a refcount onit -- either the one made implicitly by e.g.gst_caps_new_simple(), or via taking one explicitly with thisfunction.
Parameters
caps
the GstCaps to reference
Returns
thesame GstCaps object.
gst_caps_intersect_full()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html#gst-caps-intersect-full
GstCaps *
gst_caps_intersect_full (GstCaps *caps1,
GstCaps *caps2,
GstCapsIntersectMode mode);
Createsa new GstCaps that contains all the formats that arecommon to both caps1 and caps2 , the order is defined by theGstCapsIntersectModeused.
Parameters
caps1
a GstCaps to intersect
caps2
a GstCaps to intersect
mode
The intersection algorithm/mode to use
Returns
thenew GstCaps.
enum GstCapsIntersectMode
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html#GstCapsIntersectMode
Modesof caps intersection
GST_CAPS_INTERSECT_ZIG_ZAG tries to preserve overall order of bothcaps by iterating on the caps' structures as the following matrix shows:
1
2
3
4
5
caps1
+-------------
| 1 2 4 7
caps2 | 3 5 8 10
| 6 9 11 12
Usedwhen there is no explicit precedence of one caps over the other. e.g. tee'ssink pad getcaps function, it will probe its src pad peers' for their caps andintersect them with this mode.
GST_CAPS_INTERSECT_FIRST is useful when an element wants topreserve another element's caps priority order when intersecting with its owncaps. Example: If caps1 is [A, B, C] and caps2 is [E, B, D, A], the resultwould be [A, B], maintaining the first caps priority on the intersection.
Members
GST_CAPS_INTERSECT_ZIG_ZAG
Zig-zags over both caps.
GST_CAPS_INTERSECT_FIRST
Keeps the first caps order.
(5.5)
struct GstVideoInfo
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo
struct GstVideoInfo {
constGstVideoFormatInfo *finfo;
GstVideoInterlaceMode interlace_mode;
GstVideoFlags flags;
gint width;
gint height;
gsize size;
gint views;
GstVideoChromaSite chroma_site;
GstVideoColorimetry colorimetry;
gint par_n;
gint par_d;
gint fps_n;
gint fps_d;
gsize offset[GST_VIDEO_MAX_PLANES];
gint stride[GST_VIDEO_MAX_PLANES];
/* Union preservespadded struct size for backwards compat
* Consumer codeshould use the accessor macros for fields */
union {
struct {
GstVideoMultiviewMode multiview_mode;
GstVideoMultiviewFlags multiview_flags;
} abi;
};
Informationdescribing image properties. This information can be filled in from GstCapswithgst_video_info_from_caps(). The information is also used to store thespecific video info when mapping a video frame withgst_video_frame_map().
Usethe provided macros to access the info in this structure.
Members
const GstVideoFormatInfo *finfo;
the format info of the video
GstVideoInterlaceModeinterlace_mode;
the interlace mode
GstVideoFlagsflags;
additional video flags
gintwidth;
the width of the video
gintheight;
the height of the video
gsizesize;
the default size of one frame
gintviews;
the number of views for multiview video
GstVideoChromaSitechroma_site;
a GstVideoChromaSite.
GstVideoColorimetrycolorimetry;
the colorimetry info
gintpar_n;
the pixel-aspect-ratio numerator
gintpar_d;
the pixel-aspect-ratio demnominator
gintfps_n;
the framerate numerator
gintfps_d;
the framerate demnominator
gsizeoffset[GST_VIDEO_MAX_PLANES];
offsets of the planes
gintstride[GST_VIDEO_MAX_PLANES];
strides of the planes
gst_video_info_from_caps ()
gboolean
gst_video_info_from_caps (GstVideoInfo *info,
const GstCaps *caps);
Parse caps and update info .
Parameters
info
a GstVideoInfo
caps
a GstCaps
Returns
TRUEif caps could be parsed
GST_VIDEO_FRAME_WIDTH()
#defineGST_VIDEO_FRAME_WIDTH(f) (GST_VIDEO_INFO_WIDTH(&(f)->info))
GST_VIDEO_FRAME_HEIGHT()
#defineGST_VIDEO_FRAME_HEIGHT(f) (GST_VIDEO_INFO_HEIGHT(&(f)->info))
GST_VIDEO_INFO_FPS_N()
#defineGST_VIDEO_INFO_FPS_N(i) ((i)->fps_n)
GST_VIDEO_INFO_FPS_D()
#defineGST_VIDEO_INFO_FPS_D(i) ((i)->fps_d)
gst_caps_copy ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html
GstCaps *
gst_caps_copy(const GstCaps *caps);
Createsa new GstCaps as a copy of the old caps . The new caps will have a refcount of 1,owned by the caller. The structures are copied as well.
Notethat this function is the semantic equivalent of a gst_caps_ref() followed by a gst_caps_make_writable(). If you only want to hold on to areference to the data, you should usegst_caps_ref().
Whenyou are finished with the caps, call gst_caps_unref() on it.
Parameters
caps
a GstCaps.
Returns
thenew GstCaps
gst_caps_is_equal ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html
gboolean
gst_caps_is_equal (const GstCaps *caps1,
const GstCaps *caps2);
Checksif the given caps represent the same set of caps.
Parameters
caps1
a GstCaps
caps2
another GstCaps
Returns
TRUE if both caps are equal.
(5.6)
gst_query_set_latency ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html#gst-query-set-latency
void
gst_query_set_latency (GstQuery *query,
gboolean live,
GstClockTime min_latency,
GstClockTime max_latency);
Answera latency query by setting the requested values in the given format.
Parameters
query
a GstQuery
live
if there is a live element upstream
min_latency
the minimal latency of the upstream elements
max_latency
the maximal latency of the upstream elements
(5.7)
gst_query_parse_allocation ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html#gst-query-parse-allocation
void
gst_query_parse_allocation (GstQuery *query,
GstCaps **caps,
gboolean *need_pool);
Parsean allocation query, writing the requested caps in caps and whether a pool is needed in need_pool , if the respective parameters are non-NULL.
Parameters
query
a GstQuery
caps
The GstCaps.
[out][transfer none][allow-none]
need_pool
Whether a GstBufferPool is needed.
[out][allow-none]
gst_video_info_init ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#gst-video-info-init
void
gst_video_info_init(GstVideoInfo *info);
Initializeinfo with default values.
Parameters
info
a GstVideoInfo
gst_video_info_from_caps ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#gst-video-info-init
gboolean
gst_video_info_from_caps (GstVideoInfo *info,
const GstCaps *caps);
Parse caps and update info .
Parameters
info
a GstVideoInfo
caps
a GstCaps
Returns
TRUEif caps could be parsed
gst_query_get_n_allocation_pools ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html#gst-query-add-allocation-pool
guint
gst_query_get_n_allocation_pools(GstQuery *query);
Retrievethe number of values currently stored in the pool array of the query'sstructure.
Parameters
query
a GST_QUERY_ALLOCATION type query GstQuery
Returns
thepool array size as a guint.
gst_query_set_nth_allocation_pool ()
void
gst_query_set_nth_allocation_pool (GstQuery *query,
guint index,
GstBufferPool *pool,
guint size,
guint min_buffers,
guint max_buffers);
Setthe pool parameters in query .
Parameters
index
index to modify
query
A valid GstQuery of type GST_QUERY_ALLOCATION.
pool
the GstBufferPool.
[transfer none][allow-none]
size
the size
min_buffers
the min buffers
max_buffers
the max buffers
gst_query_add_allocation_pool ()
void
gst_query_add_allocation_pool (GstQuery *query,
GstBufferPool *pool,
guint size,
guint min_buffers,
guint max_buffers);
Setthe pool parameters in query.
Parameters
query
A valid GstQuery of type GST_QUERY_ALLOCATION.
pool
the GstBufferPool.
[transfer none][allow-none]
size
the size
min_buffers
the min buffers
max_buffers
the max buffers
gst_query_get_n_allocation_params ()
guint
gst_query_get_n_allocation_params(GstQuery *query);
Retrievethe number of values currently stored in the allocator params array of thequery's structure.
If nomemory allocator is specified, the downstream element can handle the defaultmemory allocator. The first memory allocator in the query should be generic andallow mapping to system memory, all following allocators should be ordered bypreference with the preferred one first.
Parameters
query
a GST_QUERY_ALLOCATION type query GstQuery
Returns
theallocator array size as a guint.
gst_query_parse_nth_allocation_param ()
void
gst_query_parse_nth_allocation_param (GstQuery *query,
guint index,
GstAllocator **allocator,
GstAllocationParams *params);
Parsean available query and get the allocator and its params at index of the allocator array.
Parameters
query
a GST_QUERY_ALLOCATION type query GstQuery
index
position in the allocator array to read
allocator
variable to hold the result.
[out][transfer full][allow-none]
params
parameters for the allocator.
gst_allocation_params_init ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstAllocator.html#gst-allocation-params-init
void
gst_allocation_params_init(GstAllocationParams *params);
Initializeparams to its default values
Parameters
params
a GstAllocationParams
gst_query_parse_nth_allocation_pool ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html#gst-query-get-n-allocation-pools
void
gst_query_parse_nth_allocation_pool (GstQuery *query,
guint index,
GstBufferPool **pool,
guint *size,
guint *min_buffers,
guint *max_buffers);
Getthe pool parameters in query .
Unref pool with gst_object_unref() when it's not needed any more.
Parameters
query
A valid GstQuery of type GST_QUERY_ALLOCATION.
index
index to parse
pool
the GstBufferPool.
[out][allow-none][transfer full]
size
the size.
[out][allow-none]
min_buffers
the min buffers.
[out][allow-none]
max_buffers
the max buffers.
[out][allow-none]
gst_buffer_pool_new ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferPool.html#gst-buffer-pool-new
GstBufferPool *
gst_buffer_pool_new(void);
Createsa new GstBufferPool instance.
Returns
a new GstBufferPool instance.
gst_video_buffer_pool_new ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstVideoPool.html#gst-video-buffer-pool-new
GstBufferPool *
gst_video_buffer_pool_new(void);
Createa new bufferpool that can allocate video frames. This bufferpool supports allthe video bufferpool options.
Returns
a new GstBufferPool to allocate video frames.
gst_buffer_pool_get_config ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferPool.html#gst-buffer-pool-config-set-params
GstStructure *
gst_buffer_pool_get_config(GstBufferPool *pool);
Get acopy of the current configuration of the pool. This configuration can either bemodified and used for thegst_buffer_pool_set_config() call or it must be freed after usage.
Parameters
pool
a GstBufferPool
Returns
a copyof the current configuration of pool . use gst_structure_free() after usage or gst_buffer_pool_set_config().
gst_buffer_pool_config_set_params ()
void
gst_buffer_pool_config_set_params (GstStructure *config,
GstCaps *caps,
guint size,
guint min_buffers,
guint max_buffers);
Configureconfig with the given parameters.
Parameters
config
a GstBufferPool configuration
caps
caps for the buffers
size
the size of each buffer, not including prefix and padding
min_buffers
the minimum amount of buffers to allocate.
max_buffers
the maximum amount of buffers to allocate or 0 for unlimited.
gst_buffer_pool_config_set_allocator ()
void
gst_buffer_pool_config_set_allocator (GstStructure *config,
GstAllocator *allocator,
const GstAllocationParams *params);
Setthe allocator and params on config .
One ofallocator and params can be NULL, but not both. When allocator is NULL, the default allocator of the pool willuse the values in param to perform its allocation. When param isNULL, the pool will use the provided allocator with its defaultGstAllocationParams.
A callto gst_buffer_pool_set_config() can update the allocator and params withthe values that it is able to do. Some pools are, for example, not able tooperate with different allocators or cannot allocate with the values specifiedin params . Use gst_buffer_pool_get_config() to get the currently used values.
Parameters
config
a GstBufferPool configuration
allocator
a GstAllocator.
[allow-none]
params
GstAllocationParams.
[allow-none]
gst_buffer_pool_set_config ()
gboolean
gst_buffer_pool_set_config (GstBufferPool *pool,
GstStructure *config);
Setthe configuration of the pool. If the pool is already configured, and the configurationhaven't change, this function will returnTRUE. If the pool is active, this method willreturnFALSE and active configuration will remain.Buffers allocated form this pool must be returned or else this function will donothing and returnFALSE.
config is a GstStructure that contains the configuration parametersfor the pool. A default and mandatory set of parameters can be configured withgst_buffer_pool_config_set_params(), gst_buffer_pool_config_set_allocator() andgst_buffer_pool_config_add_option().
If theparameters in config can not be set exactly, this functionreturns FALSE and will try to update as much state aspossible. The new state can then be retrieved and refined withgst_buffer_pool_get_config().
Thisfunction takes ownership of config .
Parameters
pool
a GstBufferPool
config
a GstStructure.
[transfer full]
Returns
TRUE when the configuration could be set.
(5.8.1)
gst_base_src_get_buffer_pool ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSrc.html#gst-base-src-get-buffer-pool
GstBufferPool *
gst_base_src_get_buffer_pool(GstBaseSrc *src);
Parameters
src
a GstBaseSrc
Returns
theinstance of the GstBufferPool used by the src; unref it after usage.
struct GstVideoAlignment
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment
struct GstVideoAlignment {
guint padding_top;
guintpadding_bottom;
guint padding_left;
guintpadding_right;
guintstride_align[GST_VIDEO_MAX_PLANES];
};
Extraalignment paramters for the memory of video buffers. This structure is usuallyused to configure the bufferpool if it supports theGST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.
Members
guintpadding_top;
extra pixels on the top
guintpadding_bottom;
extra pixels on the bottom
guintpadding_left;
extra pixels on the left side
guintpadding_right;
extra pixels on the right side
guintstride_align[GST_VIDEO_MAX_PLANES];
array with extra alignment requirements for the strides
gst_buffer_pool_config_has_option ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferPool.html#gst-buffer-pool-config-has-option
gboolean
gst_buffer_pool_config_has_option (GstStructure *config,
constgchar *option);
Checkif config contains option .
Parameters
config
a GstBufferPool configuration
option
an option
Returns
TRUE if the options array contains option .
gst_buffer_pool_config_get_video_alignment ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstVideoPool.html#gst-video-buffer-pool-new
gboolean
gst_buffer_pool_config_get_video_alignment
(GstStructure *config,
GstVideoAlignment *align);
Getthe video alignment from the bufferpool configuration config in in align
Parameters
config
a GstStructure
align
a GstVideoAlignment
Returns
TRUE if config could be parsed correctly.
gst_buffer_pool_config_get_params ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferPool.html#gst-buffer-pool-config-get-params
gboolean
gst_buffer_pool_config_get_params (GstStructure *config,
GstCaps **caps,
guint *size,
guint *min_buffers,
guint *max_buffers);
Getthe configuration values from config .
Parameters
config
a GstBufferPool configuration.
[transfer none]
caps
the caps of buffers.
[out][transfer none][allow-none]
size
the size of each buffer, not including prefix and padding.
[out][allow-none]
min_buffers
the minimum amount of buffers to allocate.
[out][allow-none]
max_buffers
the maximum amount of buffers to allocate or 0 for unlimited.
[out][allow-none]
Returns
TRUE if all parameters could be fetched.
(5.8.2)
gst_buffer_pool_acquire_buffer ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferPool.html#gst-buffer-pool-config-get-params
GstFlowReturn
gst_buffer_pool_acquire_buffer (GstBufferPool *pool,
GstBuffer **buffer,
GstBufferPoolAcquireParams *params);
Acquirea buffer from pool . buffer should point to a memory location that canhold a pointer to the new buffer.
params can be NULL or contain optional parameters toinfluence the allocation.
Parameters
pool
a GstBufferPool
buffer
a location for a GstBuffer.
[out]
params
parameters.
[transfer none][allow-none]
Returns
a GstFlowReturn such as GST_FLOW_FLUSHING when the pool is inactive.
(5.8.5)
gst_buffer_add_video_meta ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideometa.html#gst-buffer-add-video-meta
GstVideoMeta *
gst_buffer_add_video_meta (GstBuffer *buffer,
GstVideoFrameFlags flags,
GstVideoFormat format,
guint width,
guint height);
AttachesGstVideoMeta metadata to buffer with the given parameters and the defaultoffsets and strides for format and width x height .
Thisfunction calculates the default offsets and strides and then calls gst_buffer_add_video_meta_full() with them.
Parameters
buffer
a GstBuffer
flags
GstVideoFrameFlags
format
a GstVideoFormat
width
the width
height
the height
Returns
the GstVideoMetaon buffer .
gst_buffer_get_video_meta ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideometa.html#gst-buffer-get-video-meta
GstVideoMeta *
gst_buffer_get_video_meta(GstBuffer *buffer);
Findthe GstVideoMeta on buffer with the lowest id .
Bufferscan contain multiple GstVideoMeta metadata items when dealing with multiviewbuffers.
Parameters
buffer
a GstBuffer
Returns
the GstVideoMeta with lowest id (usually 0) orNULL when there is no such metadata on buffer .
gst_video_info_from_caps ()
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#gst-video-info-from-caps
gboolean
gst_video_info_from_caps (GstVideoInfo *info,
const GstCaps *caps);
Parse caps and update info .
Parameters
info
a GstVideoInfo
caps
a GstCaps
Returns
TRUEif caps could be parsed
- 5. gstreamer插件所用函数整理
- gstreamer插件
- 一步一步创建GStreamer插件
- 创建gstreamer插件
- 一步一步创建GStreamer插件(
- 一步一步创建GStreamer插件
- Gstreamer 中的playback插件
- gstreamer拥有的插件
- gstreamer插件指南
- gstreamer 安装ffmpeg插件
- gstreamer插件之 videotestsrc
- gstreamer插件之 v4l2src
- gstreamer插件指南
- gstreamer插件简介
- gstreamer插件简介(1)--gstreamer框架
- Gstreamer插件教程2.3—编写一个插件(Writing a Plugin):chain函数(The chain function)
- Gstreamer插件教程2.4—编写一个插件(Writing a Plugin):event函数(The event function)
- Gstreamer插件教程2.5—编写一个插件(Writing a Plugin):query函数(The query function)
- hibernate 正向工程和反向工程
- Andorid中BindingAdapter的用法示例
- Android之AsyncTask异步任务
- Hibernate one-to-one一对一映射
- 正则表达式 group()方法 笔记
- 5. gstreamer插件所用函数整理
- lightoj1026【tarjan】
- 三级了----caffe的可视化接口python配置(Windows+vs2013+CPU)
- 安生与七月
- 创建线程的几种方式,以及为什么启动线程不用run,而用start方法!!!
- UI设计学习--PPI、DPI、PX、DP
- java bean入门
- 6. Gobject 学习总结
- codevs 1230 元素查找(hash)