Wednesday, July 06, 2005

 

A Walk Through Design Lane

All right, I finished documenting my topmost level of design, as well as the first (of many) second-level design diagram. I'll be presenting these in this post; the original information is all available in the current design document.

Top-level design

four packages: SWFIO, SWFContext, Frontend and TagLogic. SWFContext depends on SWFIO, and TagLogic depends on all of the other packages.

Because of the dependencies, the packages should be implemented in this order:

  1. SWFIO
  2. SWFContext
  3. Frontend (can be done concurrently with 1 and 2)
  4. TagLogic

Package Descriptions

SWFIO

A strictly data-oriented interface to the SWF format.

Handles reading and writing all primitive data types, and data-only structures from an SWF stream.

SWFContext

Provides different levels of containers that, as a whole, represent the state of an entire SWF file.

The SWFContext package is intended to provide a common access point for external SWF processors (such as SWF interpreters, writers, or even dynamic filters). Some of these applications will want the SWF container to be smart (in the case of writers), whereas others will want the container to be as dumb as possible (in the case of interpreters and some special filters). This is why SWFContext is a package, and not just a single class.

Frontend

A normalized interface to shuffle data to and from the user.

Any implementation of the Frontend package will need to provide functionality for reading keyboard events, reading mouse events, displaying graphical objects, playing sounds, and possibly reading graphical objects (webcam) and reading sounds (microphone).

TagLogic

A behavior-oriented interface to the SWF file format.

TagLogic requires SWFIO for the TagData package it contains. Each TagLogic class representing a flash tag has a corresponding SWFIO TagData class embedded within it. TagLogic also requires the SWFContext package, since tags may need to refer to and modify other tags in the SWF file. Finally, TagLogic also requires an appropriate Frontend package (which could be implemented multiple times, allowing for the Frontend to be switched) in order to get input from the user, and provide the appropriate visual/audio output.

SWFIO package

Four packages: Filters, Datatypes, Structures, and TagData. Datatypes, Structures and TagData depend on Filters; Structures and TagData depend on Datatypes; and TagData depends on Structures.

Because of the dependencies, the packages should be implemented in this order:

  1. Filters
  2. Datatypes
  3. Structures
  4. TagData

Package Descriptions

Filters

Provides a framework for normalized I/O and drop-in data filters.

This package defines filter classes that can be "chained" together, similar to a pipe on the command line. Filters can perform an in-line function (like encryption/decryption, compression/decompression, executing a SED script, etc.), normalize access to an existing data source/sink (STL iostreams, C file I/O, NAPI asynchronous I/O, etc.), and/or provide "special" data extraction/insertion methods (SWF primitive data types).

Datatypes

Provides a way to access SWF primitives that are not directly provided by the SWF filter.

Some primitive data types (most noticeably the fixed-point types) are directly derived from other SWF primitives. As such, these types are not really primitive, but alternate interpretations of "true" primitive types. This package sits on top of the SWF filter, and provides the primitives that the SWF filter does not directly support.

Structures

Contains classes for data structures that are used by several different SWF tags.

The structure objects in Structures do not have any behavior other than asserting that the structure values are always within their bounds and providing correct serialization/deserialization to/from an SWF filter.

TagData

Contains classes that read and write entire SWF tag objects.

The tag objects in TagData do not have any behavior other than asserting that the tag values are always within their bounds and providing correct serialization/deserialization to/from an SWF filter.

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

Note: I have been told by someone who recently downloaded the SWF specification that Macromedia has added a restrictive license to the end of the document. Because of this, newcomers will not be able to get a copy of the spec and still be able to contribute to GPLFlash's development. Since other developers (such as myself) already have access to the specification without the license, this should not pose a major problem in the short term. Please bear with us, and do not seek out or use this specification in conjunction with the GPLFlash project.