[gst-devel] Incorrect messages from GST_DEBUG.

Edward Hervey bilboed at gmail.com
Wed May 19 08:31:06 CEST 2010


On Tue, 2010-05-18 at 06:57 -0700, wl2776 wrote:
> I have these statements:
> 
> GstFormat fmt=GST_FORMAT_TIME;
> gint m_direction=1;
> gdouble rate;
> gint64 start=-1,stop=-1;
> 
> GST_DEBUG("current segment: rate %lf fmt %d start %d stop %d direction %d",
>                     rate,fmt,start,stop,m_direction);
> GST_DEBUG("m_direction=%d",m_direction);

  If you want your code to be portable, use the conversion specifiers
from glib, like G_GUINT64_FORMAT :
http://library.gnome.org/devel/glib/stable/glib-Miscellaneous-Macros.html

  Ex: GST_DEBUG("This is a guint64 : %"G_GUINT64_FORMAT" and this is a
gint64 value %"G_GINT64_FORMAT, my_guint64_value, my_gint64_value);

  It will handle the various architectures, operating systems and
compilers properly.

    Edward

> 
> 
> They produce the output:
> 0:00:08.522254000  2840   0412AFC0 DEBUG                 player
> gst_player.cpp:342:gst_player::bus_watch: current segment: rate 1.000000 fmt
> 3 start 0 stop 0 direction -1
> 0:00:08.522254000  2840   0412AFC0 DEBUG                 player
> gst_player.cpp:343:gst_player::bus_watch: m_direction=1
> 
> The difference in the m_direction. It is -1 in the first GST_DEBUG and 1 in
> the second one.
> 1 is the correct value, as shown in the debugger.






More information about the gstreamer-devel mailing list