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 ("video/x-h264", NULL);<br>
memcpy (GST_BUFFER_DATA (gstbuf), gst_omxbuf, GST_BUFFER_SIZE(gst_omxbuf));<br> gst_buffer_set_caps (gstbuf, caps);<br> g_print ("buffer caps setting done\n");<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("fakesrc", "fakesrc");<br> printf (" fakesrc Init completed \n ");<br><br> filesink =gst_element_factory_make("filesink", "filesink");<br>
printf (" filesink Init completed \n ");<br> g_object_set(filesink, "location", "gst.data", NULL );<br><br> g_object_set (fakesrc, "num-buffers", 4, <br> "sizemax", sizeof(gst_omxbuf),<br>
"sizetype",2,<br> "filltype",2, <br> "is-live",TRUE,<br> "can-activate-pull",FALSE,<br> "signal-handoffs", TRUE, NULL);<br>
<br><br><br> g_signal_connect(fakesrc, "handoff", 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 (" Buss completed \n ");<br> gst_bin_add_many(GST_BIN(pipeline),fakesrc,filesink,NULL);<br><br> if (!gst_element_link(fakesrc,filesink)) {<br> g_print ("Failed to link elements! \n");<br>
return -1;<br> }<br> printf (" Buss link completed \n ");<br><br><br><br> ret=gst_element_set_state(pipeline, GST_STATE_PLAYING); <br> g_print("Gst-Pipeline is Runningttttttt.........\n");<br>
<br> if (ret == GST_STATE_CHANGE_FAILURE) {<br> GstMessage *msg;<br> g_print ("Failed to start up pipeline! \n");<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, &err, NULL);<br> g_print ("ERROR: %s\n", err->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("Returned, stopping playback\n");<br> gst_element_set_state(pipeline, GST_STATE_NULL);<br>
<br> g_print("Deleting pipeline\n");<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"><<a href="/user/SendEmail.jtp?type=node&node=4121915&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></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>> Greetings,
<br>>
<br>> I am trying to streaming a compressed video into networks.
<br>>
<br>> The data coming from non-gst h264encoder and I donot want to change my
<br>> existing codes a lot.
<br>>
<br>> So I just keep memcpying compressed data from the output of encode and load
<br>> them into fakesrc and create a thread in my codes to run the gst-pipeline.
<br>>
<br>> So far, I have not successfully done it.
</div></div>What error do you get?
<br><br>>
<br>> Anyone can suggest any easier approach?
<br>>
<br>> If I just want to keep feeding data into sink pad of a gst-pipeline, which
<br>> kind of elements is more suitable to do achieve this?
<br>>
<br>>
<br>>
<br>> 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>>
<br>>
<br>>
<br>> Regards,
<br>>
<br>>
<br>>
<br>> Jun
<br>>
<br>> --
<br>> 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>
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
<br>> _______________________________________________
<br>> gstreamer-devel mailing list
<br>> <a href="http://user/SendEmail.jtp?type=node&node=4121779&i=0" 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></div><br>--
<br>Thiago
<br><br><br>_______________________________________________
<br>gstreamer-devel mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=4121779&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&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&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/>