Changes between Version 1 and Version 2 of FLASH_RESEARCH


Ignore:
Timestamp:
02/22/10 14:11:16 (15 years ago)
Author:
stefan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TabularUnified FLASH_RESEARCH

    v1 v2  
    1010 * Looking for potential memory leek places in the code of the flash native. 
    1111 * Check the possibility of static building. 
    12 About the libraries: 
    13  * Swfdec - is a library for decoding and rendering Flash animations.  
    14  * Cairo is a software library used to provide a vector graphics-based, device-independent API for software developers. It is designed to provide primitives for 2-dimensional drawing across a number of different backends. 
    15 Result of the task should be wiki page and/or written document. 
    1612 
    1713== Overview == 
     
    1915 
    2016== Task requirements == 
    21 ^(List the necessary requirements that the task must fulfill.)^ 
     17 * An opinion on the possibility of eventual flash implementation in Sophie. 
    2218 
    2319== Task result == 
    24 ^(List the end product of the task (for example "Source code", "Wiki page", etc.))^ 
     20 * Wiki page 
    2521 
    2622== Implementation idea == 
     
    3430 
    3531= Design = 
    36 ^(Describe your design here.)^ 
     32About the libraries: 
     33 * [http://swfdec.freedesktop.org/wiki/ Swfdec] - is a library for decoding and rendering Flash animations.  
     34 * [http://cairographics.org/ Cairo] - is a software library used to provide a vector graphics-based, device-independent API for software developers. It is designed to provide primitives for 2-dimensional drawing across a number of different backends. 
     35Main idea of this task is not to explain why these two libraries (swfdec for flash, and cairo for rendering) were chosen for the implementation, but if it would be possible to implement flash capability in Sophie 2.0 in a reasonable time - few weeks. 
     36While I was researching the swfdec and cairo capabilities, I found out that both libraries have many dependencies (some of them are only needed for win32 build): 
     37 * libiconv - ''library for convertion from one character encoding to another through Unicode conversion.'' 
     38 * libbz2 - ''high-quality block-sorting file compressor library.'' 
     39 * libfontconfig-1 - ''generic font configuration library (shared library).'' 
     40 * libfreetype6 - ''high-quality software font engine (runtime library).'' 
     41 * libgcrypt11 - ''a general purpose cryptographic library based on the code from GnuPG.'' 
     42 * libgio-2.0-0 - ''provides a virtual file system (VFS) API.'' 
     43 * libglib-2.0-0 - ''a cross-platform software utility library.'' 
     44  * libgmodule-2.0-0 
     45  * libgobject-2.0-0 
     46  * libgthread-2.0-0 
     47 * liboil - ''a library of simple functions that are optimized for various CPUs.'' 
     48 * libpango - ''a library for laying out and rendering of text.'' 
     49  * libpangocairo 
     50  * libpangoft2-1.0-0 
     51  * libpangowin32-1.0-0 
     52 * libpixman - ''pixel-manipulation library for X and cairo.'' 
     53 * libpng12-0 - ''official PNG reference library which supports almost all PNG features.'' 
     54 * libxml2 - ''XML C parser and toolkit.'' 
     55 * msvcrt - ''a module containing standard C library functions such as printf, memcpy, and cos. It is a part of the Microsoft C Runtime Library.'' 
     56 * msvcrt20 - ''a module containing standard C library functions such as printf, memcpy, and cos. It is a part of the Microsoft C Runtime Library.'' 
     57 * msvcrt40 - ''a module containing standard C library functions such as printf, memcpy, and cos. It is a part of the Microsoft C Runtime Library.'' 
     58 * pthreadGC2 - ''a module\r for POSIX threads'' 
     59 * zlib1 - ''a compression library.'' 
    3760 
     61I came at conclusion that there are so many dependecies, and mainly because [http://library.gnome.org/devel/glib/ glib] library 
     62[http://www.cygwin.com/ml/cygwin-apps/2006-01/msg00007.html cannot] be linked staticly, our native application/program cannot be build staticly. 
     63So, that is one disadvantage. But, this dependencies can be easily fixed (I tried this, and made successful build of cairo and swfdec under linux64). 
     64As my first impressions were, it came out that that task of implementing flash isn't that hard in algorithms and programming part 
     65(as was the case in the other natives), but in building the libraries. Here are the conclusions I made about the builds under different platforms: 
     66 * Linux (32bit and 64bit) - I already made necessary builds and made executable native for linux64, so I guess, with high certainty, it wont be a problem either in linux32. 
     67 * Mac (32bit intel) - I talked to the developer that made first attempt of implementing flash capabilities, and it came out that it is the same case like the linux - with the mac's package manager all the dipendencies can be fixed. 
     68 * Windows (32bit) - My biggest concern was about windows because of the so many dependencies, and it is quite difficult to find the adequate libraries for the build. But, from the previous attempts, there are almost all needed libraries (in form of .dlls for win). There was even a successful build of the libraries and the native application itself. So, again, with high certainty, I can say that, the native application can be build under windows32. 
     69 
     70Another problem with the [http://sophie2.org/trac/browser/branches/private/ivo/flash_native/sophie2-native/src/flash_embed code of the native application] itself, was the fact that it was producing big memory leaks. As I was looking the code I came out with several "suspects" :) 
     71 * in the method {{{getFrame()}}} in [http://sophie2.org/trac/browser/branches/private/ivo/flash_native/sophie2-native/src/flash_embed/flash_player.h flash_player.h] every time {{{getFrame()}}} is called, a {{{CairoHandler}}} is created (it has several fields containing) and there are several {{{memcpy(...)}}} which maybe are not needed, because ever frame, every time is copied twice. 
     72 {{{ 
     73                CairoHandler cairoHandler(width, height); 
     74        outputToCairoHandler(&cairoHandler); 
     75 
     76        char *result = new char[(width * height + 2) * sizeof (int) ]; 
     77 
     78        memcpy(result, &width, sizeof (int)); 
     79        memcpy(result + sizeof (int), &height, sizeof (int)); 
     80        memcpy(result + 2 * sizeof (int), cairoHandler.getData(), width * height 
     81                * sizeof (int)); 
     82 
     83        return result; 
     84 }}} 
     85  
     86 Apart of that, swfdec and cairo have very useful and clean APIs (as isn't the case with ffmpeg), so the [http://sophie2.org/trac/browser/branches/private/ivo/flash_native/sophie2-native/src/flash_embed code of the native application] is quite clean and readable , so I dont suspect that there will be major difficulties around the APIs, that is if we ever build the libraries :). 
     87 So, at the end, my opinion is that it is worth trying to develop the native. One developer for about 2-2,5 weeks, probably should be enough as a resource of this task. 
     88  
    3889= Implementation = 
    3990^(Describe and link the implementation results here (from the wiki or the repository).)^