Incorrect messages from GST_DEBUG.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Incorrect messages from GST_DEBUG.

wl2776
Administrator
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);


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.
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect messages from GST_DEBUG.

wl2776
Administrator
wl2776 wrote
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);
The problem was solved with replacing two %d's with %lld, as start and stop are gint64
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect messages from GST_DEBUG.

Marco Ballesio
In reply to this post by wl2776


On Tue, May 18, 2010 at 4:57 PM, wl2776 <[hidden email]> 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);


I may be wrong, but at a first glance I'd suggest you to cross check your first format with:

http://linux.die.net/man/3/printf

especially the "ell" and "ell ell" notations.

Regards.
 

------------------------------------------------------------------------------


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect messages from GST_DEBUG.

Edward Hervey
Administrator
In reply to this post by wl2776
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.



------------------------------------------------------------------------------

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel