appsrc undefined reference to 'gst_app_buffer_new'

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

appsrc undefined reference to 'gst_app_buffer_new'

Nathan
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?


/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://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: appsrc undefined reference to 'gst_app_buffer_new'

Nathan
Folllowing is my test codes. It runs ok with out gst_app_buffer_new and gst_app_buffer_push.
Any advice?

Thanks,

Jun

#include <gst/gst.h>
#include <glib.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappbuffer.h>
#include <gst/base/gstbasesrc.h>

#include <gst/gstbuffer.h>
#include <string.h>
#include <gst/app/gstappsink.h>
#include <stdio.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 *appsrc;
  GstElement *h264parse;
  GstElement *gstperf;
  GstElement *queue1;
  GstElement *rtph264pay;
  GstElement *filesink;
  GstElement *queue;
  GstElement *pipeline;
  GMainLoop *loop;
  guint length;
  guint64 offset;
};


 App s_app;
 guint frame_num=sizeof(mp3);



static void FIFOwrite_data (App* app)
{

 guint8 framesize;
 guint8 *tmpdata=malloc(1);
 *tmpdata=0;
 guint frame_count1=0;

    gst_element_set_state(app->pipeline, GST_STATE_PLAYING);
     GstFlowReturn ret;
     g_print("into FIFO write \n");


   
 while(1){
   GstBuffer *buffer;
 g_print("===================start================================ \n");
     framesize=1;
     buffer = gst_app_buffer_new (tmpdata, framesize, g_free, tmpdata);

   //  buffer = gst_buffer_new_and_alloc (framesize);

    *tmpdata=mp3[frame_count1];
     memcpy(GST_BUFFER_DATA(buffer),tmpdata,framesize);

    // buffer=malloc(framesize);
    // gst_buffer_set_data(buffer,tmpdata, framesize);
     g_signal_emit_by_name (app->appsrc, "push-buffer", buffer, &ret);
     if(ret != GST_FLOW_OK){
     g_print("error%x \n");
     return;

    }
     g_print("print data info in buffer 0x%x \n",*GST_BUFFER_DATA(buffer));

     g_print("framenum %d \n", frame_count1);
     frame_count1=frame_count1+1;


     g_print("=================end=================================== \n");
     if ( frame_count1 >= frame_num-1) {
      //gst_app_src_end_of_stream(app->appsrc);
       g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret);
       g_print("this is the last frame \n");
        gst_buffer_unref (buffer);
       pthread_exit(NULL);
  }


}
    g_print("go out \n");
}

static gboolean
bus_call (GstBus *bus, GstMessage *msg, gpointer data)
{
        GMainLoop *loop = data;
        switch (GST_MESSAGE_TYPE (msg)) {
                case GST_MESSAGE_EOS:
                        g_print ("End-of-stream\n");
                        g_main_loop_quit (loop);
                break;
                case GST_MESSAGE_ERROR: {
                        gchar *debug = NULL;
                        GError *err = NULL;
                        gst_message_parse_error (msg, &err, &debug);
                        g_print ("Error: %s\n", err->message);
                        g_error_free (err);
                                if (debug) {
                                        g_print ("Debug details: %s\n", debug);
                                        g_free (debug);
                                }
                        g_main_loop_quit (loop);
                break;
        }
        default:
        break;
        }
return TRUE;
}

int main(){
    gst_init(NULL,NULL);

    App *app=&s_app;
    GstBus* bus;

    GstStateChangeReturn ret;

    g_print  (" Gstreamer Init completed \n ");
   
    app->appsrc = gst_element_factory_make("appsrc", "appsrc");
    g_assert(app->appsrc);

   app->filesink  = gst_element_factory_make("filesink", "filesink");
   g_assert(app->filesink);

   app->queue     = gst_element_factory_make("queue", "queue");
   g_assert(app->queue);

   app->pipeline  = gst_pipeline_new("server");

   app->loop     = g_main_loop_new(NULL, FALSE);


      pthread_t write_thread;
   
      g_object_set(G_OBJECT(app->filesink), "location", "appsyn0.data", NULL);
      g_object_set(G_OBJECT(app->appsrc),"max-bytes",0,NULL);
     //g_object_set(G_OBJECT(app->appsrc), "is-live",TRUE,"max-bytes",0,NULL);


      bus = gst_pipeline_get_bus (GST_PIPELINE (app->pipeline));
      gst_bus_add_watch (bus, bus_call, app->loop);
      gst_object_unref(bus);

     gst_bin_add_many(GST_BIN(app->pipeline),app->appsrc,app->queue,app->filesink,NULL);

      if (!gst_element_link_many (app->appsrc,app->queue,app->filesink, NULL)) {
        g_print ("Failed to link one or more elements! \n");
        return -1;
        }

      g_print("Gst-Pipeline is Running.........\n");
      pthread_create(&write_thread, NULL,FIFOwrite_data, app);

     //  ret=gst_element_set_state(app->pipeline, GST_STATE_PLAYING);  

        if (ret == GST_STATE_CHANGE_FAILURE) {
                GstMessage *msg;
        g_print ("Failed to start up pipeline! \n");
/* check if there is an error message with details on the bus */
        msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
        if (msg) {
        GError *err = NULL;
        gst_message_parse_error (msg, &err, NULL);
        g_print ("ERROR: %s\n", err->message);
        g_error_free (err);
        gst_message_unref (msg);
        }
        return -1;
     //pthread_exit (NULL);
     }

        g_main_loop_run(app->loop);
   
    /* Out of the main loop, clean up nicely */
        g_print("Returned, stopping playback\n");
        gst_element_set_state(app->pipeline, GST_STATE_NULL);
   
       g_print("Deleting pipeline\n");
       gst_object_unref(GST_OBJECT(app->pipeline));

      pthread_join(write_thread, NULL);

     return 0;
}
Reply | Threaded
Open this post in threaded view
|

Re: appsrc undefined reference to 'gst_app_buffer_new'

Mailing List SVR
In reply to this post by Nathan
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://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: appsrc undefined reference to 'gst_app_buffer_new'

Nathan
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] <[hidden email]> 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://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
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.
NAML