Audio-Play-MPG123
view release on metacpan or search on metacpan
mpg123/system.c view on Meta::CPAN
136137138139140141142143144145146147148149150151152153154155156
if
(ret < 0)
return
-1;
cnt -= ret;
}
ret = len;
}
return
ret;
}
static unsigned long system_raw_timer_value(unsigned char
*buf
)
{
unsigned long val;
if
(!(buf[0] & 0x1) || !(buf[2] & 0x1) || !(buf[4] & 0x1)) {
if
(verbose)
fprintf(stderr,
"Warning: missing marker in time stamp!\n"
);
}
val = (buf[0] & 0xe) << (29-1);
val |= buf[1] << 21;
mpg123/system.c view on Meta::CPAN
188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
if
( (buf[
pos
] & 0xc0) == 0x40 ) {
pi->scale = (buf[
pos
] >> 5) & 0x1;
pi->size = (buf[
pos
] & 0x1f) << 8;
pi->size |= buf[
pos
+1];
pos
+= 2;
}
switch( buf[
pos
] & 0xf0) {
case 0x00:
if
(buf[
pos
] != 0x0f) {
fprintf(stderr,
"Ouch ... illegal timer code!\n"
);
return
-1;
}
pos
++;
break;
case 0x20:
pi->pts = system_raw_timer_value(buf+
pos
);
pos
+= 5;
break;
case 0x30:
pi->pts = system_raw_timer_value(buf+
pos
);
pos
+= 5;
if
( (buf[
pos
] & 0xf) != 0x10) {
if
(verbose)
fprintf(stderr,
"DTS should start with 0x1x!\n"
);
}
pi->dts = system_raw_timer_value(buf+
pos
);
pos
+= 5;
break;
default
:
if
(verbose)
fprintf(stderr,
"Ouch ... illegal timer code!\n"
);
return
-1;
}
#if 1
write
(1,buf+
pos
,len-
pos
);
#endif
return
0;
( run in 0.319 second using v1.01-cache-2.11-cpan-e5176c747c2 )