[Swfdec] screenshot of swf file

Paul Brooker paul at thefunnyfish.net
Wed Jan 20 15:29:08 PST 2010


Paul Brooker wrote:
> Hi,
> Im trying to thumbnail a swf file based on this found at 
> http://www.mail-archive.com/swfdec@lists.freedesktop.org/msg00821.html.
> 
> #include <stdlib.h>
> #include <stdio.h>
> #include <swfdec/swfdec.h>
> #include <cairo.h>
> 
> void swfdec_player_save (SwfdecPlayer *player, guint width, guint 
> height, const char *filename) {
>      cairo_surface_t *surface;
>      cairo_t *cr;
>      surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, 
> height);
>      cr = cairo_create (surface);
>      swfdec_player_render (player, cr);
>      cairo_destroy (cr);
>      cairo_surface_write_to_png (surface, filename);
>      cairo_surface_destroy (surface);
> }
> 
> int main(int argc, char *argv[]) {
>      char *input = argv[1];
>      char *output = argv[2];
>      SwfdecPlayer *player = swfdec_player_new(NULL);
>      SwfdecURL *url = swfdec_url_new_from_input(input);
>      swfdec_player_set_url(player, url);
>      swfdec_url_free (url);
>      swfdec_player_set_size (player, 800, 480);
>      swfdec_player_advance(player, swfdec_player_get_next_event (player));
>      swfdec_player_save(player, 800, 480, output);
>      return 0;
> }
> 
> Using this i get a blank transparent png output as reported by the 
> original poster.  Ive also tried the gnome thumbnailer which produces 
> the same result. The swf file is a single frame containing just two 
> boxes. I cant see anything unusual from any of the debugging output.  Im 
> not sure where to look for the problem. Im running it on an ARM board 
> and using swfdec version 0.8.4. Any help would be much appreciated.
> 
> Thanks in advance,
> Paul Brooker
> _______________________________________________
> Swfdec mailing list
> Swfdec at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/swfdec
> 

ok, having looked a bit further into this ive got it working on my host and have compared the debugging output with that of the arm board. The only 
differences towards the end of the debugging output.

Host debug :

SWFDEC: LOG  : swfdec_sprite_movie.c(215): swfdec_sprite_movie_perform_place:   matrix = { 1 0, 0 1 } + { 0 0 }
SWFDEC: DEBUG: swfdec_movie.c(917): swfdec_movie_set_property: inserting SwfdecGraphicMovie 0x8939018 into SwfdecSpriteMovie 0x88ac130
SWFDEC: LOG  : swfdec_as_context.c(199): swfdec_as_context_try_use_mem: + 448 bytes, total  243918 ( 244206 since GC)
SWFDEC: LOG  : swfdec_sprite_movie.c(379): swfdec_sprite_movie_perform_one_action: 0x88ac130: executing 2th tag ShowFrame in frame 0
SWFDEC: LOG  : swfdec_stream_target.c(120): swfdec_stream_target_close: close on file:////opt/x86/box.swf
SWFDEC: LOG  : swfdec_player.c(453): swfdec_player_add_action: adding action  0
SWFDEC: DEBUG: swfdec_player.c(1988): swfdec_player_unlock_soft: UNLOCK
SWFDEC: LOG  : swfdec_movie.c(122): swfdec_movie_invalidate: invalidating SwfdecGraphicMovie  at end
SWFDEC: LOG  : swfdec_player.c(2490): swfdec_player_invalidate:   invalidating 0 0  750 430
SWFDEC: DEBUG: swfdec_player.c(2506): swfdec_player_invalidate: toplevel invalidation of 0 0  750 430 - now 1 subregions
SWFDEC: LOG  : swfdec_movie.c(122): swfdec_movie_invalidate: invalidating SwfdecSpriteMovie  at end
SWFDEC: LOG  : swfdec_movie.c(122): swfdec_movie_invalidate: invalidating SwfdecGraphicMovie  at end
SWFDEC: LOG  : swfdec_player.c(2490): swfdec_player_invalidate:   invalidating 0 0  750 430
SWFDEC: DEBUG: swfdec_player.c(2506): swfdec_player_invalidate: toplevel invalidation of 0 0  750 430 - now 1 subregions
SWFDEC: INFO : swfdec_player.c(3141): swfdec_player_render_with_renderer: === 0x88a2150: START RENDER ===
SWFDEC: LOG  : swfdec_movie.c(798): swfdec_movie_render: transforming movie, transform: 1 1  0 0   0 0
SWFDEC: LOG  : swfdec_movie.c(1309): swfdec_movie_do_render: rendering 0x8939018 with depth -16383
SWFDEC: LOG  : swfdec_movie.c(798): swfdec_movie_render: transforming movie, transform: 1 1  0 0   0 0
SWFDEC: LOG  : swfdec_color.c(102): swfdec_color_apply_transform: in rgba 136,136,136,255
SWFDEC: LOG  : swfdec_color.c(114): swfdec_color_apply_transform: out rgba 136,136,136,255
SWFDEC: LOG  : swfdec_color.c(102): swfdec_color_apply_transform: in rgba 0,255,255,255
SWFDEC: LOG  : swfdec_color.c(114): swfdec_color_apply_transform: out rgba 0,255,255,255
SWFDEC: INFO : swfdec_player.c(3154): swfdec_player_render_with_renderer: === 0x88a2150: END RENDER ===

ARM board debug:

SWFDEC: LOG  : swfdec_sprite_movie.c(215): swfdec_sprite_movie_perform_place:   matrix = { 1 0, 0 1 } + { 0 0 }
SWFDEC: DEBUG: swfdec_movie.c(917): swfdec_movie_set_property: inserting SwfdecGraphicMovie 0x75008 into SwfdecSpriteMovie 0x28128
SWFDEC: LOG  : swfdec_as_context.c(199): swfdec_as_context_try_use_mem: + 448 bytes, total  150299 ( 150323 since GC)
SWFDEC: INFO : swfdec_color.c(243): swfdec_matrix_ensure_invertible: matrix not invertible, adding epsilon to smallest member
SWFDEC: INFO : swfdec_color.c(243): swfdec_matrix_ensure_invertible: matrix not invertible, adding epsilon to smallest member
SWFDEC: LOG  : swfdec_sprite_movie.c(379): swfdec_sprite_movie_perform_one_action: 0x28128: executing 2th tag ShowFrame in frame 0
SWFDEC: LOG  : swfdec_stream_target.c(120): swfdec_stream_target_close: close on file:////home/plg/box.swf
SWFDEC: LOG  : swfdec_player.c(453): swfdec_player_add_action: adding action  0
SWFDEC: DEBUG: swfdec_player.c(1988): swfdec_player_unlock_soft: UNLOCK
SWFDEC: LOG  : swfdec_movie.c(122): swfdec_movie_invalidate: invalidating SwfdecGraphicMovie  at end
SWFDEC: LOG  : swfdec_player.c(2490): swfdec_player_invalidate:   invalidating 0 0  1 1
SWFDEC: DEBUG: swfdec_player.c(2506): swfdec_player_invalidate: toplevel invalidation of 0 0  1 1 - now 1 subregions
SWFDEC: LOG  : swfdec_movie.c(122): swfdec_movie_invalidate: invalidating SwfdecSpriteMovie  at end
SWFDEC: LOG  : swfdec_movie.c(122): swfdec_movie_invalidate: invalidating SwfdecGraphicMovie  at end
SWFDEC: LOG  : swfdec_player.c(2490): swfdec_player_invalidate:   invalidating 0 0  1 1
SWFDEC: DEBUG: swfdec_player.c(2506): swfdec_player_invalidate: toplevel invalidation of 0 0  1 1 - now 1 subregions
SWFDEC: INFO : swfdec_player.c(3141): swfdec_player_render_with_renderer: === 0x1c0c0: START RENDER ===
SWFDEC: LOG  : swfdec_movie.c(798): swfdec_movie_render: transforming movie, transform: 1 1  0 0   0 0
SWFDEC: LOG  : swfdec_movie.c(1309): swfdec_movie_do_render: rendering 0x75008 with depth -16383
SWFDEC: LOG  : swfdec_movie.c(798): swfdec_movie_render: transforming movie, transform: 1.52588e-05 1.52588e-05  0 0   0 0
SWFDEC: LOG  : swfdec_color.c(102): swfdec_color_apply_transform: in rgba 136,136,136,255
SWFDEC: LOG  : swfdec_color.c(114): swfdec_color_apply_transform: out rgba 136,136,136,255
SWFDEC: LOG  : swfdec_color.c(102): swfdec_color_apply_transform: in rgba 0,255,255,255
SWFDEC: LOG  : swfdec_color.c(114): swfdec_color_apply_transform: out rgba 0,255,255,255
SWFDEC: INFO : swfdec_player.c(3154): swfdec_player_render_with_renderer: === 0x1c0c0: END RENDER ===

The first differences are the swfdec_matrix_ensure_invertible failures which dont appear on the host output.  From then on the invalidating regions 
are incorrect and are set to 0,0->1,1.  Im not clear on the inner workings so not sure what is calling the functions incorrectly.  Im suspicious of 
liboil as the oil_test produces failures of some conversion functions.  Where is liboil used?


More information about the Swfdec mailing list