[Swfdec] swf file parsing

Benjamin Otte otte at gnome.org
Tue Oct 28 03:32:01 PDT 2008


On Tue, Oct 28, 2008 at 5:05 AM, zou lunkai <zoulunkai at gmail.com> wrote:
> Here is my test(the test is already verified here):
>
> test file: bigswf.swf, size: 5.1MB, total frames: 233
>
> as in frame1(the first frame at root):
>  trace(_root._framesloaded);  // output: 52, swfdec behaves correctly here
>  trace(_root._currentframe);   // output:1,   swfdec is also correct here
>  _root.gotoAndPlay(1000);     // try jump to an unparsed frame.
>  trace(_root._currentframe);  // expected output: 53,  swfdec's output: 1
>
> The parsing policy of local swfs inside swfdec should be correct.
> gotoFrame implementation is a bit different agains the proprietory
> player, though.
>
That's a bug in Swfdec. Looks like Swfdec behaves wrong when it gets
an out-of-range goto. Could you file this in bugzilla?

> (I don't mean swfdec need to be full compatible here,
> just describe the tested result. We all know pp do weird things
> sometimes).
>
Swfdec absolutely must produce the same output as the proprietary
player, even if that looks completely stupid. If you create a Flash
file that produces a noticably different (visual, trace or audible)
output as the Adobe Player, that's a bug in Swfdec.

> How does swfdec fetch and parse the network data?
>
Each SwfdecPlayer keeps a list of things to do and when to do them
inside a SwfdecTimeout structure. The list of things to do next is
keep in SwfdecPlayerPrivate's timeouts variable.
Whenever swfdec_player_advance() advances the time so far that it hits
the time of the first timeout, it executes this timeout.

Whenever new data is provided to the player using swfdec_stream_push()
- the whole file in the local cae, the chunks read asynchronously from
the HTTP input, RTMP or XML sockets - a new timeout is cued to be
executed immediately. This timeout will the cause the resource's parse
callback to be executed (the stuff we talked about yesterday). As the
parse callback is fast (it just scans the data), this is not really a
problem, even if you hand it a huge file.

This in turn means that the asynchronous behavior is done by the
application and not by Swfdec itself. The Gtk backend achieves this
using the glib main loop.

> I am hacking on swfdec recently, so I ask those questions that help me
> understand the code better.
>
:)

Cheers,
Benjamin


More information about the Swfdec mailing list