<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Things to check when writing an application</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79;charset=UTF-8"><LINK REL="HOME" TITLE="GStreamer Application Development Manual (0.10.36)" HREF="index.html"><LINK REL="UP" TITLE="Appendices" HREF="part-appendices.html"><LINK REL="PREVIOUS" TITLE="Appendices" HREF="part-appendices.html"><LINK REL="NEXT" TITLE="Debugging" HREF="section-checklist-debug.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 (0.10.36)</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="part-appendices.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="section-checklist-debug.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="chapter" ><H1 ><A NAME="chapter-checklist-element" ></A >Chapter 21. Things to check when writing an application</H1 ><P > This chapter contains a fairly random selection of things that can be useful to keep in mind when writing <SPAN CLASS="application" >GStreamer</SPAN >-based applications. It's up to you how much you're going to use the information provided here. We will shortly discuss how to debug pipeline problems using <SPAN CLASS="application" >GStreamer</SPAN > applications. Also, we will touch upon how to acquire knowledge about plugins and elements and how to test simple pipelines before building applications around them. </P ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="section-checklist-programming" >21.1. Good programming habits</A ></H1 ><P ></P ><UL ><LI ><P > Always add a <CODE CLASS="classname" >GstBus</CODE > handler to your pipeline. Always report errors in your application, and try to do something with warnings and information messages, too. </P ></LI ><LI ><P > Always check return values of <SPAN CLASS="application" >GStreamer</SPAN > functions. Especially, check return values of <CODE CLASS="function" >gst_element_link ()</CODE > and <CODE CLASS="function" >gst_element_set_state ()</CODE >. </P ></LI ><LI ><P > Dereference return values of all functions returning a non-base type, such as <CODE CLASS="function" >gst_element_get_pad ()</CODE >. Also, always free non-const string returns, such as <CODE CLASS="function" >gst_object_get_name ()</CODE >. </P ></LI ><LI ><P > Always use your pipeline object to keep track of the current state of your pipeline. Don't keep private variables in your application. Also, don't update your user interface if a user presses the <SPAN CLASS="QUOTE" >"play"</SPAN > button. Instead, listen for the <SPAN CLASS="QUOTE" >"state-changed"</SPAN > message on the <CODE CLASS="classname" >GstBus</CODE > and only update the user interface whenever this message is received. </P ></LI ><LI ><P > Report all bugs that you find in <SPAN CLASS="application" >GStreamer</SPAN > bugzilla at <A HREF="http://bugzilla.gnome.org" TARGET="_top" >http://bugzilla.gnome.org/</A >. </P ></LI ></UL ></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="part-appendices.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-checklist-debug.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Appendices</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="part-appendices.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Debugging</TD ></TR ></TABLE ></DIV ></BODY ></HTML >