changeset 2203:13b8ab116b69

removed debugging stuff. some notes added
author Eugene Zagidullin <e.asphyx@gmail.com>
date Mon, 03 Dec 2007 02:10:29 +0300
parents f76e846d53d9
children 43da009d6e76
files src/madplug/plugin.c src/madplug/tuple.c
diffstat 2 files changed, 13 insertions(+), 197 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug/plugin.c	Mon Dec 03 01:26:57 2007 +0300
+++ b/src/madplug/plugin.c	Mon Dec 03 02:10:29 2007 +0300
@@ -792,6 +792,9 @@
         }
     }
 
+    /* TUDO: make tuple more informative (bitrate, layer).
+     * but it can slowdown tuple creation and avoid sense of TLEN reading. --eugene */
+
     aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy");
     aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "MPEG Audio (MP3)");
     aud_tuple_associate_string(tuple, FIELD_MIMETYPE, NULL, "audio/mpeg");
--- a/src/madplug/tuple.c	Mon Dec 03 01:26:57 2007 +0300
+++ b/src/madplug/tuple.c	Mon Dec 03 02:10:29 2007 +0300
@@ -38,8 +38,6 @@
 /* yaz */
 #include <langinfo.h>
 
-#define DEBUG
-
 static void
 update_id3_frame(struct id3_tag *tag, const char *frame_name, const char *data, int sjis)
 {
@@ -51,11 +49,11 @@
     if (data == NULL)
         return;
 
-    // printf ("updating id3: %s: %s\n", frame_name, data);
+    /* printf ("updating id3: %s: %s\n", frame_name, data);
 
-    //
-    // An empty string removes the frame altogether.
-    //
+    
+     An empty string removes the frame altogether.
+    */
     if (strlen(data) == 0) {
         while ((frame = id3_tag_findframe(tag, frame_name, 0))) {
 #ifdef DEBUG
@@ -75,7 +73,7 @@
         id3_tag_attachframe(tag, frame);
     }
 
-    // setup ucs4 string
+    /* setup ucs4 string */
     if(sjis) {
         ucs4 = id3_latin1_ucs4duplicate((id3_latin1_t *) data);
     }
@@ -83,31 +81,31 @@
         ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) data);
     }
 
-    // set encoding
+    /* set encoding */
     field = id3_frame_field(frame, 0);
     id3_field_settextencoding(field, sjis ? ID3_FIELD_TEXTENCODING_ISO_8859_1 :
 			      ID3_FIELD_TEXTENCODING_UTF_8);
 
-    // setup genre code
+    /* setup genre code */
     if (!strcmp(frame_name, ID3_FRAME_GENRE)) {
         char *tmp;
         int index = id3_genre_number(ucs4);
         g_free(ucs4);
 
-        if(index == -1) { // unknown genre. remove TCON frame.
+        if(index == -1) { /* unknown genre. remove TCON frame. */
 #ifdef DEBUG
             fprintf(stderr, "madplug: remove genre frame\n");
 #endif
             id3_tag_detachframe(tag, frame);
         }
-        else { // meaningful genre
+        else { /* meaningful genre */
             tmp = g_strdup_printf("%d", index);
             ucs4 = id3_latin1_ucs4duplicate((unsigned char *) tmp);
         }
 
     }
 
-    // write string
+    /* write string */
     if (!strcmp(frame_name, ID3_FRAME_COMMENT)) {
         field = id3_frame_field(frame, 3);
         field->type = ID3_FIELD_TYPE_STRINGFULL;
@@ -205,188 +203,3 @@
     return TRUE;
 }
 
-/*#endif                          // !NOGUI
-
-void audmad_get_file_info(char *fileurl)
-{
-#ifndef NOGUI
-    gchar *title;
-    gchar message[128];
-    static char const *const layer_str[3] = { "I", "II", "III" };
-    static char const *const mode_str[4] = {
-        ("single channel"), ("dual channel"), "joint stereo", "stereo"
-    };
-    gchar *tmp, *utf_filename;
-    gchar *realfn = NULL;
-#ifdef DEBUG
-    {
-        tmp = aud_str_to_utf8(fileurl);
-        g_message("f: audmad_get_file_info: %s", tmp);
-        g_free(tmp);
-        tmp = NULL;
-    }
-#endif
-
-    if(!aud_vfs_is_remote(fileurl) && !aud_vfs_file_test(fileurl, G_FILE_TEST_EXISTS)) {
-        return;
-    }
-
-    input_init(&info, fileurl, NULL);
-
-    if(audmad_is_remote(fileurl)) {
-        info.remote = TRUE;
-        if(aud_vfs_is_streaming(info.infile))
-           return; //file info dialog for remote streaming doesn't make sense.
-    }
-
-    realfn = g_filename_from_uri(fileurl, NULL, NULL);
-    utf_filename = aud_str_to_utf8(realfn ? realfn : fileurl);
-    g_free(realfn); realfn = NULL;
-    create_window();
-
-    info.fileinfo_request = TRUE;
-    input_get_info(&info, info.remote ? TRUE : FALSE);
-
-    tmp = g_path_get_basename(utf_filename);
-    title = g_strdup_printf(_("File Info - %s"), tmp);
-    g_free(tmp); tmp = NULL;
-    gtk_window_set_title(GTK_WINDOW(window), title);
-    g_free(title);
-
-    gtk_entry_set_text(GTK_ENTRY(filename_entry), utf_filename);
-    gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1);
-
-    free(utf_filename);
-
-    id3_frame_to_entry(ID3_FRAME_ARTIST, GTK_ENTRY(artist_entry));
-    id3_frame_to_entry(ID3_FRAME_TITLE, GTK_ENTRY(title_entry));
-    id3_frame_to_entry(ID3_FRAME_ALBUM, GTK_ENTRY(album_entry));
-
-// year
-// id3_frame_to_entry (ID3_FRAME_YEAR, GTK_ENTRY (year_entry));
-// to set year entry, we have to do manually because TYER is still used equally to TDRC.
-    gtk_entry_set_text(GTK_ENTRY(year_entry), "");
-    if (info.tag) {
-        gchar *text = NULL;
-        text = input_id3_get_string(info.tag, "TDRC");
-        if (!text)
-            text = input_id3_get_string(info.tag, "TYER");
-        if (text) {
-            gtk_entry_set_text(GTK_ENTRY(year_entry), text);
-            g_free(text);
-        }
-    }
-
-    id3_frame_to_entry(ID3_FRAME_TRACK, GTK_ENTRY(tracknum_entry));
-    id3_frame_to_entry(ID3_FRAME_COMMENT, GTK_ENTRY(comment_entry));
-    snprintf(message, 127, _("Layer %s"), layer_str[info.mpeg_layer - 1]);
-    gtk_label_set_text(GTK_LABEL(mpeg_level), message);
-    if (info.vbr) {
-        snprintf(message, 127, _("VBR (avg. %d kbps)"), info.bitrate / 1000);
-    }
-    else {
-        snprintf(message, 127, "%d kbps", info.bitrate / 1000);
-    }
-    gtk_label_set_text(GTK_LABEL(mpeg_bitrate), message);
-    snprintf(message, 127, _("%d Hz"), info.freq);
-    gtk_label_set_text(GTK_LABEL(mpeg_samplerate), message);
-    if (info.frames != -1) {
-        snprintf(message, 127, _("%d frames"), info.frames);
-        gtk_label_set_text(GTK_LABEL(mpeg_frames), message);
-    }
-    else {
-        gtk_label_set_text(GTK_LABEL(mpeg_frames), "");
-    }
-    gtk_label_set_text(GTK_LABEL(mpeg_flags), mode_str[info.mode]);
-    {
-        guint sec = mad_timer_count(info.duration, MAD_UNITS_SECONDS);
-        snprintf(message, 127, _("%d:%02d (%d seconds)"), sec /60 ,sec % 60, sec);
-    }
-    gtk_label_set_text(GTK_LABEL(mpeg_duration), message);
-
-    if (info.replaygain_album_str != NULL) {
-        snprintf(message, 127, _("RG_album=%4s (x%4.2f)"),
-                 info.replaygain_album_str, info.replaygain_album_scale);
-        gtk_label_set_text(GTK_LABEL(mpeg_replaygain), message);
-    }
-    else
-        gtk_label_set_text(GTK_LABEL(mpeg_replaygain), "");
-
-    if (info.replaygain_track_str != NULL) {
-        snprintf(message, 127, _("RG_track=%4s (x%4.2f)"),
-                 info.replaygain_track_str, info.replaygain_track_scale);
-        gtk_label_set_text(GTK_LABEL(mpeg_replaygain2), message);
-    }
-    else
-        gtk_label_set_text(GTK_LABEL(mpeg_replaygain2), "");
-
-    if (info.replaygain_album_peak_str != NULL) {
-        snprintf(message, 127, _("Peak album=%4s (%+5.3fdBFS)"),
-                 info.replaygain_album_peak_str,
-                 20 * log10(info.replaygain_album_peak));
-        gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), message);
-    }
-    else
-        gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), "");
-
-    if (info.replaygain_track_peak_str != NULL) {
-        snprintf(message, 127, _("Peak track=%4s (%+5.3fdBFS)"),
-                 info.replaygain_track_peak_str,
-                 20 * log10(info.replaygain_track_peak));
-        gtk_label_set_text(GTK_LABEL(mpeg_replaygain4), message);
-    }
-    else
-        gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), "");
-
-    if (info.mp3gain_undo_str != NULL) {
-        snprintf(message, 127, _("mp3gain undo=%4s (%+5.3fdB)"),
-                 info.mp3gain_undo_str, info.mp3gain_undo);
-        gtk_label_set_text(GTK_LABEL(mp3gain1), message);
-    }
-    else
-        gtk_label_set_text(GTK_LABEL(mp3gain1), "");
-
-    if (info.mp3gain_minmax_str != NULL) {
-        snprintf(message, 127, _("mp3gain minmax=%4s (max-min=%+6.3fdB)"),
-                 info.mp3gain_minmax_str, info.mp3gain_minmax);
-        gtk_label_set_text(GTK_LABEL(mp3gain2), message);
-    }
-    else
-        gtk_label_set_text(GTK_LABEL(mp3gain2), "");
-
-    gtk_label_set_text(GTK_LABEL(mpeg_fileinfo), "");
-
-
-    // work out the index of the genre in the list
-    {
-        const id3_ucs4_t *string;
-        id3_ucs4_t *genre;
-        struct id3_frame *frame;
-        union id3_field *field;
-        frame = id3_tag_findframe(info.tag, ID3_FRAME_GENRE, 0);
-        if (frame) {
-            field = id3_frame_field(frame, 1);
-            string = id3_field_getstrings(field, 0);
-            genre = mad_parse_genre(string);
-#ifdef DEBUG
-            if (genre) {
-                gchar *utf = (gchar *)id3_ucs4_utf8duplicate(genre);
-                g_print("genre = %s\n", utf);
-                g_print("genre num = %d\n", id3_genre_number(genre));
-                g_free(utf);
-            }
-#endif
-            if (genre) {
-                gtk_list_select_item(GTK_LIST
-                                     (GTK_COMBO(genre_combo)->list),
-                                     id3_genre_number(genre)+1); //shift one for "Unknown".
-                g_free((void *)genre);
-            }
-        }
-    }
-
-    gtk_widget_set_sensitive(id3_frame, TRUE);
-
-#endif                          // !NOGUI
-}*/
-