+++ /dev/null
---- in_mpc.c 2003-01-16 23:17:01.000000000 +0100
-+++ in_mpc.c 2004-02-19 16:35:48.667521040 +0100
-@@ -33,6 +33,8 @@
- #include "mpc_dec.h"
- #include "mpplus_blue.xpm"
-
-+#include <xmms/titlestring.h>
-+
- #ifndef M_LN10
- # define M_LN10 2.3025850929940456840179914546843642
- #endif
-@@ -50,6 +52,7 @@
- unsigned int ByteLength;
- unsigned int Profile;
- unsigned int EncVersion;
-+ unsigned int SampleRate;
- } StreamInfo;
-
- int TrueGapless = 0;
-@@ -110,6 +113,7 @@
- static void play ( char* );
- static void setvolume ( const int, const int );
- static void infoDlg ( char* );
-+static gchar *get_title(gchar *filename);
- static void getfileinfo ( char*, char**, int* );
- static void config ( void );
- static void about ( void );
-@@ -124,7 +128,7 @@
- static void Equalizer_Setup ( int on, float preamp_ctrl, float* eq_ctrl );
-
-
--char displayed_info [512];
-+/*char displayed_info [512];*/
- static GtkWidget* mp_info = NULL;
- static GtkWidget* mp_conf = NULL;
- static GtkWidget* g_bitrate;
-@@ -355,6 +359,8 @@
- Info -> Frames = HeaderData [1];
- Info -> MS = (HeaderData [2] << 1) >> 31;
- Info -> Profile = (HeaderData [2] >> 20) & 15;
-+ static const unsigned short sftable [4] = { 44100, 48000, 37800, 32000 };
-+ Info->SampleRate = sftable [ HeaderData[2] >> 22 & 2 ];
- Info -> EncVersion = HeaderData [6] >> 24;
- }
- else {
-@@ -366,6 +372,7 @@
- Info -> Frames >>= 16;
- if ( Info -> StreamVersion < 6 ) // Bugfix: last frame was invalid for up to SV5
- Info -> Frames--;
-+ Info->SampleRate = 44100;
- }
-
- return 0;
-@@ -412,8 +419,6 @@
- if ( GTK_TOGGLE_BUTTON (g_displaytaginfo) -> active ) {
- i_displaytaginfo = 1;
- strcpy ( TitleFormat, gtk_entry_get_text(GTK_ENTRY(titleformat_entry)) );
-- if ( *lastfilename != '\0' )
-- get_tags ( lastfilename );
- }
- else {
- i_displaytaginfo = 0;
-@@ -437,8 +442,6 @@
-
- if ( i_displaytaginfo ) {
- strcpy ( TitleFormat, gtk_entry_get_text ( GTK_ENTRY (titleformat_entry) ) );
-- if ( *lastfilename != '\0' )
-- get_tags ( lastfilename );
- }
-
- write_cfg_file ();
-@@ -534,8 +537,8 @@
- gtk_entry_set_text ( GTK_ENTRY (titleformat_entry), TitleFormat );
- gtk_widget_set_sensitive ( titleformat_entry, i_displaytaginfo );
- gtk_box_pack_start ( GTK_BOX (title_box), titleformat_entry, TRUE, TRUE, 0 );
-- gtk_widget_show ( titleformat_entry );
-- gtk_widget_show ( title_box );
-+// gtk_widget_show ( titleformat_entry );
-+// gtk_widget_show ( title_box );
-
- format_box = gtk_hbox_new ( FALSE, 5 );
- gtk_box_pack_start ( GTK_BOX (vbox), format_box, FALSE, FALSE, 0 );
-@@ -548,8 +551,8 @@
- gtk_misc_set_alignment ( GTK_MISC (tag_description_label2), 0, 0 );
- gtk_label_set_justify ( GTK_LABEL (tag_description_label2), GTK_JUSTIFY_LEFT );
- gtk_box_pack_start ( GTK_BOX (format_box), tag_description_label2, TRUE, TRUE, 0 );
-- gtk_widget_show ( tag_description_label2 );
-- gtk_widget_show ( format_box );
-+// gtk_widget_show ( tag_description_label2 );
-+// gtk_widget_show ( format_box );
-
- // The OK & Cancel buttons are separated from the config stuff
- separator = gtk_hseparator_new ();
-@@ -846,17 +849,17 @@
- Init_Tags ();
- CopyTags ( filename );
-
-- printf ("Filename=%s\n", filename);
-- gettag ("Artist" , artist , sizeof artist ); printf ("Artist =%s\n", artist );
-- gettag ("Album" , album , sizeof album ); printf ("Album =%s\n", album );
-- gettag ("Title" , title , sizeof title ); printf ("Title =%s\n", title );
-- gettag ("Comment", comment, sizeof comment); printf ("Comment =%s\n", comment );
-- gettag ("Genre" , genre , sizeof genre ); printf ("Genre =%s\n", genre );
-- gettag ("Year" , year , sizeof year ); printf ("Year =%s\n", year );
-- gettag ("Track" , track , sizeof track ); printf ("Track =%s\n", track );
-+ // printf ("Filename=%s\n", filename);
-+ gettag ("Artist" , artist , sizeof artist );// printf ("Artist =%s\n", artist );
-+ gettag ("Album" , album , sizeof album );// printf ("Album =%s\n", album );
-+ gettag ("Title" , title , sizeof title );// printf ("Title =%s\n", title );
-+ gettag ("Comment", comment, sizeof comment);// printf ("Comment =%s\n", comment );
-+ gettag ("Genre" , genre , sizeof genre );// printf ("Genre =%s\n", genre );
-+ gettag ("Year" , year , sizeof year );// printf ("Year =%s\n", year );
-+ gettag ("Track" , track , sizeof track );// printf ("Track =%s\n", track );
-
- tag_found = *artist && *album && (*title || !*track);
-- strcpy ( displayed_info, eval_tag_format ( filename, artist, album, title, year, comment, genre, track ) );
-+/* strcpy ( displayed_info, eval_tag_format ( filename, artist, album, title, year, comment, genre, track ) );*/
- }
-
-
-@@ -1354,8 +1357,6 @@
- decode_pos_ms = 0;
- seek_needed =-1;
-
-- get_tags ( lastfilename );
--
- // opening sound-device
- maxlatency = mod.output -> open_audio ( FMT_S16_LE, SAMPLERATE, NCH );
- if ( maxlatency < 0 ) { // cannot open sound device
-@@ -1379,7 +1380,9 @@
- VBR_Bitrate = 0;
- }
-
-- mod.set_info ( i_displaytaginfo && tag_found ? displayed_info : NULL,
-+ char *title = get_title(filename);
-+
-+ mod.set_info ( title,
- getlength (),
- VBR_Bitrate,
- SAMPLERATE / 1000,
-@@ -1587,12 +1590,57 @@
- return;
- }
-
-+static gchar *get_title(gchar *filename)
-+{
-+ TitleInput *input;
-+ gchar *temp, *ext, *_title, *path, *temp2;
-+
-+ XMMS_NEW_TITLEINPUT(input);
-+
-+ path = g_strdup(filename);
-+ temp = g_strdup(filename);
-+ ext = strrchr(temp, '.');
-+ if (ext)
-+ *ext = '\0';
-+ temp2 = strrchr(path, '/');
-+ if (temp2)
-+ *temp2 = '\0';
-+
-+ input->file_name = g_basename(filename);
-+ input->file_ext = ext ? ext+1 : NULL;
-+ input->file_path = g_strdup_printf("%s/", path);
-+
-+ if(i_displaytaginfo)
-+ {
-+ get_tags(filename);
-+ if(tag_found)
-+ {
-+ input->track_name = title;
-+ input->performer = artist;
-+ input->album_name = album;
-+ input->track_number = atoi(track);
-+ input->date = year;
-+ input->genre = genre;
-+ input->comment = comment;
-+ }
-+ }
-+
-+ _title = xmms_get_titlestring(xmms_get_gentitle_format(), input);
-+ if ( _title == NULL )
-+ _title = g_strdup(input->file_name);
-+
-+ g_free(temp);
-+ g_free(path);
-+ g_free(input);
-+
-+ return _title;
-+}
-
- static void
- getfileinfo ( char* filename, char** _title, int* length_in_ms )
- {
- StreamInfo Info;
-- unsigned int tmpFrames;
-+ *_title = get_title(filename);
-
- if ( filename == NULL || filename[0] == '\0' ) { // currently playing file
- if ( length_in_ms != NULL )
-@@ -1603,8 +1651,7 @@
- if ( length_in_ms != NULL ) {
- if ( ReadFileHeader ( filename, &Info) )
- return;
-- tmpFrames = Info.Frames;
-- *length_in_ms = (int) ( tmpFrames * 1152.e3 / SAMPLERATE + 0.5f );
-+ *length_in_ms = (int) ( Info.Frames * 1152.e3 / Info.SampleRate + 0.5f );
- }
- }
- }
-@@ -1751,14 +1798,14 @@
- xmms_usleep ( 25000 );
-
- // does not jump back to file in playlist, sets "green" on idle or out of snyc
-- if ( i_bitrate ) {
-+/* if ( i_bitrate ) {
- mod.set_info ( i_displaytaginfo && tag_found ? displayed_info : NULL,
- getlength (),
- avg_bitrate,
- SAMPLERATE / 1000,
- NCH );
- }
--
-+*/
- killDecodeThread = 1;
- pthread_exit (NULL);
- return 0;
-@@ -1803,12 +1850,12 @@
- Frames++;
- if ( i_bitrate && Frames % i_bitrate == 0 ) {
- avg_bitrate = 1000 * (int) ( (BitsRead()-BitCounter) * SAMPLERATE / 1152.e3 / i_bitrate );
-- mod.set_info ( i_displaytaginfo && tag_found ? displayed_info : NULL,
-+/* mod.set_info ( i_displaytaginfo && tag_found ? displayed_info : NULL,
- getlength (),
- avg_bitrate,
- SAMPLERATE / 1000,
- NCH );
--
-+*/
- BitCounter = BitsRead ();
- }
-