Mercurial > audlegacy-plugins
comparison src/flac112/plugin.c @ 492:0dd1ff7e5ba7 trunk
[svn] flac 112 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:03:30 -0800 |
| parents | be4cde738a73 |
| children | 5f2145032f46 |
comparison
equal
deleted
inserted
replaced
| 491:9fc8b269e811 | 492:0dd1ff7e5ba7 |
|---|---|
| 237 | 237 |
| 238 /* title */ | 238 /* title */ |
| 239 | 239 |
| 240 bmp_cfg_db_get_bool(db, "flac", "title.tag_override", &flac_cfg.title.tag_override); | 240 bmp_cfg_db_get_bool(db, "flac", "title.tag_override", &flac_cfg.title.tag_override); |
| 241 | 241 |
| 242 bmp_cfg_db_get_bool(db, "flac", "title.disable_bitrate_update", &flac_cfg.title.disable_bitrate_update); | |
| 243 | |
| 242 if(!bmp_cfg_db_get_string(db, "flac", "title.tag_format", &flac_cfg.title.tag_format)) | 244 if(!bmp_cfg_db_get_string(db, "flac", "title.tag_format", &flac_cfg.title.tag_format)) |
| 243 flac_cfg.title.tag_format = g_strdup("%p - %t"); | 245 flac_cfg.title.tag_format = g_strdup("%p - %t"); |
| 244 | 246 |
| 245 bmp_cfg_db_get_bool(db, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); | 247 bmp_cfg_db_get_bool(db, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); |
| 246 | 248 |
| 445 { | 447 { |
| 446 g_free(flac_ip.description); | 448 g_free(flac_ip.description); |
| 447 flac_ip.description = NULL; | 449 flac_ip.description = NULL; |
| 448 | 450 |
| 449 if (flac_cfg.title.tag_format) { | 451 if (flac_cfg.title.tag_format) { |
| 450 free(flac_cfg.title.tag_format); | 452 g_free(flac_cfg.title.tag_format); |
| 451 flac_cfg.title.tag_format = NULL; | 453 flac_cfg.title.tag_format = NULL; |
| 452 } | 454 } |
| 453 | 455 |
| 454 if (flac_cfg.title.user_char_set) { | 456 if (flac_cfg.title.user_char_set) { |
| 455 free(flac_cfg.title.user_char_set); | 457 g_free(flac_cfg.title.user_char_set); |
| 456 flac_cfg.title.user_char_set = NULL; | 458 flac_cfg.title.user_char_set = NULL; |
| 457 } | 459 } |
| 458 | 460 |
| 459 if (flac_cfg.stream.proxy_host) { | 461 if (flac_cfg.stream.proxy_host) { |
| 460 free(flac_cfg.stream.proxy_host); | 462 g_free(flac_cfg.stream.proxy_host); |
| 461 flac_cfg.stream.proxy_host = NULL; | 463 flac_cfg.stream.proxy_host = NULL; |
| 462 } | 464 } |
| 463 | 465 |
| 464 if (flac_cfg.stream.proxy_user) { | 466 if (flac_cfg.stream.proxy_user) { |
| 465 free(flac_cfg.stream.proxy_user); | 467 g_free(flac_cfg.stream.proxy_user); |
| 466 flac_cfg.stream.proxy_user = NULL; | 468 flac_cfg.stream.proxy_user = NULL; |
| 467 | 469 |
| 468 } | 470 } |
| 469 | 471 |
| 470 if (flac_cfg.stream.proxy_pass) { | 472 if (flac_cfg.stream.proxy_pass) { |
| 471 free(flac_cfg.stream.proxy_pass); | 473 g_free(flac_cfg.stream.proxy_pass); |
| 472 flac_cfg.stream.proxy_pass = NULL; | 474 flac_cfg.stream.proxy_pass = NULL; |
| 473 } | 475 } |
| 474 | 476 |
| 475 decoder_func_table_ -> safe_decoder_delete(decoder_); | 477 decoder_func_table_ -> safe_decoder_delete(decoder_); |
| 476 decoder_ = 0; | 478 decoder_ = 0; |
| 585 file_info_.seek_to_in_sec = -1; | 587 file_info_.seek_to_in_sec = -1; |
| 586 file_info_.eof = false; | 588 file_info_.eof = false; |
| 587 sample_buffer_first_ = sample_buffer_last_ = 0; | 589 sample_buffer_first_ = sample_buffer_last_ = 0; |
| 588 } | 590 } |
| 589 } | 591 } |
| 590 else { | 592 else if ( !flac_cfg.title.disable_bitrate_update ) |
| 593 { | |
| 591 /* display the right bitrate from history */ | 594 /* display the right bitrate from history */ |
| 592 unsigned bh_index_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; | 595 unsigned bh_index_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; |
| 593 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) { | 596 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) { |
| 594 bh_index_last_o = bh_index_o; | 597 bh_index_last_o = bh_index_o; |
| 595 flac_ip.set_info(file_info_.title, file_info_.length_in_msec, bitrate_history_[bh_index_o], file_info_.sample_rate, file_info_.channels); | 598 flac_ip.set_info(file_info_.title, file_info_.length_in_msec, bitrate_history_[bh_index_o], file_info_.sample_rate, file_info_.channels); |
