Mercurial > audlegacy-plugins
comparison src/madplug/decoder.c @ 1687:d158ce84fda7
Modified for Tuplez/plugin API changes.
| author | Matti Hamalainen <ccr@tnsp.org> |
|---|---|
| date | Wed, 05 Sep 2007 09:29:26 +0300 |
| parents | 4e612b01f303 |
| children | 5fa26178eaef |
comparison
equal
deleted
inserted
replaced
| 1600:49fe2225d236 | 1687:d158ce84fda7 |
|---|---|
| 190 info->bitrate = 0; | 190 info->bitrate = 0; |
| 191 info->pos = mad_timer_zero; | 191 info->pos = mad_timer_zero; |
| 192 info->duration = mad_timer_zero; // should be cleared before loop, if we use it as break condition. | 192 info->duration = mad_timer_zero; // should be cleared before loop, if we use it as break condition. |
| 193 | 193 |
| 194 if(info->fileinfo_request == TRUE) { | 194 if(info->fileinfo_request == TRUE) { |
| 195 tuple_associate_int(info->tuple, "length", -1); | 195 tuple_associate_int(info->tuple, FIELD_LENGTH, NULL, -1); |
| 196 info->fileinfo_request = FALSE; | 196 info->fileinfo_request = FALSE; |
| 197 } | 197 } |
| 198 | 198 |
| 199 #ifdef DEBUG | 199 #ifdef DEBUG |
| 200 g_message("f: scan_file"); | 200 g_message("f: scan_file"); |
| 268 mad_timer_count(header.duration, | 268 mad_timer_count(header.duration, |
| 269 MAD_UNITS_MILLISECONDS)); | 269 MAD_UNITS_MILLISECONDS)); |
| 270 g_message("size = %d", stream.next_frame - stream.this_frame); | 270 g_message("size = %d", stream.next_frame - stream.this_frame); |
| 271 #endif | 271 #endif |
| 272 #endif | 272 #endif |
| 273 if(tuple_get_int(info->tuple, "length") == -1) | 273 if(tuple_get_int(info->tuple, FIELD_LENGTH, NULL) == -1) |
| 274 mad_timer_add(&info->duration, header.duration); | 274 mad_timer_add(&info->duration, header.duration); |
| 275 else { | 275 else { |
| 276 gint length = tuple_get_int(info->tuple, "length"); | 276 gint length = tuple_get_int(info->tuple, FIELD_LENGTH, NULL); |
| 277 | 277 |
| 278 info->duration.seconds = length / 1000; | 278 info->duration.seconds = length / 1000; |
| 279 info->duration.fraction = length % 1000; | 279 info->duration.fraction = length % 1000; |
| 280 } | 280 } |
| 281 data_used += stream.next_frame - stream.this_frame; | 281 data_used += stream.next_frame - stream.this_frame; |
| 355 if(info->size != 0) | 355 if(info->size != 0) |
| 356 info->frames = (info->size - tagsize) / frame_size; | 356 info->frames = (info->size - tagsize) / frame_size; |
| 357 #ifdef DEBUG | 357 #ifdef DEBUG |
| 358 g_message("info->frames = %d", info->frames); | 358 g_message("info->frames = %d", info->frames); |
| 359 #endif | 359 #endif |
| 360 if(tuple_get_int(info->tuple, "length") == -1) { | 360 if(tuple_get_int(info->tuple, FIELD_LENGTH, NULL) == -1) { |
| 361 if(xing_bitrate > 0.0) { | 361 if(xing_bitrate > 0.0) { |
| 362 /* calc duration with xing info */ | 362 /* calc duration with xing info */ |
| 363 double tmp = 8 * (double)info->xing.bytes * 1000 / xing_bitrate; | 363 double tmp = 8 * (double)info->xing.bytes * 1000 / xing_bitrate; |
| 364 info->duration.seconds = (guint)(tmp / 1000); | 364 info->duration.seconds = (guint)(tmp / 1000); |
| 365 info->duration.fraction = (guint)(tmp - info->duration.seconds * 1000); | 365 info->duration.fraction = (guint)(tmp - info->duration.seconds * 1000); |
| 369 info->duration.fraction /= N_AVERAGE_FRAMES; | 369 info->duration.fraction /= N_AVERAGE_FRAMES; |
| 370 mad_timer_multiply(&info->duration, info->frames); | 370 mad_timer_multiply(&info->duration, info->frames); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 else { | 373 else { |
| 374 gint length = tuple_get_int(info->tuple, "length"); | 374 gint length = tuple_get_int(info->tuple, FIELD_LENGTH, NULL); |
| 375 | 375 |
| 376 info->duration.seconds = length / 1000; | 376 info->duration.seconds = length / 1000; |
| 377 info->duration.fraction = length % 1000; | 377 info->duration.fraction = length % 1000; |
| 378 } | 378 } |
| 379 #ifdef DEBUG | 379 #ifdef DEBUG |
