summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@freedesktop.org>2013-05-13 19:34:39 -0700
committerJoe Rayhawk <jrayhawk@freedesktop.org>2013-05-13 19:34:39 -0700
commit62cbb82acd3739d06dbd2de00c6155d58cabc37d (patch)
treec2be41e89a149e6dbd3d96a64e143b86ba22a418
parente70608fa2d104284e8515944fb40be7cc890ba7d (diff)
parent9593256c8a65b2b2e90064a55e6934e50707ac73 (diff)
moin2iki: Importing Moin history for page SwfdecExamples
-rw-r--r--SwfdecExamples.moin91
1 files changed, 91 insertions, 0 deletions
diff --git a/SwfdecExamples.moin b/SwfdecExamples.moin
new file mode 100644
index 0000000..84884ef
--- /dev/null
+++ b/SwfdecExamples.moin
@@ -0,0 +1,91 @@
+= SWFDEC Examples =
+The examples section.
+----
+'''Version 0.8.0'''
+
+===== Create a minimal gtk-based player with informations =====
+{{{
+//Created by : pepsidrinker@hotmail.com
+// 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;
+}
+}}}
+----