| | 240 | auto_flac0 (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data) |
|---|
| | 241 | { |
|---|
| | 242 | unsigned char * header = op->packet; |
|---|
| | 243 | int content; |
|---|
| | 244 | ogg_int64_t granule_rate = 0; |
|---|
| | 245 | |
|---|
| | 246 | if (op->b_o_s) { |
|---|
| | 247 | if (op->bytes < 4) return 0; |
|---|
| | 248 | if (strncmp ((char *)header, "fLaC", 4)) return 0; |
|---|
| | 249 | oggz_stream_set_content (oggz, serialno, OGGZ_CONTENT_FLAC0); |
|---|
| | 250 | } else { |
|---|
| | 251 | content = oggz_stream_get_content (oggz, serialno); |
|---|
| | 252 | if (content != OGGZ_CONTENT_FLAC0) return 0; |
|---|
| | 253 | |
|---|
| | 254 | granule_rate = (ogg_int64_t) (header[14] << 12) | (header[15] << 4) | ((header[16] >> 4)&0xf); |
|---|
| | 255 | #ifdef DEBUG |
|---|
| | 256 | printf ("Got flac rate %d\n", (int)granule_rate); |
|---|
| | 257 | #endif |
|---|
| | 258 | |
|---|
| | 259 | oggz_set_metric_linear (oggz, serialno, granule_rate, OGGZ_AUTO_MULT); |
|---|
| | 260 | } |
|---|
| | 261 | |
|---|
| | 262 | return 1; |
|---|
| | 263 | } |
|---|
| | 264 | |
|---|
| | 265 | static int |
|---|