appsrc undefined reference to 'gst_app_buffer_new'
Nathan
zjustc at gmail.com
Fri Dec 9 07:09:11 PST 2011
Cool! It works right now.
However, I had another issue.
I just try to let appsrc keep reading data from a array and then write data
into file.
My pipleline is like appsrc->queue->filesink.
However, I cannot get right data in the file, actually there is no data in
the file but a bunch of symbols.
I attached my codes here. Anyone met this problem before or know why?
#include <gst/gst.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappbuffer.h>
#include <gst/app/gstappsink.h>
static const guint8 mp3[] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,0x07, 0x08, 0x09, 0x10, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF};
typedef struct _App App;
struct _App
{
GstElement *pipe;
GstElement *src;
GstElement *q;
GstElement *id;
GstElement *q1;
GstElement *sink;
};
App s_app;
static void finalize (void *priv);
int
main (int argc, char *argv[])
{
FILE *fp;
size_t bytes_read;
App *app = &s_app;
int i;
int mp3size;
gst_init (&argc, &argv);
app->pipe = gst_pipeline_new (NULL);
g_assert (app->pipe);
app->src = gst_element_factory_make ("appsrc", NULL);
g_assert (app->src);
gst_bin_add (GST_BIN (app->pipe), app->src);
app->q = gst_element_factory_make ("queue", NULL);
g_assert (app->q);
gst_bin_add (GST_BIN (app->pipe), app->q);
/*
app->id = gst_element_factory_make ("identity", NULL);
g_assert (app->id);
gst_bin_add (GST_BIN (app->pipe), app->id);
app->q1 = gst_element_factory_make ("queue", NULL);
g_assert (app->q1);
gst_bin_add (GST_BIN (app->pipe), app->q1);
*/
app->sink = gst_element_factory_make ("filesink", NULL);
g_object_set (G_OBJECT (app->sink), "location", "mp3.data", NULL);
g_assert (app->sink);
gst_bin_add (GST_BIN (app->pipe), app->sink);
gst_element_link (app->src, app->q);
//gst_element_link (app->q, app->id);
// gst_element_link (app->id, app->q1);
gst_element_link (app->q, app->sink);
printf("Setting PIPELINE to PLAY.......\n");
gst_element_set_state (app->pipe, GST_STATE_PLAYING);
mp3size=sizeof(mp3);
for (i = 0; i < mp3size-1; i++)
{
GstBuffer *buf;
guint8 *data=malloc(1);
*data=mp3[i];
buf = gst_app_buffer_new (data, 1, finalize, data);
gst_app_src_push_buffer (GST_APP_SRC (app->src), buf);
printf("framenum %d\n", (i+1));
printf("framenum data %d\n",*GST_BUFFER_DATA(buf));
}
gst_app_src_end_of_stream (GST_APP_SRC (app->src));
gst_element_set_state (app->pipe, GST_STATE_NULL);
//g_object_unref (buf);
//free(data);
return 0;
}
static void
finalize (void *priv)
{
//printf ("\nfreeing buffer for pointer %p\n", priv);
//free (priv);
}
//=================
On Fri, Dec 9, 2011 at 5:47 AM, Mailing List SVR [via GStreamer-devel] <
ml-node+s966125n4176080h54 at n4.nabble.com> wrote:
> Il 08/12/2011 21:11, Jun Zhang ha scritto:
>
> Hello,
>
>
> I am trying to use appsrc to get data from my C application and met
> following problems.
>
> 1.undefined reference to `gst_app_buffer_new'
> 2. undefined reference to `gst_app_src_push_buffer'
> 3.undefined reference to gst_app_src_end_of_stream
>
> 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.
> export
> PKG_CONFIG_PATH=/root/targetfs/opt/gstreame/lib/pkgconfig:$PKG_CONFIG_PATH
>
> /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
>
> 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
> libgstapp-0.10.so.
>
> Any suggestions?
>
>
> try lo link to gstreamer-app-0.10 too,
>
> Nicola
>
>
>
> /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/
> libgstapp-0.10.so, not found (try using -rpath or -rpath-link)
> /root/targetfs///opt/gstreamer/lib/libgstapp-0.10.so: undefined reference
> to `gst_base_sink_wait_preroll'
> /root/targetfs///opt/gstreamer/lib/libgstapp-0.10.so: undefined reference
> to `gst_base_src_set_live'
> /root/targetfs///opt/gstreamer/lib/libgstapp-0.10.so: undefined reference
> to `gst_base_src_get_type'
> /root/targetfs///opt/gstreamer/lib/libgstapp-0.10.so: undefined reference
> to `gst_base_src_query_latency'
> /root/targetfs///opt/gstreamer/lib/libgstapp-0.10.so: undefined reference
> to `gst_base_src_set_format'
> /root/targetfs///opt/gstreamer/lib/libgstapp-0.10.so: undefined reference
> to `gst_base_src_is_live'
> /root/targetfs///opt/gstreamer/lib/libgstapp-0.10.so: undefined reference
> to `gst_base_sink_get_type'
>
>
> Thanks,
>
> Jun
>
>
> _______________________________________________
> gstreamer-devel mailing list[hidden email] <http://user/SendEmail.jtp?type=node&node=4176080&i=0>http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4176080&i=1>
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://gstreamer-devel.966125.n4.nabble.com/appsrc-undefined-reference-to-gst-app-buffer-new-tp4174142p4176080.html
> To unsubscribe from appsrc undefined reference to 'gst_app_buffer_new', click
> here<http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4174142&code=emp1c3RjQGdtYWlsLmNvbXw0MTc0MTQyfDE4NzQxNjA3ODI=>
> .
> NAML<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>
>
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/appsrc-undefined-reference-to-gst-app-buffer-new-tp4174142p4176938.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111209/a4863335/attachment.htm>
More information about the gstreamer-devel
mailing list