Analysis
Overview
This task is about embedding flash in Sophie. The purpose of this revision is to perform a research on embedding flash. As a result a simple demo of c++ - java communication displaying flash will be present.
Task requirements
- perform research for a suitable library
- write a simple demo
Task result
A simple demo for the communication between java and c++ displaying a .swf file.
Implementation idea
Use swfdec library. Possibly gnash if swfdec turns to be improper.
Related
How to demo
Run the created demo.
Design
The idea is to create a few classes in both the c++ and java sides and implement communication between them.
- In the java part:
- Create a class SwfdecCommunicator that will implement the communication between the java and c++ code:
- create a construct that takes a string - path to the c++ executable as its only argument
- create a method sendCommand that sends a command to the c++ executable and returns the result as a BufferedImage. For the purposes of this demo there are only two possible commands - one with code -1 meaning "terminate" and another with code 1 meaning "get next frame".
- Create a class FlashMovieDemo that will play the flash movie in a JFrame. This class will extend javax.awt.Component so that it can be added as a component in the Jframe object.
- create a main method that will perform the creation of the JFrame and will take care that it is repainted accordingly.
- Create a class SwfdecCommunicator that will implement the communication between the java and c++ code:
- In the c++ part:
- Create a class SwfdecCommunicator that will hold the SwfdecPlayer object needed to decode the swf file.
- create a constructor that takes as its only argument the url to the swf file. This method will create the SwfdecPalyer and take care that it is properly initialized.
- create a method setSize that sets the size of the player
- create a method outputToCairo that renders the current frame to a cairo object
- create a method advance that will advance the player to the next frame
- Create a class CairoHandler that handles the cairo object and takes care that it is properly destroyed. Make SwfdecCommunicator it's friend class so that it can render to the CairoHandlers cairo object.
- Create a main function that performs the demo.
- Create a class SwfdecCommunicator that will hold the SwfdecPlayer object needed to decode the swf file.
Implementation
http://sophie2.org/trac/browser/branches/private/ivo/swfdec-test
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)