Audio-Play-MPG123

 view release on metacpan or  search on metacpan

mpg123/system.c  view on Meta::CPAN

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
                        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

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
    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 )