[gst-devel] compiling

Fabian Hergenreder fabian_h at uol.com.ar
Sat Jul 9 23:57:25 CEST 2005


Sorry but I send a message with a wrong subject

I did try this

fabian at jaguar:/$ gst-
gst-complete        gst-feedback-0.8    gst-launch-ext-0.8   
gst-typefind        gst-xmllaunch
gst-complete-0.8    gst-inspect         gst-md5sum           
gst-typefind-0.8    gst-xmllaunch-0.8
gst-compprep        gst-inspect-0.8     gst-md5sum-0.8       
gst-visualise-0.8
gst-compprep-0.8    gst-launch          gst-register        gst-xmlinspect
gst-feedback        gst-launch-0.8      gst-register-0.8     
gst-xmlinspect-0.8

this is my code now (I changed include line for gst.h library)

#include <stdlib.h>
#include <gst/gst.h>

/*
  * Global objects are usually a bad thing. For the purpose of this
  * example, we will use them, however.
  */

GstElement *pipeline, *source, *parser, *decoder, *sink;

static void new_pad (GstElement *element,GstPad *pad, gpointer data)
{
   /* We can now link this pad with the audio decoder and
    * add both decoder and audio output to the pipeline. */
   gst_pad_link (pad, gst_element_get_pad (decoder, "sink"));
   gst_bin_add_many (GST_BIN (pipeline), decoder, sink, NULL);

   /* This function synchronizes a bins state on all of its
    * contained children. */
   gst_bin_sync_children_state (GST_BIN (pipeline));
}

int main (int   argc, char *argv[])
{
   /* initialize GStreamer */
   gst_init (&argc, &argv);

   /* check input arguments */
   if (argc != 2) {
     g_print ("Usage: %s <Ogg/Vorbis filename>\n", argv[0]);
     return -1;
   }

   /* create elements */
   pipeline = gst_pipeline_new ("audio-player");
   source = gst_element_factory_make ("filesrc", "file-source");
   parser = gst_element_factory_make ("oggdemux", "ogg-parser");
   decoder = gst_element_factory_make ("vorbisdec", "vorbis-decoder");
   sink = gst_element_factory_make ("alsasink", "alsa-output");

   /* set filename property on the file source */
   g_object_set (G_OBJECT (source), "location", argv[1], NULL);

   /* link together - note that we cannot link the parser and
    * decoder yet, becuse the parser uses dynamic pads. For that,
    * we set a new-pad signal handler. */
   gst_element_link (source, parser);
   gst_element_link (decoder, sink);
   g_signal_connect (parser, "new-pad", G_CALLBACK (new_pad), NULL);

   /* put all elements in a bin - or at least the ones we will use
    * instantly. */
   gst_bin_add_many (GST_BIN (pipeline), source, parser, NULL);

   /* Now set to playing and iterate. We will set the decoder and
    * audio output to ready so they initialize their memory already.
    * This will decrease the amount of time spent on linking these
    * elements when the Ogg parser emits the new-pad signal. */
   gst_element_set_state (decoder, GST_STATE_READY);
   gst_element_set_state (sink, GST_STATE_READY);
   gst_element_set_state (pipeline, GST_STATE_PLAYING);

   /* and now iterate - the rest will be automatic from here on.
    * When the file is finished, gst_bin_iterate () will return
    * FALSE, thereby terminating this loop. */
   while (gst_bin_iterate (GST_BIN (pipeline))) ;

   /* clean up nicely */
   gst_element_set_state (pipeline, GST_STATE_NULL);
   gst_object_unref (GST_OBJECT (pipeline));

   return 0;
}

And this that i got

fabian at jaguar$gcc -Wall $(pkg-config --cflags --libs gstreamer-0.8  
glib-2.0) hello.c -ohello

/usr/local/lib/libgstreamer-0.8.so: undefined reference to  
`g_assert_warning'
/usr/local/lib/libgstreamer-0.8.so: undefined reference to  
`g_return_if_fail_warning'
collect2: ld returned 1 exit status

Thanks for guides, I did many things, I uninstall gstreamer 9.0 and debian  
packages and
  I did compile my own so it is working now with gstreamers commands
but I can't compile the above code.

I can't understand why the error show library libstreamer-0.8.so
should it work with <library>.h like gst.h ??

fabian




More information about the gstreamer-devel mailing list