Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > f0a9f2b9c81d34eadc43f527947c0b70 > files > 103

libgstreamer0.7-devel-0.7.4-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Elements</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="GStreamer Application Development Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Basic API"
HREF="part-basic-api.html"><LINK
REL="PREVIOUS"
TITLE="Initializing GStreamer"
HREF="chapter-initialisation.html"><LINK
REL="NEXT"
TITLE="GstElement properties"
HREF="section-elements-properties.html"></HEAD
><BODY
CLASS="chapter"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
><SPAN
CLASS="application"
>GStreamer</SPAN
> Application Development Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="chapter-initialisation.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="section-elements-properties.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="chapter-elements-api"
></A
>Chapter 12. Elements</H1
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="section-elements-create"
>12.1. Creating a GstElement</A
></H1
><P
> 
      A <CODE
CLASS="classname"
>GstElement</CODE
> object is created from
      a factory.  To create an element, you have to get access to a
      <CODE
CLASS="classname"
>GstElementFactory</CODE
> object using a unique
      factory name.
    </P
><P
> 
      The following code example is used to get a factory that can be used 
      to create the 'mad' element, an mp3 decoder.
    </P
><PRE
CLASS="programlisting"
>&#13; GstElementFactory *factory;

 factory = gst_element_factory_find ("mad");
    </PRE
><P
> 
      Once you have the handle to the element factory, you can create a 
      real element with the following code fragment:
    </P
><PRE
CLASS="programlisting"
>&#13; GstElement *element;

 element = gst_element_factory_create (factory, "decoder");
    </PRE
><P
>&#13;      <CODE
CLASS="function"
>gst_element_factory_create</CODE
> will use the element
      factory to create an element with the given name. The name of the
      element is something you can use later on to look up the element in
      a bin, for example. You can pass <VAR
CLASS="symbol"
>NULL</VAR
> as the name
      argument to get a unique, default name.
    </P
><P
>&#13;      A simple shortcut exists for creating an element from a factory. The
      following example creates an element named "decoder" from the element
      factory named "mad". This convenience function is most widely used to
      create an element.
    </P
><PRE
CLASS="programlisting"
>&#13; GstElement *element;

 element = gst_element_factory_make ("mad", "decoder");
    </PRE
><P
> 
      When you don't need the element anymore, you need to unref it, as shown in the following
      example. 
    </P
><PRE
CLASS="programlisting"
>&#13; GstElement *element;

  ...
 gst_element_unref (element);
    </PRE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="chapter-initialisation.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="section-elements-properties.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Initializing <SPAN
CLASS="application"
>GStreamer</SPAN
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="part-basic-api.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>GstElement properties</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>