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

 
 

sr #107543: Building the Gnash libraries into my application

Submitted by:  None
Submitted on:  Mon Dec 6 22:13:47 2010  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun May 29 10:02:26 2016, 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 May 29 09:59:28 2016, 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 (file #37300)
Screenshot from example GTK2 application: gnash-xembed-gtk2.png (file #37301)

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 May 29 09:47:14 2016, 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 Dec 6 22:13:47 2010, 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 File(s):
   
   
Comment:
   

Attached Files
file #37302:  hovercolorbars.tar.gz added by nachanon (3kB - application/x-gzip - Example SWF file and source code (HoverColorBars demo))
file #37301:  gnash-xembed-gtk2.png added by nachanon (5kB - image/png - Screenshot from GTK2 Gnash XEmbed example)
file #37300:  gnash-xembed-qt4.png added by nachanon (3kB - image/png - Screenshot from Qt4 Gnash XEmbed example)
file #37299:  gnash-xembed-gtk2.tar.gz added by nachanon (8kB - application/x-gzip - GTK2-based Gnash XEmbed example)
file #37298:  gnash-xembed-qt4.tar.gz added by nachanon (8kB - 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
  • -unavailable- added by nachanon (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun May 29 09:56:45 2016nachanonAttached File-=>Added hovercolorbars.tar.gz, #37302
    Sun May 29 09:54:36 2016nachanonAttached File-=>Added gnash-xembed-gtk2.png, #37301
    Sun May 29 09:51:37 2016nachanonAttached File-=>Added gnash-xembed-qt4.png, #37300
    Sun May 29 09:51:05 2016nachanonAttached File-=>Added gnash-xembed-gtk2.tar.gz, #37299
    Sun May 29 09:50:25 2016nachanonAttached File-=>Added gnash-xembed-qt4.tar.gz, #37298

    Back to the top


    Powered by Savane 3.1-cleanup