Audio-Play-MPG123
view release on metacpan or search on metacpan
mpg123/system.c view on Meta::CPAN
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
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 1.181 second using v1.01-cache-2.11-cpan-49f99fa48dc )