<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >Custom bins</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="Bins" HREF="chapter-bins-api.html"><LINK REL="PREVIOUS" TITLE="Adding elements to a bin" HREF="section-bin-adding.html"><LINK REL="NEXT" TITLE="Ghost pads" HREF="section-bin-ghostpads.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-bin-adding.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 16. Bins</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="section-bin-ghostpads.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="section-bin-custom" >16.3. Custom bins</A ></H1 ><P > The application programmer can create custom bins packed with elements to perform a specific task. This allows you to write an MPEG audio decoder with just the following lines of code: </P ><PRE CLASS="programlisting" > /* create the mp3player element */ GstElement *mp3player = gst_element_factory_make ("mp3player", "mp3player"); /* set the source mp3 audio file */ g_object_set (G_OBJECT (mp3player), "location", "helloworld.mp3", NULL); /* start playback */ gst_element_set_state (GST_ELEMENT (mp3player), GST_STATE_PLAYING); ... /* pause playback */ gst_element_set_state (GST_ELEMENT (mp3player), GST_STATE_PAUSED); ... /* stop */ gst_element_set_state (GST_ELEMENT (mp3player), GST_STATE_NULL); </PRE ><P > Note that the above code assumes that the mp3player bin derives itself from a <CODE CLASS="classname" >GstThread</CODE >, which begins to play as soon as its state is set to PLAYING. Other bin types may need explicit iteration. For more information, see <A HREF="chapter-threads.html" >Chapter 21</A >. </P ><P > Custom bins can be created with a plugin or an XML description. You will find more information about creating custom bin in the Plugin Writers Guide (FIXME ref). </P ></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-bin-adding.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-bin-ghostpads.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Adding elements to a bin</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="chapter-bins-api.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Ghost pads</TD ></TR ></TABLE ></DIV ></BODY ></HTML >