<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >Explicit caps</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="GStreamer Plugin Writer's Guide" HREF="index.html"><LINK REL="UP" TITLE="Specifying the pads" HREF="chapter-building-pads.html"><LINK REL="PREVIOUS" TITLE="The getcaps function" HREF="section-pads-getcapsfn.html"><LINK REL="NEXT" TITLE="The chain function" HREF="chapter-building-chainfn.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 > Plugin Writer's Guide</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="section-pads-getcapsfn.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 4. Specifying the pads</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="chapter-building-chainfn.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="section-pads-explicitcaps" >4.3. Explicit caps</A ></H1 ><P > Obviously, many elements will not need this complex mechanism, because they are much simpler than that. They only support one format, or their format is fixed but the contents of the format depend on the stream or something else. In those cases, <SPAN CLASS="emphasis" ><I CLASS="emphasis" >explicit caps</I ></SPAN > are an easy way of handling caps. Explicit caps are an easy way of specifying one, fixed, supported format on a pad. Pads using explicit caps do not implement their own <CODE CLASS="function" >_getcaps ()</CODE > or <CODE CLASS="function" >_link ()</CODE > functions. When the exact format is known, an elements uses <CODE CLASS="function" >gst_pad_set_explicit_caps ()</CODE > to specify the exact format. This is very useful for demuxers, for example. </P ><PRE CLASS="programlisting" > static void gst_my_filter_init (GstMyFilter *filter) { GstElementClass *klass = GST_ELEMENT_GET_CLASS (filter); [..] filter->srcpad = gst_pad_new_from_template ( gst_element_class_get_pad_template (klass, "src"), "src"); gst_pad_use_explicit_caps (filter->srcpad); [..] } static void gst_my_filter_somefunction (GstMyFilter *filter) { GstCaps *caps = ..; [..] gst_pad_set_explicit_caps (filter->srcpad, caps); [..] } </PRE ></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-pads-getcapsfn.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="chapter-building-chainfn.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >The getcaps function</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="chapter-building-pads.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >The chain function</TD ></TR ></TABLE ></DIV ></BODY ></HTML >