Sophie

Sophie

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

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>GStreamer types</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="More on factories"
HREF="chapter-factories.html"><LINK
REL="PREVIOUS"
TITLE="More on MIME Types"
HREF="section-factories-mime.html"><LINK
REL="NEXT"
TITLE="Creating elements with the factory"
HREF="section-factories-create.html"></HEAD
><BODY
CLASS="sect1"
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-factories-mime.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 20. More on factories</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="section-factories-create.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="section-factories-gstreamer-types"
>20.3. GStreamer types</A
></H1
><P
> 
      GStreamer assigns a unique number to all registered MIME types.
      GStreamer also keeps a reference to
      a function that can be used to determine if a given buffer is of
      the given MIME type.
    </P
><P
>&#13;      There is also an association between a MIME type and a file extension,
      but the use of typefind functions (similar to file(1)) is preferred.
    </P
><P
> 
      The type information is maintained in a list of 
      <CODE
CLASS="classname"
>GstType</CODE
>. The definition of a 
      <CODE
CLASS="classname"
>GstType</CODE
> is like:
    </P
><P
>&#13;      <PRE
CLASS="programlisting"
>&#13;typedef GstCaps (*GstTypeFindFunc) (GstBuffer *buf,gpointer *priv);
 
typedef struct _GstType GstType;

struct _GstType {
  guint16 id;                   /* type id (assigned) */

  gchar *mime;                  /* MIME type */
  gchar *exts;                  /* space-delimited list of extensions */

  GstTypeFindFunc typefindfunc; /* typefind function */
};
      </PRE
>
    </P
><P
> 
      All operations on <CODE
CLASS="classname"
>GstType</CODE
> occur
      via their <CODE
CLASS="classname"
>guint16 id</CODE
> numbers, with
      the <CODE
CLASS="classname"
>GstType</CODE
> structure private to the GStreamer
      library.
    </P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN778"
>20.3.1. MIME type to id conversion</A
></H2
><P
> 
        We can obtain the id for a given MIME type
        with the following piece of code:
      </P
><PRE
CLASS="programlisting"
>&#13;  guint16 id;
  
  id = gst_type_find_by_mime ("audio/mpeg");
      </PRE
><P
> 
        This function will return 0 if the type was not known.
      </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN783"
>20.3.2. id to <CODE
CLASS="classname"
>GstType</CODE
> conversion</A
></H2
><P
> 
        We can obtain the <CODE
CLASS="classname"
>GstType</CODE
> for a given id 
        with the following piece of code:
      </P
><PRE
CLASS="programlisting"
>&#13;  GstType *type;
  
  type = gst_type_find_by_id (id);
      </PRE
><P
> 
        This function will return NULL if the id was not associated with
        any known <CODE
CLASS="classname"
>GstType</CODE
>
      </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN791"
>20.3.3. extension to id conversion</A
></H2
><P
> 
        We can obtain the id for a given file extension
        with the following piece of code:
      </P
><PRE
CLASS="programlisting"
>&#13;  guint16 id;
  
  id = gst_type_find_by_ext (".mp3");
      </PRE
><P
> 
        This function will return 0 if the extension was not known.
      </P
><P
>&#13;        For more information, see <A
HREF="chapter-autoplug.html"
>Chapter 28</A
>.
      </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-factories-mime.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-create.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>More on MIME Types</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="chapter-factories.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Creating elements with the factory</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>