Why a player cannot be configured?
Hi all ...
When I doing my project using JMF, I used a cloned dataSource(cds) to create a player:
Player p = Manager.createRealizedPlayer(cds);
but When I put the player in the configure state, it cannot be configured.
Does anybody know why? Please help!
Regards.
Lianke
[313 byte] By [
liankea] at [2007-11-27 10:18:55]

# 2
hi Lanse:
Thanks for your reply. I think I got that wrong.
However, after the player has been realized and when I try to convert a grabbed frame to bufferedImage, the image has Null value.(the code
as follow:)
public void takeSnapshot(){
FrameGrabbingControl fgc = null;
snapshotDs = dataSource.cloneCamSource();
try{
snapshotPlayer = Manager.createRealizedPlayer(snapshotDs);
if(snapshotPlayer != null)
snapshotPlayer.start();
}catch (IOException e) {
JOptionPane.showMessageDialog(this,
"Exception creating snapshotPlayer: " + e.getMessage(), "Error", JOptionPane.WARNING_MESSAGE);
return;
}catch (NoPlayerException e) {
JOptionPane.showMessageDialog(this,
"Exception creating snapshotPlayer: " + e.getMessage(), "Error", JOptionPane.WARNING_MESSAGE);
return;
}catch (CannotRealizeException e) {
JOptionPane.showMessageDialog(this,
"Exception creating snapshotPlayer: " + e.getMessage(), "Error", JOptionPane.WARNING_MESSAGE);
return;
}
playhelper = new StateHelper(snapshotPlayer);
if(!playhelper.realize(10000)){
JOptionPane.showMessageDialog(this,
"cannot realize snapshotPlayer", "Error", JOptionPane.WARNING_MESSAGE);
return;
}
if( snapshotPlayer != null)
fgc = (FrameGrabbingControl)snapshotPlayer.getControl("javax.media.control.FrameGrabbingControl");
else
System.err.println("Cannot get FrameGrabbingControl");
Buffer bufferFrame = fgc.grabFrame();
System.out.println("bufferFrame :"+bufferFrame);
BufferToImage bufferToImage = new BufferToImage((VideoFormat)bufferFrame.getFormat());
System.out.println("bufferToImage :"+bufferToImage);
BufferedImage image = (BufferedImage)bufferToImage.createImage(bufferFrame);
if(image != null)
System.out.println("Successful convert image :"+image);
else
System.out.println("Fail to convert image :" + image);
}
and I got the ouputs from terminal window:
bufferFrame :javax.media.Buffer@9b87f6
bufferToImage :javax.media.util.BufferToImage@140b8fd
Fail to convert image :null
Does anyone know why the image is Null value and how can I fix the problem?
Kinds regards.
Lianke