~ubuntu-branches/ubuntu/quantal/gecko-mediaplayer/quantal

« back to all changes in this revision

Viewing changes to src/plugin_setup.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2011-07-17 22:24:37 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20110717222437-f0skmzay316o4rve
Tags: 1.0.4-0ubuntu1
* New upstream release.
* debian/patches:
 - 90_svn420_fix_null.patch: Remove, merged upstream.
 - 91_svn421_disable_npp_initialize.patch: Remove, merged upstream.
 - dont_use_libxul.patch: Remove, fixed upstream.
 - autotools.patch: Remove, not needed now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
    gchar *arg[10];
57
57
    GRand *rand;
58
58
    gchar *tmp;
59
 
    gchar *url;
 
59
    //gchar *url;
60
60
    gchar **parse;
61
61
    gint width = 0, height = 0;
62
62
    GError *error;
113
113
                sscanf(argv[i], "%i", &height);
114
114
            }
115
115
 
 
116
            if (g_ascii_strcasecmp(argn[i], "style") == 0) {
 
117
                tmp = g_strrstr(argv[i], "width:");
 
118
                sscanf(tmp + strlen("width:"), "%i", &width);
 
119
                tmp = g_strrstr(argv[i], "height:");
 
120
                sscanf(tmp + strlen("height:"), "%i", &height);
 
121
            }
 
122
 
 
123
 
116
124
            if (g_ascii_strcasecmp(argn[i], "src") == 0 || g_ascii_strcasecmp(argn[i], "url") == 0) {
117
125
                item = g_new0(ListItem, 1);
118
126
                if (g_strrstr(argv[i], "XXmovies.apple.com")) { // tmp disabled, to reenable remove XX
301
309
                if (g_ascii_strcasecmp(argv[i], "true") == 0
302
310
                    || g_ascii_strcasecmp(argv[i], "yes") == 0
303
311
                    || g_ascii_strcasecmp(argv[i], "1") == 0
304
 
                    || g_ascii_strcasecmp(argv[i], "") == 0
305
 
                    || argv[i] == NULL) {
 
312
                    || g_ascii_strcasecmp(argv[i], "") == 0 || argv[i] == NULL) {
306
313
                    force_streaming = TRUE;
307
314
                } else {
308
315
                    force_streaming = FALSE;
423
430
 
424
431
        };
425
432
    } else {
426
 
 
 
433
        // printf("Non-Embed Mode\n");
 
434
        for (i = 0; i < argc; i++) {
 
435
 
 
436
            if (argn[i] == NULL)
 
437
                continue;
 
438
 
 
439
            printf("ARG: %s = %s\n", argn[i], argv[i]);
 
440
 
 
441
            if (g_ascii_strcasecmp(argn[i], "src") == 0) {
 
442
                item = g_new0(ListItem, 1);
 
443
                if (g_strrstr(argv[i], "XXmovies.apple.com")) { // tmp disabled, to reenable remove XX
 
444
                    tmp = g_strrstr(argv[i], "movies.");
 
445
                    if (tmp != NULL && strlen(tmp) > strlen("movies.")) {
 
446
                        tmp = tmp + strlen("movies.");
 
447
                        g_snprintf(item->src, 4096, "http://www.%s", tmp);
 
448
                    } else {
 
449
                        g_strlcpy(item->src, argv[i], 4096);
 
450
                    }
 
451
                } else {
 
452
                    g_strlcpy(item->src, argv[i], 4096);
 
453
                }
 
454
                item->streaming = streaming(item->src);
 
455
                printf("this should match %s\n", item->src);
 
456
                item->play = TRUE;
 
457
                item->id = instance->nextid++;
 
458
                instance->playlist = g_list_append(instance->playlist, item);
 
459
                src = item;
 
460
            }
 
461
 
 
462
        }
427
463
    }
428
464
 
429
465
    nperror = NPN_GetValue(instance->mInstance, (NPNVariable) 17 /* NPNVSupportsWindowless */ ,
449
485
        } else {
450
486
            loop = FALSE;
451
487
        }
 
488
    } else {
 
489
        // Having this event fire creates several instances of gmp at some websites
 
490
        // postPlayStateChange(instance->mInstance, STATE_TRANSITIONING);
452
491
    }
 
492
 
453
493
    // link up src to href objects by id
454
494
    if (href != NULL && src != NULL) {
455
495
        src->hrefid = href->id;
474
514
        if (qtsrc)
475
515
            qtsrc->streaming = TRUE;
476
516
    }
477
 
    
 
517
 
478
518
    list_qualify_url(instance->playlist, instance->page_url);
479
 
    
480
 
    
 
519
 
 
520
 
481
521
//    if (g_ascii_strcasecmp(instance->mimetype,"video/x-flv") == 0) {
482
522
//      item->streaming = TRUE;
483
523
//    }
485
525
    // list_dump(instance->playlist);
486
526
 
487
527
    if (instance->hidden == TRUE || ((width == 0 || height == 0) && instance->mode != NP_FULL)) {
488
 
 
489
528
        if (item->streaming) {
490
529
            open_location(instance, item, FALSE);
491
530
            item->requested = 1;
492
531
        } else {
493
532
            item->requested = 1;
494
 
            NPN_GetURLNotify(instance->mInstance, item->src, NULL, item);
 
533
            instance->GetURLNotify(instance->mInstance, item->src, NULL, item);
495
534
        }
496
535
    }
497
536
 
528
567
            g_error_free(error);
529
568
            error = NULL;
530
569
        }
531
 
        NPN_GetURLNotify(instance->mInstance, href->src, NULL, href);
 
570
        instance->GetURLNotify(instance->mInstance, href->src, NULL, href);
532
571
        g_free(app_name);
533
572
    }
534
573
 
558
597
    if (g_ascii_strncasecmp(url, "dvd://", 6) == 0)
559
598
        ret = TRUE;
560
599
 
 
600
    if (g_ascii_strncasecmp(url, "udp://", 6) == 0)
 
601
        ret = TRUE;
 
602
 
561
603
    if (g_strrstr(url, ".m3u") != NULL)
562
604
        ret = TRUE;
563
605
 
564
 
    if (g_strrstr(url, "stream") != NULL)
 
606
    if (g_strrstr(url, "stream") != NULL) {
 
607
        if (g_strrstr(url, "http://") == NULL)
 
608
            ret = TRUE;
 
609
    }
 
610
 
 
611
    if (g_strrstr(url, "MSWMExt=.asf") != NULL)
565
612
        ret = TRUE;
566
613
 
567
 
    if (g_ascii_strncasecmp(url, "file://", 7) == 0) {
 
614
    if (ret == FALSE && g_ascii_strncasecmp(url, "file://", 7) == 0) {
568
615
        p = g_filename_from_uri(url, NULL, NULL);
569
616
        if (p != NULL) {
570
617
            if (g_file_test(p, G_FILE_TEST_EXISTS)) {