<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">

<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-postmall17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:navy;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->




<div class=Section1>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>Hi again,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>I think you are right, Marco, about the caps of the buffer. I
didn’t think about that! <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>I haven’t been able to get it to work, though.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>At first I tried:<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp; base_caps =
gst_caps_copy (gst_pad_get_pad_template_caps (filter-&gt;srcpad));<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;
gst_buffer_set_caps(outbuf, base_caps);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>But I got the error:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:9.0pt;font-family:"Courier New"'>**
(gst-launch-0.10:6344): CRITICAL **: file ..\Source\gstreamer\gst\gstpad.c:
line 2508: assertion `caps == NULL || gst_caps_is_fixed (caps)' failed<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>So I tried to remove the fixed caps and use _<i>set</i>_caps-functions
for the pads.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>But what do I need to do in the _<i>set</i>_caps-functions? The
input to the encoder has a fixed format and the output from the decoder has the
same fixed format.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>The compressed audio could have different rates, that could be
represented in the caps. Do the _set_caps for the sink-pad need to set the caps
of the source?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>I tried:<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp; ...<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp; filter = GST_GtestENC (gst_pad_get_parent
(pad));<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp; otherpad = (pad == filter-&gt;srcpad) ?
filter-&gt;sinkpad : filter-&gt;srcpad;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp; </span><span lang=EN-US style='font-size:
10.0pt;font-family:"Courier New"'>base_caps = gst_caps_copy
(GST_PAD_CAPS(otherpad));<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:blue'>&nbsp; return</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New"'> gst_pad_set_caps (otherpad, base_caps);</span><span
lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'> <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>But I get an empty caps from GST_PAD_CAPS(filter-&gt;sinkpad) and
gst_caps_copy gives this error:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:9.0pt;font-family:"Courier New"'>**
(gst-launch-0.10:6724): CRITICAL **: file ..\Source\gstreamer\gst\gstcaps.c:
line 280: assertion `GST_IS_CAPS (caps)' failed<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>However. In my “real” encoder/decoder I <i>do</i> set the caps in
my _chain-function:<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp; ret =<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;
gst_pad_alloc_buffer_and_set_caps (filter-&gt;srcpad, GST_BUFFER_OFFSET_NONE,<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; FRAME_LENGTH, GST_PAD_CAPS (filter-&gt;srcpad),
&amp;outbuf);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>But I get an error in the _<i>set</i>_caps-function for the sink in
the decoder:<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:blue'>static</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> gboolean<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>gst_mydec_sink_set_caps
(GstPad * pad, GstCaps * caps)<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp; mydec *filter;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp; GstPad *otherpad;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp; GstCaps *base_caps;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp; </span><span
style='font-size:10.0pt;font-family:"Courier New"'>GstFlowReturn ret;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp; filter = GST_MYDEC (gst_pad_get_parent
(pad));<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp; otherpad = (pad == filter-&gt;srcpad) ?
filter-&gt;sinkpad : filter-&gt;srcpad;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp; </span><span lang=EN-US style='font-size:
10.0pt;font-family:"Courier New"'>base_caps = gst_caps_copy
(gst_pad_get_pad_template_caps (otherpad));<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp; ret =
gst_pad_set_caps (otherpad, base_caps); <span style='color:green'>// error</span><o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp; <span
style='color:blue'>return</span> ret;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>The error I get is:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:9.0pt;font-family:"Courier New";
color:navy'>** (gst-launch-0.10:2964): CRITICAL **: file
..\Source\gstreamer\gst\gstpad.c: line 2508: assertion `caps == NULL ||
gst_caps_is_fixed (caps)' failed<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>But I checked with </span><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New"'>GST_IS_CAPS (base_caps)</span><span lang=EN-US
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:navy'> and </span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>gst_caps_is_fixed(base_caps)</span><span
lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'> and base_caps IS a caps and it is not fixed, so why do I get an
error?<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>Clearly there is something I have done wrong or misunderstood, but
I can’t figure it out…<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>Regards <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:navy'>Markus<o:p></o:p></span></p>

</div>





<br><hr align="left" width="300">
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/Caps-problem-when-writing-encoder-decoder-tp2219436p2224288.html">SV: Caps problem when writing encoder/decoder</a><br>
Sent from the <a href="http://gstreamer-devel.966125.n4.nabble.com/">GStreamer-devel mailing list archive</a> at Nabble.com.<br>