我用的JDK是jdk 1.6 bate
调试程序成功
但是运行时候报错误如下: 怎么解决
Starting application C:\java3dTestProgram.class
Command line: "C:\Program Files\Java\jdk1.6.0\bin\java.exe" -classpath C:\ java3dTestProgram
The current directory is: C:\
url = file:/c:/bt.avi
running on Windows XP
The input format is not compatible with the given renderer plugin: J3DRenderer@120a47e
Failed to realize: com.sun.media.ProcessEngine@192d342
Cannot build a flow graph with the customized options:
Unable to add customed renderer: J3DRenderer@120a47e
Error: Unable to realize com.sun.media.ProcessEngine@192d342
Failed to prefech the processor
Interactive Session Endedcom.sun.media.ProcessEngine识别错误 怎么解决````
调试程序成功
但是运行时候报错误如下: 怎么解决
Starting application C:\java3dTestProgram.class
Command line: "C:\Program Files\Java\jdk1.6.0\bin\java.exe" -classpath C:\ java3dTestProgram
The current directory is: C:\
url = file:/c:/bt.avi
running on Windows XP
The input format is not compatible with the given renderer plugin: J3DRenderer@120a47e
Failed to realize: com.sun.media.ProcessEngine@192d342
Cannot build a flow graph with the customized options:
Unable to add customed renderer: J3DRenderer@120a47e
Error: Unable to realize com.sun.media.ProcessEngine@192d342
Failed to prefech the processor
Interactive Session Endedcom.sun.media.ProcessEngine识别错误 怎么解决````
import javax.media.format.*;
import javax.media.control.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;/*
* This is the demo program to render live video on a 3D cylinder
* surface
*/public class DemoJMFJ3D extends Frame implements ControllerListener, Runnable {
Processor p;
int[] waitSync = new int[0];
boolean stateTransOK = true;
boolean dispCtrl = true;
boolean dispMessage = true;
TickerCanvas tc = null; public static void main(String[] args) {
MediaLocator ml;
String url = "file:/c:/bt.avi";
boolean dc = true;
/***
int i = 0; while ( i < args.length ) {
if ( args[i].equals("-m") ){
i++;
if ( i >= args.length){
printUsuage();
System.exit(0);
} url = args[i];
if ( !(url.startsWith("file:") || url.startsWith("http:"))) {
url = "file:" + "c:/test/clock.avi";
}
} else if ( args[i].equals("-c") ) {
i++;
if ( i >= args.length){
printUsuage();
System.exit(0);
}
dc = new Boolean(args[i]).booleanValue();
}
i++;
} if ( url == null ) {
try {
Class cls = Class.forName("DemoJMFJ3D");
url = cls.getResource ("Behfar.mov").toString();
} catch (Exception ex) {
ex.printStackTrace();
}
} ****/
System.out.println("url = " + url ); try {
ml = new MediaLocator(url);
if ( ml == null ) {
System.out.println("can not access url = " + url);
printUsuage();
System.exit(0);
} DemoJMFJ3D tj3d = new DemoJMFJ3D("JMF J3DRenderer Demo");
tj3d.setDispCtrl(dc); if ( !tj3d.open(ml))
System.exit(0); tj3d.init(); } catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
} public static void printUsuage() {
System.out.println("java DemoJMFJ3D [-m <url-of-the-movie>]");
System.out.println("e.g. java DemoJMFJ3D -m file:/home/hsy/media/video/cinepak/gun1.mov");
} public DemoJMFJ3D(String title) {
super(title);
this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e ) { System.exit(0); }}); } public void setDispCtrl (boolean dispCtrl) {
this.dispCtrl = dispCtrl;
} public boolean open(MediaLocator ml) {
try {
p = Manager.createProcessor(ml);
} catch (Exception ex) {
System.out.println("failed to create a processor for movie " + ml);
printUsuage();
return false;
} p.addControllerListener(this);
p.configure();
if ( !waitForState(p.Configured)) {
System.out.println("Failed to configure the processor");
return false;
}
// use processor as a player
p.setContentDescriptor(null);
// obtain the track control
TrackControl[] tc = p.getTrackControls(); if ( tc == null ) {
System.out.println("Failed to get the track control from processor");
return false;
} TrackControl vtc = null;
for ( int i =0; i < tc.length; i++ ) {
if (tc[i].getFormat() instanceof VideoFormat ) {
vtc = tc[i];
break;
}
} if ( vtc == null ) {
System.out.println("can't find video track");
return false;
}
try {
J3DRenderer j3dRenderer = new J3DRenderer();
j3dRenderer.getComponent().setSize(296, 240);
vtc.setRenderer(j3dRenderer);
} catch ( Exception ex) {
ex.printStackTrace();
System.out.println("the processor does not support effect");
return false;
} // prefetch
p.prefetch();
if ( !waitForState(p.Prefetched)) {
System.out.println("Failed to prefech the processor");
return false;
}
System.out.println("end of prefetch"); return true;
} public void init() {
setLayout(new BorderLayout());
Component cc, vc;
if ( (vc = p.getVisualComponent()) != null ){
// System.out.println("vc = " + vc);
add("Center", vc);
}
// if ( dispCtrl && (cc = p.getControlPanelComponent()) != null ) {
// add("South", cc);
// }
// create Ticker canvas
tc = new TickerCanvas();
tc.setSize(296, 20);
add("South", tc); setVisible(true); //create ticker thread
Thread t = new Thread(this);
t.start(); p.start();
System.out.println("p start"); } public void addNotify() {
super.addNotify();
pack();
} public void run() {
while (true) {
if ( dispMessage ) {
tc.updateCoord();
tc.repaint();
} dispMessage = tc.getDisplayFlag();
try {
Thread.currentThread().sleep(250);
} catch (Exception ex) {
}
}
}
// -------------------
public boolean waitForState(int state) {
synchronized (waitSync) {
try {
while ( p.getState() != state && stateTransOK ) {
waitSync.wait();
}
} catch (Exception ex) {}
return stateTransOK;
}
}
// -----------------------
public void controllerUpdate(ControllerEvent evt) {
if ( evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent ) {
synchronized (waitSync) {
stateTransOK = true;
waitSync.notifyAll();
}
} else if ( evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransOK = false;
waitSync.notifyAll();
}
} else if ( evt instanceof EndOfMediaEvent) {
p.setMediaTime(new Time(0));
p.start();
// p.close();
// System.exit(0);
}
}
}
~