<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:\5B8B\4F53;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:\9ED1\4F53;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@\5B8B\4F53";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@\9ED1\4F53";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-indent:10.0pt;
        font-size:10.5pt;
        font-family:"Times New Roman";}
h1
        {margin-top:17.0pt;
        margin-right:0cm;
        margin-bottom:16.5pt;
        margin-left:0cm;
        text-align:justify;
        text-justify:inter-ideograph;
        text-indent:10.0pt;
        line-height:240%;
        page-break-after:avoid;
        mso-list:l1 level1 lfo10;
        font-size:22.0pt;
        font-family:"Times New Roman";}
h2
        {margin-top:13.0pt;
        margin-right:0cm;
        margin-bottom:13.0pt;
        margin-left:0cm;
        text-align:justify;
        text-justify:inter-ideograph;
        text-indent:10.0pt;
        line-height:173%;
        page-break-after:avoid;
        font-size:16.0pt;
        font-family:Arial;}
h3
        {margin-top:13.0pt;
        margin-right:0cm;
        margin-bottom:13.0pt;
        margin-left:68.15pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-indent:-36.0pt;
        line-height:173%;
        page-break-after:avoid;
        mso-list:l1 level3 lfo10;
        font-size:16.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.StyleHeading1Left1ch, li.StyleHeading1Left1ch, div.StyleHeading1Left1ch
        {margin-top:17.0pt;
        margin-right:0cm;
        margin-bottom:16.5pt;
        margin-left:0cm;
        text-indent:10.0pt;
        line-height:240%;
        page-break-after:avoid;
        mso-list:l2 level1 lfo11;
        font-size:22.0pt;
        font-family:"Times New Roman";
        font-weight:bold;}
p.List7, li.List7, div.List7
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Times New Roman";}
p.List8, li.List8, div.List8
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:21.0pt;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-indent:-21.0pt;
        mso-list:l0 level1 lfo8;
        font-size:10.5pt;
        font-family:"Times New Roman";}
p.StyleHeading2Firstline2ch, li.StyleHeading2Firstline2ch, div.StyleHeading2Firstline2ch
        {margin-top:13.0pt;
        margin-right:0cm;
        margin-bottom:13.0pt;
        margin-left:60.95pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-indent:-28.8pt;
        line-height:173%;
        page-break-after:avoid;
        mso-list:l1 level2 lfo10;
        font-size:16.0pt;
        font-family:Arial;
        font-weight:bold;}
p.StyleFirstline074cm, li.StyleFirstline074cm, div.StyleFirstline074cm
        {margin-top:5.0pt;
        margin-right:0cm;
        margin-bottom:2.5pt;
        margin-left:0cm;
        mso-para-margin-top:1.0gd;
        mso-para-margin-right:0cm;
        mso-para-margin-bottom:.5gd;
        mso-para-margin-left:0cm;
        text-indent:21.0pt;
        text-autospace:none;
        font-size:10.0pt;
        font-family:"Times New Roman";}
span.EmailStyle22
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
/* Page Definitions */
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
/* List Definitions */
@list l0
        {mso-list-id:1249470;
        mso-list-type:hybrid;
        mso-list-template-ids:484456656 -1587220538 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-style-link:"List 8";
        mso-level-text:\F0FC;
        mso-level-tab-stop:21.0pt;
        mso-level-number-position:left;
        margin-left:21.0pt;
        text-indent:-21.0pt;
        font-family:Wingdings;}
@list l1
        {mso-list-id:105731748;
        mso-list-template-ids:-580499146;}
@list l1:level1
        {mso-level-style-link:"Heading 1";
        mso-level-text:%1;
        mso-level-tab-stop:53.75pt;
        mso-level-number-position:left;
        margin-left:53.75pt;
        text-indent:-21.6pt;}
@list l1:level2
        {mso-level-style-link:"Style Heading 2 + First line\: 2 ch";
        mso-level-text:"%1\.%2";
        mso-level-tab-stop:60.95pt;
        mso-level-number-position:left;
        margin-left:60.95pt;
        text-indent:-28.8pt;}
@list l1:level3
        {mso-level-style-link:"Heading 3";
        mso-level-text:"%1\.%2\.%3";
        mso-level-tab-stop:68.15pt;
        mso-level-number-position:left;
        margin-left:68.15pt;
        text-indent:-36.0pt;}
@list l1:level4
        {mso-level-text:"%1\.%2\.%3\.%4";
        mso-level-tab-stop:75.35pt;
        mso-level-number-position:left;
        margin-left:75.35pt;
        text-indent:-43.2pt;}
@list l1:level5
        {mso-level-text:"%1\.%2\.%3\.%4\.%5";
        mso-level-tab-stop:82.55pt;
        mso-level-number-position:left;
        margin-left:82.55pt;
        text-indent:-50.4pt;}
@list l1:level6
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6";
        mso-level-tab-stop:89.75pt;
        mso-level-number-position:left;
        margin-left:89.75pt;
        text-indent:-57.6pt;}
@list l1:level7
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7";
        mso-level-tab-stop:96.95pt;
        mso-level-number-position:left;
        margin-left:96.95pt;
        text-indent:-64.8pt;}
@list l1:level8
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8";
        mso-level-tab-stop:104.15pt;
        mso-level-number-position:left;
        margin-left:104.15pt;
        text-indent:-72.0pt;}
@list l1:level9
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8\.%9";
        mso-level-tab-stop:111.35pt;
        mso-level-number-position:left;
        margin-left:111.35pt;
        text-indent:-79.2pt;}
@list l2
        {mso-list-id:1739015857;
        mso-list-template-ids:-1907050734;}
@list l2:level1
        {mso-level-style-link:"Style Heading 1 + Left\: 1 ch";
        mso-level-text:%1;
        mso-level-tab-stop:21.25pt;
        mso-level-number-position:left;
        margin-left:21.25pt;
        text-indent:-21.25pt;}
@list l2:level2
        {mso-level-text:"%1\.%2";
        mso-level-tab-stop:49.6pt;
        mso-level-number-position:left;
        margin-left:49.6pt;
        text-indent:-1.0cm;}
@list l2:level3
        {mso-level-text:"%1\.%2\.%3";
        mso-level-tab-stop:70.9pt;
        mso-level-number-position:left;
        margin-left:70.9pt;
        text-indent:-1.0cm;}
@list l2:level4
        {mso-level-text:"%1\.%2\.%3\.%4";
        mso-level-tab-stop:99.2pt;
        mso-level-number-position:left;
        margin-left:99.2pt;
        text-indent:-35.4pt;}
@list l2:level5
        {mso-level-text:"%1\.%2\.%3\.%4\.%5";
        mso-level-tab-stop:127.55pt;
        mso-level-number-position:left;
        margin-left:127.55pt;
        text-indent:-42.5pt;}
@list l2:level6
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6";
        mso-level-tab-stop:163.0pt;
        mso-level-number-position:left;
        margin-left:163.0pt;
        text-indent:-2.0cm;}
@list l2:level7
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7";
        mso-level-tab-stop:191.35pt;
        mso-level-number-position:left;
        margin-left:191.35pt;
        text-indent:-63.8pt;}
@list l2:level8
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8";
        mso-level-tab-stop:219.7pt;
        mso-level-number-position:left;
        margin-left:219.7pt;
        text-indent:-70.9pt;}
@list l2:level9
        {mso-level-text:"%1\.%2\.%3\.%4\.%5\.%6\.%7\.%8\.%9";
        mso-level-tab-stop:255.1pt;
        mso-level-number-position:left;
        margin-left:255.1pt;
        text-indent:-85.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>
</head>
<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>
<div class=Section1 style='layout-grid:15.6pt'>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>Hi all:<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>I try to replace audio
sink as following, but failed, could you give me some advice<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:20.95pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:20.95pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>/* pause */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PAUSED);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>/* unlink and remove
former alsa sink */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_unlink(decoder, alsaaudiosink); <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_bin_remove (GST_BIN (pipeline), alsaaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>/* link to pulse audio
sink */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
pulseaudiosink = gst_element_factory_make ("pulsesink",
"pulse_play_audio");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_bin_add (GST_BIN (pipeline), pulseaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_link(decoder, pulseaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>/* start playing */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PLAYING);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>====complete source
code====<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>/* example-begin
helloworld.c */ <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>#include <gst/gst.h><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>int <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>main (int argc, char
*argv[]) <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> GstElement *pipeline,
*filesrc, *decoder, *alsaaudiosink = NULL, *pulseaudiosink = NULL;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> gst_init(&argc,
&argv);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> if (argc != 2) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> g_print
("usage: %s <mp3 filename>\n", argv[0]);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> exit
(-1);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> }<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* create a new
pipeline to hold the elements */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> pipeline =
gst_pipeline_new ("pipeline");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* create a disk
reader */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> filesrc =
gst_element_factory_make ("filesrc", "disk_source");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> g_object_set
(G_OBJECT (filesrc), "location", argv[1], NULL);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* now it's time to
get the decoder */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> decoder =
gst_element_factory_make ("mad", "decoder");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* and an audio
sink */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> alsaaudiosink =
gst_element_factory_make ("alsasink", "alsa_play_audio");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* add objects to
the main pipeline */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> gst_bin_add_many
(GST_BIN (pipeline), filesrc, decoder, alsaaudiosink, NULL);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* link src to sink
*/<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_link(filesrc, decoder);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_link(decoder,alsaaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* start playing */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PLAYING);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> static int
is_playing = 1;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> static int
is_quiting = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> static int
is_alsasink = 1;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> while
(1) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
if(!(gst_bin_iterate_elements (GST_BIN (pipeline)))) break;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
printf(" q:Quit, p:Pause/Play, t:Test: ");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> char ch
=0 ;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
ch=getchar();<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> switch
(ch) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> case
'p':<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
if(is_playing) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
/* pause */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PAUSED);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
else {<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
/* start playing */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PLAYING);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
is_playing = !is_playing;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> break;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> case
't':<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
printf("================================================================\n");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
if(is_alsasink) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
/* pause */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PAUSED);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
// gst_element_set_state (pipeline, GST_STATE_NULL);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
sleep(1);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_unlink(decoder, alsaaudiosink); <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_bin_remove (GST_BIN (pipeline), alsaaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (alsaaudiosink, GST_STATE_NULL);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_object_unref (GST_OBJECT
(alsaaudiosink)); <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
pulseaudiosink = gst_element_factory_make ("pulsesink",
"pulse_play_audio");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_bin_add (GST_BIN (pipeline), pulseaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_link(decoder, pulseaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
sleep(1);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
/* start playing */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
printf("pulse sink prepare to play:\n");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PLAYING);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
else {<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
/* pause */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PAUSED);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
// gst_element_set_state (pipeline, GST_STATE_NULL);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
sleep(1);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_unlink(decoder, pulseaudiosink); <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_bin_remove (GST_BIN (pipeline), pulseaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pulseaudiosink, GST_STATE_NULL);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_object_unref (GST_OBJECT
(pulseaudiosink)); <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
alsaaudiosink = gst_element_factory_make ("alsasink",
"alsa_play_audio");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_bin_add (GST_BIN (pipeline), alsaaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_link(decoder, alsaaudiosink);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
sleep(1);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
/* start playing */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
printf("alsa sink prepare to play:\n");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_PLAYING);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
is_alsasink = !is_alsasink;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> break;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> case
'q':<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
is_quiting = 1;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> break;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
default:<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> break;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> }<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
if(is_quiting) break;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
GstFormat fmt = GST_FORMAT_TIME;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gint64 pos, len;<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
if (gst_element_query_position (pipeline, &fmt, &pos)<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
&& gst_element_query_duration (pipeline, &fmt, &len)) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
g_print ("Time: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT
"\n",<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
GST_TIME_ARGS (pos), GST_TIME_ARGS (len));<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
sleep(2);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> }<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* stop the
pipeline */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>
gst_element_set_state (pipeline, GST_STATE_NULL);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* we don't need a
reference to these objects anymore */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> gst_object_unref
(GST_OBJECT (pipeline));<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> /* unreffing the
pipeline unrefs the contained elements as well */<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'> exit (0);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;font-family:Arial'>/* example-end helloworld.c
*/ <o:p></o:p></span></font></p>
<div>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:20.1pt'><b><font size=2 color=blue face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:blue;font-weight:bold'>ZHAO,
Halley (Aihua)</span></font></b><span lang=EN-US><o:p></o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:20.0pt'><font size=2 color=blue face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:blue'>Email: halley.zhao<a
href="mailto:aihua.zhao@intel.com" title="mailto:hui.xue@intel.com">@intel.com</a></span></font><font
color=blue><span lang=EN-US style='color:blue'><o:p></o:p></span></font></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:16.0pt'><font size=1 color=blue face=Arial><span lang=DA
style='font-size:8.0pt;font-family:Arial;color:blue'>Tel: +86(21)61166476</span></font><span
lang=DA><o:p></o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:16.0pt'><font size=1 color=blue face=Arial><span lang=DA
style='font-size:8.0pt;font-family:Arial;color:blue'>iNet: 8821-6476</span></font><span
lang=DA><o:p></o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
text-indent:20.0pt'><font size=2 color="#3366ff" face=Arial><span lang=DA
style='font-size:10.0pt;font-family:Arial;color:#3366FF'>SSG/OTC/UMD 3W033</span></font><span
lang=DA><o:p></o:p></span></p>
</div>
<p class=MsoNormal style='text-indent:21.0pt'><span lang=DA><o:p> </o:p></span></p>
</div>
</body>
</html>