[Swfdec] swfdec(no gtk) problems
myopc myopc
myopc.hi at gmail.com
Mon Apr 26 01:51:15 PDT 2010
thanks for your quick response ! I am using curl as my net lib and will try
it .
On Mon, Apr 26, 2010 at 4:44 AM, Benjamin Otte <otte at gnome.org> wrote:
> Your SwfdecPlayer subclass needs to use a SwfdecLoader that can parse
> HTTP urls. The default implementation can only open file:// urls.
> But the code in swfdec-gtk/swfdec_gtk_loader.c contains an
> implementation that uses GNOME's libsoup for this purpose. You can
> cut'n'paste this code if you want. It doesn't use gtk, but it does use
> libsoup. Or you can write your own using any HTTP library that you
> want.
>
> Benjamin
>
>
> On Mon, Apr 26, 2010 at 10:04 AM, myopc myopc <myopc.hi at gmail.com> wrote:
> > 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.
> >
> >
> > _______________________________________________
> > Swfdec mailing list
> > Swfdec at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/swfdec
> >
> >
>
--
--
Best Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/swfdec/attachments/20100426/b48abe89/attachment.html>
More information about the Swfdec
mailing list