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 655319 - hlsdemux: compilation problem on NetBSD caused by wrong GST_ELEMENT_ERROR usage
hlsdemux: compilation problem on NetBSD caused by wrong GST_ELEMENT_ERROR usage
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
0.10.22
Other NetBSD
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-07-26 09:08 UTC by Olaf 'Rhialto' Seibert
Modified: 2011-07-27 10:05 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Olaf 'Rhialto' Seibert 2011-07-26 09:08:22 UTC
See also short mail thread starting at http://mail-index.netbsd.org/pkgsrc-users/2011/07/15/msg014690.html. Below is the mail with the short version of the issue and the solution I found.

On Fri 15 Jul 2011 at 17:54:27 +0200, Rhialto wrote:
> I'm compiling my bulk of updated stuff for the new pkgsrc-2011Q2 branch,
> using a pkg_comp chroot with a 5.0 userland.
> 
> With multimedia/gst-plugins0.10-bad I see a failure like this:

I've had some time to look into this more.

>   CC     libgstfragmented_la-gsthlsdemux.lo
> gsthlsdemux.c: In function 'gst_hls_demux_sink_event':
> gsthlsdemux.c:373: error: expected expression before 'void'
...

> The lines with errors look like this:

> ->  373         GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid 
> playlist."),
>  NULL);

The 5th (last) argument to the GST_ELEMENT_ERROR macro, called debug, is
NULL.

> GST_ELEMENT_ERROR is defined in
> ./.buildlink/include/gstreamer-0.10/gst/gstelement.h:
> 
> /**
>  * GST_ELEMENT_ERROR:
>  * @el:     the element that generates the error
>  * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
>  * @code:   error code defined for that domain (see #gstreamer-GstGError)
>  * @text:   the message to display (format string and args enclosed in
>             parentheses)
>  * @debug:  debugging information for the message (format string and args
>             enclosed in parentheses)
>  * 
>  * Utility function that elements can use in case they encountered a fatal
>  * data processing error. The pipeline will post an error message and the
>  * application will be requested to stop further media processing.
>  */
> #define GST_ELEMENT_ERROR(el, domain, code, text, debug)                \
> G_STMT_START {                                                          \
>   gchar *__txt = _gst_element_error_printf text;                        \
>   gchar *__dbg = _gst_element_error_printf debug;                       \

This expands to gchar *__dbg = _gst_element_error_printf (void)0;

That is indeed a syntax error. 

The argument should be inside an extra pair of parentheses, like the
previous argument, text. Even the doc text I quoted mentions it,
in fact.

So, now the solution becomes simple: add this patch:


--- gst/hls/gsthlsdemux.c.orig  2011-07-25 14:52:33.000000000 +0000
+++ gst/hls/gsthlsdemux.c       2011-07-25 14:53:51.000000000 +0000
@@ -370,14 +370,14 @@
         /* In most cases, this will happen if we set a wrong url in the
          * source element and we have received the 404 HTML response instead of
          * the playlist */
-        GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid playlist."), NULL);
+        GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid playlist."), 
(NULL));
         return FALSE;
       }
 
       if (!ret && gst_m3u8_client_is_live (demux->client)) {
         GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
             ("Failed querying the playlist uri, "
-                "required for live sources."), NULL);
+                "required for live sources."), (NULL));
         return FALSE;
       }
 
@@ -605,7 +605,7 @@
 cache_error:
   {
     GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
-        ("Could not cache the first fragments"), NULL);
+        ("Could not cache the first fragments"), (NULL));
     gst_hls_demux_stop (demux);
     return;
   }
@@ -868,7 +868,7 @@
 state_change_error:
   {
     GST_ELEMENT_ERROR (demux, CORE, STATE_CHANGE,
-        ("Error changing state of the fetcher element."), NULL);
+        ("Error changing state of the fetcher element."), (NULL));
     bret = FALSE;
     goto quit;
   }


What I don't understand is this: This code obviously can't compile. I checked the git versions, and apparently they have not changed. Yet I have not been able to find other complaints about this, which suggests that there is no problem. How to reconcile these views?
Comment 1 David Schleef 2011-07-27 04:35:10 UTC
Patch is generally correct.  Could you attach a new version created using 'git format-patch'?  (If you aren't compiling from git, ignore that.)

It works on other systems because NULL is typically defined as ((void *)0), whereas on BSD derived systems it's (void *)0 or even just 0.
Comment 2 Olaf 'Rhialto' Seibert 2011-07-27 08:57:43 UTC
Sorry, I didn't compile from git. (I used the released tarball, in a pkgsrc environment; that is mainly for making dependencies explicit by removing headers and libraries of un-declared dependencies from sight, and for patches as needed to compile on the host system.)

Re the definition of NULL: of course! I never really expected anything more verbose than plain "0" (which is the simplest valid definition) so I was already kind of surprised by seeing "(void *)0" in the expansion. I didn't think of more verbosity in the form of more parentheses...

Thanks.
Comment 3 Tim-Philipp Müller 2011-07-27 10:05:01 UTC
Fixed, thanks!

 commit 7583080023ad66222c7245268d82e66ee775afc3
 Author: Olaf Seibert <rhialto@azenomei.knuffel.net>
 Date:   Wed Jul 27 11:02:41 2011 +0100

    hlsdemux: fix wrong usage of GST_ELEMENT_ERROR macros and compilation on NetBSD
    
    https://bugzilla.gnome.org/show_bug.cgi?id=655319

(Next time a git format-patch formattted patch please.)