Mercurial > audlegacy-plugins
comparison src/flac113/plugin.c @ 493:31d21ad70903 trunk
[svn] flac 113 plugin: stability fixes and a new option to disable bitrate update in player window during playback (saves cpu, this is the solution for most people playing flac and reporting high cpu usage)
| author | giacomo |
|---|---|
| date | Sun, 21 Jan 2007 16:08:19 -0800 |
| parents | 9fc8b269e811 |
| children | 522acbb51ecc |
comparison
equal
deleted
inserted
replaced
| 492:0dd1ff7e5ba7 | 493:31d21ad70903 |
|---|---|
| 211 | 211 |
| 212 /* title */ | 212 /* title */ |
| 213 | 213 |
| 214 bmp_cfg_db_get_bool(db, "flac", "title.tag_override", &flac_cfg.title.tag_override); | 214 bmp_cfg_db_get_bool(db, "flac", "title.tag_override", &flac_cfg.title.tag_override); |
| 215 | 215 |
| 216 bmp_cfg_db_get_bool(db, "flac", "title.disable_bitrate_update", &flac_cfg.title.disable_bitrate_update); | |
| 217 | |
| 216 if(!bmp_cfg_db_get_string(db, "flac", "title.tag_format", &flac_cfg.title.tag_format)) | 218 if(!bmp_cfg_db_get_string(db, "flac", "title.tag_format", &flac_cfg.title.tag_format)) |
| 217 flac_cfg.title.tag_format = g_strdup("%p - %t"); | 219 flac_cfg.title.tag_format = g_strdup("%p - %t"); |
| 218 | 220 |
| 219 bmp_cfg_db_get_bool(db, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); | 221 bmp_cfg_db_get_bool(db, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); |
| 220 | 222 |
| 417 { | 419 { |
| 418 g_free(flac_ip.description); | 420 g_free(flac_ip.description); |
| 419 flac_ip.description = NULL; | 421 flac_ip.description = NULL; |
| 420 | 422 |
| 421 if (flac_cfg.title.tag_format) { | 423 if (flac_cfg.title.tag_format) { |
| 422 free(flac_cfg.title.tag_format); | 424 g_free(flac_cfg.title.tag_format); |
| 423 flac_cfg.title.tag_format = NULL; | 425 flac_cfg.title.tag_format = NULL; |
| 424 } | 426 } |
| 425 | 427 |
| 426 if (flac_cfg.title.user_char_set) { | 428 if (flac_cfg.title.user_char_set) { |
| 427 free(flac_cfg.title.user_char_set); | 429 g_free(flac_cfg.title.user_char_set); |
| 428 flac_cfg.title.user_char_set = NULL; | 430 flac_cfg.title.user_char_set = NULL; |
| 429 } | 431 } |
| 430 | 432 |
| 431 if (flac_cfg.stream.proxy_host) { | 433 if (flac_cfg.stream.proxy_host) { |
| 432 free(flac_cfg.stream.proxy_host); | 434 g_free(flac_cfg.stream.proxy_host); |
| 433 flac_cfg.stream.proxy_host = NULL; | 435 flac_cfg.stream.proxy_host = NULL; |
| 434 } | 436 } |
| 435 | 437 |
| 436 if (flac_cfg.stream.proxy_user) { | 438 if (flac_cfg.stream.proxy_user) { |
| 437 free(flac_cfg.stream.proxy_user); | 439 g_free(flac_cfg.stream.proxy_user); |
| 438 flac_cfg.stream.proxy_user = NULL; | 440 flac_cfg.stream.proxy_user = NULL; |
| 439 | 441 |
| 440 } | 442 } |
| 441 | 443 |
| 442 if (flac_cfg.stream.proxy_pass) { | 444 if (flac_cfg.stream.proxy_pass) { |
| 443 free(flac_cfg.stream.proxy_pass); | 445 g_free(flac_cfg.stream.proxy_pass); |
| 444 flac_cfg.stream.proxy_pass = NULL; | 446 flac_cfg.stream.proxy_pass = NULL; |
| 445 } | 447 } |
| 446 | 448 |
| 447 safe_decoder_delete_(decoder_); | 449 safe_decoder_delete_(decoder_); |
| 448 decoder_ = 0; | 450 decoder_ = 0; |
| 579 stream_data_.eof = false; | 581 stream_data_.eof = false; |
| 580 sample_buffer_first_ = sample_buffer_last_ = 0; | 582 sample_buffer_first_ = sample_buffer_last_ = 0; |
| 581 } | 583 } |
| 582 stream_data_.seek_to_in_sec = -1; | 584 stream_data_.seek_to_in_sec = -1; |
| 583 } | 585 } |
| 584 else { | 586 else if ( !flac_cfg.title.disable_bitrate_update ) |
| 587 { | |
| 585 /* display the right bitrate from history */ | 588 /* display the right bitrate from history */ |
| 586 unsigned bh_index_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; | 589 unsigned bh_index_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; |
| 587 if(bh_index_o != bh_index_last_o && bh_index_o != bh_index_last_w && bh_index_o != (bh_index_last_w + 1) % BITRATE_HIST_SIZE) { | 590 if(bh_index_o != bh_index_last_o && bh_index_o != bh_index_last_w && bh_index_o != (bh_index_last_w + 1) % BITRATE_HIST_SIZE) { |
| 588 bh_index_last_o = bh_index_o; | 591 bh_index_last_o = bh_index_o; |
| 589 flac_ip.set_info(stream_data_.title, stream_data_.length_in_msec, bitrate_history_[bh_index_o], stream_data_.sample_rate, stream_data_.channels); | 592 flac_ip.set_info(stream_data_.title, stream_data_.length_in_msec, bitrate_history_[bh_index_o], stream_data_.sample_rate, stream_data_.channels); |
