Hi Thiago
<br><br>Thanks for your quick reply very much. I really appreciated that.<br><br>video_h264encodingthread{<br>Frame_count i;<br>Byte*  encbuffer; // will be copied into gst_thread<br><br>//bunch of codes, then the encbuffer will have a frame of compressed video data;<br>
// which will be copied into gst_thread gst buffer;<br>gst_omxbuf=memcpy(encbuffer, sizeof(encbuffer) );<br>}<br><br>I just create a new thread name gst_thread, which will create a fakesrc and then link to filesink (later will use this fakesrc to do some complex gst applications)<br>
the data in gst_omxbuf will be copied into fakesrc. <br>Is any problem with the structure of my codes?<br><br>I donot really understand the buffer management of gst-fakesrc or gst-appsrc;<br>like the data is keeping copying into gst_omxbuf in the h264encodingthread , how the callback function of fakesrc in gst_thread can match the speed of that. Sould I create a heap so that in one end the data is writing into the heap and in the other end fakesrc keep reading data from heap?<br>
<br>My codes seems working okay, i didnot get any errors when running it. however, when i check the file written by filesink, there are all zero.<br><br>Could you please give me any advice, or any comments on this problem?<br>
<br>Is any other better way to achieve my goal?<br><br>Thanks a lot,<br><br><br>Jun <br><br>========================================<br><br>void fill_src_buffer(GstElement *fakesrc, GstBuffer *gstbuf, GstPad *pad, int i)<br>
{<br>  GstCaps *caps;<br><br>  GST_BUFFER_MALLOCDATA(gstbuf)=GST_BUFFER_DATA(gstbuf)=gst_omxbuf;<br>  GST_BUFFER_SIZE(gstbuf)=GST_BUFFER_SIZE(gst_omxbuf);<br>  caps = gst_caps_new_simple (&quot;video/x-h264&quot;, NULL);<br>
  memcpy (GST_BUFFER_DATA (gstbuf), gst_omxbuf, GST_BUFFER_SIZE(gst_omxbuf));<br>  gst_buffer_set_caps (gstbuf, caps);<br>  g_print (&quot;buffer caps setting done\n&quot;);<br>  gst_caps_unref (caps);<br>}<br><br>void gst_pipelinetask()<br>
{<br> // omit bunch of variables statements<br><br><br>  fakesrc =gst_element_factory_make(&quot;fakesrc&quot;, &quot;fakesrc&quot;);<br>  printf (&quot;  fakesrc  Init completed \n &quot;);<br><br>  filesink =gst_element_factory_make(&quot;filesink&quot;, &quot;filesink&quot;);<br>
  printf (&quot;  filesink  Init completed \n &quot;);<br>  g_object_set(filesink, &quot;location&quot;, &quot;gst.data&quot;, NULL );<br><br>  g_object_set (fakesrc, &quot;num-buffers&quot;, 4, <br>                         &quot;sizemax&quot;, sizeof(gst_omxbuf),<br>
              &quot;sizetype&quot;,2,<br>                         &quot;filltype&quot;,2, <br>             &quot;is-live&quot;,TRUE,<br>             &quot;can-activate-pull&quot;,FALSE,<br>                         &quot;signal-handoffs&quot;, TRUE, NULL);<br>
<br><br><br>  g_signal_connect(fakesrc, &quot;handoff&quot;, G_CALLBACK (fill_src_buffer), 0);<br><br><br>    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>    gst_bus_add_watch (bus, bus_call, loop);<br>    gst_object_unref (bus);<br>
    printf (&quot; Buss completed \n &quot;);<br>    gst_bin_add_many(GST_BIN(pipeline),fakesrc,filesink,NULL);<br><br>      if (!gst_element_link(fakesrc,filesink)) {<br>    g_print (&quot;Failed to link elements! \n&quot;);<br>
    return -1;<br>    }<br>     printf (&quot; Buss link completed \n &quot;);<br><br><br><br>    ret=gst_element_set_state(pipeline, GST_STATE_PLAYING);   <br>    g_print(&quot;Gst-Pipeline is Runningttttttt.........\n&quot;);<br>
<br>    if (ret == GST_STATE_CHANGE_FAILURE) {<br>        GstMessage *msg;<br>    g_print (&quot;Failed to start up pipeline! \n&quot;);<br>/* check if there is an error message with details on the bus */<br>    msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);<br>
    if (msg) {<br>    GError *err = NULL;<br>    gst_message_parse_error (msg, &amp;err, NULL);<br>    g_print (&quot;ERROR: %s\n&quot;, err-&gt;message);<br>    g_error_free (err);<br>    gst_message_unref (msg);<br>    }<br>
    return -1;<br>}<br><br>    g_main_loop_run(loop);<br>   <br>    /* Out of the main loop, clean up nicely */<br>    g_print(&quot;Returned, stopping playback\n&quot;);<br>    gst_element_set_state(pipeline, GST_STATE_NULL);<br>
   <br>    g_print(&quot;Deleting pipeline\n&quot;);<br>    gst_object_unref(GST_OBJECT(pipeline));<br>   <br>   return 0;<br><br>}<br><br><br><br><br><br><div class="gmail_quote">On Tue, Nov 29, 2011 at 10:37 PM, Thiago Sousa Santos-2 [via GStreamer-devel] <span dir="ltr">&lt;<a href="/user/SendEmail.jtp?type=node&node=4121915&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

        On Tue, 2011-11-29 at 13:00 -0800, Nathan wrote:
<div><div class='shrinkable-quote'><br>&gt; Greetings,
<br>&gt; 
<br>&gt; I am trying to streaming a compressed video into networks.
<br>&gt; 
<br>&gt; The data coming from non-gst h264encoder and I donot want to change my
<br>&gt; existing codes a lot.
<br>&gt; 
<br>&gt; So I just keep memcpying compressed data from the output of encode and load
<br>&gt; them into fakesrc and create a thread in my codes to run the gst-pipeline.
<br>&gt; 
<br>&gt; So far, I have not successfully done it.
</div></div>What error do you get?
<br><br>&gt; 
<br>&gt; Anyone can suggest any easier approach?
<br>&gt; 
<br>&gt; If I just want to keep feeding data into sink pad of a gst-pipeline, which
<br>&gt; kind of elements is more suitable to do achieve this?
<br>&gt; 
<br>&gt;  
<br>&gt; 
<br>&gt; I try to use gstpushsrc, however didnot find any useful example.
<br><br>Take a look at appsrc, from gst-plugins-base:
<br><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-appsrc.html" rel="nofollow" link="external" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-appsrc.html</a><br>
<br>You put the appsrc as a source of your pipeline and link your remaining
<br>elements as usual, set the pipeline to playing and feed appsrc with your
<br>data inside GstBuffers.
<br><div><div class='shrinkable-quote'><br>&gt; 
<br>&gt;  
<br>&gt; 
<br>&gt; Regards,
<br>&gt; 
<br>&gt;  
<br>&gt; 
<br>&gt; Jun 
<br>&gt; 
<br>&gt; --
<br>&gt; View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/how-to-import-a-live-buffer-into-gstreamer-tp4120766p4120766.html" rel="nofollow" link="external" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/how-to-import-a-live-buffer-into-gstreamer-tp4120766p4120766.html</a></div>
&gt; Sent from the GStreamer-devel mailing list archive at Nabble.com.
<br>&gt; _______________________________________________
<br>&gt; gstreamer-devel mailing list
<br>&gt; <a href="http://user/SendEmail.jtp?type=node&amp;node=4121779&amp;i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br>&gt; <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="nofollow" link="external" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></div><br>--
<br>Thiago
<br><br><br>_______________________________________________
<br>gstreamer-devel mailing list
<br><a href="http://user/SendEmail.jtp?type=node&amp;node=4121779&amp;i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="nofollow" link="external" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
        
        <br>
        <br>
        <hr color="#cccccc" noshade size="1">
        <div style="color: rgb(68, 68, 68); font: 12px tahoma,geneva,helvetica,arial,sans-serif;">
                <div style="font-weight: bold;">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://gstreamer-devel.966125.n4.nabble.com/how-to-import-a-live-buffer-into-gstreamer-tp4120766p4121779.html" target="_blank" rel="nofollow" link="external">http://gstreamer-devel.966125.n4.nabble.com/how-to-import-a-live-buffer-into-gstreamer-tp4120766p4121779.html</a>
        </div>
        <div style="color: rgb(102, 102, 102); font: 11px/1.5em tahoma,geneva,helvetica,arial,sans-serif; margin-top: 0.4em;">
                
                To unsubscribe from how to import a live buffer into gstreamer?, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>

                <a href="http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&amp;breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font: 9px serif;" target="_blank" link="external">NAML</a>
        </div></blockquote></div><br>

        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/how-to-import-a-live-buffer-into-gstreamer-tp4120766p4121915.html">Re: how to import a live buffer into gstreamer?</a><br/>
Sent from the <a href="http://gstreamer-devel.966125.n4.nabble.com/">GStreamer-devel mailing list archive</a> at Nabble.com.<br/>