Cool! It works right now.<br>However, I had another issue.<br><br>I just try to let appsrc keep reading data from a array and then write data into file.<br>My pipleline is like appsrc->queue->filesink.<br>However, I cannot get right data in the file, actually there is no data in the file but a bunch of symbols.<br>
<br>I attached my codes here. Anyone met this problem before or know why?<br><br>#include <gst/gst.h><br>#include <stdio.h><br>#include <string.h><br>#include <stdlib.h><br>#include <gst/app/gstappsrc.h><br>
#include <gst/app/gstappbuffer.h><br>#include <gst/app/gstappsink.h><br><br><br>static const guint8 mp3[] = {<br>0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,<br>0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};<br>
<br>typedef struct _App App;<br>struct _App<br>{<br> GstElement *pipe;<br> GstElement *src;<br> GstElement *q;<br> GstElement *id;<br> GstElement *q1;<br> GstElement *sink;<br>};<br><br>App s_app;<br><br>static void finalize (void *priv);<br>
<br>int<br>main (int argc, char *argv[])<br>{<br><br><br> FILE *fp;<br> size_t bytes_read;<br> App *app = &s_app;<br> int i;<br> int mp3size;<br> gst_init (&argc, &argv);<br><br> app->pipe = gst_pipeline_new (NULL);<br>
g_assert (app->pipe);<br><br> app->src = gst_element_factory_make ("appsrc", NULL);<br> g_assert (app->src);<br> gst_bin_add (GST_BIN (app->pipe), app->src);<br><br> app->q = gst_element_factory_make ("queue", NULL);<br>
g_assert (app->q);<br> gst_bin_add (GST_BIN (app->pipe), app->q);<br>/*<br> app->id = gst_element_factory_make ("identity", NULL);<br> g_assert (app->id);<br> gst_bin_add (GST_BIN (app->pipe), app->id);<br>
<br> app->q1 = gst_element_factory_make ("queue", NULL);<br> g_assert (app->q1);<br> gst_bin_add (GST_BIN (app->pipe), app->q1);<br>*/<br> app->sink = gst_element_factory_make ("filesink", NULL);<br>
g_object_set (G_OBJECT (app->sink), "location", "mp3.data", NULL);<br> g_assert (app->sink);<br> gst_bin_add (GST_BIN (app->pipe), app->sink);<br><br> gst_element_link (app->src, app->q);<br>
//gst_element_link (app->q, app->id);<br>// gst_element_link (app->id, app->q1);<br> gst_element_link (app->q, app->sink);<br><br> printf("Setting PIPELINE to PLAY.......\n");<br> <br> gst_element_set_state (app->pipe, GST_STATE_PLAYING);<br>
<br> mp3size=sizeof(mp3);<br><br> for (i = 0; i < mp3size-1; i++)<br> {<br> GstBuffer *buf;<br> guint8 *data=malloc(1);<br> *data=mp3[i];<br> buf = gst_app_buffer_new (data, 1, finalize, data);<br> gst_app_src_push_buffer (GST_APP_SRC (app->src), buf);<br>
printf("framenum %d\n", (i+1));<br> printf("framenum data %d\n",*GST_BUFFER_DATA(buf));<br><br> }<br><br> gst_app_src_end_of_stream (GST_APP_SRC (app->src));<br><br> gst_element_set_state (app->pipe, GST_STATE_NULL);<br>
//g_object_unref (buf);<br> //free(data);<br> return 0;<br>}<br><br>static void<br>finalize (void *priv)<br>{<br> //printf ("\nfreeing buffer for pointer %p\n", priv);<br> //free (priv);<br>}<br><br>//=================<br>
<br><br><br><br><br><br><br><br><br><div class="gmail_quote">On Fri, Dec 9, 2011 at 5:47 AM, Mailing List SVR [via GStreamer-devel] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=4176938&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;"><div class="im">
        
Il 08/12/2011 21:11, Jun Zhang ha scritto:
</div><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">Hello,<div class="im"><br>
<br>
I am trying to use appsrc to get data from my C application and
met following problems.<br>
<br>
1.undefined reference to `gst_app_buffer_new'<br>
2. undefined reference to `gst_app_src_push_buffer'<br>
3.undefined reference to gst_app_src_end_of_stream <br>
<br>
After searching for a solution, I saw someone suggest add
-lgstapp-0.10 into the make file: Following is the commands in the
make file.<br>
export
PKG_CONFIG_PATH=/root/targetfs/opt/gstreame/lib/pkgconfig:$PKG_CONFIG_PATH<br>
<br>
/root/CodeSourcery/Sourcery_G++_Lite//bin/arm-none-linux-gnueabi-gcc
-lgstapp-0.10 `pkg-config --cflags --libs gstreamer-0.10`-o syn
test_syn.c<br>
<br>
And then I have following compile errors. However, i did check and
found that the missing libgstbase-0.10.so.0 is in the same place
with <a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>.<br>
<br>
Any suggestions?<br>
</div></blockquote>
<br><div class="im">
try lo link to gstreamer-app-0.10 too,<br>
<br>
Nicola<br>
</div><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite"><br>
<br><div class="im">
/root/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld:
warning: libgstbase-0.10.so.0, needed by
/root/targetfs///opt/gstreamer/lib/<a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>, not found
(try using -rpath or -rpath-link)<br>
/root/targetfs///opt/gstreamer/lib/<a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>: undefined
reference to `gst_base_sink_wait_preroll'<br>
/root/targetfs///opt/gstreamer/lib/<a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>: undefined
reference to `gst_base_src_set_live'<br>
/root/targetfs///opt/gstreamer/lib/<a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>: undefined
reference to `gst_base_src_get_type'<br>
/root/targetfs///opt/gstreamer/lib/<a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>: undefined
reference to `gst_base_src_query_latency'<br>
/root/targetfs///opt/gstreamer/lib/<a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>: undefined
reference to `gst_base_src_set_format'<br>
/root/targetfs///opt/gstreamer/lib/<a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>: undefined
reference to `gst_base_src_is_live'<br>
/root/targetfs///opt/gstreamer/lib/<a href="http://libgstapp-0.10.so" rel="nofollow" link="external" target="_blank">libgstapp-0.10.so</a>: undefined
reference to `gst_base_sink_get_type'<br>
<br>
<br>
Thanks,<br>
<br>
Jun <br>
<br>
<fieldset></fieldset>
<br>
</div><pre>_______________________________________________
gstreamer-devel mailing list
<a href="http://user/SendEmail.jtp?type=node&node=4176080&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<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>
</pre>
</blockquote>
<br>
<br>_______________________________________________
<br>gstreamer-devel mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=4176080&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/appsrc-undefined-reference-to-gst-app-buffer-new-tp4174142p4176080.html" target="_blank" rel="nofollow" link="external">http://gstreamer-devel.966125.n4.nabble.com/appsrc-undefined-reference-to-gst-app-buffer-new-tp4174142p4176080.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 appsrc undefined reference to 'gst_app_buffer_new', <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/appsrc-undefined-reference-to-gst-app-buffer-new-tp4174142p4176938.html">Re: appsrc undefined reference to 'gst_app_buffer_new'</a><br/>
Sent from the <a href="http://gstreamer-devel.966125.n4.nabble.com/">GStreamer-devel mailing list archive</a> at Nabble.com.<br/>