swf解码库
sudo apt-get install libswfdec-0.8-dev
example from http://swfdec.freedesktop.org/wiki/SwfdecExamples
//Created by : [email protected] // Date : Sept. 15 2008 #include <swfdec-gtk/swfdec-gtk.h> /* Simple SWFDEC ---> version 0.8.0 <---- playback tutorial : This tutorial may contain error(s) and/or ugly code. It is not optimized at all. Feel free to change it as you wish */ static void playback_aborted (SwfdecPlayer *player) { if (swfdec_player_is_initialized (player)) g_print ("Given file is not a Flash file."); else g_print ("Broken Flash file."); gtk_main_quit(); } static void print_infos (SwfdecPlayer *player) { guint h,w; //SWFDEC_PLAYER type infos g_print("Max runtime : %lu/n",swfdec_player_get_maximum_runtime (player)); swfdec_player_get_default_size(player,&h,&w); g_print("Size: %d, %d/n",h,w); g_print("BG Color : %d/n",swfdec_player_get_background_color(player)); g_print("Rate: %f/n",swfdec_player_get_rate(player)); //SWFDEC_GTK_PLAYER type infos g_print("Speed :%f/n",swfdec_gtk_player_get_speed (SWFDEC_GTK_PLAYER(player))); g_print("Audio enabled : %d/n",swfdec_gtk_player_get_audio_enabled (SWFDEC_GTK_PLAYER(player))); g_print("Is playing :%d/n",swfdec_gtk_player_get_playing(SWFDEC_GTK_PLAYER(player))); } int main (int argc, char **argv) { SwfdecPlayer *player; // GTK init stuff GtkWidget *window, *widget; gtk_init (&argc, &argv); if (argc < 2) { g_print ("usage: %s file://PATH or URL", argv[0]); // Ex: file://foobar.swf OR http://www.foo.bar/foobar.swf return 1; } //Create a new player player = swfdec_gtk_player_new (NULL); //Pass out the URL or File Path SwfdecURL* url = swfdec_url_new(argv[1]); swfdec_player_set_url(player,url); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); widget = swfdec_gtk_widget_new (player); gtk_container_add (GTK_CONTAINER (window), widget); gtk_widget_show_all (window); //Get notifications g_signal_connect (player, "notify::initialized", G_CALLBACK (print_infos), NULL); g_signal_connect (player, "notify::aborted", G_CALLBACK (playback_aborted), NULL); //Play ! swfdec_gtk_player_set_playing (SWFDEC_GTK_PLAYER (player), TRUE); //GTK main loop gtk_main (); return 0; }
编译
gcc -o flashplayer flashplayer.c `pkg-config swfdec-gtk-0.8 --cflags --libs`
运行
./flashplayer http://bskin.org/tetris.swf