Hi All
I grabbed this old jme3.newvideo package from 3.0 branch to test ogv video playing on JME.
Here is the test class
package com.jme3.newvideo;
import com.fluendo.jst.BusHandler;
import com.fluendo.jst.Element;
import com.fluendo.jst.Message;
import com.fluendo.jst.Pipeline;
import com.fluendo.utils.Debug;
import com.jme3.app.SimpleApplication;
import com.jme3.system.AppSettings;
import com.jme3.texture.Texture2D;
import com.jme3.ui.Picture;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.concurrent.Callable;
public class TestNewVideo extends SimpleApplication implements BusHandler {
private Picture picture;
private JmeVideoPipeline p;
private int frame = 0;
public static void main(String[] args){
TestNewVideo app = new TestNewVideo();
AppSettings settings = new AppSettings(true);
settings.setFrameRate(24);
app.setSettings(settings);
app.start();
}
private void createVideo(){
Debug.level = Debug.INFO;
p = new JmeVideoPipeline(this);
p.getBus().addHandler(this);
try {
p.inputStream = new FileInputStream("PATH_TO_VIDEO.ogv");
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
p.setState(Pipeline.PLAY);
}
@Override
public void simpleUpdate(float tpf){
if (p == null){
System.err.println("Pipeline is null!");
return;
}
Texture2D tex = p.getTexture();
if (tex == null)
{
System.err.println("Texture is null!");
return;
}
if (picture != null){
synchronized (tex){
try {
tex.wait();
} catch (InterruptedException ex) {
// ignore
System.err.println("Wait exception : "+ex);
}
tex.getImage().setUpdateNeeded();
renderer.setTexture(0, tex);
((VideoTexture)tex).free();
System.out.println("PLAY : " + (frame++));
}
return;
}
picture = new Picture("VideoPicture", true);
picture.setPosition(0, 0);
picture.setWidth(settings.getWidth());
picture.setHeight(settings.getHeight());
picture.setTexture(assetManager, tex, false);
rootNode.attachChild(picture);
}
public void simpleInitApp() {
// start video playback
createVideo();
}
@Override
public void destroy(){
if (p != null){
p.setState(Pipeline.STOP);
p.shutDown();
}
super.destroy();
}
public void handleMessage(Message msg) {
switch (msg.getType()){
case Message.EOS:
Debug.log(Debug.INFO, "EOS: playback ended");
/*
enqueue(new Callable<Void>(){
public Void call() throws Exception {
rootNode.detachChild(picture);
p.setState(Element.STOP);
p.shutDown();
p = null;
return null;
}
});
Texture2D tex = p.getTexture();
synchronized (tex){
tex.notifyAll();
}
*/
break;
case Message.STREAM_STATUS:
Debug.info(msg.toString());
break;
}
}
}
but it returns null texture in Texture2D tex = p.getTexture();
here is output :
:core:jme3-media-player:run
[INFO] registered plugin: com.fluendo.plugin.HTTPSrc
[INFO] registered plugin: com.fluendo.plugin.VideoSink
[INFO] registered plugin: com.fluendo.plugin.AudioSinkJ2
[INFO] registered plugin: com.fluendo.plugin.AudioSinkSA
[INFO] registered plugin: com.fluendo.plugin.Queue
[INFO] registered plugin: com.fluendo.plugin.FakeSink
[INFO] registered plugin: com.fluendo.plugin.Overlay
[INFO] registered plugin: com.fluendo.plugin.Selector
[INFO] registered plugin: com.fluendo.plugin.OggDemux
[INFO] Ogg payload com.fluendo.plugin.TheoraDec found
[INFO] Ogg payload com.fluendo.plugin.VorbisDec found
[INFO] Ogg payload com.fluendo.plugin.KateDec found
[INFO] registered plugin: com.fluendo.plugin.TheoraDec
[INFO] registered plugin: com.fluendo.plugin.VorbisDec
[INFO] registered plugin: com.fluendo.plugin.KateDec
[INFO] registered plugin: com.fluendo.plugin.KateOverlay
[INFO] create element: Element: [audiosink]
[INFO] using high quality javax.sound backend
[INFO] mixer description: Direct Audio Device: default, default, default, vendor: ALSA (http://www.alsa-project.org)
[INFO] Mixer supports line: interface SourceDataLine supporting 512 audio formats, and buffers of at least 32 bytes
[INFO] Format: PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
[INFO] Format: PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
[INFO] Format: PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
[INFO] Format: PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
.
.
.
[INFO] Format: PCM_SIGNED unknown sample rate, 32 bit, 31 channels, 124 bytes/frame, big-endian
[INFO] Format: PCM_SIGNED unknown sample rate, 32 bit, 31 channels, 124 bytes/frame, little-endian
[INFO] Format: PCM_SIGNED unknown sample rate, 32 bit, 32 channels, 128 bytes/frame, big-endian
[INFO] Format: PCM_SIGNED unknown sample rate, 32 bit, 32 channels, 128 bytes/frame, little-endian
[INFO] Format: ULAW unknown sample rate, 8 bit, mono, 8 bytes/frame,
[INFO] Format: ULAW unknown sample rate, 8 bit, stereo, 16 bytes/frame,
.
.
.
[INFO] Format: ALAW unknown sample rate, 8 bit, 32 channels, 256 bytes/frame,
[INFO] Attempting to get a line from ALSA mixer
[INFO] [Message]: Pad: InputStreamSource:src type: STREAM_STATUS, start, reason: ok, activating
[INFO] using typefind contentType: application/ogg
[INFO] Ogg payload com.fluendo.plugin.TheoraDec found
[INFO] Ogg payload com.fluendo.plugin.VorbisDec found
[INFO] Ogg payload com.fluendo.plugin.KateDec found
[INFO] create element: Element: [OggFileDemuxer]
[INFO] create element: Element: [BufferQueue]
[INFO] [Message]: Pad: BufferQueue:src type: STREAM_STATUS, start, reason: ok, activating
[INFO] ogg: got discont
[INFO] new stream -667506712, mime video/x-theora
[INFO] new stream 305187160, mime audio/x-vorbis
Texture is null!
[INFO] pad added Pad: OggFileDemuxer:serial_-667506712
[INFO] create element: Element: [v_queue]
[INFO] create element: Element: [v_queue2]
[INFO] create element: Element: [videodec]
[INFO] pad added Pad: OggFileDemuxer:serial_305187160
[INFO] all streams detected
[INFO] file has no audio, remove audiosink
[INFO] file has no video, remove videosink
[INFO] [Message]: Pad: v_queue2:src type: STREAM_STATUS, start, reason: ok, activating
[INFO] [Message]: Pad: v_queue:src type: STREAM_STATUS, start, reason: ok, activating
[ERRO] does not contain Theora video data.
[INFO] got EOS Pad: videodec:sink
[INFO] got EOS: Pad: v_queue2:sink
[INFO] [Message]: Pad: v_queue:src type: STREAM_STATUS, stop, reason: error, flow stopped
[INFO] Pad: TextureVideoSink:sink got EOS
[INFO] [Message]: Pad: v_queue2:src type: STREAM_STATUS, stop, reason: ok, flow stopped, EOS
.
.
.
Texture is null!
.
.
.
[INFO] [Message]: Pad: v_queue2:src type: STREAM_STATUS, stop, reason: wrong-state, stopping
[INFO] [Message]: Pad: v_queue:src type: STREAM_STATUS, stop, reason: wrong-state, stopping
[INFO] [Message]: Pad: BufferQueue:src type: STREAM_STATUS, stop, reason: wrong-state, flow stopped
[INFO] [Message]: Pad: BufferQueue:src type: STREAM_STATUS, stop, reason: wrong-state, stopping
[INFO] [Message]: Pad: InputStreamSource:src type: STREAM_STATUS, stop, reason: wrong-state, stopping
[INFO] [Message]: Pad: InputStreamSource:src type: STREAM_STATUS, stop, reason: wrong-state, reason: wrong-state
[INFO] cleanup
as you see above it gives error [ERRO] does not contain Theora video data.
I already tested it with a few ogv files but no success.
Curious if anyone ever was able to use this API before ?
Thanks