<br><br>---------- Forwarded message ----------<br><span class="gmail_quote">From: <b class="gmail_sendername">Riccardo Corona</b> &lt;<a href="mailto:coronariccardo@gmail.com">coronariccardo@gmail.com</a>&gt;<br>Date: 30-mag-2007 
13.28<br>Subject: Re: [gst-devel] Fakesrc signal handoff question<br>To: Tim Muller &lt;<a href="mailto:t.i.m@zen.co.uk">t.i.m@zen.co.uk</a>&gt;<br><br></span>This&#39;s my testing pipeline :<br><br>..............................
<br>pipeline = gst_pipeline_new (&quot;pipeline&quot;);<br>&nbsp;&nbsp;&nbsp; fakesrc = gst_element_factory_make (&quot;fakesrc&quot;, &quot;source&quot;);<br>&nbsp;&nbsp;&nbsp; decoder = gst_element_factory_make (&quot;ffdec_mpeg4&quot;,&quot;mpeg4-decoder&quot;);
<br>&nbsp;&nbsp;&nbsp; videoscale = gst_element_factory_make (&quot;videoscale&quot;, &quot;scaling-video&quot;);<br>&nbsp;&nbsp;&nbsp; par = gst_element_factory_make (&quot;capsfilter&quot;, &quot;dimens&quot;);<br>&nbsp;&nbsp;&nbsp; videorate=gst_element_factory_make(&quot;videorate&quot;, &quot;rateVideo&quot;);
<br><br>&nbsp;&nbsp;&nbsp; parFakesrc = gst_element_factory_make (&quot;capsfilter&quot;, &quot;fakeSrcType&quot;);<br><br>&nbsp;&nbsp;&nbsp; parDDSink = gst_element_factory_make (&quot;capsfilter&quot;, &quot;ddSinkSetup&quot;);<br><br>&nbsp;&nbsp;&nbsp; g_object_set (G_OBJECT(parFakesrc), &quot;caps&quot;,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_caps_new_simple (&quot;video/mpeg&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;width&quot;, G_TYPE_INT, 720,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;height&quot;, G_TYPE_INT, 288,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;framerate&quot;,GST_TYPE_FRACTION,25,1,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;mpegversion&quot;,G_TYPE_INT,4,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;systemstream&quot;,G_TYPE_BOOLEAN,false),<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL);<br><br>&nbsp;&nbsp;&nbsp; g_object_set (G_OBJECT(par), &quot;caps&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp; gst_caps_new_simple( &quot;video/x-raw-yuv&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;width&quot;, G_TYPE_INT, 720,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;height&quot;, G_TYPE_INT, 576,NULL),<br>&nbsp;&nbsp;&nbsp; &nbsp; NULL );<br><br>&nbsp;&nbsp;&nbsp; g_object_set (G_OBJECT (fakesrc),<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;blocksize&quot;,40000,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;signal-handoffs&quot;, TRUE,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;sizemin&quot;, 0,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;sizemax&quot;, 30000,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;sizetype&quot;, 3,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;datarate&quot;, 2000, <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;filltype&quot;,2,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;NULL);<br><br>&nbsp;&nbsp;&nbsp; g_object_set (G_OBJECT (videorate),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;in&quot;, 0,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;out&quot;, 25,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;NULL);<br><br>&nbsp;&nbsp;&nbsp; g_object_set (G_OBJECT(parDDSink), &quot;caps&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_caps_new_simple (&quot;video/x-raw-rgb&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;width&quot;, G_TYPE_INT, 720,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;height&quot;, G_TYPE_INT, 576,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;framerate&quot;,GST_TYPE_FRACTION,25,1),<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL);<br><br>&nbsp;&nbsp;&nbsp; conv = gst_element_factory_make (&quot;ffmpegcolorspace&quot;, &quot;converter&quot;);
<br><br>&nbsp;&nbsp;&nbsp; videosink = gst_element_factory_make (&quot;directdrawsink&quot;, &quot;directdraw&quot;);<br><br>&nbsp;&nbsp;&nbsp; gst_bin_add_many (GST_BIN (pipeline),<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fakesrc, parFakesrc, decoder,videoscale ,par,videorate, conv,parDDSink, videosink, NULL);
<br><br>&nbsp;&nbsp;&nbsp; gst_element_link_many (fakesrc,parFakesrc,decoder,videoscale, par,videorate, conv, parDDSink, videosink, NULL);<br><br><br>........................<br><br><br>Some of the pads are unusefull but I&#39;ve leaved it...
<br>I can&#39;t find any pads or element properties to convert my time_t (<a name="112dcbe8594e1d2e_returnValueToggle">the time as seconds elapsed since midnight, January 1, 1970) to the TIME type that you are talking about.
<br>However I&#39;ve tried the buffer allocation with&nbsp;  GST_BUFFER_MALLOCDATA but nothing is changed.
<br>I don&#39;t believe that is possible to run my MFC application with GST_DEBUG output, or I was unable to find a way to do it.<br>I see that offset parameter of gst_buffer increments with the first packets from 0 to X, it sounds good but the offset_end have a different value (the ending byte of the offset, I assume), so I&#39;ve tried to force this value to the offset one but nothing to do.
<br>I think that the problem is in timestamp value but I cannot find a way to escape from this hell...<br><br></a><br><br><br><br><div><span class="gmail_quote">2007/5/30, Tim Muller &lt;<a href="mailto:t.i.m@zen.co.uk" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
t.i.m@zen.co.uk
</a>&gt;:</span><div><span class="q" id="q_112dcbe8594e1d2e_1"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Riccardo Corona &lt;<a href="mailto:coronariccardo@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
coronariccardo@gmail.com
</a>&gt; wrote :<br><br>Hi,<br><br>&gt; Hi,during my test with gstreamer app for win32 I&#39;ve used a fakesrc with<br>&gt; an handoff function in which I obtain some mpeg4 fragment that is put into<br>&gt; a gstbuffer. I&#39;ve also used the right plugin to visualize the mpeg4 packet
<br>&gt; on my directdraw sink.<br><br>Some more details about the pipeline used would probably be helpful.<br><br><br>&gt; It works weel only for the first 2-3 packets received and then the refresh<br>&gt; of the images stops and, if I run in debug mode, I can see that some thread
<br>&gt; stop its execution but there isn&#39;t gstreamer thread. This is main part of<br>&gt; may handoff:<br><br>&gt; static void<br>&gt; cb_handoff (GstElement *fakesrc, GstBuffer&nbsp;&nbsp;*buffer, GstPad *pad,<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; gpointer user_data)
<br>&gt; {<br>&gt;&nbsp;&nbsp; MyClass* dlg=(MyClass*)user_data;<br>&gt;<br>&gt;&nbsp;&nbsp;//fg_image is the object that contains the correct (I&#39;ve checked it...)<br>&gt;&nbsp;&nbsp;//mpeg4 fragment<br>&gt;&nbsp;&nbsp;//dt contains the time of the fragment
<br>&gt;&nbsp;&nbsp;//dlg-&gt;t is a struct tm that allows to obtain time_t<br>&gt;&nbsp;&nbsp;...<br>&gt;&nbsp;&nbsp;buffer-&gt;timestamp = mktime(&amp;dlg-&gt;t);//GST_CLOCK_TIME_NONE;<br><br>The timestamps you&#39;re creating, are they 0-based? (there may also be problems
<br>due to fakesrc sending a newsegment event in BYTES format, but the videosink<br>expecting a TIME format, so it depends on your pipeline setup if there&#39;s an<br>element that converts it to TIME Format or not).<br><br>

&gt; //fg_image-&gt;pixel_ptr contains the mpeg4 image buffer<br>&gt; gst_buffer_set_data(buffer,fg_image-&gt;pixel_ptr,fg_image-&gt;dimension);<br><br>Have you tried memcpy()&#39;ing the data first, to make sure the data you&#39;re
<br>passing is not invalidated while it makes its way through the pipeline?<br>Maybe something like (this assumes you&#39;re getting passed empty buffers, which<br>may not be the case if you&#39;ve set certain fakesrc properties):
<br><br>&nbsp;&nbsp;GST_BUFFER_MALLOCDATA(buffer) =<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g_memdup (fg_image-&gt;pixel_ptr,fg_image-&gt;dimension);<br>&nbsp;&nbsp;GST_BUFFER_DATA(buffer) = GST_BUFFER_MALLOCDATA(buffer);<br>&nbsp;&nbsp;GST_BUFFER_SIZE(buffer) = fg_image-&gt;dimension;
<br><br><br>In case it&#39;s your handoff callback that stops being called, run your program with<br><br>&nbsp;&nbsp;GST_DEBUG=basesrc:5 yourapp<br><br>(or whatever the way to set an environment variable is on win32) to see why it stops/pauses (see &#39;flow&#39; or &#39;reason&#39;).
<br><br> Cheers<br>&nbsp;&nbsp;-Tim<br><br><br><br><br><br></blockquote></span></div></div><br><br clear="all"><br>-- <br><span class="sg">Riccardo Corona
</span><br clear="all"><br>-- <br>Riccardo Corona