Mercurial > audlegacy
changeset 1098:b5ae09a6c2f1 trunk
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
line wrap: on
line diff
--- a/Plugins/Input/mpg123/Makefile.in Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/Makefile.in Mon May 22 17:22:34 2006 -0700 @@ -9,7 +9,7 @@ decode_2to1.c decode_4to1.c \ layer1.c layer2.c layer3.c \ tabinit.c equalizer.c http.c \ - dxhead.c decode.c dct64.c psycho.c + dxhead.c decode.c dct64.c psycho.c interface.c OBJECTS = ${SOURCES:.c=.o} tag_c_hacked.o
--- a/Plugins/Input/mpg123/common.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/common.c Mon May 22 17:22:34 2006 -0700 @@ -19,22 +19,22 @@ {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}} }; -const int mpg123_freqs[9] = +const int mpgdec_freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000 }; struct bitstream_info bsi; -extern gint mpg123_bitrate, mpg123_frequency, mpg123_length; -extern gchar *mpg123_title, *mpg123_filename; -extern gboolean mpg123_stereo; +extern gint mpgdec_bitrate, mpgdec_frequency, mpgdec_length; +extern gchar *mpgdec_title, *mpgdec_filename; +extern gboolean mpgdec_stereo; static int fsizeold = 0, ssize; static unsigned char bsspace[2][MAXFRAMESIZE + 512]; /* MAXFRAMESIZE */ static unsigned char *bsbuf = bsspace[1], *bsbufold; static int bsnum = 0; -unsigned char *mpg123_pcm_sample; -int mpg123_pcm_point = 0; +unsigned char *mpgdec_pcm_sample; +int mpgdec_pcm_point = 0; static VFSFile *filept; static int filept_opened; @@ -50,7 +50,7 @@ if (fd) ret = vfs_fread(buf + cnt, 1, count - cnt, fd); else - ret = mpg123_http_read(buf + cnt, count - cnt); + ret = mpgdec_http_read(buf + cnt, count - cnt); if (ret < 0) return ret; if (ret == 0) @@ -69,12 +69,12 @@ } void -mpg123_stream_close(void) +mpgdec_stream_close(void) { if (filept) vfs_fclose(filept); - else if (mpg123_info->network_stream) - mpg123_http_close(); + else if (mpgdec_info->network_stream) + mpgdec_http_close(); } /**************************************** @@ -117,7 +117,7 @@ } static int -stream_mpg123_read_frame_body(unsigned char *buf, int size) +stream_mpgdec_read_frame_body(unsigned char *buf, int size) { long l; @@ -143,28 +143,28 @@ */ int -mpg123_stream_jump_to_frame(struct frame *fr, int frame) +mpgdec_stream_jump_to_frame(struct frame *fr, int frame) { if (!filept) return -1; - mpg123_read_frame_init(); + mpgdec_read_frame_init(); vfs_fseek(filept, frame * (fr->framesize + 4), SEEK_SET); - mpg123_read_frame(fr); + mpgdec_read_frame(fr); return 0; } int -mpg123_stream_jump_to_byte(struct frame *fr, int byte) +mpgdec_stream_jump_to_byte(struct frame *fr, int byte) { if (!filept) return -1; vfs_fseek(filept, byte, SEEK_SET); - mpg123_read_frame(fr); + mpgdec_read_frame(fr); return 0; } int -mpg123_stream_check_for_xing_header(struct frame *fr, xing_header_t * xhead) +mpgdec_stream_check_for_xing_header(struct frame *fr, xing_header_t * xhead) { unsigned char *head_data; int ret; @@ -172,7 +172,7 @@ vfs_fseek(filept, -(fr->framesize + 4), SEEK_CUR); head_data = g_malloc(fr->framesize + 4); vfs_fread(head_data, 1, fr->framesize + 4, filept); - ret = mpg123_get_xing_header(xhead, head_data); + ret = mpgdec_get_xing_header(xhead, head_data); g_free(head_data); return ret; } @@ -187,32 +187,32 @@ if (vfs_fseek(filept, 0, SEEK_END) < 0) return -1; - mpg123_info->filesize = vfs_ftell(filept); + mpgdec_info->filesize = vfs_ftell(filept); if (vfs_fseek(filept, -128, SEEK_END) < 0) return -1; if (fullread(filept, buf, 3) != 3) return -1; if (!strncmp((char *) buf, "TAG", 3)) - mpg123_info->filesize -= 128; + mpgdec_info->filesize -= 128; if (vfs_fseek(filept, 0, SEEK_SET) < 0) return -1; - if (mpg123_info->filesize <= 0) + if (mpgdec_info->filesize <= 0) return -1; - return mpg123_info->filesize; + return mpgdec_info->filesize; } void -mpg123_read_frame_init(void) +mpgdec_read_frame_init(void) { memset(bsspace[0], 0, MAXFRAMESIZE + 512); memset(bsspace[1], 0, MAXFRAMESIZE + 512); - mpg123_info->output_audio = FALSE; + mpgdec_info->output_audio = FALSE; } int -mpg123_head_check(unsigned long head) +mpgdec_head_check(unsigned long head) { if ((head & 0xffe00000) != 0xffe00000) return FALSE; @@ -237,7 +237,7 @@ * read next frame */ int -mpg123_read_frame(struct frame *fr) +mpgdec_read_frame(struct frame *fr) { unsigned long newhead; @@ -246,7 +246,7 @@ if (!stream_head_read(&newhead)) return FALSE; - if (!mpg123_head_check(newhead) || !mpg123_decode_header(fr, newhead)) { + if (!mpgdec_head_check(newhead) || !mpgdec_decode_header(fr, newhead)) { int try = 0; do { @@ -260,19 +260,19 @@ return 0; } - while ((!mpg123_head_check(newhead) || - !mpg123_decode_header(fr, newhead)) && try < (256 * 1024)); + while ((!mpgdec_head_check(newhead) || + !mpgdec_decode_header(fr, newhead)) && try < (256 * 1024)); if (try >= (256 * 1024)) return FALSE; - mpg123_info->filesize -= try; + mpgdec_info->filesize -= try; } /* flip/init buffer for Layer 3 */ bsbufold = bsbuf; bsbuf = bsspace[bsnum] + 512; bsnum = (bsnum + 1) & 1; - if (!stream_mpg123_read_frame_body(bsbuf, fr->framesize)) + if (!stream_mpgdec_read_frame_body(bsbuf, fr->framesize)) return 0; bsi.bitindex = 0; @@ -288,7 +288,7 @@ * into the frame structure */ int -mpg123_decode_header(struct frame *fr, unsigned long newhead) +mpgdec_decode_header(struct frame *fr, unsigned long newhead) { if (newhead & (1 << 20)) { fr->lsf = (newhead & (1 << 19)) ? 0x0 : 0x1; @@ -324,25 +324,25 @@ switch (fr->lay) { case 1: - fr->do_layer = mpg123_do_layer1; + fr->do_layer = mpgdec_do_layer1; /* inits also shared tables with layer1 */ - mpg123_init_layer2(fr->synth_type == SYNTH_MMX); + mpgdec_init_layer2(fr->synth_type == SYNTH_MMX); fr->framesize = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000; - fr->framesize /= mpg123_freqs[fr->sampling_frequency]; + fr->framesize /= mpgdec_freqs[fr->sampling_frequency]; fr->framesize = ((fr->framesize + fr->padding) << 2) - 4; break; case 2: - fr->do_layer = mpg123_do_layer2; + fr->do_layer = mpgdec_do_layer2; /* inits also shared tables with layer1 */ - mpg123_init_layer2(fr->synth_type == SYNTH_MMX); + mpgdec_init_layer2(fr->synth_type == SYNTH_MMX); fr->framesize = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000; - fr->framesize /= mpg123_freqs[fr->sampling_frequency]; + fr->framesize /= mpgdec_freqs[fr->sampling_frequency]; fr->framesize += fr->padding - 4; break; case 3: - fr->do_layer = mpg123_do_layer3; + fr->do_layer = mpgdec_do_layer3; if (fr->lsf) ssize = (fr->stereo == 1) ? 9 : 17; else @@ -351,7 +351,7 @@ ssize += 2; fr->framesize = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000; - fr->framesize /= mpg123_freqs[fr->sampling_frequency] << (fr->lsf); + fr->framesize /= mpgdec_freqs[fr->sampling_frequency] << (fr->lsf); fr->framesize = fr->framesize + fr->padding - 4; break; default: @@ -363,25 +363,25 @@ } void -mpg123_open_stream(char *bs_filenam, int fd) +mpgdec_open_stream(char *bs_filenam, int fd) { filept_opened = 1; if (!strncasecmp(bs_filenam, "http://", 7)) { filept = NULL; - mpg123_http_open(bs_filenam); - mpg123_info->filesize = 0; - mpg123_info->network_stream = TRUE; + mpgdec_http_open(bs_filenam); + mpgdec_info->filesize = 0; + mpgdec_info->network_stream = TRUE; } else { if ((filept = vfs_fopen(bs_filenam, "rb")) == NULL || stream_init() == -1) - mpg123_info->eof = TRUE; + mpgdec_info->eof = TRUE; } } void -mpg123_set_pointer(long backstep) +mpgdec_set_pointer(long backstep) { bsi.wordpointer = bsbuf + ssize - backstep; if (backstep) @@ -390,7 +390,7 @@ } double -mpg123_compute_bpf(struct frame *fr) +mpgdec_compute_bpf(struct frame *fr) { double bpf; @@ -398,13 +398,13 @@ case 1: bpf = tabsel_123[fr->lsf][0][fr->bitrate_index]; bpf *= 12000.0 * 4.0; - bpf /= mpg123_freqs[fr->sampling_frequency] << (fr->lsf); + bpf /= mpgdec_freqs[fr->sampling_frequency] << (fr->lsf); break; case 2: case 3: bpf = tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index]; bpf *= 144000; - bpf /= mpg123_freqs[fr->sampling_frequency] << (fr->lsf); + bpf /= mpgdec_freqs[fr->sampling_frequency] << (fr->lsf); break; default: bpf = 1.0; @@ -414,15 +414,15 @@ } int -mpg123_calc_numframes(struct frame *fr) +mpgdec_calc_numframes(struct frame *fr) { - return (int) (mpg123_info->filesize / mpg123_compute_bpf(fr)); + return (int) (mpgdec_info->filesize / mpgdec_compute_bpf(fr)); } double -mpg123_relative_pos(void) +mpgdec_relative_pos(void) { - if (!filept || !mpg123_info->filesize) + if (!filept || !mpgdec_info->filesize) return 0; - return ((double) stream_tell()) / mpg123_info->filesize; + return ((double) stream_tell()) / mpgdec_info->filesize; }
--- a/Plugins/Input/mpg123/configure.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/configure.c Mon May 22 17:22:34 2006 -0700 @@ -13,7 +13,7 @@ #include <libaudacious/titlestring.h> -static GtkWidget *mpg123_configurewin = NULL; +static GtkWidget *mpgdec_configurewin = NULL; static GtkWidget *vbox, *notebook; static GtkWidget *decode_vbox, *decode_hbox1; static GtkWidget *decode_res_frame, *decode_res_vbox, *decode_res_16, @@ -34,84 +34,84 @@ static GtkWidget *title_encoding_hbox, *title_encoding_enabled, *title_encoding, *title_encoding_label; /* Encoding patch */ -MPG123Config mpg123_cfg; +MPG123Config mpgdec_cfg; static void -mpg123_configurewin_ok(GtkWidget * widget, gpointer data) +mpgdec_configurewin_ok(GtkWidget * widget, gpointer data) { ConfigDb *db; if (GTK_TOGGLE_BUTTON(decode_res_16)->active) - mpg123_cfg.resolution = 16; + mpgdec_cfg.resolution = 16; else if (GTK_TOGGLE_BUTTON(decode_res_8)->active) - mpg123_cfg.resolution = 8; + mpgdec_cfg.resolution = 8; if (GTK_TOGGLE_BUTTON(decode_ch_stereo)->active) - mpg123_cfg.channels = 2; + mpgdec_cfg.channels = 2; else if (GTK_TOGGLE_BUTTON(decode_ch_mono)->active) - mpg123_cfg.channels = 1; + mpgdec_cfg.channels = 1; if (GTK_TOGGLE_BUTTON(decode_freq_1to1)->active) - mpg123_cfg.downsample = 0; + mpgdec_cfg.downsample = 0; else if (GTK_TOGGLE_BUTTON(decode_freq_1to2)->active) - mpg123_cfg.downsample = 1; + mpgdec_cfg.downsample = 1; if (GTK_TOGGLE_BUTTON(decode_freq_1to4)->active) - mpg123_cfg.downsample = 2; + mpgdec_cfg.downsample = 2; - mpg123_cfg.http_buffer_size = + mpgdec_cfg.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value; - mpg123_cfg.http_prebuffer = + mpgdec_cfg.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value; - mpg123_cfg.save_http_stream = + mpgdec_cfg.save_http_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); - if (mpg123_cfg.save_http_path) - g_free(mpg123_cfg.save_http_path); - mpg123_cfg.save_http_path = + if (mpgdec_cfg.save_http_path) + g_free(mpgdec_cfg.save_http_path); + mpgdec_cfg.save_http_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry))); - mpg123_cfg.use_udp_channel = + mpgdec_cfg.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title)); - mpg123_cfg.title_override = + mpgdec_cfg.title_override = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override)); - mpg123_cfg.disable_id3v2 = + mpgdec_cfg.disable_id3v2 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_id3v2_disable)); - g_free(mpg123_cfg.id3_format); - mpg123_cfg.id3_format = + g_free(mpgdec_cfg.id3_format); + mpgdec_cfg.id3_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_id3_entry))); - mpg123_cfg.title_encoding_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_encoding_enabled)); - mpg123_cfg.title_encoding = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_encoding))); - if (mpg123_cfg.title_encoding_enabled) - mpg123_id3_encoding_list = g_strsplit_set(mpg123_cfg.title_encoding, ENCODING_SEPARATOR, 0); + mpgdec_cfg.title_encoding_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_encoding_enabled)); + mpgdec_cfg.title_encoding = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_encoding))); + if (mpgdec_cfg.title_encoding_enabled) + mpgdec_id3_encoding_list = g_strsplit_set(mpgdec_cfg.title_encoding, ENCODING_SEPARATOR, 0); db = bmp_cfg_db_open(); - bmp_cfg_db_set_int(db, "MPG123", "resolution", mpg123_cfg.resolution); - bmp_cfg_db_set_int(db, "MPG123", "channels", mpg123_cfg.channels); - bmp_cfg_db_set_int(db, "MPG123", "downsample", mpg123_cfg.downsample); + bmp_cfg_db_set_int(db, "MPG123", "resolution", mpgdec_cfg.resolution); + bmp_cfg_db_set_int(db, "MPG123", "channels", mpgdec_cfg.channels); + bmp_cfg_db_set_int(db, "MPG123", "downsample", mpgdec_cfg.downsample); bmp_cfg_db_set_int(db, "MPG123", "http_buffer_size", - mpg123_cfg.http_buffer_size); + mpgdec_cfg.http_buffer_size); bmp_cfg_db_set_int(db, "MPG123", "http_prebuffer", - mpg123_cfg.http_prebuffer); + mpgdec_cfg.http_prebuffer); bmp_cfg_db_set_bool(db, "MPG123", "save_http_stream", - mpg123_cfg.save_http_stream); + mpgdec_cfg.save_http_stream); bmp_cfg_db_set_string(db, "MPG123", "save_http_path", - mpg123_cfg.save_http_path); + mpgdec_cfg.save_http_path); bmp_cfg_db_set_bool(db, "MPG123", "use_udp_channel", - mpg123_cfg.use_udp_channel); + mpgdec_cfg.use_udp_channel); bmp_cfg_db_set_bool(db, "MPG123", "title_override", - mpg123_cfg.title_override); + mpgdec_cfg.title_override); bmp_cfg_db_set_bool(db, "MPG123", "disable_id3v2", - mpg123_cfg.disable_id3v2); - bmp_cfg_db_set_string(db, "MPG123", "id3_format", mpg123_cfg.id3_format); + mpgdec_cfg.disable_id3v2); + bmp_cfg_db_set_string(db, "MPG123", "id3_format", mpgdec_cfg.id3_format); /* Encoding patch */ - bmp_cfg_db_set_bool(db, "MPG123", "title_encoding_enabled", mpg123_cfg.title_encoding_enabled); - bmp_cfg_db_set_string(db, "MPG123", "title_encoding", mpg123_cfg.title_encoding); + bmp_cfg_db_set_bool(db, "MPG123", "title_encoding_enabled", mpgdec_cfg.title_encoding_enabled); + bmp_cfg_db_set_string(db, "MPG123", "title_encoding", mpgdec_cfg.title_encoding); /* Encoding patch */ bmp_cfg_db_close(db); - gtk_widget_destroy(mpg123_configurewin); + gtk_widget_destroy(mpgdec_configurewin); } static void @@ -127,14 +127,14 @@ streaming_save_dirbrowser = xmms_create_dir_browser(_ ("Select the directory where you want to store the MPEG streams:"), - mpg123_cfg.save_http_path, + mpgdec_cfg.save_http_path, GTK_SELECTION_SINGLE, streaming_save_dirbrowser_cb); g_signal_connect(G_OBJECT(streaming_save_dirbrowser), "destroy", G_CALLBACK(gtk_widget_destroyed), &streaming_save_dirbrowser); gtk_window_set_transient_for(GTK_WINDOW(streaming_save_dirbrowser), - GTK_WINDOW(mpg123_configurewin)); + GTK_WINDOW(mpgdec_configurewin)); gtk_widget_show(streaming_save_dirbrowser); } } @@ -179,7 +179,7 @@ } void -mpg123_configure(void) +mpgdec_configure(void) { GtkWidget *streaming_vbox; GtkWidget *streaming_buf_frame, *streaming_buf_hbox; @@ -192,27 +192,27 @@ GtkWidget *title_frame, *title_id3_vbox, *title_id3_label; GtkWidget *bbox, *ok, *cancel; - if (mpg123_configurewin != NULL) { - gtk_window_present(GTK_WINDOW(mpg123_configurewin)); + if (mpgdec_configurewin != NULL) { + gtk_window_present(GTK_WINDOW(mpgdec_configurewin)); return; } - mpg123_configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_type_hint(GTK_WINDOW(mpg123_configurewin), + mpgdec_configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_type_hint(GTK_WINDOW(mpgdec_configurewin), GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_position(GTK_WINDOW(mpg123_configurewin), + gtk_window_set_position(GTK_WINDOW(mpgdec_configurewin), GTK_WIN_POS_CENTER); - g_signal_connect(G_OBJECT(mpg123_configurewin), "destroy", - G_CALLBACK(gtk_widget_destroyed), &mpg123_configurewin); - g_signal_connect(G_OBJECT(mpg123_configurewin), "destroy", - G_CALLBACK(configure_destroy), &mpg123_configurewin); - gtk_window_set_title(GTK_WINDOW(mpg123_configurewin), + g_signal_connect(G_OBJECT(mpgdec_configurewin), "destroy", + G_CALLBACK(gtk_widget_destroyed), &mpgdec_configurewin); + g_signal_connect(G_OBJECT(mpgdec_configurewin), "destroy", + G_CALLBACK(configure_destroy), &mpgdec_configurewin); + gtk_window_set_title(GTK_WINDOW(mpgdec_configurewin), _("MPEG Audio Plugin Configuration")); - gtk_window_set_resizable(GTK_WINDOW(mpg123_configurewin), FALSE); - /* gtk_window_set_position(GTK_WINDOW(mpg123_configurewin), GTK_WIN_POS_MOUSE); */ - gtk_container_border_width(GTK_CONTAINER(mpg123_configurewin), 10); + gtk_window_set_resizable(GTK_WINDOW(mpgdec_configurewin), FALSE); + /* gtk_window_set_position(GTK_WINDOW(mpgdec_configurewin), GTK_WIN_POS_MOUSE); */ + gtk_container_border_width(GTK_CONTAINER(mpgdec_configurewin), 10); vbox = gtk_vbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(mpg123_configurewin), vbox); + gtk_container_add(GTK_CONTAINER(mpgdec_configurewin), vbox); notebook = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); @@ -232,7 +232,7 @@ gtk_container_add(GTK_CONTAINER(decode_res_frame), decode_res_vbox); decode_res_16 = gtk_radio_button_new_with_label(NULL, _("16 bit")); - if (mpg123_cfg.resolution == 16) + if (mpgdec_cfg.resolution == 16) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_res_16), TRUE); gtk_box_pack_start(GTK_BOX(decode_res_vbox), decode_res_16, FALSE, FALSE, 0); @@ -241,7 +241,7 @@ gtk_radio_button_new_with_label(gtk_radio_button_group (GTK_RADIO_BUTTON(decode_res_16)), _("8 bit")); - if (mpg123_cfg.resolution == 8) + if (mpgdec_cfg.resolution == 8) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_res_8), TRUE); gtk_box_pack_start(GTK_BOX(decode_res_vbox), decode_res_8, FALSE, @@ -256,7 +256,7 @@ decode_ch_stereo = gtk_radio_button_new_with_label(NULL, _("Stereo (if available)")); - if (mpg123_cfg.channels == 2) + if (mpgdec_cfg.channels == 2) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_ch_stereo), TRUE); @@ -267,7 +267,7 @@ gtk_radio_button_new_with_label(gtk_radio_button_group (GTK_RADIO_BUTTON (decode_ch_stereo)), _("Mono")); - if (mpg123_cfg.channels == 1) + if (mpgdec_cfg.channels == 1) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_ch_mono), TRUE); gtk_box_pack_start(GTK_BOX(decode_ch_vbox), decode_ch_mono, FALSE, @@ -283,7 +283,7 @@ decode_freq_1to1 = gtk_radio_button_new_with_label(NULL, _("1:1 (44 kHz)")); - if (mpg123_cfg.downsample == 0) + if (mpgdec_cfg.downsample == 0) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to1), TRUE); gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to1, FALSE, @@ -294,7 +294,7 @@ (GTK_RADIO_BUTTON (decode_freq_1to1)), _("1:2 (22 kHz)")); - if (mpg123_cfg.downsample == 1) + if (mpgdec_cfg.downsample == 1) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to2), TRUE); gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to2, FALSE, @@ -305,7 +305,7 @@ (GTK_RADIO_BUTTON (decode_freq_1to1)), _("1:4 (11 kHz)")); - if (mpg123_cfg.downsample == 2) + if (mpgdec_cfg.downsample == 2) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to4), TRUE); @@ -334,7 +334,7 @@ gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label, FALSE, FALSE, 0); streaming_size_adj = - gtk_adjustment_new(mpg123_cfg.http_buffer_size, 4, 4096, 4, 4, 4); + gtk_adjustment_new(mpgdec_cfg.http_buffer_size, 4, 4096, 4, 4, 4); streaming_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0); gtk_widget_set_usize(streaming_size_spin, 60, -1); @@ -349,7 +349,7 @@ gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label, FALSE, FALSE, 0); streaming_pre_adj = - gtk_adjustment_new(mpg123_cfg.http_prebuffer, 0, 90, 1, 1, 1); + gtk_adjustment_new(mpgdec_cfg.http_prebuffer, 0, 90, 1, 1, 1); streaming_pre_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0); gtk_widget_set_usize(streaming_pre_spin, 60, -1); @@ -372,7 +372,7 @@ streaming_save_use = gtk_check_button_new_with_label(_("Save stream to disk")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use), - mpg123_cfg.save_http_stream); + mpgdec_cfg.save_http_stream); g_signal_connect(G_OBJECT(streaming_save_use), "clicked", G_CALLBACK(streaming_save_use_cb), NULL); gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use, @@ -380,7 +380,7 @@ streaming_save_hbox = gtk_hbox_new(FALSE, 5); gtk_widget_set_sensitive(streaming_save_hbox, - mpg123_cfg.save_http_stream); + mpgdec_cfg.save_http_stream); gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox, FALSE, FALSE, 0); @@ -390,7 +390,7 @@ streaming_save_entry = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), - mpg123_cfg.save_http_path); + mpgdec_cfg.save_http_path); gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, TRUE, TRUE, 0); @@ -416,7 +416,7 @@ gtk_check_button_new_with_label(_ ("Enable Icecast Metadata UDP Channel")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title), - mpg123_cfg.use_udp_channel); + mpgdec_cfg.use_udp_channel); gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title, FALSE, FALSE, 0); @@ -433,7 +433,7 @@ title_id3v2_disable = gtk_check_button_new_with_label(_("Disable ID3V2 tags")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_id3v2_disable), - mpg123_cfg.disable_id3v2); + mpgdec_cfg.disable_id3v2); gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_id3v2_disable, FALSE, FALSE, 0); @@ -442,14 +442,14 @@ title_encoding_enabled = gtk_check_button_new_with_label(_("Convert non-UTF8 ID3 tags to UTF8")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_encoding_enabled), - mpg123_cfg.title_encoding_enabled); + mpgdec_cfg.title_encoding_enabled); g_signal_connect(G_OBJECT(title_encoding_enabled), "clicked", G_CALLBACK(title_encoding_enabled_cb), NULL); gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_encoding_enabled, FALSE, FALSE, 0); title_encoding_hbox = gtk_hbox_new(FALSE, 5); - gtk_widget_set_sensitive(title_encoding_hbox, mpg123_cfg.title_encoding_enabled); + gtk_widget_set_sensitive(title_encoding_hbox, mpgdec_cfg.title_encoding_enabled); gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_encoding_hbox, FALSE, FALSE, 0); @@ -458,7 +458,7 @@ FALSE, 0); title_encoding = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(title_encoding), mpg123_cfg.title_encoding); + gtk_entry_set_text(GTK_ENTRY(title_encoding), mpgdec_cfg.title_encoding); gtk_box_pack_start(GTK_BOX(title_encoding_hbox), title_encoding, TRUE, TRUE, 0); /* Encoding patch */ @@ -467,14 +467,14 @@ title_override = gtk_check_button_new_with_label(_("Override generic titles")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_override), - mpg123_cfg.title_override); + mpgdec_cfg.title_override); g_signal_connect(G_OBJECT(title_override), "clicked", G_CALLBACK(title_override_cb), NULL); gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_override, FALSE, FALSE, 0); title_id3_box = gtk_hbox_new(FALSE, 5); - gtk_widget_set_sensitive(title_id3_box, mpg123_cfg.title_override); + gtk_widget_set_sensitive(title_id3_box, mpgdec_cfg.title_override); gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_id3_box, FALSE, FALSE, 0); @@ -483,12 +483,12 @@ FALSE, 0); title_id3_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(title_id3_entry), mpg123_cfg.id3_format); + gtk_entry_set_text(GTK_ENTRY(title_id3_entry), mpgdec_cfg.id3_format); gtk_box_pack_start(GTK_BOX(title_id3_box), title_id3_entry, TRUE, TRUE, 0); title_tag_desc = xmms_titlestring_descriptions("pafFetnygc", 2); - gtk_widget_set_sensitive(title_tag_desc, mpg123_cfg.title_override); + gtk_widget_set_sensitive(title_tag_desc, mpgdec_cfg.title_override); gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_tag_desc, FALSE, FALSE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, @@ -502,17 +502,17 @@ cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); g_signal_connect_swapped(G_OBJECT(cancel), "clicked", G_CALLBACK(gtk_widget_destroy), - GTK_OBJECT(mpg123_configurewin)); + GTK_OBJECT(mpgdec_configurewin)); GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); ok = gtk_button_new_from_stock(GTK_STOCK_OK); g_signal_connect(G_OBJECT(ok), "clicked", - G_CALLBACK(mpg123_configurewin_ok), NULL); + G_CALLBACK(mpgdec_configurewin_ok), NULL); GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0); gtk_widget_grab_default(ok); - gtk_widget_show_all(mpg123_configurewin); + gtk_widget_show_all(mpgdec_configurewin); }
--- a/Plugins/Input/mpg123/dct64.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/dct64.c Mon May 22 17:22:34 2006 -0700 @@ -14,7 +14,7 @@ #include "mpg123.h" void -mpg123_dct64(mpgdec_real * out0, mpgdec_real * out1, mpgdec_real * samples) +mpgdec_dct64(mpgdec_real * out0, mpgdec_real * out1, mpgdec_real * samples) { mpgdec_real bufs[64]; @@ -24,7 +24,7 @@ b1 = samples; bs = bufs; - costab = mpg123_pnts[0] + 16; + costab = mpgdec_pnts[0] + 16; b2 = b1 + 32; for (i = 15; i >= 0; i--) @@ -33,7 +33,7 @@ *bs++ = (*--b2 - *b1++) * *--costab; b1 = bufs; - costab = mpg123_pnts[1] + 8; + costab = mpgdec_pnts[1] + 8; b2 = b1 + 16; { @@ -51,7 +51,7 @@ } bs = bufs; - costab = mpg123_pnts[2]; + costab = mpgdec_pnts[2]; b2 = b1 + 8; for (j = 2; j; j--) { @@ -68,7 +68,7 @@ } b1 = bufs; - costab = mpg123_pnts[3]; + costab = mpgdec_pnts[3]; b2 = b1 + 4; for (j = 4; j; j--) { @@ -84,7 +84,7 @@ b2 += 8; } bs = bufs; - costab = mpg123_pnts[4]; + costab = mpgdec_pnts[4]; for (j = 8; j; j--) { mpgdec_real v0, v1;
--- a/Plugins/Input/mpg123/dct64_i386.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/dct64_i386.c Mon May 22 17:22:34 2006 -0700 @@ -3,18 +3,18 @@ * Discrete Cosine Tansform (DCT) for subband synthesis * optimized for machines with no auto-increment. * The performance is highly compiler dependend. Maybe - * the mpg123_dct64.c version for 'normal' processor may be faster + * the mpgdec_dct64.c version for 'normal' processor may be faster * even for Intel processors. */ #include "mpg123.h" static void -mpg123_dct64_1(mpgdec_real * out0, mpgdec_real * out1, mpgdec_real * b1, mpgdec_real * b2, mpgdec_real * samples) +mpgdec_dct64_1(mpgdec_real * out0, mpgdec_real * out1, mpgdec_real * b1, mpgdec_real * b2, mpgdec_real * samples) { { - register mpgdec_real *costab = mpg123_pnts[0]; + register mpgdec_real *costab = mpgdec_pnts[0]; b1[0x00] = samples[0x00] + samples[0x1F]; b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0]; @@ -66,7 +66,7 @@ } { - register mpgdec_real *costab = mpg123_pnts[1]; + register mpgdec_real *costab = mpgdec_pnts[1]; b2[0x00] = b1[0x00] + b1[0x0F]; b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0]; @@ -104,7 +104,7 @@ } { - register mpgdec_real *costab = mpg123_pnts[2]; + register mpgdec_real *costab = mpgdec_pnts[2]; b1[0x00] = b2[0x00] + b2[0x07]; b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0]; @@ -144,8 +144,8 @@ } { - register mpgdec_real const cos0 = mpg123_pnts[3][0]; - register mpgdec_real const cos1 = mpg123_pnts[3][1]; + register mpgdec_real const cos0 = mpgdec_pnts[3][0]; + register mpgdec_real const cos1 = mpgdec_pnts[3][1]; b2[0x00] = b1[0x00] + b1[0x03]; b2[0x03] = (b1[0x00] - b1[0x03]) * cos0; @@ -189,7 +189,7 @@ } { - register mpgdec_real const cos0 = mpg123_pnts[4][0]; + register mpgdec_real const cos0 = mpgdec_pnts[4][0]; b1[0x00] = b2[0x00] + b2[0x01]; b1[0x01] = (b2[0x00] - b2[0x01]) * cos0; @@ -304,13 +304,13 @@ } /* - * the call via mpg123_dct64 is a trick to force GCC to use + * the call via mpgdec_dct64 is a trick to force GCC to use * (new) registers for the b1,b2 pointer to the bufs[xx] field */ void -mpg123_dct64(mpgdec_real * a, mpgdec_real * b, mpgdec_real * c) +mpgdec_dct64(mpgdec_real * a, mpgdec_real * b, mpgdec_real * c) { mpgdec_real bufs[0x40]; - mpg123_dct64_1(a, b, bufs, bufs + 0x20, c); + mpgdec_dct64_1(a, b, bufs, bufs + 0x20, c); }
--- a/Plugins/Input/mpg123/decode.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/decode.c Mon May 22 17:22:34 2006 -0700 @@ -17,18 +17,18 @@ else if( (sum) < REAL_MINUS_32768) { *(samples) = -0x8000; (clip)++; } \ else { *(samples) = sum; } -int mpg123_synth_1to1_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) +int mpgdec_synth_1to1_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) { short samples_tmp[64]; short *tmp1 = samples_tmp + channel; int i,ret; int pnt1=0; - ret = mpg123_synth_1to1(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_1to1(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); samples += channel + *pnt; for(i=0;i<32;i++) { - *samples = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples = mpgdec_conv16to8[*tmp1>>AUSHIFT]; samples += 2; tmp1 += 2; } @@ -37,18 +37,18 @@ return ret; } -int mpg123_synth_1to1_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_1to1_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[64]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<32;i++) { - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; tmp1 += 2; } *pnt += 32; @@ -56,19 +56,19 @@ return ret; } -int mpg123_synth_1to1_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_1to1_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[64]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<32;i++) { - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; tmp1 += 2; } *pnt += 64; @@ -76,14 +76,14 @@ return ret; } -int mpg123_synth_1to1_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_1to1_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[64]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<32;i++) { @@ -97,11 +97,11 @@ } -int mpg123_synth_1to1_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_1to1_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { int i,ret; - ret = mpg123_synth_1to1(bandPtr,0,samples,pnt); + ret = mpgdec_synth_1to1(bandPtr,0,samples,pnt); samples = samples + *pnt - 128; for(i=0;i<32;i++) { @@ -113,7 +113,7 @@ } -int mpg123_synth_1to1(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) +int mpgdec_synth_1to1(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) { static mpgdec_real buffs[2][2][0x110]; static const int step = 2; @@ -137,18 +137,18 @@ if(bo & 0x1) { b0 = buf[0]; bo1 = bo; - mpg123_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); + mpgdec_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); } else { b0 = buf[1]; bo1 = bo+1; - mpg123_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); + mpgdec_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); } { register int j; - mpgdec_real *window = mpg123_decwin + 16 - bo1; + mpgdec_real *window = mpgdec_decwin + 16 - bo1; for (j=16;j;j--,window+=0x10,samples+=step) {
--- a/Plugins/Input/mpg123/decode_2to1.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/decode_2to1.c Mon May 22 17:22:34 2006 -0700 @@ -18,18 +18,18 @@ else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ else { *(samples) = sum; } -int mpg123_synth_2to1_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) +int mpgdec_synth_2to1_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) { short samples_tmp[32]; short *tmp1 = samples_tmp + channel; int i,ret; int pnt1 = 0; - ret = mpg123_synth_2to1(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_2to1(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); samples += channel + *pnt; for(i=0;i<16;i++) { - *samples = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples = mpgdec_conv16to8[*tmp1>>AUSHIFT]; samples += 2; tmp1 += 2; } @@ -38,18 +38,18 @@ return ret; } -int mpg123_synth_2to1_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_2to1_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[32]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_2to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_2to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<16;i++) { - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; tmp1 += 2; } *pnt += 16; @@ -58,19 +58,19 @@ } -int mpg123_synth_2to1_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_2to1_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[32]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_2to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_2to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<16;i++) { - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; tmp1 += 2; } *pnt += 32; @@ -78,14 +78,14 @@ return ret; } -int mpg123_synth_2to1_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_2to1_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[32]; short *tmp1 = samples_tmp; int i,ret; int pnt1=0; - ret = mpg123_synth_2to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_2to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<16;i++) { @@ -98,11 +98,11 @@ return ret; } -int mpg123_synth_2to1_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_2to1_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { int i,ret; - ret = mpg123_synth_2to1(bandPtr,0,samples,pnt); + ret = mpgdec_synth_2to1(bandPtr,0,samples,pnt); samples = samples + *pnt - 64; for(i=0;i<16;i++) { @@ -113,7 +113,7 @@ return ret; } -int mpg123_synth_2to1(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) +int mpgdec_synth_2to1(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) { static mpgdec_real buffs[2][2][0x110]; static const int step = 2; @@ -137,17 +137,17 @@ if(bo & 0x1) { b0 = buf[0]; bo1 = bo; - mpg123_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); + mpgdec_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); } else { b0 = buf[1]; bo1 = bo+1; - mpg123_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); + mpgdec_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); } { register int j; - mpgdec_real *window = mpg123_decwin + 16 - bo1; + mpgdec_real *window = mpgdec_decwin + 16 - bo1; for (j=8;j;j--,b0+=0x10,window+=0x30) {
--- a/Plugins/Input/mpg123/decode_4to1.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/decode_4to1.c Mon May 22 17:22:34 2006 -0700 @@ -19,18 +19,18 @@ else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ else { *(samples) = sum; } -int mpg123_synth_4to1_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) +int mpgdec_synth_4to1_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) { short samples_tmp[16]; short *tmp1 = samples_tmp + channel; int i,ret; int pnt1 = 0; - ret = mpg123_synth_4to1(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_4to1(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); samples += channel + *pnt; for(i=0;i<8;i++) { - *samples = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples = mpgdec_conv16to8[*tmp1>>AUSHIFT]; samples += 2; tmp1 += 2; } @@ -39,18 +39,18 @@ return ret; } -int mpg123_synth_4to1_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_4to1_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[16]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_4to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_4to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<8;i++) { - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; tmp1 += 2; } *pnt += 8; @@ -59,19 +59,19 @@ } -int mpg123_synth_4to1_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_4to1_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[16]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_4to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_4to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<8;i++) { - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; tmp1 += 2; } *pnt += 16; @@ -79,14 +79,14 @@ return ret; } -int mpg123_synth_4to1_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_4to1_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[16]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_4to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_4to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<8;i++) { @@ -99,11 +99,11 @@ return ret; } -int mpg123_synth_4to1_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_4to1_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { int i,ret; - ret = mpg123_synth_4to1(bandPtr,0,samples,pnt); + ret = mpgdec_synth_4to1(bandPtr,0,samples,pnt); samples = samples + *pnt - 32; for(i=0;i<8;i++) { @@ -114,7 +114,7 @@ return ret; } -int mpg123_synth_4to1(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) +int mpgdec_synth_4to1(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) { static mpgdec_real buffs[2][2][0x110]; static const int step = 2; @@ -138,17 +138,17 @@ if(bo & 0x1) { b0 = buf[0]; bo1 = bo; - mpg123_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); + mpgdec_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); } else { b0 = buf[1]; bo1 = bo+1; - mpg123_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); + mpgdec_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); } { register int j; - mpgdec_real *window = mpg123_decwin + 16 - bo1; + mpgdec_real *window = mpgdec_decwin + 16 - bo1; for (j=4;j;j--,b0+=0x30,window+=0x70) {
--- a/Plugins/Input/mpg123/decode_ntom.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/decode_ntom.c Mon May 22 17:22:34 2006 -0700 @@ -23,7 +23,7 @@ static unsigned long ntom_step = NTOM_MUL; -void mpg123_synth_ntom_set_step(long m,long n) +void mpgdec_synth_ntom_set_step(long m,long n) { if(n >= 96000 || m >= 96000 || m == 0 || n == 0) { fprintf(stderr,"NtoM converter: illegal rates\n"); @@ -41,18 +41,18 @@ ntom_val[0] = ntom_val[1] = NTOM_MUL>>1; } -int mpg123_synth_ntom_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) +int mpgdec_synth_ntom_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) { short samples_tmp[8*64]; short *tmp1 = samples_tmp + channel; int i,ret; int pnt1 = 0; - ret = mpg123_synth_ntom(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_ntom(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); samples += channel + *pnt; for(i=0;i<(pnt1>>2);i++) { - *samples = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples = mpgdec_conv16to8[*tmp1>>AUSHIFT]; samples += 2; tmp1 += 2; } @@ -61,18 +61,18 @@ return ret; } -int mpg123_synth_ntom_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_ntom_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[8*64]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_ntom(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_ntom(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<(pnt1>>2);i++) { - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; tmp1 += 2; } *pnt += pnt1 >> 2; @@ -80,19 +80,19 @@ return ret; } -int mpg123_synth_ntom_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_ntom_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[8*64]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_ntom(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_ntom(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<(pnt1>>2);i++) { - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; - *samples++ = mpg123_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; + *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; tmp1 += 2; } *pnt += pnt1 >> 1; @@ -100,14 +100,14 @@ return ret; } -int mpg123_synth_ntom_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_ntom_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { short samples_tmp[8*64]; short *tmp1 = samples_tmp; int i,ret; int pnt1 = 0; - ret = mpg123_synth_ntom(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + ret = mpgdec_synth_ntom(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; for(i=0;i<(pnt1>>2);i++) { @@ -121,12 +121,12 @@ } -int mpg123_synth_ntom_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) +int mpgdec_synth_ntom_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) { int i,ret; int pnt1 = *pnt; - ret = mpg123_synth_ntom(bandPtr,0,samples,pnt); + ret = mpgdec_synth_ntom(bandPtr,0,samples,pnt); samples += pnt1; for(i=0;i<((*pnt-pnt1)>>2);i++) { @@ -138,7 +138,7 @@ } -int mpg123_synth_ntom(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) +int mpgdec_synth_ntom(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) { static mpgdec_real buffs[2][2][0x110]; static const int step = 2; @@ -166,12 +166,12 @@ if(bo & 0x1) { b0 = buf[0]; bo1 = bo; - mpg123_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); + mpgdec_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); } else { b0 = buf[1]; bo1 = bo+1; - mpg123_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); + mpgdec_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); }
--- a/Plugins/Input/mpg123/dxhead.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/dxhead.c Mon May 22 17:22:34 2006 -0700 @@ -13,7 +13,7 @@ (i = (b[0] << 24) | (b[1] << 16) | b[2] << 8 | b[3], b += 4, i) int -mpg123_get_xing_header(xing_header_t * xing, unsigned char *buf) +mpgdec_get_xing_header(xing_header_t * xing, unsigned char *buf) { int i, head_flags; int id, mode; @@ -80,7 +80,7 @@ } int -mpg123_seek_point(xing_header_t * xing, float percent) +mpgdec_seek_point(xing_header_t * xing, float percent) { /* interpolate in TOC to get file seek point in bytes */ int a, seekpoint;
--- a/Plugins/Input/mpg123/dxhead.h Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/dxhead.h Mon May 22 17:22:34 2006 -0700 @@ -33,11 +33,11 @@ * xing structure to receive header data (output) * buf bitstream input */ -int mpg123_get_xing_header(xing_header_t * xing, unsigned char *buf); +int mpgdec_get_xing_header(xing_header_t * xing, unsigned char *buf); /* * Returns seekpoint in bytes (may be at eof if percent=100.0) * percent: play time percentage of total playtime. May be fractional. */ -int mpg123_seek_point(xing_header_t * xing, float percent); +int mpgdec_seek_point(xing_header_t * xing, float percent);
--- a/Plugins/Input/mpg123/equalizer.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/equalizer.c Mon May 22 17:22:34 2006 -0700 @@ -54,14 +54,14 @@ } void -mpg123_set_eq(int on, float preamp, float *b) +mpgdec_set_eq(int on, float preamp, float *b) { float x[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, yf[10], val, band[10]; int bands[] = { 0, 4, 8, 16, 26, 78, 157, 313, 366, 418 }; int i, j; - mpg123_info->eq_active = on; - if (mpg123_info->eq_active) { + mpgdec_info->eq_active = on; + if (mpgdec_info->eq_active) { for (i = 0; i < 10; i++) { band[i] = b[i] + preamp; } @@ -74,10 +74,10 @@ i + ((float) (j - bands[i]) * (1.0 / (bands[i + 1] - bands[i])))); - mpg123_info->eq_mul[j] = pow(2, val / 10.0); + mpgdec_info->eq_mul[j] = pow(2, val / 10.0); } } for (i = bands[9]; i < 576; i++) - mpg123_info->eq_mul[i] = mpg123_info->eq_mul[bands[9] - 1]; + mpgdec_info->eq_mul[i] = mpgdec_info->eq_mul[bands[9] - 1]; } }
--- a/Plugins/Input/mpg123/fileinfo.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/fileinfo.c Mon May 22 17:22:34 2006 -0700 @@ -69,10 +69,10 @@ static GList *genre_list = NULL; static gchar *current_filename = NULL; -extern gchar *mpg123_filename; -extern gint mpg123_bitrate, mpg123_frequency, mpg123_layer, mpg123_lsf, - mpg123_mode; -extern gboolean mpg123_stereo, mpg123_mpeg25; +extern gchar *mpgdec_filename; +extern gint mpgdec_bitrate, mpgdec_frequency, mpgdec_layer, mpgdec_lsf, + mpgdec_mode; +extern gboolean mpgdec_stereo, mpgdec_mpeg25; glong info_rate; @@ -215,12 +215,12 @@ file_info_http(gchar * filename) { gtk_widget_set_sensitive(id3_frame, FALSE); - if (mpg123_filename && !strcmp(filename, mpg123_filename) && - mpg123_bitrate != 0) { - set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf, mpg123_layer); - label_set_text(mpeg_bitrate_val, _("%d KBit/s"), mpg123_bitrate); - label_set_text(mpeg_samplerate_val, _("%ld Hz"), mpg123_frequency); - label_set_text(mpeg_flags, "%s", channel_mode_name(mpg123_mode)); + if (mpgdec_filename && !strcmp(filename, mpgdec_filename) && + mpgdec_bitrate != 0) { + set_mpeg_level_label(mpgdec_mpeg25, mpgdec_lsf, mpgdec_layer); + label_set_text(mpeg_bitrate_val, _("%d KBit/s"), mpgdec_bitrate); + label_set_text(mpeg_samplerate_val, _("%ld Hz"), mpgdec_frequency); + label_set_text(mpeg_flags, "%s", channel_mode_name(mpgdec_mode)); } } @@ -231,7 +231,7 @@ } void -mpg123_file_info_box(gchar * filename) +mpgdec_file_info_box(gchar * filename) { gint i; gchar *title, *filename_utf8; @@ -536,7 +536,7 @@ for (i = 0; i < GENRE_MAX; i++) genre_list = g_list_prepend(genre_list, - (gchar *) mpg123_id3_genres[i]); + (gchar *) mpgdec_id3_genres[i]); genre_list = g_list_prepend(genre_list, ""); genre_list = g_list_sort(genre_list, genre_comp_func); } @@ -772,7 +772,7 @@ head = ((guint32) tmp[0] << 24) | ((guint32) tmp[1] << 16) | ((guint32) tmp[2] << 8) | (guint32) tmp[3]; - while (!mpg123_head_check(head)) { + while (!mpgdec_head_check(head)) { head <<= 8; if (vfs_fread(tmp, 1, 1, fh) != 1) { vfs_fclose(fh); @@ -780,7 +780,7 @@ } head |= tmp[0]; } - if (mpg123_decode_header(&frm, head)) { + if (mpgdec_decode_header(&frm, head)) { guchar *buf; gint pos;
--- a/Plugins/Input/mpg123/getbits.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/getbits.c Mon May 22 17:22:34 2006 -0700 @@ -1,19 +1,19 @@ #include "mpg123.h" #include "common.h" -void mpg123_backbits(struct bitstream_info *bitbuf,int number_of_bits) +void mpgdec_backbits(struct bitstream_info *bitbuf,int number_of_bits) { bitbuf->bitindex -= number_of_bits; bitbuf->wordpointer += (bitbuf->bitindex>>3); bitbuf->bitindex &= 0x7; } -int mpg123_getbitoffset(struct bitstream_info *bitbuf) +int mpgdec_getbitoffset(struct bitstream_info *bitbuf) { return (-bitbuf->bitindex)&0x7; } -int mpg123_getbyte(struct bitstream_info *bitbuf) +int mpgdec_getbyte(struct bitstream_info *bitbuf) { #ifdef DEBUG_GETBITS if(bitbuf->bitindex) @@ -22,7 +22,7 @@ return *bitbuf->wordpointer++; } -unsigned int mpg123_getbits(struct bitstream_info *bitbuf,int number_of_bits) +unsigned int mpgdec_getbits(struct bitstream_info *bitbuf,int number_of_bits) { unsigned long rval; @@ -62,7 +62,7 @@ return rval; } -unsigned int mpg123_getbits_fast(struct bitstream_info *bitbuf,int number_of_bits) +unsigned int mpgdec_getbits_fast(struct bitstream_info *bitbuf,int number_of_bits) { unsigned int rval; #ifdef DEBUG_GETBITS @@ -89,7 +89,7 @@ return rval; } -unsigned int mpg123_get1bit(struct bitstream_info *bitbuf) +unsigned int mpgdec_get1bit(struct bitstream_info *bitbuf) { unsigned char rval;
--- a/Plugins/Input/mpg123/getbits.h Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/getbits.h Mon May 22 17:22:34 2006 -0700 @@ -5,29 +5,29 @@ unsigned long rval; unsigned char rval_uc; -#define mpg123_backbits(bitbuf,nob) ((void)( \ +#define mpgdec_backbits(bitbuf,nob) ((void)( \ (*(bitbuf)).bitindex -= (nob), \ (*(bitbuf)).wordpointer += ((*(bitbuf)).bitindex>>3), \ (*(bitbuf)).bitindex &= 0x7 )) -#define mpg123_getbitoffset(bitbuf) ((-(*(bitbuf)).bitindex)&0x7) -#define mpg123_getbyte(bitbuf) (*(*(bitbuf)).wordpointer++) +#define mpgdec_getbitoffset(bitbuf) ((-(*(bitbuf)).bitindex)&0x7) +#define mpgdec_getbyte(bitbuf) (*(*(bitbuf)).wordpointer++) -#define mpg123_getbits(bitbuf,nob) ( \ +#define mpgdec_getbits(bitbuf,nob) ( \ rval = (*(bitbuf)).wordpointer[0], rval <<= 8, rval |= (*(bitbuf)).wordpointer[1], \ rval <<= 8, rval |= (*(bitbuf)).wordpointer[2], rval <<= (*(bitbuf)).bitindex, \ rval &= 0xffffff, (*(bitbuf)).bitindex += (nob), \ rval >>= (24-(nob)), (*(bitbuf)).wordpointer += ((*(bitbuf)).bitindex>>3), \ (*(bitbuf)).bitindex &= 7,rval) -#define mpg123_getbits_fast(bitbuf,nob) ( \ +#define mpgdec_getbits_fast(bitbuf,nob) ( \ rval = (unsigned char) ((*(bitbuf)).wordpointer[0] << (*(bitbuf)).bitindex), \ rval |= ((unsigned long) (*(bitbuf)).wordpointer[1]<<(*(bitbuf)).bitindex)>>8, \ rval <<= (nob), rval >>= 8, \ (*(bitbuf)).bitindex += (nob), (*(bitbuf)).wordpointer += ((*(bitbuf)).bitindex>>3), \ (*(bitbuf)).bitindex &= 7, rval ) -#define mpg123_get1bit(bitbuf) ( \ +#define mpgdec_get1bit(bitbuf) ( \ rval_uc = *(*(bitbuf)).wordpointer << (*(bitbuf)).bitindex, (*(bitbuf)).bitindex++, \ (*(bitbuf)).wordpointer += ((*(bitbuf)).bitindex>>3), (*(bitbuf)).bitindex &= 7, rval_uc>>7 )
--- a/Plugins/Input/mpg123/http.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/http.c Mon May 22 17:22:34 2006 -0700 @@ -54,8 +54,8 @@ static gint udp_establish_listener(gint * sock); static gint udp_check_for_data(gint sock); -extern gint mpg123_bitrate, mpg123_frequency, mpg123_stereo; -extern gboolean mpg123_stereo; +extern gint mpgdec_bitrate, mpgdec_frequency, mpgdec_stereo; +extern gboolean mpgdec_stereo; static gboolean prebuffering, going, eof = FALSE; static gint sock; @@ -179,7 +179,7 @@ } void -mpg123_http_close(void) +mpgdec_http_close(void) { going = FALSE; @@ -209,7 +209,7 @@ http_wait_for_data(gsize bytes) { while ((prebuffering || http_used() < bytes) && !eof && going - && mpg123_info->going) + && mpgdec_info->going) g_usleep(10000); } @@ -228,14 +228,14 @@ } int -mpg123_http_read(gpointer data, gsize length) +mpgdec_http_read(gpointer data, gsize length) { gsize len, cnt, off = 0, meta_len, meta_off = 0, i; gchar *meta_data, **tags; http_wait_for_data(length); - if (!going && !mpg123_info->going) + if (!going && !mpgdec_info->going) return 0; len = min(http_used(), length); @@ -262,10 +262,10 @@ gchar *temp = tags[i] + 13; gchar *title = g_strdup_printf("%s (%s)", temp, icy_name); - mpg123_ip.set_info(title, -1, - mpg123_bitrate * 1000, - mpg123_frequency, - mpg123_stereo); + mpgdec_ip.set_info(title, -1, + mpgdec_bitrate * 1000, + mpgdec_frequency, + mpgdec_stereo); g_free(title); } @@ -315,7 +315,7 @@ } gint -mpg123_http_read_line(gchar * buf, gint size) +mpgdec_http_read_line(gchar * buf, gint size) { gint i = 0; @@ -370,8 +370,8 @@ g_free(url); url = temp; - chost = mpg123_cfg.use_proxy ? mpg123_cfg.proxy_host : host; - cport = mpg123_cfg.use_proxy ? mpg123_cfg.proxy_port : port; + chost = mpgdec_cfg.use_proxy ? mpgdec_cfg.proxy_host : host; + cport = mpgdec_cfg.use_proxy ? mpgdec_cfg.proxy_port : port; #ifdef USE_IPV6 snprintf(service, 6, "%d", cport); @@ -384,7 +384,7 @@ continue; fcntl(sock, F_SETFL, O_NONBLOCK); status = g_strdup_printf(_("CONNECTING TO %s:%d"), chost, cport); - mpg123_ip.set_info_text(status); + mpgdec_ip.set_info_text(status); g_free(status); ((struct sockaddr_in6 *)res->ai_addr)->sin6_port = htons(cport); if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { @@ -401,14 +401,14 @@ status = g_strdup_printf(_("Couldn't connect to host %s:%d"), chost, cport); show_error_message(status); g_free(status); - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); } } else { status = g_strdup_printf(_("Couldn't look up host %s"), chost); show_error_message(status); g_free(status); - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); eof = TRUE; } #else @@ -417,7 +417,7 @@ address.sin_family = AF_INET; status = g_strdup_printf(_("LOOKING UP %s"), chost); - mpg123_ip.set_info_text(status); + mpgdec_ip.set_info_text(status); g_free(status); if (!(hp = gethostbyname(chost))) { @@ -425,7 +425,7 @@ show_error_message(status); g_free(status); - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); eof = TRUE; } #endif @@ -437,7 +437,7 @@ address.sin_port = g_htons(cport); status = g_strdup_printf(_("CONNECTING TO %s:%d"), chost, cport); - mpg123_ip.set_info_text(status); + mpgdec_ip.set_info_text(status); g_free(status); if (connect (sock, (struct sockaddr *) &address, @@ -449,7 +449,7 @@ show_error_message(status); g_free(status); - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); eof = TRUE; } } @@ -470,7 +470,7 @@ show_error_message(status); g_free(status); - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); eof = TRUE; } @@ -482,7 +482,7 @@ gchar udpspace[30]; gint udp_port; - if (mpg123_cfg.use_udp_channel) { + if (mpgdec_cfg.use_udp_channel) { udp_port = udp_establish_listener(&udp_sock); if (udp_port > 0) sprintf(udpspace, "x-audiocast-udpport: %d\r\n", @@ -496,14 +496,14 @@ basic_authentication_encode(user, pass, "Authorization"); - if (mpg123_cfg.use_proxy) { + if (mpgdec_cfg.use_proxy) { file = g_strdup(url); - if (mpg123_cfg.proxy_use_auth && mpg123_cfg.proxy_user - && mpg123_cfg.proxy_pass) { + if (mpgdec_cfg.proxy_use_auth && mpgdec_cfg.proxy_user + && mpgdec_cfg.proxy_pass) { proxy_auth = - basic_authentication_encode(mpg123_cfg. + basic_authentication_encode(mpgdec_cfg. proxy_user, - mpg123_cfg. + mpgdec_cfg. proxy_pass, "Proxy-Authorization"); } @@ -518,7 +518,7 @@ proxy_auth ? proxy_auth : "", auth ? auth : "", "Icy-MetaData:1\r\n", - mpg123_cfg. + mpgdec_cfg. use_udp_channel ? udpspace : ""); g_free(file); @@ -528,10 +528,10 @@ g_free(auth); write(sock, temp, strlen(temp)); g_free(temp); - mpg123_ip.set_info_text(_("CONNECTED: WAITING FOR REPLY")); + mpgdec_ip.set_info_text(_("CONNECTED: WAITING FOR REPLY")); while (going && !eof) { if (http_check_for_data()) { - if (mpg123_http_read_line(line, 1024)) { + if (mpgdec_http_read_line(line, 1024)) { status = strchr(line, ' '); if (status) { if (status[1] == '2') @@ -542,7 +542,7 @@ while (going) { if (http_check_for_data()) { if ((cnt = - mpg123_http_read_line + mpgdec_http_read_line (line, 1024)) != -1) { if (!cnt) break; @@ -554,7 +554,7 @@ } else { eof = TRUE; - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); break; } } @@ -575,14 +575,14 @@ } else { eof = TRUE; - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); } } } while (going && !redirect) { if (http_check_for_data()) { - if ((cnt = mpg123_http_read_line(line, 1024)) != -1) { + if ((cnt = mpgdec_http_read_line(line, 1024)) != -1) { if (!cnt) break; if (!strncmp(line, "icy-name:", 9)) @@ -603,7 +603,7 @@ } else { eof = TRUE; - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); break; } } @@ -624,11 +624,11 @@ } } while (redirect); - if (mpg123_cfg.save_http_stream) { + if (mpgdec_cfg.save_http_stream) { gchar *output_name; gint i = 1; - file = mpg123_http_get_title(url); + file = mpgdec_http_get_title(url); output_name = file; if (!strncasecmp(output_name, "http://", 7)) output_name += 7; @@ -639,11 +639,11 @@ while ((temp = strchr(output_name, '/'))) *temp = '_'; output_name = g_strdup_printf("%s/%s.mp3", - mpg123_cfg.save_http_path, output_name); + mpgdec_cfg.save_http_path, output_name); while (!access(output_name, F_OK) && i < 100000) { g_free(output_name); output_name = g_strdup_printf("%s/%s-%d.mp3", - mpg123_cfg.save_http_path, + mpgdec_cfg.save_http_path, output_name, i++); } @@ -655,7 +655,7 @@ while (going) { - if (!http_used() && !mpg123_ip.output->buffer_playing()) + if (!http_used() && !mpgdec_ip.output->buffer_playing()) prebuffering = TRUE; if (http_free() > 0 && !eof) { if (http_check_for_data()) { @@ -668,7 +668,7 @@ if (prebuffering) { prebuffering = FALSE; - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); } } @@ -679,14 +679,14 @@ if (prebuffering) { if (http_used() > prebuffer_length) { prebuffering = FALSE; - mpg123_ip.set_info_text(NULL); + mpgdec_ip.set_info_text(NULL); } else { status = g_strdup_printf(_("PRE-BUFFERING: %zuKB/%zuKB"), http_used() / 1024, prebuffer_length / 1024); - mpg123_ip.set_info_text(status); + mpgdec_ip.set_info_text(status); g_free(status); } @@ -695,7 +695,7 @@ else g_usleep(10000); - if (mpg123_cfg.use_udp_channel && udp_sock != 0) + if (mpgdec_cfg.use_udp_channel && udp_sock != 0) if (udp_check_for_data(udp_sock) < 0) { close(udp_sock); udp_sock = 0; @@ -720,7 +720,7 @@ } int -mpg123_http_open(gchar * _url) +mpgdec_http_open(gchar * _url) { gchar *url; @@ -728,8 +728,8 @@ rd_index = 0; wr_index = 0; - buffer_length = mpg123_cfg.http_buffer_size * 1024; - prebuffer_length = (buffer_length * mpg123_cfg.http_prebuffer) / 100; + buffer_length = mpgdec_cfg.http_buffer_size * 1024; + prebuffer_length = (buffer_length * mpgdec_cfg.http_prebuffer) / 100; buffer_read = 0; icy_metaint = 0; prebuffering = TRUE; @@ -743,7 +743,7 @@ } char * -mpg123_http_get_title(gchar * url) +mpgdec_http_get_title(gchar * url) { if (icy_name) return g_strdup(icy_name); @@ -877,21 +877,21 @@ if (strstr(lines[i], "x-audiocast-streamtitle") != NULL) { title = g_strdup_printf("%s (%s)", valptr, icy_name); if (going) - mpg123_ip.set_info(title, -1, mpg123_bitrate * 1000, - mpg123_frequency, mpg123_stereo); + mpgdec_ip.set_info(title, -1, mpgdec_bitrate * 1000, + mpgdec_frequency, mpgdec_stereo); g_free(title); } #if 0 else if (strstr(lines[i], "x-audiocast-streamlength") != NULL) { if (atoi(valptr) != -1) - mpg123_ip.set_info(NULL, atoi(valptr), - mpg123_bitrate * 1000, mpg123_frequency, - mpg123_stereo); + mpgdec_ip.set_info(NULL, atoi(valptr), + mpgdec_bitrate * 1000, mpgdec_frequency, + mpgdec_stereo); } #endif else if (strstr(lines[i], "x-audiocast-streammsg") != NULL) { - /* mpg123_ip.set_info(title, -1, mpg123_bitrate * 1000, mpg123_frequency, mpg123_stereo); */ + /* mpgdec_ip.set_info(title, -1, mpgdec_bitrate * 1000, mpgdec_frequency, mpgdec_stereo); */ /* xmms_show_message(_("Message"), valptr, _("Ok"), */ /* FALSE, NULL, NULL); */ g_message("Stream_message: %s", valptr);
--- a/Plugins/Input/mpg123/interface.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/interface.c Mon May 22 17:22:34 2006 -0700 @@ -22,6 +22,8 @@ #include "common.h" +static const long outscale = 32768; + mpgdec_t *global_ins; mpgdec_t *mpgdec_new(void) @@ -30,4 +32,9 @@ /* yeah i know this is cheating */ global_ins = ins; + + mpgdec_make_decode_tables(outscale); + psycho_init(); + + return ins; }
--- a/Plugins/Input/mpg123/layer1.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/layer1.c Mon May 22 17:22:34 2006 -0700 @@ -21,34 +21,34 @@ int i; int jsbound = fr->jsbound; for (i=0;i<jsbound;i++) { - *ba++ = mpg123_getbits(&bsi,4); - *ba++ = mpg123_getbits(&bsi,4); + *ba++ = mpgdec_getbits(&bsi,4); + *ba++ = mpgdec_getbits(&bsi,4); } for (i=jsbound;i<SBLIMIT;i++) - *ba++ = mpg123_getbits(&bsi,4); + *ba++ = mpgdec_getbits(&bsi,4); ba = balloc; for (i=0;i<jsbound;i++) { if ((*ba++)) - *sca++ = mpg123_getbits(&bsi,6); + *sca++ = mpgdec_getbits(&bsi,6); if ((*ba++)) - *sca++ = mpg123_getbits(&bsi,6); + *sca++ = mpgdec_getbits(&bsi,6); } for (i=jsbound;i<SBLIMIT;i++) if ((*ba++)) { - *sca++ = mpg123_getbits(&bsi,6); - *sca++ = mpg123_getbits(&bsi,6); + *sca++ = mpgdec_getbits(&bsi,6); + *sca++ = mpgdec_getbits(&bsi,6); } } else { int i; for (i=0;i<SBLIMIT;i++) - *ba++ = mpg123_getbits(&bsi,4); + *ba++ = mpgdec_getbits(&bsi,4); ba = balloc; for (i=0;i<SBLIMIT;i++) if ((*ba++)) - *sca++ = mpg123_getbits(&bsi,6); + *sca++ = mpgdec_getbits(&bsi,6); } } @@ -68,30 +68,30 @@ ba = balloc; for (sample=smpb,i=0;i<jsbound;i++) { if ((n = *ba++)) - *sample++ = mpg123_getbits(&bsi,n+1); + *sample++ = mpgdec_getbits(&bsi,n+1); if ((n = *ba++)) - *sample++ = mpg123_getbits(&bsi,n+1); + *sample++ = mpgdec_getbits(&bsi,n+1); } for (i=jsbound;i<SBLIMIT;i++) if ((n = *ba++)) - *sample++ = mpg123_getbits(&bsi,n+1); + *sample++ = mpgdec_getbits(&bsi,n+1); ba = balloc; for (sample=smpb,i=0;i<jsbound;i++) { if((n=*ba++)) - *f0++ = (mpgdec_real) ( ((-1)<<n) + (*sample++) + 1) * mpg123_muls[n+1][*sca++]; + *f0++ = (mpgdec_real) ( ((-1)<<n) + (*sample++) + 1) * mpgdec_muls[n+1][*sca++]; else *f0++ = 0.0; if((n=*ba++)) - *f1++ = (mpgdec_real) ( ((-1)<<n) + (*sample++) + 1) * mpg123_muls[n+1][*sca++]; + *f1++ = (mpgdec_real) ( ((-1)<<n) + (*sample++) + 1) * mpgdec_muls[n+1][*sca++]; else *f1++ = 0.0; } for (i=jsbound;i<SBLIMIT;i++) { if ((n=*ba++)) { mpgdec_real samp = ( ((-1)<<n) + (*sample++) + 1); - *f0++ = samp * mpg123_muls[n+1][*sca++]; - *f1++ = samp * mpg123_muls[n+1][*sca++]; + *f0++ = samp * mpgdec_muls[n+1][*sca++]; + *f1++ = samp * mpgdec_muls[n+1][*sca++]; } else *f0++ = *f1++ = 0.0; @@ -104,11 +104,11 @@ ba = balloc; for (sample=smpb,i=0;i<SBLIMIT;i++) if ((n = *ba++)) - *sample++ = mpg123_getbits(&bsi,n+1); + *sample++ = mpgdec_getbits(&bsi,n+1); ba = balloc; for (sample=smpb,i=0;i<SBLIMIT;i++) { if((n=*ba++)) - *f0++ = (mpgdec_real) ( ((-1)<<n) + (*sample++) + 1) * mpg123_muls[n+1][*sca++]; + *f0++ = (mpgdec_real) ( ((-1)<<n) + (*sample++) + 1) * mpgdec_muls[n+1][*sca++]; else *f0++ = 0.0; } @@ -118,7 +118,7 @@ } int -mpg123_do_layer1(struct frame *fr) +mpgdec_do_layer1(struct frame *fr) { int i, stereo = fr->stereo; unsigned int balloc[2 * SBLIMIT]; @@ -138,29 +138,29 @@ I_step_two(fraction, balloc, scale_index, fr); if (single >= 0) { - (fr->synth_mono) ((mpgdec_real *) fraction[single], mpg123_pcm_sample, - &mpg123_pcm_point); + (fr->synth_mono) ((mpgdec_real *) fraction[single], mpgdec_pcm_sample, + &mpgdec_pcm_point); } else { - int p1 = mpg123_pcm_point; + int p1 = mpgdec_pcm_point; - (fr->synth) ((mpgdec_real *) fraction[0], 0, mpg123_pcm_sample, &p1); - (fr->synth) ((mpgdec_real *) fraction[1], 1, mpg123_pcm_sample, - &mpg123_pcm_point); + (fr->synth) ((mpgdec_real *) fraction[0], 0, mpgdec_pcm_sample, &p1); + (fr->synth) ((mpgdec_real *) fraction[1], 1, mpgdec_pcm_sample, + &mpgdec_pcm_point); } #ifdef PSYCHO - psycho_process(mpg123_pcm_sample, mpg123_pcm_point, mpg123_cfg.channels == 2 ? fr->stereo : 1); + psycho_process(mpgdec_pcm_sample, mpgdec_pcm_point, mpgdec_cfg.channels == 2 ? fr->stereo : 1); #endif - if (mpg123_info->output_audio && mpg123_info->jump_to_time == -1) { - produce_audio(mpg123_ip.output->written_time(), - mpg123_cfg.resolution == + if (mpgdec_info->output_audio && mpgdec_info->jump_to_time == -1) { + produce_audio(mpgdec_ip.output->written_time(), + mpgdec_cfg.resolution == 16 ? FMT_S16_NE : FMT_U8, - mpg123_cfg.channels == - 2 ? fr->stereo : 1, mpg123_pcm_point, - mpg123_pcm_sample, &mpg123_info->going); + mpgdec_cfg.channels == + 2 ? fr->stereo : 1, mpgdec_pcm_point, + mpgdec_pcm_sample, &mpgdec_info->going); } - mpg123_pcm_point = 0; + mpgdec_pcm_point = 0; } return 1;
--- a/Plugins/Input/mpg123/layer2.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/layer2.c Mon May 22 17:22:34 2006 -0700 @@ -16,10 +16,10 @@ static int grp_5tab[128 * 3] = { 0, }; /* used: 125 */ static int grp_9tab[1024 * 3] = { 0, }; /* used: 729 */ -mpgdec_real mpg123_muls[27][64]; /* also used by layer 1 */ +mpgdec_real mpgdec_muls[27][64]; /* also used by layer 1 */ void -mpg123_init_layer2 (gboolean mmx) +mpgdec_init_layer2 (gboolean mmx) { static double mulmul[27] = { 0.0, -2.0 / 3.0, 2.0 / 3.0, 2.0 / 7.0, 2.0 / 15.0, @@ -56,7 +56,7 @@ for (k = 0; k < 27; k++) { double m = mulmul[k]; - table = mpg123_muls[k]; + table = mpgdec_muls[k]; for (j = 3, i = 0; i < 63; i++, j--) *table++ = m * pow (2.0, (double) j / 3.0); *table++ = 0.0; @@ -81,12 +81,12 @@ { for (i = jsbound; i > 0; i--, alloc1 += (1 << step)) { - *bita++ = (char) mpg123_getbits (&bsi, step = alloc1->bits); - *bita++ = (char) mpg123_getbits (&bsi, step); + *bita++ = (char) mpgdec_getbits (&bsi, step = alloc1->bits); + *bita++ = (char) mpgdec_getbits (&bsi, step); } for (i = sblimit - jsbound; i > 0; i--, alloc1 += (1 << step)) { - bita[0] = (char) mpg123_getbits (&bsi, step = alloc1->bits); + bita[0] = (char) mpgdec_getbits (&bsi, step = alloc1->bits); bita[1] = bita[0]; bita += 2; } @@ -94,18 +94,18 @@ scfsi = scfsi_buf; for (i = sblimit2; i; i--) if (*bita++) - *scfsi++ = (char) mpg123_getbits_fast (&bsi, 2); + *scfsi++ = (char) mpgdec_getbits_fast (&bsi, 2); } else /* mono */ { for (i = sblimit; i; i--, alloc1 += (1 << step)) - *bita++ = (char) mpg123_getbits (&bsi, step = alloc1->bits); + *bita++ = (char) mpgdec_getbits (&bsi, step = alloc1->bits); bita = bit_alloc; scfsi = scfsi_buf; for (i = sblimit; i; i--) if (*bita++) - *scfsi++ = (char) mpg123_getbits_fast (&bsi, 2); + *scfsi++ = (char) mpgdec_getbits_fast (&bsi, 2); } bita = bit_alloc; @@ -115,23 +115,23 @@ switch (*scfsi++) { case 0: - *scale++ = mpg123_getbits_fast (&bsi, 6); - *scale++ = mpg123_getbits_fast (&bsi, 6); - *scale++ = mpg123_getbits_fast (&bsi, 6); + *scale++ = mpgdec_getbits_fast (&bsi, 6); + *scale++ = mpgdec_getbits_fast (&bsi, 6); + *scale++ = mpgdec_getbits_fast (&bsi, 6); break; case 1: - *scale++ = sc = mpg123_getbits_fast (&bsi, 6); + *scale++ = sc = mpgdec_getbits_fast (&bsi, 6); *scale++ = sc; - *scale++ = mpg123_getbits_fast (&bsi, 6); + *scale++ = mpgdec_getbits_fast (&bsi, 6); break; case 2: - *scale++ = sc = mpg123_getbits_fast (&bsi, 6); + *scale++ = sc = mpgdec_getbits_fast (&bsi, 6); *scale++ = sc; *scale++ = sc; break; default: /* case 3 */ - *scale++ = mpg123_getbits_fast (&bsi, 6); - *scale++ = sc = mpg123_getbits_fast (&bsi, 6); + *scale++ = mpgdec_getbits_fast (&bsi, 6); + *scale++ = sc = mpgdec_getbits_fast (&bsi, 6); *scale++ = sc; break; } @@ -160,14 +160,14 @@ k = (alloc2 = alloc1 + ba)->bits; if ((d1 = alloc2->d) < 0) { - mpgdec_real cm = mpg123_muls[k][scale[x1]]; + mpgdec_real cm = mpgdec_muls[k][scale[x1]]; fraction[j][0][i] = - ((mpgdec_real) ((int) mpg123_getbits (&bsi, k) + d1)) * cm; + ((mpgdec_real) ((int) mpgdec_getbits (&bsi, k) + d1)) * cm; fraction[j][1][i] = - ((mpgdec_real) ((int) mpg123_getbits (&bsi, k) + d1)) * cm; + ((mpgdec_real) ((int) mpgdec_getbits (&bsi, k) + d1)) * cm; fraction[j][2][i] = - ((mpgdec_real) ((int) mpg123_getbits (&bsi, k) + d1)) * cm; + ((mpgdec_real) ((int) mpgdec_getbits (&bsi, k) + d1)) * cm; } else { @@ -175,11 +175,11 @@ { 0, 0, 0, grp_3tab, 0, grp_5tab, 0, 0, 0, grp_9tab }; unsigned int idx, *tab, m = scale[x1]; - idx = (unsigned int) mpg123_getbits (&bsi, k); + idx = (unsigned int) mpgdec_getbits (&bsi, k); tab = (unsigned int *) (table[d1] + idx + idx + idx); - fraction[j][0][i] = mpg123_muls[*tab++][m]; - fraction[j][1][i] = mpg123_muls[*tab++][m]; - fraction[j][2][i] = mpg123_muls[*tab][m]; + fraction[j][0][i] = mpgdec_muls[*tab++][m]; + fraction[j][1][i] = mpgdec_muls[*tab++][m]; + fraction[j][2][i] = mpgdec_muls[*tab][m]; } scale += 3; } @@ -199,17 +199,17 @@ { mpgdec_real cm; - cm = mpg123_muls[k][scale[x1 + 3]]; + cm = mpgdec_muls[k][scale[x1 + 3]]; fraction[1][0][i] = (fraction[0][0][i] = - (mpgdec_real) ((int) mpg123_getbits (&bsi, k) + + (mpgdec_real) ((int) mpgdec_getbits (&bsi, k) + d1)) * cm; fraction[1][1][i] = (fraction[0][1][i] = - (mpgdec_real) ((int) mpg123_getbits (&bsi, k) + + (mpgdec_real) ((int) mpgdec_getbits (&bsi, k) + d1)) * cm; fraction[1][2][i] = (fraction[0][2][i] = - (mpgdec_real) ((int) mpg123_getbits (&bsi, k) + + (mpgdec_real) ((int) mpgdec_getbits (&bsi, k) + d1)) * cm; - cm = mpg123_muls[k][scale[x1]]; + cm = mpgdec_muls[k][scale[x1]]; fraction[0][0][i] *= cm; fraction[0][1][i] *= cm; fraction[0][2][i] *= cm; @@ -222,14 +222,14 @@ m1 = scale[x1]; m2 = scale[x1 + 3]; - idx = (unsigned int) mpg123_getbits (&bsi, k); + idx = (unsigned int) mpgdec_getbits (&bsi, k); tab = (unsigned int *) (table[d1] + idx + idx + idx); - fraction[0][0][i] = mpg123_muls[*tab][m1]; - fraction[1][0][i] = mpg123_muls[*tab++][m2]; - fraction[0][1][i] = mpg123_muls[*tab][m1]; - fraction[1][1][i] = mpg123_muls[*tab++][m2]; - fraction[0][2][i] = mpg123_muls[*tab][m1]; - fraction[1][2][i] = mpg123_muls[*tab][m2]; + fraction[0][0][i] = mpgdec_muls[*tab][m1]; + fraction[1][0][i] = mpgdec_muls[*tab++][m2]; + fraction[0][1][i] = mpgdec_muls[*tab][m1]; + fraction[1][1][i] = mpgdec_muls[*tab++][m2]; + fraction[0][2][i] = mpgdec_muls[*tab][m1]; + fraction[1][2][i] = mpgdec_muls[*tab][m2]; } scale += 6; } @@ -287,7 +287,7 @@ int -mpg123_do_layer2 (struct frame *fr) +mpgdec_do_layer2 (struct frame *fr) { int i, j; int stereo = fr->stereo; @@ -314,33 +314,33 @@ { if (single >= 0) { - (fr->synth_mono) (fraction[single][j], mpg123_pcm_sample, - &mpg123_pcm_point); + (fr->synth_mono) (fraction[single][j], mpgdec_pcm_sample, + &mpgdec_pcm_point); } else { - int p1 = mpg123_pcm_point; + int p1 = mpgdec_pcm_point; - (fr->synth) (fraction[0][j], 0, mpg123_pcm_sample, &p1); - (fr->synth) (fraction[1][j], 1, mpg123_pcm_sample, - &mpg123_pcm_point); + (fr->synth) (fraction[0][j], 0, mpgdec_pcm_sample, &p1); + (fr->synth) (fraction[1][j], 1, mpgdec_pcm_sample, + &mpgdec_pcm_point); } - /* if(mpg123_pcm_point >= audiobufsize) + /* if(mpgdec_pcm_point >= audiobufsize) audio_flush(outmode,ai); */ } } #ifdef PSYCHO - psycho_process(mpg123_pcm_sample, mpg123_pcm_point, mpg123_cfg.channels == 2 ? fr->stereo : 1); + psycho_process(mpgdec_pcm_sample, mpgdec_pcm_point, mpgdec_cfg.channels == 2 ? fr->stereo : 1); #endif - if (mpg123_info->output_audio) + if (mpgdec_info->output_audio) { - produce_audio (mpg123_ip.output->written_time (), - mpg123_cfg.resolution == 16 ? FMT_S16_NE : FMT_U8, - mpg123_cfg.channels == 2 ? fr->stereo : 1, - mpg123_pcm_point, mpg123_pcm_sample, &mpg123_pcm_point); + produce_audio (mpgdec_ip.output->written_time (), + mpgdec_cfg.resolution == 16 ? FMT_S16_NE : FMT_U8, + mpgdec_cfg.channels == 2 ? fr->stereo : 1, + mpgdec_pcm_point, mpgdec_pcm_sample, &mpgdec_pcm_point); } - mpg123_pcm_point = 0; + mpgdec_pcm_point = 0; return 1; }
--- a/Plugins/Input/mpg123/layer3.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/layer3.c Mon May 22 17:22:34 2006 -0700 @@ -127,7 +127,7 @@ static mpgdec_real pow1_1[2][16],pow2_1[2][16],pow1_2[2][16],pow2_2[2][16]; void -mpg123_init_layer3(int down_sample_sblimit) +mpgdec_init_layer3(int down_sample_sblimit) { int i, j, k, l; @@ -375,16 +375,16 @@ static const int tabs[2][5] = { { 2,9,5,3,4 } , { 1,8,1,2,9 } }; const int *tab = tabs[lsf]; - si->main_data_begin = mpg123_getbits(&bsi,tab[1]); + si->main_data_begin = mpgdec_getbits(&bsi,tab[1]); if (stereo == 1) - si->private_bits = mpg123_getbits_fast(&bsi,tab[2]); + si->private_bits = mpgdec_getbits_fast(&bsi,tab[2]); else - si->private_bits = mpg123_getbits_fast(&bsi,tab[3]); + si->private_bits = mpgdec_getbits_fast(&bsi,tab[3]); if(!lsf) { for (ch=0; ch<stereo; ch++) { si->ch[ch].gr[0].scfsi = -1; - si->ch[ch].gr[1].scfsi = mpg123_getbits_fast(&bsi,4); + si->ch[ch].gr[1].scfsi = mpgdec_getbits_fast(&bsi,4); } } @@ -392,34 +392,34 @@ for (ch=0; ch<stereo; ch++) { register struct gr_info_s *gr_info = &(si->ch[ch].gr[gr]); - gr_info->part2_3_length = mpg123_getbits(&bsi,12); - gr_info->big_values = mpg123_getbits(&bsi,9); + gr_info->part2_3_length = mpgdec_getbits(&bsi,12); + gr_info->big_values = mpgdec_getbits(&bsi,9); if(gr_info->big_values > 288) { gr_info->big_values = 288; } - gr_info->pow2gain = gainpow2+256 - mpg123_getbits_fast(&bsi,8) + powdiff; + gr_info->pow2gain = gainpow2+256 - mpgdec_getbits_fast(&bsi,8) + powdiff; if(ms_stereo) gr_info->pow2gain += 2; - gr_info->scalefac_compress = mpg123_getbits(&bsi,tab[4]); + gr_info->scalefac_compress = mpgdec_getbits(&bsi,tab[4]); - if(mpg123_get1bit(&bsi)) { /* window switch flag */ + if(mpgdec_get1bit(&bsi)) { /* window switch flag */ int i; #ifdef L3_DEBUG if(2*gr_info->big_values > bandInfo[sfreq].shortIdx[12]) fprintf(stderr,"L3: BigValues too large, doesn't make sense %d %d\n",2*gr_info->big_values,bandInfo[sfreq].shortIdx[12]); #endif - gr_info->block_type = mpg123_getbits_fast(&bsi,2); - gr_info->mixed_block_flag = mpg123_get1bit(&bsi); - gr_info->table_select[0] = mpg123_getbits_fast(&bsi,5); - gr_info->table_select[1] = mpg123_getbits_fast(&bsi,5); + gr_info->block_type = mpgdec_getbits_fast(&bsi,2); + gr_info->mixed_block_flag = mpgdec_get1bit(&bsi); + gr_info->table_select[0] = mpgdec_getbits_fast(&bsi,5); + gr_info->table_select[1] = mpgdec_getbits_fast(&bsi,5); /* * table_select[2] not needed, because there is no region2, * but to satisfy some verifications tools we set it either. */ gr_info->table_select[2] = 0; for(i=0;i<3;i++) - gr_info->full_gain[i] = gr_info->pow2gain + (mpg123_getbits_fast(&bsi,3)<<3); + gr_info->full_gain[i] = gr_info->pow2gain + (mpgdec_getbits_fast(&bsi,3)<<3); if(gr_info->block_type == 0) { return 0; @@ -444,9 +444,9 @@ fprintf(stderr,"L3: BigValues too large, doesn't make sense %d %d\n",2*gr_info->big_values,bandInfo[sfreq].longIdx[21]); #endif for (i=0; i<3; i++) - gr_info->table_select[i] = mpg123_getbits_fast(&bsi,5); - r0c = mpg123_getbits_fast(&bsi,4); - r1c = mpg123_getbits_fast(&bsi,3); + gr_info->table_select[i] = mpgdec_getbits_fast(&bsi,5); + r0c = mpgdec_getbits_fast(&bsi,4); + r1c = mpgdec_getbits_fast(&bsi,3); gr_info->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ; if(r0c + r1c + 2 > 22) gr_info->region2start = 576>>1; @@ -456,9 +456,9 @@ gr_info->mixed_block_flag = 0; } if(!lsf) - gr_info->preflag = mpg123_get1bit(&bsi); - gr_info->scalefac_scale = mpg123_get1bit(&bsi); - gr_info->count1table_select = mpg123_get1bit(&bsi); + gr_info->preflag = mpgdec_get1bit(&bsi); + gr_info->scalefac_scale = mpgdec_get1bit(&bsi); + gr_info->count1table_select = mpgdec_get1bit(&bsi); } } @@ -484,15 +484,15 @@ if (gr_info->mixed_block_flag) { for (i=8;i;i--) - *scf++ = mpg123_getbits_fast(&bsi,num0); + *scf++ = mpgdec_getbits_fast(&bsi,num0); i = 9; numbits -= num0; /* num0 * 17 + num1 * 18 */ } for (;i;i--) - *scf++ = mpg123_getbits_fast(&bsi,num0); + *scf++ = mpgdec_getbits_fast(&bsi,num0); for (i = 18; i; i--) - *scf++ = mpg123_getbits_fast(&bsi,num1); + *scf++ = mpgdec_getbits_fast(&bsi,num1); *scf++ = 0; *scf++ = 0; *scf++ = 0; /* short[13][0..2] = 0 */ } else { @@ -501,9 +501,9 @@ if(scfsi < 0) { /* scfsi < 0 => granule == 0 */ for(i=11;i;i--) - *scf++ = mpg123_getbits_fast(&bsi,num0); + *scf++ = mpgdec_getbits_fast(&bsi,num0); for(i=10;i;i--) - *scf++ = mpg123_getbits_fast(&bsi,num1); + *scf++ = mpgdec_getbits_fast(&bsi,num1); numbits = (num0 + num1) * 10 + num0; *scf++ = 0; } @@ -511,7 +511,7 @@ numbits = 0; if(!(scfsi & 0x8)) { for (i=0;i<6;i++) - *scf++ = mpg123_getbits_fast(&bsi,num0); + *scf++ = mpgdec_getbits_fast(&bsi,num0); numbits += num0 * 6; } else { @@ -520,7 +520,7 @@ if(!(scfsi & 0x4)) { for (i=0;i<5;i++) - *scf++ = mpg123_getbits_fast(&bsi,num0); + *scf++ = mpgdec_getbits_fast(&bsi,num0); numbits += num0 * 5; } else { @@ -529,7 +529,7 @@ if(!(scfsi & 0x2)) { for(i=0;i<5;i++) - *scf++ = mpg123_getbits_fast(&bsi,num1); + *scf++ = mpgdec_getbits_fast(&bsi,num1); numbits += num1 * 5; } else { @@ -538,7 +538,7 @@ if(!(scfsi & 0x1)) { for (i=0;i<5;i++) - *scf++ = mpg123_getbits_fast(&bsi,num1); + *scf++ = mpgdec_getbits_fast(&bsi,num1); numbits += num1 * 5; } else { @@ -585,7 +585,7 @@ slen >>= 3; if(num) { for(j=0;j<(int)(pnt[i]);j++) - *scf++ = mpg123_getbits_fast(&bsi,num); + *scf++ = mpgdec_getbits_fast(&bsi,num); numbits += pnt[i] * num; } else { @@ -611,7 +611,7 @@ #define BITSHIFT ((sizeof(long)-1)*8) #define REFRESH_MASK \ while(num < BITSHIFT) { \ - mask |= ((unsigned long)mpg123_getbyte(&bsi))<<(BITSHIFT-num); \ + mask |= ((unsigned long)mpgdec_getbyte(&bsi))<<(BITSHIFT-num); \ num += 8; \ part2remain -= 8; } @@ -624,10 +624,10 @@ int part2remain = gr_info->part2_3_length - part2bits; int *me; - int num = mpg123_getbitoffset(&bsi); + int num = mpgdec_getbitoffset(&bsi); long mask; /* we must split this, because for num==0 the shift is undefined if you do it in one step */ - mask = ((unsigned long) mpg123_getbits(&bsi,num))<<BITSHIFT; + mask = ((unsigned long) mpgdec_getbits(&bsi,num))<<BITSHIFT; mask <<= 8-num; part2remain -= num; @@ -994,18 +994,18 @@ } part2remain += num; - mpg123_backbits(&bsi,num); + mpgdec_backbits(&bsi,num); num = 0; while(xrpnt < &xr[SBLIMIT][0]) *xrpnt++ = DOUBLE_TO_REAL(0.0); while( part2remain > 16 ) { - mpg123_getbits(&bsi,16); /* Dismiss stuffing Bits */ + mpgdec_getbits(&bsi,16); /* Dismiss stuffing Bits */ part2remain -= 16; } if(part2remain > 0) - mpg123_getbits(&bsi,part2remain); + mpgdec_getbits(&bsi,part2remain); #if 0 else if(part2remain < 0) { g_warn("Can't rewind stream by %d bits!\n",-part2remain); @@ -1713,7 +1713,7 @@ } } int -mpg123_do_layer3(struct frame *fr) +mpgdec_do_layer3(struct frame *fr) { int gr, ch, ss; int scalefacs[2][39]; /* max 39 for short[13][3] mode, mixed: 38, long: 22 */ @@ -1745,7 +1745,7 @@ (&sideinfo, stereo, ms_stereo, sfreq, single, fr->lsf)) return 0; - mpg123_set_pointer(sideinfo.main_data_begin); + mpgdec_set_pointer(sideinfo.main_data_begin); for (gr = 0; gr < granules; gr++) { mpgdec_real hybridIn[2][SBLIMIT][SSLIMIT]; @@ -1826,21 +1826,21 @@ } #ifdef XMMS_EQ - if (mpg123_info->eq_active) { + if (mpgdec_info->eq_active) { int i, sb; if (single < 0) { for (sb = 0, i = 0; sb < SBLIMIT; sb++) { for (ss = 0; ss < SSLIMIT; ss++) { - hybridIn[0][sb][ss] *= mpg123_info->eq_mul[i]; - hybridIn[1][sb][ss] *= mpg123_info->eq_mul[i++]; + hybridIn[0][sb][ss] *= mpgdec_info->eq_mul[i]; + hybridIn[1][sb][ss] *= mpgdec_info->eq_mul[i++]; } } } else { for (sb = 0, i = 0; sb < SBLIMIT; sb++) { for (ss = 0; ss < SSLIMIT; ss++) - hybridIn[0][sb][ss] *= mpg123_info->eq_mul[i++]; + hybridIn[0][sb][ss] *= mpgdec_info->eq_mul[i++]; } } } @@ -1857,32 +1857,32 @@ for (ss = 0; ss < SSLIMIT; ss++) { if (single >= 0) { - (fr->synth_mono) (hybridOut[0][ss], mpg123_pcm_sample, - &mpg123_pcm_point); + (fr->synth_mono) (hybridOut[0][ss], mpgdec_pcm_sample, + &mpgdec_pcm_point); } else { - int p1 = mpg123_pcm_point; + int p1 = mpgdec_pcm_point; - (fr->synth) (hybridOut[0][ss], 0, mpg123_pcm_sample, &p1); - (fr->synth) (hybridOut[1][ss], 1, mpg123_pcm_sample, - &mpg123_pcm_point); + (fr->synth) (hybridOut[0][ss], 0, mpgdec_pcm_sample, &p1); + (fr->synth) (hybridOut[1][ss], 1, mpgdec_pcm_sample, + &mpgdec_pcm_point); } } #ifdef PSYCHO - psycho_process(mpg123_pcm_sample, mpg123_pcm_point, mpg123_cfg.channels == 2 ? fr->stereo : 1); + psycho_process(mpgdec_pcm_sample, mpgdec_pcm_point, mpgdec_cfg.channels == 2 ? fr->stereo : 1); #endif - if (mpg123_info->output_audio && mpg123_info->jump_to_time == -1) { - produce_audio(mpg123_ip.output->written_time(), - mpg123_cfg.resolution == + if (mpgdec_info->output_audio && mpgdec_info->jump_to_time == -1) { + produce_audio(mpgdec_ip.output->written_time(), + mpgdec_cfg.resolution == 16 ? FMT_S16_NE : FMT_U8, - mpg123_cfg.channels == - 2 ? fr->stereo : 1, mpg123_pcm_point, - mpg123_pcm_sample, &mpg123_info->going); + mpgdec_cfg.channels == + 2 ? fr->stereo : 1, mpgdec_pcm_point, + mpgdec_pcm_sample, &mpgdec_info->going); } - mpg123_pcm_point = 0; + mpgdec_pcm_point = 0; } return 1; }
--- a/Plugins/Input/mpg123/mpg123.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/mpg123.c Mon May 22 17:22:34 2006 -0700 @@ -25,31 +25,31 @@ #include "audacious/util.h" #include <tag_c.h> -static const long outscale = 32768; - #define BUFSIZE_X 2048 static struct frame fr, temp_fr; -PlayerInfo *mpg123_info = NULL; +PlayerInfo *mpgdec_info = NULL; static GThread *decode_thread; static gboolean audio_error = FALSE, output_opened = FALSE, dopause = FALSE; -gint mpg123_bitrate, mpg123_frequency, mpg123_length, mpg123_layer, - mpg123_lsf; -gchar *mpg123_title = NULL, *mpg123_filename = NULL; +gint mpgdec_bitrate, mpgdec_frequency, mpgdec_length, mpgdec_layer, + mpgdec_lsf; +gchar *mpgdec_title = NULL, *mpgdec_filename = NULL; static int disp_bitrate, skip_frames = 0; static int cpu_fflags, cpu_efflags; -gboolean mpg123_stereo, mpg123_mpeg25; -int mpg123_mode; +gboolean mpgdec_stereo, mpgdec_mpeg25; +int mpgdec_mode; -gchar **mpg123_id3_encoding_list = NULL; +mpgdec_t *ins; + +gchar **mpgdec_id3_encoding_list = NULL; static TagLib_File *taglib_file; static TagLib_Tag *taglib_tag; static const TagLib_AudioProperties *taglib_ap; -const char *mpg123_id3_genres[GENRE_MAX] = { +const char *mpgdec_id3_genres[GENRE_MAX] = { N_("Blues"), N_("Classic Rock"), N_("Country"), N_("Dance"), N_("Disco"), N_("Funk"), N_("Grunge"), N_("Hip-Hop"), N_("Jazz"), N_("Metal"), N_("New Age"), N_("Oldies"), @@ -96,13 +96,13 @@ }; double -mpg123_compute_tpf(struct frame *fr) +mpgdec_compute_tpf(struct frame *fr) { const int bs[4] = { 0, 384, 1152, 1152 }; double tpf; tpf = bs[fr->lay]; - tpf /= mpg123_freqs[fr->sampling_frequency] << (fr->lsf); + tpf /= mpgdec_freqs[fr->sampling_frequency] << (fr->lsf); return tpf; } @@ -117,31 +117,31 @@ int p8 = 0; static func funcs[][3] = { - {mpg123_synth_1to1, - mpg123_synth_2to1, - mpg123_synth_4to1}, - {mpg123_synth_1to1_8bit, - mpg123_synth_2to1_8bit, - mpg123_synth_4to1_8bit}, + {mpgdec_synth_1to1, + mpgdec_synth_2to1, + mpgdec_synth_4to1}, + {mpgdec_synth_1to1_8bit, + mpgdec_synth_2to1_8bit, + mpgdec_synth_4to1_8bit}, }; static func_mono funcs_mono[2][4] = { - {mpg123_synth_1to1_mono, - mpg123_synth_2to1_mono, - mpg123_synth_4to1_mono}, - {mpg123_synth_1to1_8bit_mono, - mpg123_synth_2to1_8bit_mono, - mpg123_synth_4to1_8bit_mono} + {mpgdec_synth_1to1_mono, + mpgdec_synth_2to1_mono, + mpgdec_synth_4to1_mono}, + {mpgdec_synth_1to1_8bit_mono, + mpgdec_synth_2to1_8bit_mono, + mpgdec_synth_4to1_8bit_mono} }; - if (mpg123_cfg.resolution == 8) + if (mpgdec_cfg.resolution == 8) p8 = 1; fr->synth = funcs[p8][ds]; fr->synth_mono = funcs_mono[p8][ds]; fr->synth_type = SYNTH_FPU; if (p8) { - mpg123_make_conv16to8_table(); + mpgdec_make_conv16to8_table(); } } @@ -150,116 +150,114 @@ { ConfigDb *db; - mpg123_make_decode_tables(outscale); + ins = mpgdec_new(); - memset(&mpg123_cfg, 0, sizeof(mpg123_cfg)); + memset(&mpgdec_cfg, 0, sizeof(mpgdec_cfg)); - mpg123_cfg.resolution = 16; - mpg123_cfg.channels = 2; - mpg123_cfg.downsample = 0; - mpg123_cfg.http_buffer_size = 128; - mpg123_cfg.http_prebuffer = 25; - mpg123_cfg.proxy_port = 8080; - mpg123_cfg.proxy_use_auth = FALSE; - mpg123_cfg.proxy_user = NULL; - mpg123_cfg.proxy_pass = NULL; - mpg123_cfg.use_udp_channel = TRUE; - mpg123_cfg.title_override = FALSE; - mpg123_cfg.disable_id3v2 = FALSE; - mpg123_cfg.default_synth = SYNTH_AUTO; + mpgdec_cfg.resolution = 16; + mpgdec_cfg.channels = 2; + mpgdec_cfg.downsample = 0; + mpgdec_cfg.http_buffer_size = 128; + mpgdec_cfg.http_prebuffer = 25; + mpgdec_cfg.proxy_port = 8080; + mpgdec_cfg.proxy_use_auth = FALSE; + mpgdec_cfg.proxy_user = NULL; + mpgdec_cfg.proxy_pass = NULL; + mpgdec_cfg.use_udp_channel = TRUE; + mpgdec_cfg.title_override = FALSE; + mpgdec_cfg.disable_id3v2 = FALSE; + mpgdec_cfg.default_synth = SYNTH_AUTO; - mpg123_cfg.title_encoding_enabled = FALSE; - mpg123_cfg.title_encoding = NULL; + mpgdec_cfg.title_encoding_enabled = FALSE; + mpgdec_cfg.title_encoding = NULL; db = bmp_cfg_db_open(); - bmp_cfg_db_get_int(db, "MPG123", "resolution", &mpg123_cfg.resolution); - bmp_cfg_db_get_int(db, "MPG123", "channels", &mpg123_cfg.channels); - bmp_cfg_db_get_int(db, "MPG123", "downsample", &mpg123_cfg.downsample); + bmp_cfg_db_get_int(db, "MPG123", "resolution", &mpgdec_cfg.resolution); + bmp_cfg_db_get_int(db, "MPG123", "channels", &mpgdec_cfg.channels); + bmp_cfg_db_get_int(db, "MPG123", "downsample", &mpgdec_cfg.downsample); bmp_cfg_db_get_int(db, "MPG123", "http_buffer_size", - &mpg123_cfg.http_buffer_size); + &mpgdec_cfg.http_buffer_size); bmp_cfg_db_get_int(db, "MPG123", "http_prebuffer", - &mpg123_cfg.http_prebuffer); + &mpgdec_cfg.http_prebuffer); bmp_cfg_db_get_bool(db, "MPG123", "save_http_stream", - &mpg123_cfg.save_http_stream); + &mpgdec_cfg.save_http_stream); if (!bmp_cfg_db_get_string - (db, "MPG123", "save_http_path", &mpg123_cfg.save_http_path)) - mpg123_cfg.save_http_path = g_strdup(g_get_home_dir()); + (db, "MPG123", "save_http_path", &mpgdec_cfg.save_http_path)) + mpgdec_cfg.save_http_path = g_strdup(g_get_home_dir()); bmp_cfg_db_get_bool(db, "MPG123", "use_udp_channel", - &mpg123_cfg.use_udp_channel); + &mpgdec_cfg.use_udp_channel); bmp_cfg_db_get_bool(db, "MPG123", "title_override", - &mpg123_cfg.title_override); + &mpgdec_cfg.title_override); bmp_cfg_db_get_bool(db, "MPG123", "disable_id3v2", - &mpg123_cfg.disable_id3v2); + &mpgdec_cfg.disable_id3v2); if (!bmp_cfg_db_get_string - (db, "MPG123", "id3_format", &mpg123_cfg.id3_format)) - mpg123_cfg.id3_format = g_strdup("%p - %t"); + (db, "MPG123", "id3_format", &mpgdec_cfg.id3_format)) + mpgdec_cfg.id3_format = g_strdup("%p - %t"); bmp_cfg_db_get_int(db, "MPG123", "default_synth", - &mpg123_cfg.default_synth); + &mpgdec_cfg.default_synth); - bmp_cfg_db_get_bool(db, "MPG123", "title_encoding_enabled", &mpg123_cfg.title_encoding_enabled); - bmp_cfg_db_get_string(db, "MPG123", "title_encoding", &mpg123_cfg.title_encoding); - if (mpg123_cfg.title_encoding_enabled) - mpg123_id3_encoding_list = g_strsplit_set(mpg123_cfg.title_encoding, ENCODING_SEPARATOR, 0); + bmp_cfg_db_get_bool(db, "MPG123", "title_encoding_enabled", &mpgdec_cfg.title_encoding_enabled); + bmp_cfg_db_get_string(db, "MPG123", "title_encoding", &mpgdec_cfg.title_encoding); + if (mpgdec_cfg.title_encoding_enabled) + mpgdec_id3_encoding_list = g_strsplit_set(mpgdec_cfg.title_encoding, ENCODING_SEPARATOR, 0); - bmp_cfg_db_get_bool(db, NULL, "use_proxy", &mpg123_cfg.use_proxy); - bmp_cfg_db_get_string(db, NULL, "proxy_host", &mpg123_cfg.proxy_host); - bmp_cfg_db_get_int(db, NULL, "proxy_port", &mpg123_cfg.proxy_port); - bmp_cfg_db_get_bool(db, NULL, "proxy_use_auth", &mpg123_cfg.proxy_use_auth); - bmp_cfg_db_get_string(db, NULL, "proxy_user", &mpg123_cfg.proxy_user); - bmp_cfg_db_get_string(db, NULL, "proxy_pass", &mpg123_cfg.proxy_pass); + bmp_cfg_db_get_bool(db, NULL, "use_proxy", &mpgdec_cfg.use_proxy); + bmp_cfg_db_get_string(db, NULL, "proxy_host", &mpgdec_cfg.proxy_host); + bmp_cfg_db_get_int(db, NULL, "proxy_port", &mpgdec_cfg.proxy_port); + bmp_cfg_db_get_bool(db, NULL, "proxy_use_auth", &mpgdec_cfg.proxy_use_auth); + bmp_cfg_db_get_string(db, NULL, "proxy_user", &mpgdec_cfg.proxy_user); + bmp_cfg_db_get_string(db, NULL, "proxy_pass", &mpgdec_cfg.proxy_pass); bmp_cfg_db_close(db); - if (mpg123_cfg.resolution != 16 && mpg123_cfg.resolution != 8) - mpg123_cfg.resolution = 16; + if (mpgdec_cfg.resolution != 16 && mpgdec_cfg.resolution != 8) + mpgdec_cfg.resolution = 16; - mpg123_cfg.channels = CLAMP(mpg123_cfg.channels, 0, 2); - mpg123_cfg.downsample = CLAMP(mpg123_cfg.downsample, 0, 2); - mpg123_getcpuflags(&cpu_fflags, &cpu_efflags); - - psycho_init(); + mpgdec_cfg.channels = CLAMP(mpgdec_cfg.channels, 0, 2); + mpgdec_cfg.downsample = CLAMP(mpgdec_cfg.downsample, 0, 2); + mpgdec_getcpuflags(&cpu_fflags, &cpu_efflags); } static void cleanup(void) { - g_free(mpg123_ip.description); - mpg123_ip.description = NULL; + g_free(mpgdec_ip.description); + mpgdec_ip.description = NULL; - if (mpg123_cfg.save_http_path) { - free(mpg123_cfg.save_http_path); - mpg123_cfg.save_http_path = NULL; + if (mpgdec_cfg.save_http_path) { + free(mpgdec_cfg.save_http_path); + mpgdec_cfg.save_http_path = NULL; } - if (mpg123_cfg.proxy_host) { - free(mpg123_cfg.proxy_host); - mpg123_cfg.proxy_host = NULL; + if (mpgdec_cfg.proxy_host) { + free(mpgdec_cfg.proxy_host); + mpgdec_cfg.proxy_host = NULL; } - if (mpg123_cfg.proxy_user) { - free(mpg123_cfg.proxy_user); - mpg123_cfg.proxy_user = NULL; + if (mpgdec_cfg.proxy_user) { + free(mpgdec_cfg.proxy_user); + mpgdec_cfg.proxy_user = NULL; } - if (mpg123_cfg.proxy_pass) { - free(mpg123_cfg.proxy_pass); - mpg123_cfg.proxy_pass = NULL; + if (mpgdec_cfg.proxy_pass) { + free(mpgdec_cfg.proxy_pass); + mpgdec_cfg.proxy_pass = NULL; } - if (mpg123_cfg.id3_format) { - free(mpg123_cfg.id3_format); - mpg123_cfg.id3_format = NULL; + if (mpgdec_cfg.id3_format) { + free(mpgdec_cfg.id3_format); + mpgdec_cfg.id3_format = NULL; } - if (mpg123_cfg.title_encoding) { - free(mpg123_cfg.title_encoding); - mpg123_cfg.title_encoding = NULL; + if (mpgdec_cfg.title_encoding) { + free(mpgdec_cfg.title_encoding); + mpgdec_cfg.title_encoding = NULL; } - g_strfreev(mpg123_id3_encoding_list); + g_strfreev(mpgdec_id3_encoding_list); } static guint32 @@ -273,7 +271,7 @@ #define DET_BUF_SIZE 1024 static gboolean -mpg123_detect_by_content(char *filename) +mpgdec_detect_by_content(char *filename) { VFSFile *file; guchar tmp[4]; @@ -289,7 +287,7 @@ if (vfs_fread(tmp, 1, 4, file) != 4) goto done; head = convert_to_header(tmp); - while (!mpg123_head_check(head)) { + while (!mpgdec_head_check(head)) { /* * The mpeg-stream can start anywhere in the file, * so we check the entire file @@ -305,7 +303,7 @@ for (i = 0; i < in_buf; i++) { head <<= 8; head |= buf[i]; - if (mpg123_head_check(head)) { + if (mpgdec_head_check(head)) { vfs_fseek(file, i + 1 - in_buf, SEEK_CUR); break; } @@ -314,7 +312,7 @@ if (++cyc > 20) goto done; } - if (mpg123_decode_header(&fr, head)) { + if (mpgdec_decode_header(&fr, head)) { /* * We found something which looks like a MPEG-header. * We check the next frame too, to be sure @@ -325,7 +323,7 @@ if (vfs_fread(tmp, 1, 4, file) != 4) goto done; head = convert_to_header(tmp); - if (mpg123_head_check(head) && mpg123_decode_header(&fr, head)) + if (mpgdec_head_check(head) && mpgdec_decode_header(&fr, head)) ret = TRUE; } @@ -355,15 +353,15 @@ { if (fr->error_protection) { bsi.wordpointer += 2; - /* mpg123_getbits(16); *//* skip crc */ + /* mpgdec_getbits(16); *//* skip crc */ } if (!fr->do_layer(fr)) { skip_frames = 2; - mpg123_info->output_audio = FALSE; + mpgdec_info->output_audio = FALSE; } else { if (!skip_frames) - mpg123_info->output_audio = TRUE; + mpgdec_info->output_audio = TRUE; else skip_frames--; } @@ -373,13 +371,13 @@ get_id3_genre(unsigned char genre_code) { if (genre_code < GENRE_MAX) - return gettext(mpg123_id3_genres[genre_code]); + return gettext(mpgdec_id3_genres[genre_code]); return ""; } guint -mpg123_strip_spaces(char *src, size_t n) +mpgdec_strip_spaces(char *src, size_t n) { gchar *space = NULL, /* last space in src */ *start = src; @@ -432,7 +430,7 @@ * */ void -mpg123_id3v1_to_id3v2(struct id3v1tag_t *v1, struct id3tag_t *v2) +mpgdec_id3v1_to_id3v2(struct id3v1tag_t *v1, struct id3tag_t *v2) { memset(v2, 0, sizeof(struct id3tag_t)); strncpy(v2->title, v1->title, 30); @@ -461,14 +459,14 @@ #define REMOVE_NONEXISTANT_TAG(x) if (!*x) { x = NULL; } /* - * Function mpg123_format_song_title (tag, filename) + * Function mpgdec_format_song_title (tag, filename) * * Create song title according to `tag' and/or `filename' and * return it. The title must be subsequently freed using g_free(). * */ gchar * -mpg123_format_song_title(TagLib_Tag *taglib_tag, gchar * filename) +mpgdec_format_song_title(TagLib_Tag *taglib_tag, gchar * filename) { gchar *title = NULL; TitleInput *input; @@ -480,9 +478,9 @@ input->album_name = taglib_tag_album(taglib_tag); input->track_name = taglib_tag_title(taglib_tag); - mpg123_strip_spaces(input->performer,strlen(input->performer)); - mpg123_strip_spaces(input->album_name,strlen(input->album_name)); - mpg123_strip_spaces(input->track_name,strlen(input->track_name)); + mpgdec_strip_spaces(input->performer,strlen(input->performer)); + mpgdec_strip_spaces(input->album_name,strlen(input->album_name)); + mpgdec_strip_spaces(input->track_name,strlen(input->track_name)); input->year = taglib_tag_year(taglib_tag); input->track_number = taglib_tag_track(taglib_tag); @@ -501,8 +499,8 @@ input->file_path = g_path_get_dirname(filename); input->file_ext = extname(filename); - title = xmms_get_titlestring(mpg123_cfg.title_override ? - mpg123_cfg.id3_format : + title = xmms_get_titlestring(mpgdec_cfg.title_override ? + mpgdec_cfg.id3_format : xmms_get_gentitle_format(), input); if (!title /* || strlen(input->track_name) == 0 */) { @@ -534,7 +532,7 @@ taglib_ap = taglib_file_audioproperties(taglib_file); } - ret = mpg123_format_song_title(taglib_tag, filename); + ret = mpgdec_format_song_title(taglib_tag, filename); taglib_file_free(taglib_file); taglib_tag_free_strings(); @@ -574,25 +572,25 @@ if (vfs_fread(tmp, 1, 4, file) != 4) return 0; head = convert_to_header(tmp); - while (!mpg123_head_check(head)) { + while (!mpgdec_head_check(head)) { head <<= 8; if (vfs_fread(tmp, 1, 1, file) != 1) return 0; head |= tmp[0]; } - if (mpg123_decode_header(&frm, head)) { + if (mpgdec_decode_header(&frm, head)) { buf = g_malloc(frm.framesize + 4); vfs_fseek(file, -4, SEEK_CUR); vfs_fread(buf, 1, frm.framesize + 4, file); - tpf = mpg123_compute_tpf(&frm); - if (mpg123_get_xing_header(&xing_header, buf)) { + tpf = mpgdec_compute_tpf(&frm); + if (mpgdec_get_xing_header(&xing_header, buf)) { g_free(buf); if (xing_header.bytes == 0) xing_header.bytes = get_song_length(file); return (tpf * xing_header.frames * 1000); } g_free(buf); - bpf = mpg123_compute_bpf(&frm); + bpf = mpgdec_compute_bpf(&frm); len = get_song_length(file); return ((guint) (len / bpf) * tpf * 1000); } @@ -624,13 +622,13 @@ open_output(void) { int r; - AFormat fmt = mpg123_cfg.resolution == 16 ? FMT_S16_NE : FMT_U8; - int freq = mpg123_freqs[fr.sampling_frequency] >> mpg123_cfg.downsample; - int channels = mpg123_cfg.channels == 2 ? fr.stereo : 1; - r = mpg123_ip.output->open_audio(fmt, freq, channels); + AFormat fmt = mpgdec_cfg.resolution == 16 ? FMT_S16_NE : FMT_U8; + int freq = mpgdec_freqs[fr.sampling_frequency] >> mpgdec_cfg.downsample; + int channels = mpgdec_cfg.channels == 2 ? fr.stereo : 1; + r = mpgdec_ip.output->open_audio(fmt, freq, channels); if (r && dopause) { - mpg123_ip.output->pause(TRUE); + mpgdec_ip.output->pause(TRUE); dopause = FALSE; } @@ -639,24 +637,24 @@ static int -mpg123_seek(struct frame *fr, xing_header_t * xh, gboolean vbr, int time) +mpgdec_seek(struct frame *fr, xing_header_t * xh, gboolean vbr, int time) { int jumped = -1; if (xh) { int percent = ((double) time * 100.0) / - (mpg123_info->num_frames * mpg123_info->tpf); - int byte = mpg123_seek_point(xh, percent); - jumped = mpg123_stream_jump_to_byte(fr, byte); + (mpgdec_info->num_frames * mpgdec_info->tpf); + int byte = mpgdec_seek_point(xh, percent); + jumped = mpgdec_stream_jump_to_byte(fr, byte); } - else if (vbr && mpg123_length > 0) { - int byte = ((guint64) time * 1000 * mpg123_info->filesize) / - mpg123_length; - jumped = mpg123_stream_jump_to_byte(fr, byte); + else if (vbr && mpgdec_length > 0) { + int byte = ((guint64) time * 1000 * mpgdec_info->filesize) / + mpgdec_length; + jumped = mpgdec_stream_jump_to_byte(fr, byte); } else { - int frame = time / mpg123_info->tpf; - jumped = mpg123_stream_jump_to_frame(fr, frame); + int frame = time / mpgdec_info->tpf; + jumped = mpgdec_stream_jump_to_frame(fr, frame); } return jumped; @@ -672,43 +670,43 @@ xing_header_t xing_header; /* This is used by fileinfo on http streams */ - mpg123_bitrate = 0; + mpgdec_bitrate = 0; - mpg123_pcm_sample = g_malloc0(32768); - mpg123_pcm_point = 0; - mpg123_filename = filename; + mpgdec_pcm_sample = g_malloc0(32768); + mpgdec_pcm_point = 0; + mpgdec_filename = filename; - mpg123_read_frame_init(); + mpgdec_read_frame_init(); - mpg123_open_stream(filename, -1); + mpgdec_open_stream(filename, -1); - if (mpg123_info->eof || !mpg123_read_frame(&fr)) - mpg123_info->eof = TRUE; + if (mpgdec_info->eof || !mpgdec_read_frame(&fr)) + mpgdec_info->eof = TRUE; - if (!mpg123_info->eof && mpg123_info->going) { - if (mpg123_cfg.channels == 2) + if (!mpgdec_info->eof && mpgdec_info->going) { + if (mpgdec_cfg.channels == 2) fr.single = -1; else fr.single = 3; - fr.down_sample = mpg123_cfg.downsample; - fr.down_sample_sblimit = SBLIMIT >> mpg123_cfg.downsample; + fr.down_sample = mpgdec_cfg.downsample; + fr.down_sample_sblimit = SBLIMIT >> mpgdec_cfg.downsample; set_synth_functions(&fr); - mpg123_init_layer3(fr.down_sample_sblimit); + mpgdec_init_layer3(fr.down_sample_sblimit); - mpg123_info->tpf = mpg123_compute_tpf(&fr); + mpgdec_info->tpf = mpgdec_compute_tpf(&fr); if (strncasecmp(filename, "http://", 7)) { - if (mpg123_stream_check_for_xing_header(&fr, &xing_header)) { - mpg123_info->num_frames = xing_header.frames; + if (mpgdec_stream_check_for_xing_header(&fr, &xing_header)) { + mpgdec_info->num_frames = xing_header.frames; have_xing_header = TRUE; - mpg123_read_frame(&fr); + mpgdec_read_frame(&fr); } } for (;;) { memcpy(&temp_fr, &fr, sizeof(struct frame)); - if (!mpg123_read_frame(&temp_fr)) { - mpg123_info->eof = TRUE; + if (!mpgdec_read_frame(&temp_fr)) { + mpgdec_info->eof = TRUE; break; } if (fr.lay != temp_fr.lay || @@ -720,69 +718,69 @@ } if (!have_xing_header && strncasecmp(filename, "http://", 7)) - mpg123_info->num_frames = mpg123_calc_numframes(&fr); + mpgdec_info->num_frames = mpgdec_calc_numframes(&fr); memcpy(&fr, &temp_fr, sizeof(struct frame)); - mpg123_bitrate = tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index]; - disp_bitrate = mpg123_bitrate; - mpg123_frequency = mpg123_freqs[fr.sampling_frequency]; - mpg123_stereo = fr.stereo; - mpg123_layer = fr.lay; - mpg123_lsf = fr.lsf; - mpg123_mpeg25 = fr.mpeg25; - mpg123_mode = fr.mode; + mpgdec_bitrate = tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index]; + disp_bitrate = mpgdec_bitrate; + mpgdec_frequency = mpgdec_freqs[fr.sampling_frequency]; + mpgdec_stereo = fr.stereo; + mpgdec_layer = fr.lay; + mpgdec_lsf = fr.lsf; + mpgdec_mpeg25 = fr.mpeg25; + mpgdec_mode = fr.mode; if (strncasecmp(filename, "http://", 7)) { - mpg123_length = mpg123_info->num_frames * mpg123_info->tpf * 1000; - if (!mpg123_title) - mpg123_title = get_song_title(filename); + mpgdec_length = mpgdec_info->num_frames * mpgdec_info->tpf * 1000; + if (!mpgdec_title) + mpgdec_title = get_song_title(filename); } else { - if (!mpg123_title) - mpg123_title = mpg123_http_get_title(filename); - mpg123_length = -1; + if (!mpgdec_title) + mpgdec_title = mpgdec_http_get_title(filename); + mpgdec_length = -1; } - mpg123_ip.set_info(mpg123_title, mpg123_length, - mpg123_bitrate * 1000, - mpg123_freqs[fr.sampling_frequency], fr.stereo); + mpgdec_ip.set_info(mpgdec_title, mpgdec_length, + mpgdec_bitrate * 1000, + mpgdec_freqs[fr.sampling_frequency], fr.stereo); output_opened = TRUE; if (!open_output()) { audio_error = TRUE; - mpg123_info->eof = TRUE; + mpgdec_info->eof = TRUE; } else play_frame(&fr); } - mpg123_info->first_frame = FALSE; - while (mpg123_info->going) { - if (mpg123_info->jump_to_time != -1) { + mpgdec_info->first_frame = FALSE; + while (mpgdec_info->going) { + if (mpgdec_info->jump_to_time != -1) { void *xp = NULL; if (have_xing_header) xp = &xing_header; - if (mpg123_seek(&fr, xp, vbr, mpg123_info->jump_to_time) > -1) { - mpg123_ip.output->flush(mpg123_info->jump_to_time * 1000); - mpg123_info->eof = FALSE; + if (mpgdec_seek(&fr, xp, vbr, mpgdec_info->jump_to_time) > -1) { + mpgdec_ip.output->flush(mpgdec_info->jump_to_time * 1000); + mpgdec_info->eof = FALSE; } - mpg123_info->jump_to_time = -1; + mpgdec_info->jump_to_time = -1; } - if (!mpg123_info->eof) { - if (mpg123_read_frame(&fr) != 0) { - if (fr.lay != mpg123_layer || fr.lsf != mpg123_lsf) { + if (!mpgdec_info->eof) { + if (mpgdec_read_frame(&fr) != 0) { + if (fr.lay != mpgdec_layer || fr.lsf != mpgdec_lsf) { memcpy(&temp_fr, &fr, sizeof(struct frame)); - if (mpg123_read_frame(&temp_fr) != 0) { + if (mpgdec_read_frame(&temp_fr) != 0) { if (fr.lay == temp_fr.lay && fr.lsf == temp_fr.lsf) { - mpg123_layer = fr.lay; - mpg123_lsf = fr.lsf; + mpgdec_layer = fr.lay; + mpgdec_lsf = fr.lsf; memcpy(&fr, &temp_fr, sizeof(struct frame)); } else { memcpy(&fr, &temp_fr, sizeof(struct frame)); skip_frames = 2; - mpg123_info->output_audio = FALSE; + mpgdec_info->output_audio = FALSE; continue; } @@ -790,38 +788,38 @@ } if (tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index] != - mpg123_bitrate) - mpg123_bitrate = + mpgdec_bitrate) + mpgdec_bitrate = tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index]; if (!disp_count) { disp_count = 20; - if (mpg123_bitrate != disp_bitrate) { + if (mpgdec_bitrate != disp_bitrate) { /* FIXME networks streams */ - disp_bitrate = mpg123_bitrate; + disp_bitrate = mpgdec_bitrate; if (!have_xing_header && strncasecmp(filename, "http://", 7)) { - double rel = mpg123_relative_pos(); + double rel = mpgdec_relative_pos(); if (rel) { - mpg123_length = - mpg123_ip.output->written_time() / rel; + mpgdec_length = + mpgdec_ip.output->written_time() / rel; vbr = TRUE; } - if (rel == 0 || !(mpg123_length > 0)) { - mpg123_info->num_frames = - mpg123_calc_numframes(&fr); - mpg123_info->tpf = mpg123_compute_tpf(&fr); - mpg123_length = - mpg123_info->num_frames * - mpg123_info->tpf * 1000; + if (rel == 0 || !(mpgdec_length > 0)) { + mpgdec_info->num_frames = + mpgdec_calc_numframes(&fr); + mpgdec_info->tpf = mpgdec_compute_tpf(&fr); + mpgdec_length = + mpgdec_info->num_frames * + mpgdec_info->tpf * 1000; } } - mpg123_ip.set_info(mpg123_title, mpg123_length, - mpg123_bitrate * 1000, - mpg123_frequency, mpg123_stereo); + mpgdec_ip.set_info(mpgdec_title, mpgdec_length, + mpgdec_bitrate * 1000, + mpgdec_frequency, mpgdec_stereo); } } else @@ -829,9 +827,9 @@ play_frame(&fr); } else { - mpg123_ip.output->buffer_free(); - mpg123_ip.output->buffer_free(); - mpg123_info->eof = TRUE; + mpgdec_ip.output->buffer_free(); + mpgdec_ip.output->buffer_free(); + mpgdec_info->eof = TRUE; g_usleep(10000); } } @@ -839,13 +837,13 @@ g_usleep(10000); } } - g_free(mpg123_title); - mpg123_title = NULL; - mpg123_stream_close(); + g_free(mpgdec_title); + mpgdec_title = NULL; + mpgdec_stream_close(); if (output_opened && !audio_error) - mpg123_ip.output->close_audio(); - g_free(mpg123_pcm_sample); - mpg123_filename = NULL; + mpgdec_ip.output->close_audio(); + g_free(mpgdec_pcm_sample); + mpgdec_filename = NULL; g_free(filename); return NULL; @@ -857,11 +855,11 @@ memset(&fr, 0, sizeof(struct frame)); memset(&temp_fr, 0, sizeof(struct frame)); - mpg123_info = g_malloc0(sizeof(PlayerInfo)); - mpg123_info->going = 1; - mpg123_info->first_frame = TRUE; - mpg123_info->output_audio = TRUE; - mpg123_info->jump_to_time = -1; + mpgdec_info = g_malloc0(sizeof(PlayerInfo)); + mpgdec_info->going = 1; + mpgdec_info->first_frame = TRUE; + mpgdec_info->output_audio = TRUE; + mpgdec_info->jump_to_time = -1; skip_frames = 0; audio_error = FALSE; output_opened = FALSE; @@ -874,20 +872,20 @@ static void stop(void) { - if (mpg123_info && mpg123_info->going) { - mpg123_info->going = FALSE; + if (mpgdec_info && mpgdec_info->going) { + mpgdec_info->going = FALSE; g_thread_join(decode_thread); - g_free(mpg123_info); - mpg123_info = NULL; + g_free(mpgdec_info); + mpgdec_info = NULL; } } static void seek(int time) { - mpg123_info->jump_to_time = time; + mpgdec_info->jump_to_time = time; - while (mpg123_info->jump_to_time != -1) + while (mpgdec_info->jump_to_time != -1) g_usleep(10000); } @@ -895,7 +893,7 @@ do_pause(short p) { if (output_opened) - mpg123_ip.output->pause(p); + mpgdec_ip.output->pause(p); else dopause = p; } @@ -905,12 +903,12 @@ { if (audio_error) return -2; - if (!mpg123_info) + if (!mpgdec_info) return -1; - if (!mpg123_info->going - || (mpg123_info->eof && !mpg123_ip.output->buffer_playing())) + if (!mpgdec_info->going + || (mpgdec_info->eof && !mpgdec_ip.output->buffer_playing())) return -1; - return mpg123_ip.output->output_time(); + return mpgdec_ip.output->output_time(); } static void @@ -933,33 +931,33 @@ G_CALLBACK(gtk_widget_destroyed), &aboutbox); } -InputPlugin mpg123_ip = { +InputPlugin mpgdec_ip = { NULL, NULL, NULL, /* Description */ init, aboutbox, - mpg123_configure, + mpgdec_configure, is_our_file, NULL, play_file, stop, do_pause, seek, - mpg123_set_eq, + mpgdec_set_eq, get_time, NULL, NULL, cleanup, NULL, NULL, NULL, NULL, get_song_info, - mpg123_file_info_box, /* file_info_box */ + mpgdec_file_info_box, /* file_info_box */ NULL }; InputPlugin * get_iplugin_info(void) { - mpg123_ip.description = g_strdup_printf(_("MPEG Audio Plugin")); - return &mpg123_ip; + mpgdec_ip.description = g_strdup_printf(_("MPEG Audio Plugin")); + return &mpgdec_ip; }
--- a/Plugins/Input/mpg123/mpg123.h Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/mpg123.h Mon May 22 17:22:34 2006 -0700 @@ -119,11 +119,11 @@ guint32 filesize; /* Filesize without junk */ } PlayerInfo; -void mpg123_set_eq(int on, float preamp, float *band); -void mpg123_file_info_box(char *); +void mpgdec_set_eq(int on, float preamp, float *band); +void mpgdec_file_info_box(char *); -extern PlayerInfo *mpg123_info; -extern InputPlugin mpg123_ip; +extern PlayerInfo *mpgdec_info; +extern InputPlugin mpgdec_ip; struct al_table { short bits; @@ -159,7 +159,7 @@ int synth_type; }; -void mpg123_configure(void); +void mpgdec_configure(void); typedef struct { gint resolution; @@ -183,7 +183,7 @@ int default_synth; } MPG123Config; -extern MPG123Config mpg123_cfg; +extern MPG123Config mpgdec_cfg; struct mpgdec_instance { void (*dump_audio)(struct frame *fr); @@ -220,26 +220,26 @@ /* ------ Declarations from "http.c" ------ */ -extern int mpg123_http_open(char *url); -int mpg123_http_read(gpointer data, gsize length); -void mpg123_http_close(void); -char *mpg123_http_get_title(char *url); -int mpg123_http_get_length(void); -void mpg123_http_seek(long pos); +extern int mpgdec_http_open(char *url); +int mpgdec_http_read(gpointer data, gsize length); +void mpgdec_http_close(void); +char *mpgdec_http_get_title(char *url); +int mpgdec_http_get_length(void); +void mpgdec_http_seek(long pos); /* ------ Declarations from "common.c" ------ */ -extern unsigned int mpg123_get1bit(void); -extern unsigned int mpg123_getbits(int); -extern unsigned int mpg123_getbits_fast(int); +extern unsigned int mpgdec_get1bit(void); +extern unsigned int mpgdec_getbits(int); +extern unsigned int mpgdec_getbits_fast(int); -extern void mpg123_open_stream(char *bs_filenam, int fd); -extern int mpg123_head_check(unsigned long); -extern void mpg123_stream_close(void); +extern void mpgdec_open_stream(char *bs_filenam, int fd); +extern int mpgdec_head_check(unsigned long); +extern void mpgdec_stream_close(void); -extern void mpg123_set_pointer(long); +extern void mpgdec_set_pointer(long); -extern unsigned char *mpg123_pcm_sample; -extern int mpg123_pcm_point; +extern unsigned char *mpgdec_pcm_sample; +extern int mpgdec_pcm_point; struct gr_info_s { int scfsi; @@ -271,84 +271,87 @@ }; extern void open_stream(char *, int fd); -extern long mpg123_tell_stream(void); -extern void mpg123_read_frame_init(void); -extern int mpg123_read_frame(struct frame *fr); -extern int mpg123_back_frame(struct frame *fr, int num); -int mpg123_stream_jump_to_frame(struct frame *fr, int frame); -int mpg123_stream_jump_to_byte(struct frame *fr, int byte); -int mpg123_stream_check_for_xing_header(struct frame *fr, +extern long mpgdec_tell_stream(void); +extern void mpgdec_read_frame_init(void); +extern int mpgdec_read_frame(struct frame *fr); +extern int mpgdec_back_frame(struct frame *fr, int num); +int mpgdec_stream_jump_to_frame(struct frame *fr, int frame); +int mpgdec_stream_jump_to_byte(struct frame *fr, int byte); +int mpgdec_stream_check_for_xing_header(struct frame *fr, xing_header_t * xhead); -int mpg123_calc_numframes(struct frame *fr); +int mpgdec_calc_numframes(struct frame *fr); -extern int mpg123_do_layer3(struct frame *fr); -extern int mpg123_do_layer2(struct frame *fr); -extern int mpg123_do_layer1(struct frame *fr); +extern int mpgdec_do_layer3(struct frame *fr); +extern int mpgdec_do_layer2(struct frame *fr); +extern int mpgdec_do_layer1(struct frame *fr); -extern int mpg123_synth_1to1(mpgdec_real *, int, unsigned char *, int *); -extern int mpg123_synth_1to1_8bit(mpgdec_real *, int, unsigned char *, int *); -extern int mpg123_synth_1to1_mono(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_1to1_mono2stereo(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_1to1_8bit_mono(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_1to1_8bit_mono2stereo(mpgdec_real *, unsigned char *, +extern int mpgdec_synth_1to1(mpgdec_real *, int, unsigned char *, int *); +extern int mpgdec_synth_1to1_8bit(mpgdec_real *, int, unsigned char *, int *); +extern int mpgdec_synth_1to1_mono(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_1to1_mono2stereo(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_1to1_8bit_mono(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_1to1_8bit_mono2stereo(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_2to1(mpgdec_real *, int, unsigned char *, int *); -extern int mpg123_synth_2to1_8bit(mpgdec_real *, int, unsigned char *, int *); -extern int mpg123_synth_2to1_mono(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_2to1_mono2stereo(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_2to1_8bit_mono(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_2to1_8bit_mono2stereo(mpgdec_real *, unsigned char *, +extern int mpgdec_synth_2to1(mpgdec_real *, int, unsigned char *, int *); +extern int mpgdec_synth_2to1_8bit(mpgdec_real *, int, unsigned char *, int *); +extern int mpgdec_synth_2to1_mono(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_2to1_mono2stereo(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_2to1_8bit_mono(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_2to1_8bit_mono2stereo(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_4to1(mpgdec_real *, int, unsigned char *, int *); -extern int mpg123_synth_4to1_8bit(mpgdec_real *, int, unsigned char *, int *); -extern int mpg123_synth_4to1_mono(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_4to1_mono2stereo(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_4to1_8bit_mono(mpgdec_real *, unsigned char *, int *); -extern int mpg123_synth_4to1_8bit_mono2stereo(mpgdec_real *, unsigned char *, +extern int mpgdec_synth_4to1(mpgdec_real *, int, unsigned char *, int *); +extern int mpgdec_synth_4to1_8bit(mpgdec_real *, int, unsigned char *, int *); +extern int mpgdec_synth_4to1_mono(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_4to1_mono2stereo(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_4to1_8bit_mono(mpgdec_real *, unsigned char *, int *); +extern int mpgdec_synth_4to1_8bit_mono2stereo(mpgdec_real *, unsigned char *, int *); -extern void mpg123_rewindNbits(int bits); -extern int mpg123_hsstell(void); -extern void mpg123_set_pointer(long); -extern void mpg123_huffman_decoder(int, int *); -extern void mpg123_huffman_count1(int, int *); -extern int mpg123_get_songlen(struct frame *fr, int no); +extern void mpgdec_rewindNbits(int bits); +extern int mpgdec_hsstell(void); +extern void mpgdec_set_pointer(long); +extern void mpgdec_huffman_decoder(int, int *); +extern void mpgdec_huffman_count1(int, int *); +extern int mpgdec_get_songlen(struct frame *fr, int no); -#define mpg123_getcpuflags(a, b) \ +#define mpgdec_getcpuflags(a, b) \ do { \ *(a) = 0; \ *(b) = 0; \ } while (0) -void mpg123_init_layer3(int); -void mpg123_init_layer2(gboolean); -void mpg123_make_decode_tables(long scaleval); -void mpg123_make_conv16to8_table(void); -void mpg123_dct64(mpgdec_real *, mpgdec_real *, mpgdec_real *); +void mpgdec_init_layer3(int); +void mpgdec_init_layer2(gboolean); +void mpgdec_make_decode_tables(long scaleval); +void mpgdec_make_conv16to8_table(void); +void mpgdec_dct64(mpgdec_real *, mpgdec_real *, mpgdec_real *); -int mpg123_decode_header(struct frame *fr, unsigned long newhead); -double mpg123_compute_bpf(struct frame *fr); -double mpg123_compute_tpf(struct frame *fr); -guint mpg123_strip_spaces(char *src, size_t n); -gchar *mpg123_format_song_title(TagLib_Tag *taglib_tag, gchar * filename); -double mpg123_relative_pos(void); +int mpgdec_decode_header(struct frame *fr, unsigned long newhead); +double mpgdec_compute_bpf(struct frame *fr); +double mpgdec_compute_tpf(struct frame *fr); +guint mpgdec_strip_spaces(char *src, size_t n); +gchar *mpgdec_format_song_title(TagLib_Tag *taglib_tag, gchar * filename); +double mpgdec_relative_pos(void); -extern gchar ** mpg123_id3_encoding_list; -extern unsigned char *mpg123_conv16to8; -extern const int mpg123_freqs[9]; -extern mpgdec_real mpg123_muls[27][64]; -extern mpgdec_real mpg123_decwin[512 + 32]; -extern mpgdec_real *mpg123_pnts[5]; +extern gchar ** mpgdec_id3_encoding_list; +extern unsigned char *mpgdec_conv16to8; +extern const int mpgdec_freqs[9]; +extern mpgdec_real mpgdec_muls[27][64]; +extern mpgdec_real mpgdec_decwin[512 + 32]; +extern mpgdec_real *mpgdec_pnts[5]; #define GENRE_MAX 0x94 -extern const char *mpg123_id3_genres[GENRE_MAX]; +extern const char *mpgdec_id3_genres[GENRE_MAX]; extern const int tabsel_123[2][3][16]; /* psycho.c defines */ void psycho_init(void); int psycho_process(void *data, int length, int nch); +/* interface.c */ +mpgdec_t *mpgdec_new(void); + #endif
--- a/Plugins/Input/mpg123/tabinit.c Mon May 22 17:02:59 2006 -0700 +++ b/Plugins/Input/mpg123/tabinit.c Mon May 22 17:22:34 2006 -0700 @@ -4,12 +4,12 @@ #include "mpg123.h" -mpgdec_real mpg123_decwin[512 + 32]; +mpgdec_real mpgdec_decwin[512 + 32]; static mpgdec_real cos64[16], cos32[8], cos16[4], cos8[2], cos4[1]; -mpgdec_real *mpg123_pnts[] = { cos64, cos32, cos16, cos8, cos4 }; +mpgdec_real *mpgdec_pnts[] = { cos64, cos32, cos16, cos8, cos4 }; -static unsigned char *mpg123_conv16to8_buf = NULL; -unsigned char *mpg123_conv16to8; +static unsigned char *mpgdec_conv16to8_buf = NULL; +unsigned char *mpgdec_conv16to8; static long intwinbase[] = { 0, -1, -1, -1, -1, -1, -1, -2, -2, -2, @@ -40,11 +40,11 @@ 73415, 73908, 74313, 74630, 74856, 74992, 75038 }; -void mpg123_make_decode_tables_fpu(long scaleval); -void mpg123_make_decode_tables_mmx(long scaleval); +void mpgdec_make_decode_tables_fpu(long scaleval); +void mpgdec_make_decode_tables_mmx(long scaleval); void -mpg123_make_decode_tables_fpu(long scaleval) +mpgdec_make_decode_tables_fpu(long scaleval) { int i, j; mpgdec_real *table, *costab; @@ -52,17 +52,17 @@ for (i = 0; i < 5; i++) { int kr = 0x10 >> i; int divv = 0x40 >> i; - costab = mpg123_pnts[i]; + costab = mpgdec_pnts[i]; for (j = 0; j < kr; j++) costab[j] = 1.0 / (2.0 * cos(M_PI * ((double) j * 2.0 + 1.0) / (double) divv)); } - table = mpg123_decwin; + table = mpgdec_decwin; scaleval = -scaleval; for (i = 0, j = 0; i < 256; i++, j++, table += 32) { - if (table < mpg123_decwin + 512 + 16) + if (table < mpgdec_decwin + 512 + 16) table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval; if (i % 32 == 31) @@ -72,7 +72,7 @@ } for ( /* i=256 */ ; i < 512; i++, j--, table += 32) { - if (table < mpg123_decwin + 512 + 16) + if (table < mpgdec_decwin + 512 + 16) table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval; if (i % 32 == 31) @@ -83,22 +83,22 @@ } void -mpg123_make_decode_tables_mmx(long scaleval) +mpgdec_make_decode_tables_mmx(long scaleval) { } void -mpg123_make_decode_tables(long scaleval) +mpgdec_make_decode_tables(long scaleval) { - mpg123_make_decode_tables_fpu(scaleval); - mpg123_make_decode_tables_mmx(scaleval); + mpgdec_make_decode_tables_fpu(scaleval); + mpgdec_make_decode_tables_mmx(scaleval); } void -mpg123_make_conv16to8_table(void) +mpgdec_make_conv16to8_table(void) { int i; @@ -106,12 +106,12 @@ * ????: 8.0 is right but on SB cards '2.0' is a better value ??? */ - if (!mpg123_conv16to8_buf) { - mpg123_conv16to8_buf = g_malloc(8192); - mpg123_conv16to8 = mpg123_conv16to8_buf + 4096; + if (!mpgdec_conv16to8_buf) { + mpgdec_conv16to8_buf = g_malloc(8192); + mpgdec_conv16to8 = mpgdec_conv16to8_buf + 4096; } for (i = -4096; i < 4096; i++) { - mpg123_conv16to8[i] = (i >> 5) + 128; + mpgdec_conv16to8[i] = (i >> 5) + 128; } }