mainGnash - The GNU Flash player - Support: sr #107543, Building the Gnash libraries into...

 
 

sr #107543: Building the Gnash libraries into my application

Submitter:  None
Submitted:  Mon 06 Dec 2010 10:13:47 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  None
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 29 May 2016 10:02:26 AM UTC, comment #3: 

Also, advanced features like ExternalInterface communication with the SWF, or internal plugin functions are also available (but lacks documentation).

If you want to use it, you need to open two anonymous pipe, and run (fork-exec) gnash with `--fd` parameter supplying the pipes' file descriptor number. Then you could communicate with the SWF inside Gnash. The exact protocol used here is not documented, you'll need to read libgnashcore's `movie_root.cpp` to find information about it.

Hope anyone stumbled on this thread find them useful.

Nutchanon Wetchasit <nachanon>
Sun 29 May 2016 09:59:28 AM UTC, comment #2: 

Example code for Qt4 application: gnash-xembed-qt4.tar.gz (file #37298)
Example code for GTK2 application: gnash-xembed-gtk2.tar.gz (file #37299)
Demo SWF: hovercolorbars.tar.gz (file #37302)

Screenshot from example Qt4 application: gnash-xembed-qt4.png
Screenshot from example GTK2 application: gnash-xembed-gtk2.png

The color bars part in screenshots are from the SWF file, which you can interact with them; color bar will brighten when your mouse hovers over it and fades when you click on it.

Qt: 4.8.2
GTK+: 2.24.10
Gnash: 0.8.11dev (git c6da486 10-May-2016)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Sun 29 May 2016 09:47:14 AM UTC, comment #1: 

This support thread is quite old, but since I have never found anyone writing example on how to do this, I'm going to document it here in case anyone need it.

As you probably know, Gnash is divided into few libraries (libgnashbase, libgnashcore, libgnashsound, libgnashmedia, libgnashdevice, and libgnashrender), and player applications (gtk-gnash, qt-gnash, sdl-gnash, fb-gnash, and dump-gnash).

But if you are going to just play SWF file, I'd personally advice against using Gnash's internal libraries directly (they are not documented, and prone to changes).

Instead, invoke Gnash as an external application, and instruct it to display output inside your program, using toolkit's XEmbed feature. (Gnash's Firefox plugin worked this way too).

To do so, your application must place an XEmbed widget on the screen, obtain X11 window ID from your widget, then start Gnash externally with `--xid` parameter supplying the window ID you just obtained. Once Gnash started, the SWF will display inside your application's widget, and user could interact with it the same way as you did in Gnash.

For Qt4 application (your case), the XEmbed container widget is QX11EmbedContainer class. To obtain X11 window ID of the widget, use `QWidget::winId()`

For GTK2 application, the XEmbed container widget is GtkSocket class.
To obtain X11 window ID of the widget, use `gtk_socket_get_id()`.

As you used Qt, it is better if you run `qt4-gnash` rather than `gtk-gnash` or plain `gnash`, as GTK Gnash has some resizing problem when embeded into Qt4 application.

When you are finished with the SWF-displaying screen, don't forget to kill Gnash process that you have launched too.

Nutchanon Wetchasit <nachanon>
Mon 06 Dec 2010 10:13:47 PM UTC, original submission:  

Good day!

I'm designing new application with Qt4. My application will work with both GTK and KDE desktops. I need to play simple swf-files in my application. How can I built Gnash libraries in?

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #37302:  hovercolorbars.tar.gz added by nachanon (3KiB - application/x-gzip - Example SWF file and source code (HoverColorBars demo))
file #37301:  gnash-xembed-gtk2.png added by nachanon (5KiB - image/png - Screenshot from GTK2 Gnash XEmbed example)
file #37300:  gnash-xembed-qt4.png added by nachanon (3KiB - image/png - Screenshot from Qt4 Gnash XEmbed example)
file #37299:  gnash-xembed-gtk2.tar.gz added by nachanon (8KiB - application/x-gzip - GTK2-based Gnash XEmbed example)
file #37298:  gnash-xembed-qt4.tar.gz added by nachanon (8KiB - application/x-gzip - Qt4-based Gnash XEmbed example)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nachanon (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-05-29 nachanon Attached File- Added hovercolorbars.tar.gz, #37302
    2016-05-29 nachanon Attached File- Added gnash-xembed-gtk2.png, #37301
    2016-05-29 nachanon Attached File- Added gnash-xembed-qt4.png, #37300
    2016-05-29 nachanon Attached File- Added gnash-xembed-gtk2.tar.gz, #37299
    2016-05-29 nachanon Attached File- Added gnash-xembed-qt4.tar.gz, #37298

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code