Sophie

Sophie

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

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>More on factories</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="Building an application"
HREF="part-build-app.html"><LINK
REL="PREVIOUS"
TITLE="Conclusion"
HREF="section-hello-world-conclusion.html"><LINK
REL="NEXT"
TITLE="More on MIME Types"
HREF="section-factories-mime.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="section-hello-world-conclusion.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="section-factories-mime.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="chapter-factories"
></A
>Chapter 20. More on factories</H1
><P
> 
    The small application we created in the previous chapter used the
    concept of a factory to create the elements. In this chapter we will
    show you how to use the factory concepts to create elements based
    on what they do instead of what they are called.
  </P
><P
> 
    We will first explain the concepts involved before we move on
    to the reworked helloworld example using autoplugging.
  </P
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="section-factories-helloworld-problems"
>20.1. The problems with the helloworld example</A
></H1
><P
> 
      If we take a look at how the elements were created in the previous
      example we used a rather crude mechanism:
    </P
><PRE
CLASS="programlisting"
>&#13;  ...    
  /* now it's time to get the parser */
  decoder = gst_element_factory_make ("mad", "decoder");
  ...
    </PRE
><P
>&#13;      While this mechanism is quite effective it also has some big problems:
      The elements are created based on their name. Indeed, we create an
      element, mad, by explicitly stating the mad element's name.  Our little
      program therefore always uses the mad decoder element to decode
      the MP3 audio stream, even if there are three other MP3 decoders in the
      system. We will see how we can use a more general way to create an
      MP3 decoder element.
    </P
><P
>&#13;      We have to introduce the concept of MIME types and capabilities 
      added to the source and sink pads.
    </P
></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="section-hello-world-conclusion.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-factories-mime.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Conclusion</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="part-build-app.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>More on MIME Types</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>