[Swfdec] swfdec(no gtk) problems

myopc myopc myopc.hi at gmail.com
Mon Apr 26 01:04:38 PDT 2010


hi,all
    anyone know how to make a swf player without gtk ? I have written one
but it can parse only simple files, url like 'http://..." fails (but the gtk
sample can do) ?
    My code is like this:

    swfdec_player_set_url(player, url);
    swfdec_url_free(url);
    while (!swfdec_player_is_initialized(player)) {
        glong next;
        next = swfdec_player_get_next_event(player);
        LOGD("parser header ... %d", next);
        if (next < 0) {  //????
            //LOGE("swfdec_player_get_next_event: no evt");
            return 1;
        }
        swfdec_player_advance(player, next);
    }
    swfdec_player_get_default_size(player, &width, &height);
    LOGI("w/h: %u/%u, backgroud color: %u, rate: %f",
            width,height,
            swfdec_player_get_background_color(player),
            swfdec_player_get_rate(player));

    bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height, 0);
    mysurface = cairo_image_surface_create_for_data(
            (unsigned char*) bitmap.getPixels(), CAIRO_FORMAT_ARGB32, width,
            height, bitmap.rowBytes());
    cr = cairo_create(mysurface);
    ren = swfdec_renderer_new_for_player(mysurface, player);
    swfdec_player_set_renderer(player, ren);
    cairo_surface_destroy(mysurface);
    cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
    cairo_set_tolerance(cr, 0.50);
    time_t now = time(0);
    while (1) {
        if (time(0) - now >= 10)
            break;
        //sleep(1); // dummy loop
        //LOGD("do frame");
        swfdec_player_advance(player, 100);
        swfdec_player_render(player, cr);
    }

swfdec_player_get_next_event will return 0/-1 when urls like 'http://...',
I dont know what to do with this.
any comment will be appreciated, thanks !


--
Best Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/swfdec/attachments/20100426/30bb278c/attachment.htm>


More information about the Swfdec mailing list