[MPlayer-dvb] [PATCH] Format of DVB PROGRAM N.

Mario Rossi mariofutire at googlemail.com
Tue May 29 22:42:04 CEST 2007


>Nico Sabbi wrote:
>> Mario Rossi wrote:

>>> BBC HD1 has a PROGRAM N. (36932) bigger than 2^15, so it does not fit
>>> well into a signed variable.
>>>
>>> With this patch the ouput is correct.

>>>-		mp_msg(MSGT_DEMUXER, MSGL_INFO, " PROGRAM N. %d\n", param->prog);
>>>+		mp_msg(MSGT_DEMUXER, MSGL_INFO, " PROGRAM N. %hu\n", param->prog);

>> %d is more than enough for a 16 bit int. Excerpt from sprintf()

>So it should be just a %u, nothing more, nothing less.

>Cheers,
>Juri

printf does not agree:

output with %d
VIDEO H264(pid=1502) AUDIO A52(pid=1505) NO SUBS (yet)!  PROGRAM N. -28604

with %u
VIDEO H264(pid=1502) AUDIO A52(pid=1505) NO SUBS (yet)!  PROGRAM N. 4294938692

with %hu
VIDEO H264(pid=1502) AUDIO A52(pid=1505) NO SUBS (yet)!  PROGRAM N. 36932

with %hd
VIDEO H264(pid=1502) AUDIO A52(pid=1505) NO SUBS (yet)!  PROGRAM N. -28604

The variable is a 16bit int (so the "h") but it contains a number
bigger than the MAX signed 16bit integer (36932 > 32768), so it has to
be considered unsigned (u), otherwise the number becomes negative.
Since %u is not working either, I guess that the value is pushed in
the stack with $FFFF padding (which is natural since it is signed).

Maybe the variable "tsdemux_init_t.prog" should be changed to unsigned
(since it can contain numbers bigger than 32768), instead of signed
(in which case both %d and %u work).

cheers



More information about the MPlayer-dvb mailing list