[gst-devel] where is library gst.h? AT LAST!!!! IT works!!

Daniel Díaz mrchapp at gmail.com
Mon Jul 11 21:23:26 CEST 2005


Hi, Fabian.


On 7/11/05, Fabian Hergenreder <fabian_h at uol.com.ar> wrote:
> I compiled the mp3 player code below.
> 
> I changed this variable PKG_CONFIG_PATH=/usr/local/bin/pkg-config
> and it worked with the command
>   gcc `pkg-config --cflags --libs gstreamer-0.8 glib-2.0` mp3play.c -o
> mplay `pkg-config --libs glib-2.0`
> 
> but I have to leave this include line  #include
> </usr/include/gstreamer-0.8/gst/gst.h>
> 
> So I think I have to review pkg-config for glib-2.0 but i dont know how to
> do that
> maybe Ariel can give me some idea.
> 
> Thanks Stefan for your help and your patience.

Looks like you have a mix of self-compiled and distributed libraries
in your system. Try these:

  $ ls /lib/pkgconfig/
  $ ls /usr/lib/pkgconfig/
  $ ls /usr/local/lib/pkgconfig/

  $ pkg-config --list-all
  $ PKG_CONFIG_PATH=/usr/lib/pkgconfig pkg-config --list-all
  $ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --list-all

Those are not gonna give you a straight answer, but will sure give you
something to explore.

Remember that you can have multiple paths in your PKG_CONFIG_PATH:

  $ PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig
pkg-config --list-all

Look for PKG_CONFIG_PATH on `man pkg-config`.

Greetings!

Daniel Díaz
yosoy at danieldiaz.org



> > gcc `pkg-config --cflags glib-2` glibtest.c -o glibtest `pkg-config
> > --libs glib-2`
> >
> > Stefan
> >
> > PS.: the above is untested ;)
> >
> >>
> 
> >>  this is the code
> >>  /* This is a command line mp3 player using gstreamer. It's nothing
> >> more  than
> >>  * their hello,world with one addition feature in that it prints off
> >> the  time
> >>  * while the song is playing.
> >>  *
> >>  * Just making it public for the hell of it. I did not write 100% of
> >> this  code
> >>  * I simply added a little to print off the length, time remaining...
> >>  */
> >>  #include <stdlib.h>
> >> #include </usr/include/gstreamer-0.8/gst/gst.h>
> >>  #define MY_TIME_FORMAT "u:%02u:%02u"
> >> #define MY_TIME_ARGS(t) \
> >>     (guint) ((t) / (GST_SECOND * 60 * 60)), \
> >>     (guint) (((t) / (GST_SECOND * 60)) % 60), \
> >>     (guint) (((t) / GST_SECOND) % 60)
> >>  int
> >> main (int argc, char *argv[])
> >> {
> >>       GstElement *bin, *filesrc, *decoder, *osssink;
> >>        gst_init (&argc, &argv);
> >>      if (argc != 2) {
> >>         g_print ("usage: %s <mp3 file>\n", argv[0]);
> >>             exit (-1);
> >>       }
> >>        /* create a new bin to hold the elements */
> >>       bin = gst_pipeline_new ("pipeline");
> >>       g_assert (bin);
> >>        /* create a disk reader */
> >>       filesrc = gst_element_factory_make ("filesrc", "disk_source");
> >>       g_assert (filesrc);
> >>       g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
> >>      /* now it's time to get the decoder */
> >>       decoder = gst_element_factory_make ("mad", "decode");
> >>       if (!decoder) {
> >>             g_print ("could not find 'mad' plugin\n");
> >>             return -1;
> >>       }
> >>       /* and an audio sink */
> >>       osssink = gst_element_factory_make ("osssink", "play_audio");
> >>       g_assert (osssink);
> >>        /* add objects to the main pipeline */
> >>       gst_bin_add_many (GST_BIN (bin), filesrc, decoder, osssink, NULL);
> >>        /* link the elements */
> >>       gst_element_link_many (filesrc, decoder, osssink, NULL);
> >>        /* start playing */
> >>       gst_element_set_state (bin, GST_STATE_PLAYING);
> >>      while (gst_bin_iterate (GST_BIN (bin)))
> >>     {
> >>           gint64 len, pos;
> >>             GstFormat fmt = GST_FORMAT_TIME;
> >>              if (gst_element_query (osssink, GST_QUERY_POSITION, &fmt,
> >> &pos) &&
> >>                 gst_element_query (osssink, GST_QUERY_TOTAL, &fmt,
> >> &len))
> >>         {
> >>                   g_print ("Time: %" MY_TIME_FORMAT " / %"
> >> MY_TIME_FORMAT "\r",
> >>                        MY_TIME_ARGS (pos), MY_TIME_ARGS (len));
> >>             }
> >>       }
> >>        /* stop the bin */
> >>       gst_element_set_state (bin, GST_STATE_NULL);
> >>       gst_object_unref (GST_OBJECT (bin));
> >>        exit (0);
> >> }
> >>
> >>> gst-inspect is a link to gst-inspect-0.8 (in case you are using 0.8).
> >>> Which distribution you are one. Have you installed gstreamer by
> >>> yourself  from source or as packages. gst-inspect is part of the
> >>> gstreamer (core)  package. Try gst-<TAB> doe it show anything?
> >>>
> >>> Stefan




More information about the gstreamer-devel mailing list