[Swfdec] swf file parsing

zou lunkai zoulunkai at gmail.com
Mon Oct 27 20:05:11 PDT 2008


Company and I had a discussion about local swf file parsing
yestoday.And I still have some related questions. So I continue the
topic here.  (Sorry to Comanpy, my laptop was out of battery power
yestoday, and I didn't notice the power warning, so just quited IRC

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.(I don't mean swfdec need to be full compatible here,
just describe the tested result. We all know pp do weird things

Question about parsing the network data:

How does swfdec fetch and parse the network data?

Gnash has a separate thread for parsing both local swf and network
data, so the parsing process would never block the movie advancing
process, and the GUI is always responsive even the network speed is
slow. The advantage is that the threading mode is easier for thinking.
But there are also disadvantage, like much mutex protection overhead
and dead-lock risks.
swfdec uses a single thread model. So I am wondering how does it avoid
the blocking problem when network speed is slow? eg. the network might
be down right after you buffered half a swf tag.

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

Thanks ahead.


More information about the Swfdec mailing list