[Swfdec] 回复: Can the Swfdec without the gtk?

Steven Liu lingjiujianke at gmail.com
Wed Nov 5 19:17:12 PST 2008


Let me send a test code,I don't know if i'm wrong!




#include <swfdec/swfdec.h>
#include <swfdec/swfdec_player.h>
#include <swfdec/swfdec_url.h>
#include <stdio.h>

SwfdecPlayer* player;
void PrintInfos()
{
	unsigned int h,w;

	swfdec_player_get_maximum_runtime (player);
	swfdec_player_get_default_size(player,&h,&w);
	swfdec_player_get_background_color(player);
	swfdec_player_get_rate(player);
	swfdec_player_advance(player,swfdec_player_get_maximum_runtime (player));
}

int main (int argc, char **argv)
{
	if (argc < 2)
	{
		g_print ("usage: %s file://PATH or URL", argv[0]);
		return 1;
	}

	player = swfdec_player_new (NULL);
	SwfdecURL *url1 = swfdec_url_new(argv[1]);
	if(!url1)
	{
		return ;	
	}
	swfdec_player_set_url(player,url1);

	while (!swfdec_player_is_initialized (player))
	{
		long next = swfdec_player_get_next_event (player);
		if (next < 0)
		{
			return 0;
		}
		swfdec_player_advance (player, next);
	}

	PrintInfos();


	return 0;
}





It can work ,but i don't know where to draw the flash.





2008/11/6, Benjamin Otte <otte at gnome.org>:
> Hey!
>
> Yes, Swfdec does work without Gtk. For examples, you can look at the
> thumbnailer in swfdec-gnome, our test framework or swfdec-directfb.
> However, you'll have to do quite a bit more work to get a smooth
> animation displayed, as Gtk is taking care of that: It calls
> swfdec_player_advance() at the right speed, invalidates the screen
> when things change and all these things.
> But Swfdec was designed explicitly to work without Gtk, so it's easy
> to integrate into applications that run without an X server
> (thumbnailer, GStreamer, DirectFB).
>
> Cheers,
> Benjamin
>
> On Wed, Nov 5, 2008 at 10:55 AM, Steven Liu <lingjiujianke at gmail.com> wrote:
>> Hi,all!
>>
>>        I'm a new user of swfdec,I'm learning the swfdec,I'v saw the
>> configure can disable the gtk! but how to develop the flashplayer? I'v
>> saw the "SWFDEC Examples",but it was written by gtk.it used
>> swfdec-gtk.Is there have some example without swfdec-gtk?
>> for example:
>>     SwfdecPlayer* player;
>>     player = swfdec_player_new (NULL);
>>     SwfdecURL* url = swfdec_url_new(argv[1]);
>>     swfdec_player_set_url(player,url);
>>       while (!swfdec_player_is_initialized (player))
>>  {
>>      long next = swfdec_player_get_next_event (player);
>>      if (next < 0)
>>      {
>>          /* not a flash file */
>>          return 0;
>>      }
>>      swfdec_player_advance (player, next);
>>  }
>>   swfdec_player_get_maximum_runtime (player);
>>       guint h,w;
>>    swfdec_player_get_default_size(player,&h,&w);
>> swfdec_player_get_background_color(player);
>> swfdec_player_get_rate(player);
>>
>>
>>
>> but how to play the flash use only the libswfdec?
>> _______________________________________________
>> Swfdec mailing list
>> Swfdec at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/swfdec
>>
>


More information about the Swfdec mailing list