[MPlayer-dev-eng] Re: Using -wid to embed mplayer into a java SWT application. (SOLVED)

kamal sharma kamal444 at yahoo.com
Thu Oct 13 08:57:33 CEST 2005


Hi,

Thanks for the advice.

Well I have got the Mplayer to be running from Java.

But now when I run it in eclipse it shows this error :

X11 error: BadWindow (invalid Window parameter)

I have tried with the same program code.

I think it is not able to embed inside the Java
window.

Any suggestions are welcomed.

Regards,
Kamal Sharma


--- Almerindo Rehem
<almerindo.rehem at aracaju.se.gov.br> wrote:

> LOOK THIS:
>
http://www.developer.com/java/other/article.php/3330861
> 
> []'s
> Almerindo Rehem
> 
> 
> 
> 
> 
> 
> 
> >Hi,
> 
> >Well even i tried the program , but i says the
> follow.
> >error when compiled on eclipse:
> 
> >Exception in thread "main"
> >java.lang.NoClassDefFoundError:
> >org/eclipse/swt/internal/gtk/OS
> >        at
>
>org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
> >        at
>
>org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
> >        at
>
>org.eclipse.swt.widgets.Display.<clinit>(Display.java:121)
> >       at play.mplayer.main(mplayer.java:86)
> 
> 
> >Can u help me out?
> 
> >Regards,
> >Kamal 
> 
> --- almerindo.rehem at aracaju.se.gov.br wrote:
> 
> > 
> > 
> > Reinier Zwitserloot <surial <at> gmail.com>
> writes:
> > 
> > Hello All.
> > 
> > In Linux dont works fine!
> > 
> > I tried to use its code in linux and the screen of
> > the video is for 
> > backwards of window SWT. The code modified for
> linux
> > is:
> > 
> > //Source starts here.
> > 
> > import java.io.*;
> > 
> > import org.eclipse.swt.*;
> > import org.eclipse.swt.graphics.Color;
> > import org.eclipse.swt.graphics.RGB;
> > import org.eclipse.swt.layout.FillLayout;
> > import org.eclipse.swt.widgets.*;
> > 
> >       public class Player
> >       { 
> >              //You'll have to edit these paths to
> > something useful.
> >               private static final String MPLAYER
> =
> > "/usr/bin/mplayer";
> >               private static final String
> VIDEO_FILE =
> > "/var/preserve/videos/video.mp4";
> >       
> >               public static Process setFile(final
> File
> > pFile, final int hWnd)
> >                 throws IOException
> >               {
> >                      
> > System.out.println("------------------------");
> >                         System.out.println(hWnd);
> >                        
> > System.out.println("------------------------");
> > 
> >                       final String[] lCmds = new
> String[] {
> >                               MPLAYER,
> >                               "-wid",
> > String.valueOf(hWnd),
> >                               "-nokeepaspect",
> >                               "-geometry", "0:0",
> >                               "-colorkey",
> "0x101010",
> >                               "-vo", "x11",
> >                              
> pFile.getAbsolutePath()
> >                       };
> >       
> >                       final Process lProcess =
> > Runtime.getRuntime().exec(lCmds);
> >                       final InputStream lOut1 =
> > lProcess.getErrorStream();
> >                       final InputStream lOut2 =
> > lProcess.getInputStream();
> >       
> >                       final Runnable lPrinter1 =
> new
> > Runnable() {
> >                               public void run()
> >                               {
> >                                       try {
> >                                           final
> > BufferedReader lReader = new
> > 
> > BufferedReader(new InputStreamReader(lOut1,
> > "UTF-8"));
> >                                               for
> (
> > String l = lReader.readLine() ;l
> > != null ; l = lReader.readLine() ) {
> >                                                   
> > System.out.println(l);
> > 
> >                                               }
> >                                       } catch (
> Throwable
> > t ) {
> >                                              
> > t.printStackTrace();
> >                                       }
> >                               }
> >                       };
> >       
> >                       final Runnable lPrinter2 =
> new
> > Runnable() {
> >                               public void run()
> >                               {
> >                                       try {
> >                                              
> run2();
> >                                       } catch (
> Throwable
> > t ) {
> >                                              
> > t.printStackTrace();
> >                                       }
> >                               }
> >                               public void run2()
> >                                 throws Throwable
> >                               {
> >                                       final
> > BufferedReader lReader = new 
> > BufferedReader(
> > 
> >                                                   
>                                            new
> InputStreamReader(lOut2, "UTF-8"));
> > 
> >                                       for ( String
> l =
> > lReader.readLine() ;
> > 
> >                                                   
>                            l != null ; l =
> lReader.readLine() ) {
> > 
> >                                              
> > System.out.println(l);
> > 
> >                                       }
> >                               }
> >                       };
> >       
> >                       new
> Thread(lPrinter1).start();
> >                       new
> Thread(lPrinter2).start();
> >       
> >                       return lProcess;
> >               }
> >       
> >               public static void main(String[]
> pArgs)
> >                 throws Exception
> >               {
> >                       final Display wDisplay = new
> > Display();
> >                                       
> >                                       
> >                       final Shell wShell = new
> Shell(wDisplay,
> > SWT.SHELL_TRIM);
> >                       final FillLayout wLayout =
> new
> > FillLayout();
> >                       wShell.setLayout(wLayout);
> >                       
> >                       final Canvas wVideo = new
> Canvas(wShell,
> > SWT.EMBEDDED);
> 
=== message truncated ===



		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs




More information about the MPlayer-dev-eng mailing list