~ubuntu-branches/ubuntu/lucid/gecko-mediaplayer/lucid-proposed

« back to all changes in this revision

Viewing changes to src/plugin_list.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cesare Tirabassi
  • Date: 2009-09-24 13:55:35 UTC
  • mfrom: (1.1.14 upstream) (0.1.10 sid)
  • Revision ID: james.westby@ubuntu.com-20090924135535-ftwq9l1ntkt9tdfp
Tags: 0.9.8-1ubuntu1
* Merge from debian unstable (LP: #434106), remaining changes:
  - change Build-Depends iceape-dev to libxul-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
336
336
 
337
337
}
338
338
 
 
339
GList *list_parse_qt2(GList * list, ListItem * item)
 
340
{
 
341
    ListItem *newitem;
 
342
    gchar *data;
 
343
    gsize datalen;
 
344
    gchar *p;
 
345
    gchar url[1024];
 
346
    gchar *ptr;
 
347
    gchar *urlptr;
 
348
    printf("Entering list_parse_qt2 localsize = %i\n", item->localsize);
 
349
 
 
350
    if (item->localsize < (256 * 1024)) {
 
351
        if (g_file_get_contents(item->local, &data, &datalen, NULL)) {
 
352
            //printf("read %i bytes from %s\n",datalen, item->local);
 
353
            p = (gchar *) memmem_compat(data, datalen, "mmdr", 4);
 
354
            if (p == NULL) {
 
355
                printf("unable to find mmdr in %s\n", item->local);
 
356
                return list;
 
357
            } else {
 
358
                while (p != NULL) {
 
359
                    urlptr = (gchar *) memmem(p,datalen - (p - data), "url ", 4);
 
360
                    
 
361
 
 
362
                    if (urlptr == NULL) {
 
363
                        p = NULL;
 
364
                    } else {
 
365
                        urlptr += strlen("url ");
 
366
                        g_strlcpy(url, item->src, 1024);
 
367
                        ptr = g_strrstr(url, "/");
 
368
                        if (ptr != NULL && g_strrstr(urlptr, "://") == NULL) {
 
369
                            ptr++;
 
370
                            ptr[0] = (char) NULL;
 
371
                            g_strlcat(url, urlptr, 1024);
 
372
                        } else {
 
373
                            g_strlcpy(url, urlptr, 1024);
 
374
                        }
 
375
 
 
376
                        if (list_find(list, url) == NULL) {
 
377
                            item->play = FALSE;
 
378
                            newitem = g_new0(ListItem, 1);
 
379
                            g_strlcpy(newitem->src, url, 1024);
 
380
                            // newitem->streaming = streaming(newitem->src);
 
381
                            newitem->play = TRUE;
 
382
                            newitem->id = item->id;
 
383
                            newitem->controlid = item->controlid;
 
384
                            g_strlcpy(newitem->path, item->path, 1024);
 
385
                            item->id = -1;
 
386
                            list = g_list_append(list, newitem);
 
387
                        }
 
388
                        p = (gchar *) memmem(urlptr,datalen - (urlptr - data),"mmdr",4);
 
389
                    }
 
390
 
 
391
                }
 
392
 
 
393
            }
 
394
 
 
395
        } else {
 
396
            // printf("Unable to open %s \n",item->local); 
 
397
        }
 
398
 
 
399
    } else {
 
400
        // if file is over 256K it is probably not a playlist
 
401
        // so skip parsing it.
 
402
        //printf("file not parsed > 256K actual size is %i\n",item->localsize);
 
403
    }
 
404
    list_dump(list);
 
405
    printf("Exiting list_parse_qt2\n");
 
406
    return list;
 
407
 
 
408
}
 
409
 
339
410
void strip_unicode(gchar * data, gsize len)
340
411
{
341
412
    gsize i = 0;