Mercurial > audlegacy-plugins
comparison src/madplug/decoder.c @ 1976:5fa26178eaef
s/tuple_/aud_tuple_/g
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Sun, 07 Oct 2007 00:22:59 -0500 |
| parents | d158ce84fda7 |
| children | fa9f85cebade |
comparison
equal
deleted
inserted
replaced
| 1973:f86cb7fc1d4f | 1976:5fa26178eaef |
|---|---|
| 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, FIELD_LENGTH, NULL, -1); | 195 aud_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, FIELD_LENGTH, NULL) == -1) | 273 if(aud_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, FIELD_LENGTH, NULL); | 276 gint length = aud_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, FIELD_LENGTH, NULL) == -1) { | 360 if(aud_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, FIELD_LENGTH, NULL); | 374 gint length = aud_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 |
| 480 } | 480 } |
| 481 | 481 |
| 482 /* set mainwin title */ | 482 /* set mainwin title */ |
| 483 if (info->title) | 483 if (info->title) |
| 484 g_free(info->title); | 484 g_free(info->title); |
| 485 info->title = tuple_formatter_make_title_string(info->tuple, audmad_config.title_override == TRUE ? | 485 info->title = aud_tuple_formatter_make_title_string(info->tuple, audmad_config.title_override == TRUE ? |
| 486 audmad_config.id3_format : get_gentitle_format()); | 486 audmad_config.id3_format : get_gentitle_format()); |
| 487 | 487 |
| 488 tlen = (gint) mad_timer_count(info->duration, MAD_UNITS_MILLISECONDS), | 488 tlen = (gint) mad_timer_count(info->duration, MAD_UNITS_MILLISECONDS), |
| 489 mad_plugin->set_info(info->title, | 489 mad_plugin->set_info(info->title, |
| 490 (tlen == 0 || info->size <= 0) ? -1 : tlen, | 490 (tlen == 0 || info->size <= 0) ? -1 : tlen, |
| 706 } | 706 } |
| 707 #ifdef DEBUG | 707 #ifdef DEBUG |
| 708 g_message("e: decode"); | 708 g_message("e: decode"); |
| 709 #endif /* DEBUG */ | 709 #endif /* DEBUG */ |
| 710 | 710 |
| 711 tuple_free(info->tuple); | 711 aud_tuple_free(info->tuple); |
| 712 info->tuple = NULL; | 712 info->tuple = NULL; |
| 713 | 713 |
| 714 info->playback->output->close_audio(); | 714 info->playback->output->close_audio(); |
| 715 g_mutex_lock(mad_mutex); | 715 g_mutex_lock(mad_mutex); |
| 716 info->playback->playing = 0; | 716 info->playback->playing = 0; |
