[gst-devel] where is library gst.h?
Stefan Kost
ensonic at hora-obscura.de
Mon Jul 11 00:08:56 CEST 2005
Hi Fabian,
can you first make sure you can build a simple glib based app?
--- glibtest.c ---
#include "glib/glib.h"
int main(int argc,char *argv) {
gpointer mem=g_malloc(100);
g_print("Hello\n");
g_free(mem);
}
gcc `pkg-config --cflags glib-2` glibtest.c -o glibtest `pkg-config --libs glib-2`
Stefan
PS.: the above is untested ;)
>
>> Are you sure you don'T miss a ';' in an own include you include
>> before gst.h.
>> Best would be to attach you source and show use the full commandline.
>>
>
> I did this (that I saw in gestreamer docs)
>
> fabian at jaguar:~/programas$ gcc -Wall $(pkg-config --cflags --libs
> gstreamer-0.8) mp3play.c -o mp3rep
> /usr/lib/gcc-lib/i486-linux/3.3.5/../../../libgstreamer-0.8.so:
> undefined reference to `g_assert_warning'
> /usr/lib/gcc-lib/i486-linux/3.3.5/../../../libgstreamer-0.8.so:
> undefined reference to `g_return_if_fail_warning'
> collect2: ld returned 1 exit status
>
> 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