[MPlayer-dev-eng] MPlayer -> Java Component ---> MPlayer and Video Annotations.

Almerindo Rehem almerindo.rehem at aracaju.se.gov.br
Wed Aug 31 16:19:26 CEST 2005


Thanks!

is It possible to paint over the window?

I work with MPEG-7 and video annotations. My software works fine whith
Quicktime (quicktime for java), but i want to use MPlayer (because is
Open Source). The problem is: How to redirect the video display to a
Canvas component / JComponent or any java component  ? 

If this is possible, I could to insert the component in my software, and
draw over the video (making and showing the annotations whith MPEG-7).

Any sugestion ?


Hi Almerindo,
>  
> if you can get the window ID of the JAVA component (via native
methods), you could pass it to the MPlayer via option -wid <window_id>.
I tried it with a Visual Basic window and it worked.
>  
> I use MPlayer as external viewer in my JAVA subtitling program. It
runs in slave mode (-slave option), is always-on-top (slave command
vo_ontop). I even resize the MPlayer window to fit into a certain area
on my JAVA JFrame. The only thing that sucks is the window decoration of
the MPlayer window.
>  
> Greetings,
> Oliver



>    3. Re: MPlayer-dev-eng Digest, Vol 32, Issue 71
>       (almerindo.rehem at aracaju.se.gov.br)


> To: mplayer-dev-eng at mplayerhq.hu
> Message-ID: <1125269746.431240f2c8ccb at mail.infonet.com.br>
> Content-Type: text/plain
> 
> Hello all!  
> 
> It's possible to redirect  the out of the MPLAYER to a Java Component ?
> Quicktime for java implements this. How to do?
> 
> 
> 
> Example: redirecting the out of MPLAYER to java.awt.frame (And to redir to a Component?
> JPanel ? Canvas?)
> 
> #############################
> package mplayer;
> 
> import java.awt.Toolkit;
> import javax.swing.SwingUtilities;
> import javax.swing.UIManager;
> import java.awt.Dimension;
> /**
>  * <p>Title: </p>
>  *
>  * <p>Description: </p>
>  *
>  * <p>Copyright: Copyright (c) 2005</p>
>  *
>  * <p>Company: </p>
>  *
>  * @author not attributable
>  * @version 1.0
>  */
> public class Application1 {
>     boolean packFrame = false;
>     
>     /**
>      * Construct and show the application.
>      */
>     public Application1() {
>         Frame1 frame = new Frame1();
>         // Validate frames that have preset sizes
>         // Pack frames that have useful preferred size info, e.g. from their layout
>         if (packFrame) {
>             frame.pack();
>         } else {
>             frame.validate();
>         }
> 
>         // Center the window
>         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
>         Dimension frameSize = frame.getSize();
>         if (frameSize.height > screenSize.height) {
>             frameSize.height = screenSize.height;
>         }
>         if (frameSize.width > screenSize.width) {
>             frameSize.width = screenSize.width;
>         }
>         frame.setLocation((screenSize.width - frameSize.width) / 2,
>                           (screenSize.height - frameSize.height) / 2);
>         frame.setVisible(true);
>     }
> 
>     /**
>      * Application entry point.
>      *
>      * @param args String[]
>      */
>     public static void main(String[] args) {
>         SwingUtilities.invokeLater(new Runnable() {
>             public void run() {
>                 try {
>                     UIManager.setLookAndFeel(UIManager.
>                                              getSystemLookAndFeelClassName());
>                 } catch (Exception exception) {
>                     exception.printStackTrace();
>                 }
> 
>                 new Application1();
>             }
>         });
>     }
> }
> 
> 
> #########################
> 
> package mplayer;
> 
> import java.awt.Dimension;
> 
> import java.awt.Frame;
> import java.awt.event.WindowEvent;
> import java.awt.event.WindowAdapter;
> 
> //import com.sun.tools.jdi.JDWP;
> 
> /**
>  * <p>Title: </p>
>  *
>  * <p>Description: </p>
>  *
>  * <p>Copyright: Copyright (c) 2005</p>
>  *
>  * <p>Company: </p>
>  *
>  * @author not attributable
>  * @version 1.0
>  */
> public class Frame1 extends Frame {
> 
>     public Frame1() {
>         try {
>             jbInit();
>         } catch (Exception exception) {
>             exception.printStackTrace();
>         }
>     }
> 
>     /**
>      * Component initialization.
>      *
>      * @throws java.lang.Exception
>      */
>     private void jbInit() throws Exception {
>         super.removeAll();
>         setSize(new Dimension(400, 300));
>         setTitle("Frame Title");
>         
>         this.addWindowListener(new Frame1_this_windowAdapter(this));
>     }
> 
>     public void this_windowClosing(WindowEvent e) {
>         System.exit(0);
>     }
> }
> 
> 
> class Frame1_this_windowAdapter extends WindowAdapter {
>     private Frame1 adaptee;
>     Frame1_this_windowAdapter(Frame1 adaptee) {
>         this.adaptee = adaptee;
>     }
> 
>     public void windowClosing(WindowEvent e) {
>         adaptee.this_windowClosing(e);
>     }
> }
> 
> #####################################################
> and enter with command (video.mp4 is in /tmp): 
> wmctrl -xl | grep "mplayer.Frame1.mplayer.Application1" | awk '/0x.*  / {print $1}';echo
> $i ; mplayer -slave -quiet -wid 0x02c00041   -geometry 400 300 /tem/video.mp4            
>                    
> 





More information about the MPlayer-dev-eng mailing list