After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 424143 - Hello world too complicated
Hello world too complicated
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: documentation
0.10.x
Other Linux
: Normal enhancement
: 0.10.33
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-03-29 14:56 UTC by Mathias Hasselmann (IRC: tbf)
Modified: 2011-03-08 07:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
hello-gst.c (1.60 KB, text/x-csrc)
2007-03-29 15:00 UTC, Mathias Hasselmann (IRC: tbf)
  Details
updated hello world example (5.14 KB, patch)
2011-03-07 14:25 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review

Description Mathias Hasselmann (IRC: tbf) 2007-03-29 14:56:56 UTC
The manual of gstreamer provides a hello-world example. It was a good example in the days before the great playbin element, but for today's gstreamer it is too complicated - in my opinion. What about replacing it with an example really just demonstrating the usage of playbin in a C program?
Comment 1 Mathias Hasselmann (IRC: tbf) 2007-03-29 15:00:15 UTC
Created attachment 85515 [details]
hello-gst.c

That's how my "Hello World" example would look like. Maybe even the "bus_call" should be stripped out, or be replaced by something just calling g_loop_quit. Error handling could go into a separate example demonstrating error handling. Same for the current "Hello World" example: It could serve as example for building a custom pipeline.
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-01 21:19:27 UTC
Its this one;
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/tests/examples/helloworld/helloworld.c
and I think its a good idea. Your example needs small cleanups. Anyone else +1 for this?
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-07 14:25:06 UTC
Created attachment 182703 [details] [review]
updated hello world example
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-07 14:44:47 UTC
Hmm, the one I patched is not referenced from the application developers manaual. Matthias did you menat to update:
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/manual/basics-helloworld.xml#n59 ? That we probably better keep as it is (there is also a picture that would need an update).
Comment 5 Tim-Philipp Müller 2011-03-07 15:17:08 UTC
Looks good to me. Niggles:

 - argv[1] needs to be a URI, but the help string
   says 'media file'. Maybe add some kind of

   if (gst_uri_is_valid (argv[1]))
     uri = g_strdup (argv[1]);
   else
     uri = gst_filename_to_uri (argv[1], NULL);

   (this is also something that trips up
   people quite a lot, so might be worth
   having in a hello world).

 - wonder if for a first version it would be even
   better to get rid of the main loop, and
   just do a

   while ((msg = gst_bus_*()) {
     ...
   }

   instead. (Many people don't understand
   main loops, or are confused by them).
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-08 07:44:41 UTC
(In reply to comment #5)
> Looks good to me. Niggles:
> 
>  - argv[1] needs to be a URI, but the help string
>    says 'media file'. Maybe add some kind of
> 
>    if (gst_uri_is_valid (argv[1]))
>      uri = g_strdup (argv[1]);
>    else
>      uri = gst_filename_to_uri (argv[1], NULL);
> 
>    (this is also something that trips up
>    people quite a lot, so might be worth
>    having in a hello world).

good idea. Fixed.

> 
>  - wonder if for a first version it would be even
>    better to get rid of the main loop, and
>    just do a
> 
>    while ((msg = gst_bus_*()) {
>      ...
>    }
> 
>    instead. (Many people don't understand
>    main loops, or are confused by them).

I added a couple of comment lines instead. I think the main-loop is as short as the usual event_loop helper we use, but I think its better to have a 'proper example'.
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-08 07:45:47 UTC
Comment on attachment 182703 [details] [review]
updated hello world example

Committed with small changes:

commit bdee46249443531118f119cd3f7d7d5bf794ee6b
Author: Stefan Kost <ensonic@users.sf.net>
Date:   Mon Mar 7 12:24:30 2011 +0200

    pluginfeature: avoid duplication feature->name
    
    The feature name is not supposed to change over time anyway. In order to enforce
    this parentize features to the registry and make the feature->name pointing to
    GstObject:name. In 0.11 we could consider of removing the feature->name variable
    (FIXME comment added).
    
    Fixes: #459466