[Bug 732444] Rhythmbox cannot retrieve correctly disk information from MusicBrainz

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Sun Jun 29 15:50:27 PDT 2014


https://bugzilla.gnome.org/show_bug.cgi?id=732444
  GStreamer | gst-plugins-base | unspecified

--- Comment #4 from Laurent Vivier <laurent at vivier.eu> 2014-06-29 22:50:22 UTC ---
The bug seems to be in libgstcdda, function
gst_cddabasesrc_calculate_musicbrainz_discid().

I've added some traces in this function to compare with some traces I've added
too in discid from flactag :

gst_cddabasesrc_calculate_musicbrainz_discid (GstCddaBaseSrc * src)
{
  GString *s;
  GChecksum *sha;
  guchar digest[20];
  gchar *ptr;
  gchar tmp[9];
  gulong i;
  guint leadout_sector;
  gsize digest_len;

  s = g_string_new (NULL);

  leadout_sector = src->tracks[src->num_tracks - 1].end + 1 + CD_MSF_OFFSET;

  /* generate SHA digest */
  sha = g_checksum_new (G_CHECKSUM_SHA1);
  g_snprintf (tmp, sizeof (tmp), "%02X", src->tracks[0].num);
printf("1: %s\n", tmp);
  g_string_append_printf (s, "%02X", src->tracks[0].num);
  g_checksum_update (sha, (guchar *) tmp, 2);

  g_snprintf (tmp, sizeof (tmp), "%02X", src->tracks[src->num_tracks - 1].num);
printf("2: %s\n", tmp);
  g_string_append_printf (s, " %02X", src->tracks[src->num_tracks - 1].num);
  g_checksum_update (sha, (guchar *) tmp, 2);

  g_snprintf (tmp, sizeof (tmp), "%08X", leadout_sector);
printf("3: %s\n", tmp);
  g_string_append_printf (s, " %08X", leadout_sector);
  g_checksum_update (sha, (guchar *) tmp, 8);

  for (i = 0; i < 99; i++) {
    if (i < src->num_tracks) {
      guint frame_offset = src->tracks[i].start + CD_MSF_OFFSET;

      g_snprintf (tmp, sizeof (tmp), "%08X", frame_offset);
printf("%ld: %s\n", 4 + i, tmp);
      g_string_append_printf (s, " %08X", frame_offset);
      g_checksum_update (sha, (guchar *) tmp, 8);
    } else {
      g_checksum_update (sha, (guchar *) "00000000", 8);
printf("%ld: %s\n", 4 + i, tmp);
    }
  }
  digest_len = 20;
  g_checksum_get_digest (sha, (guint8 *) & digest, &digest_len);

....


gives us :

1: 01
2: 0D
3: 00045D40
4: 00000096
5: 000050F0
6: 0000C1F2
7: 0000D151
8: 0001288B
9: 000175F7
10: 0001D9B8
11: 000225F1
12: 00028447
13: 0002D2D0
14: 00032AE3
15: 000360F8
16: 00038BC1
17: 00000000
... 00000000
102: 00000000

And for discid :

static void create_disc_id(mb_disc_private *d, char buf[]) {
        SHA_INFO        sha;
        unsigned char   digest[20], *base64;
        unsigned long   size;
        char            tmp[17]; /* for 8 hex digits (16 to avoid trouble) */
        int             i;

        assert(d != NULL);
        assert(d->success);

        sha_init(&sha);

        sprintf(tmp, "%02X", d->first_track_num);
printf("1: %s\n", tmp);
        sha_update(&sha, (unsigned char *) tmp, strlen(tmp));

        sprintf(tmp, "%02X", d->last_track_num);
printf("2: %s\n", tmp);
        sha_update(&sha, (unsigned char *) tmp, strlen(tmp));

        for (i = 0; i < 100; i++) {
                sprintf(tmp, "%08X", d->track_offsets[i]);
printf("%d: %s\n", 3+i, tmp);
                sha_update(&sha, (unsigned char *) tmp, strlen(tmp));
        }

        sha_final(digest, &sha);

        base64 = rfc822_binary(digest, sizeof(digest), &size);

        memcpy(buf, base64, size);
        buf[size] = '\0';

        free(base64);
}

1: 01
2: 0C
3: 00038BC1
4: 00000096
5: 000050F0
6: 0000C1F2
7: 0000D151
8: 0001288B
9: 000175F7
10: 0001D9B8
11: 000225F1
12: 00028447
13: 0002D2D0
14: 00032AE3
15: 000360F8
16: 00000000
... 00000000
102: 00000000
DiscID        : meKBdK4T0Cd7qHCItQhHlkME8UA-

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list