~ubuntu-branches/ubuntu/hardy/gnomad2/hardy

« back to all changes in this revision

Viewing changes to src/wmaread.c

  • Committer: Bazaar Package Importer
  • Author(s): Shaun Jackman
  • Date: 2005-08-19 16:09:28 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050819160928-l2glu227nh0algdc
Tags: 2.8.0-2
Add a versioned dependency for libnjb-dev (>> 2.2). Closes: #324036.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
 
88
88
  if ((title_length > 0) && (meta->title == NULL)) {
89
89
    get_ucs2_string(&data[offset], title_length, &meta->title);
90
 
    g_print("Found title: %s\n", meta->title);
 
90
    // g_print("Found title: %s\n", meta->title);
91
91
  }
92
92
  offset += title_length;
93
93
  if ((offset < size) && (author_length > 0) && (meta->artist == NULL)) {
94
94
    get_ucs2_string(&data[offset], author_length, &meta->artist);
95
 
    g_print("Found author/artist: %s\n", meta->artist);
 
95
    // g_print("Found author/artist: %s\n", meta->artist);
96
96
  }
97
97
  // Skip the other fields.
98
98
  offset += author_length;
121
121
  // * Descriptor Value           variable     variable        // value for Content Descriptor
122
122
  guint descriptors = (data[25] << 8) + data[24];
123
123
  guint offset = 26;
124
 
  g_print("%d descriptors\n", descriptors);
 
124
  // g_print("%d descriptors\n", descriptors);
125
125
  while ((descriptors > 0) && (offset < size)) {
126
126
    guint desc_namelen;
127
127
    gchar *desc_name;
140
140
      // Unicode string. Let's look at it...
141
141
      gchar *desc_string = NULL;
142
142
      get_ucs2_string(&data[offset], desc_datalen, &desc_string);
143
 
      g_print("Descriptor: %s, value=\'%s\'\n", desc_name, desc_string);
 
143
      // g_print("Descriptor: %s, value=\'%s\'\n", desc_name, desc_string);
144
144
      if (!strcmp(desc_name, "WM/Genre") || !strcmp(desc_name, "Genre")) {
145
145
        if (meta->genre != NULL) {
146
146
          g_free(meta->genre);
176
176
        meta->trackno = desc_value;
177
177
      }
178
178
    } else {
179
 
      g_print("Skipped descriptor: %s (type=%d,namelen=%lu,datalen=%lu)\n", desc_name, desc_datatype, desc_namelen, desc_datalen);
 
179
      // g_print("Skipped descriptor: %s (type=%d,namelen=%lu,datalen=%lu)\n", desc_name, desc_datatype, desc_namelen, desc_datalen);
180
180
    }
181
181
    offset += desc_datalen;
182
182
    g_free(desc_name);
209
209
  guint64 playtime = ((guint64) data[71] << 56) + ((guint64) data[70] << 48) + ((guint64) data[69] << 40) + 
210
210
    ((guint64) data[68] << 32) + ((guint64) data[67] << 24) + ((guint64) data[66] << 16) + ((guint64) data[65] << 8) + data[64];
211
211
 
212
 
  g_print("Flags value %02X, (%d)\n", flags, flags);
213
 
  g_print("Playtime: %llu\n", playtime);
 
212
  // g_print("Flags value %02X, (%d)\n", flags, flags);
 
213
  // g_print("Playtime: %llu\n", playtime);
214
214
  if ((flags & 0x0001) == 0) {
215
215
    // We have valid values
216
216
    gint seconds;
217
217
 
218
218
    playtime /= 10000000;
219
219
    seconds = (gint) playtime;
220
 
    g_print("Play time %d seconds\n", seconds);
 
220
    // g_print("Play time %d seconds\n", seconds);
221
221
    if (meta->length == NULL) {
222
222
      meta->length = seconds_to_mmss(seconds);
223
223
    }
224
224
  } else {
225
 
    g_print("Stream had broadcast flag set: length tag is invalid.\n");
 
225
    // g_print("Stream had broadcast flag set: length tag is invalid.\n");
226
226
  }
227
227
  return;
228
228
}
274
274
  gchar *tmppath = filename_fromutf8(meta->path);
275
275
  gint n;
276
276
 
277
 
  g_print("Getting WMA tag info for %s...\n", meta->path);
 
277
  // g_print("Getting WMA tag info for %s...\n", meta->path);
278
278
  fd = (gint) open(tmppath, O_RDONLY, 0);
279
279
  if (fd < 0) {
 
280
    g_free(tmppath);
280
281
    return;
281
282
  }
282
 
  g_print("Opened file\n");
 
283
  // g_print("Opened file\n");
283
284
  g_free(tmppath);
284
285
 
285
286
  // Read in some stuff...
286
287
  n = read(fd,header,30);
287
288
  if (n == 30) {
288
289
    // Hardcoded ASF header GUID
289
 
    gchar ASF_header[] = {0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66 ,0xCF, 0x11, 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C};
 
290
    guchar ASF_header[] = {0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66 ,0xCF, 0x11, 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C};
290
291
 
291
292
    if (guid_compare(ASF_header, header)) {
292
293
      guint headersize;
302
303
      }
303
304
      headersize = (header[19] << 24) + (header[18] << 16) + (header[17] << 8) + header[16] - 30;
304
305
      objects = (header[27] << 24) + (header[26] << 16) + (header[25] << 8) + header[24];
305
 
      g_print("Found an ASF header of %lu bytes with %lu objects\n", headersize, objects);
 
306
      // g_print("Found an ASF header of %lu bytes with %lu objects\n", headersize, objects);
306
307
      headerobject = g_malloc(headersize);
307
308
      n = read(fd,headerobject,headersize);
308
309
      if (n == headersize) {
312
313
        guint current_object = 0;
313
314
        guint offset = 0;
314
315
 
315
 
        g_print("Retrieved ASF header\n");
 
316
        // g_print("Retrieved ASF header\n");
316
317
        while (current_object < objects) {
317
318
          // Available objects
318
319
          // GUID entrance pattern:
331
332
            {0x40, 0xA4, 0xD0, 0xD2, 0x07, 0xE3, 0xD2, 0x11, 0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50};
332
333
 
333
334
          memcpy(asf_object_guid, &headerobject[offset], 16);
334
 
          g_print("Object GUID: %02X-%02X-%02X-%02X...\n", asf_object_guid[0], asf_object_guid[1], 
335
 
                  asf_object_guid[2], asf_object_guid[3]);
 
335
          // g_print("Object GUID: %02X-%02X-%02X-%02X...\n", asf_object_guid[0], asf_object_guid[1], asf_object_guid[2], asf_object_guid[3]);
336
336
 
337
337
          if (headerobject[offset+20] != 0x00 ||
338
338
              headerobject[offset+21] != 0x00 ||
343
343
          }
344
344
          asf_object_size = (headerobject[offset+19] << 24) + (headerobject[offset+18] << 16) + 
345
345
            (headerobject[offset+17] << 8) + headerobject[offset+16];
346
 
          g_print("Found object of size %lu\n", asf_object_size);
 
346
          // g_print("Found object of size %lu\n", asf_object_size);
347
347
          if (guid_compare(asf_object_guid, File_Properties_Object_GUID)) {
348
 
            g_print("Found File Properties Object\n");
 
348
            // g_print("Found File Properties Object\n");
349
349
            parse_file_properties(&headerobject[offset], asf_object_size, meta);
350
350
          } else if (guid_compare(asf_object_guid, Stream_Properties_Object_GUID)) {
351
 
            g_print("Found Stream Properties Object\n");
 
351
            // g_print("Found Stream Properties Object\n");
352
352
          } else if (guid_compare(asf_object_guid, Header_Extension_Object_GUID)) {
353
 
            g_print("Found Header Extension Object\n");
 
353
            // g_print("Found Header Extension Object\n");
354
354
            parse_header_extension(&headerobject[offset], asf_object_size, meta);
355
355
          } else if (guid_compare(asf_object_guid, Content_Description_Object_GUID)) {
356
 
            g_print("Found a Content Description Object\n");
 
356
            // g_print("Found a Content Description Object\n");
357
357
            parse_content_description(&headerobject[offset], asf_object_size, meta);
358
358
          } else if (guid_compare(asf_object_guid, Extended_Content_Description_Object_GUID)) {
359
 
            g_print("Found an Extended Content Description Object\n");
 
359
            // g_print("Found an Extended Content Description Object\n");
360
360
            parse_extended_content_description(&headerobject[offset], asf_object_size, meta);
361
361
          }
362
362
          offset += asf_object_size;