<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >Using the GstAutoplugCache element</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="Autoplugging" HREF="chapter-autoplug.html"><LINK REL="PREVIOUS" TITLE="Autoplugging" HREF="chapter-autoplug.html"><LINK REL="NEXT" TITLE="Another approach to autoplugging" HREF="section-autoplugging-spider.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="chapter-autoplug.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 28. Autoplugging</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="section-autoplugging-spider.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="section-autoplug-cache" >28.2. Using the <CODE CLASS="classname" >GstAutoplugCache</CODE > element</A ></H1 ><P > The <CODE CLASS="classname" >GstAutoplugCache</CODE > element is used to cache the media stream when performing typedetection. As we have seen in <A HREF="chapter-typedetection.html" >Chapter 27</A >, the typefind function consumes a buffer to determine its media type. After we have set up the pipeline to play the media stream we should be able to 'replay' the previous buffer(s). This is what the autoplugcache is used for. </P ><P > The basic usage pattern for the autoplugcache in combination with the typefind element is like this: <P ></P ><OL TYPE="1" ><LI ><P > Add the autoplugcache element to a bin and link the sink pad to the source pad of an element with unknown caps. </P ></LI ><LI ><P > Link the source pad of the autoplugcache to the sink pad of the typefind element. </P ></LI ><LI ><P > Iterate the pipeline until the typefind element has found a type. </P ></LI ><LI ><P > Remove the typefind element and add the plugins needed to play back the discovered media type to the autoplugcache source pad. </P ></LI ><LI ><P > Reset the cache to start playback of the cached data. Connect to the "cache_empty" signal. </P ></LI ><LI ><P > In the cache_empty signal callback function, remove the autoplugcache and relink the pads. </P ></LI ></OL > </P ><P > In the next chapter we will create a new version of our helloworld example using the autoplugger, the autoplugcache and the typefind element. </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="chapter-autoplug.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-autoplugging-spider.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Autoplugging</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="chapter-autoplug.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Another approach to autoplugging</TD ></TR ></TABLE ></DIV ></BODY ></HTML >