summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-11-28 13:43:32 +0100
committerSven Gothel <[email protected]>2013-11-28 13:43:32 +0100
commiteb9225c928b9a1a5660c865921fcd91f85cd1cd0 (patch)
treee76a310033c237bc94b50bc908955da99ee17c01 /src
parent65247a8188c7470ee7f599f2e84cae1bc84fff9c (diff)
Fix Bug 902: FFMPEGMediaPlayer uses IOUtil.decodeURIIfFilePath(uri) to decode proper file-scheme if applicable - otherwise encoded ASCII URI.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java17
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java23
3 files changed, 39 insertions, 10 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
index d2ef026bd..034b9457e 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -232,7 +232,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
private int vBytesPerPixelPerPlane = 0;
private int texWidth, texHeight; // overall (stuffing planes in one texture)
private String singleTexComp = "r";
- private GLPixelStorageModes psm;
+ private final GLPixelStorageModes psm;
//
// Audio
@@ -280,7 +280,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
System.err.println("initStream: p1 "+this);
}
- final String streamLocS=IOUtil.decodeFromURI(streamLoc.toString());
+ final String streamLocS = IOUtil.decodeURIIfFilePath(streamLoc);
destroyAudioSink();
if( GLMediaPlayer.STREAM_ID_NONE == aid ) {
audioSink = AudioSinkFactory.createNull();
@@ -331,6 +331,11 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
final int aMaxChannelCount = audioSink.getMaxSupportedChannels();
final int aPrefSampleRate = preferredAudioFormat.sampleRate;
// setStream(..) issues updateAttributes*(..), and defines avChosenAudioFormat, vid, aid, .. etc
+ if(DEBUG) {
+ System.err.println("initStream: p3 cameraPath "+cameraPath+", isCameraInput "+isCameraInput);
+ System.err.println("initStream: p3 stream "+streamLoc+" -> "+streamLocS+" -> "+resStreamLocS);
+ System.err.println("initStream: p3 vid "+vid+", sizes "+sizes+", reqVideo "+rw+"x"+rh+"@"+rr+", aid "+aid+", aMaxChannelCount "+aMaxChannelCount+", aPrefSampleRate "+aPrefSampleRate);
+ }
natives.setStream0(moviePtr, resStreamLocS, isCameraInput, vid, sizes, rw, rh, rr, aid, aMaxChannelCount, aPrefSampleRate);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
index a7636fce4..8f27e19c4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2.av;
+import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -39,6 +40,7 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
+import com.jogamp.common.util.IOUtil;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -327,7 +329,7 @@ public class MovieCube implements GLEventListener {
int aid = GLMediaPlayer.STREAM_ID_AUTO;
final boolean origSize;
- String url_s=null;
+ String url_s=null, file_s=null;
{
boolean _origSize = false;
for(int i=0; i<args.length; i++) {
@@ -351,6 +353,9 @@ public class MovieCube implements GLEventListener {
} else if(args[i].equals("-url")) {
i++;
url_s = args[i];
+ } else if(args[i].equals("-file")) {
+ i++;
+ file_s = args[i];
} else if(args[i].equals("-es2")) {
forceES2 = true;
} else if(args[i].equals("-es3")) {
@@ -369,11 +374,15 @@ public class MovieCube implements GLEventListener {
origSize = _origSize;
}
final URI streamLoc;
- if( null == url_s ) {
- streamLoc = defURI;
- } else {
+ if( null != url_s ) {
streamLoc = new URI(url_s);
+ } else if( null != file_s ) {
+ streamLoc = IOUtil.toURISimple(new File(file_s));
+ } else {
+ streamLoc = defURI;
}
+ System.err.println("url_s "+url_s);
+ System.err.println("file_s "+file_s);
System.err.println("stream "+streamLoc);
System.err.println("vid "+vid+", aid "+aid);
System.err.println("textureCount "+textureCount);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
index 897079ec2..1a9914bb7 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2.av;
+import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -45,6 +46,7 @@ import javax.media.opengl.GLUniformData;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.IOUtil;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -704,7 +706,7 @@ public class MovieSimple implements GLEventListener {
int aid = GLMediaPlayer.STREAM_ID_AUTO;
final boolean origSize;
- String url_s=null;
+ String url_s=null, file_s1=null, file_s2=null;
{
boolean _origSize = false;
for(int i=0; i<args.length; i++) {
@@ -743,6 +745,12 @@ public class MovieSimple implements GLEventListener {
} else if(args[i].equals("-url")) {
i++;
url_s = args[i];
+ } else if(args[i].equals("-file1")) {
+ i++;
+ file_s1 = args[i];
+ } else if(args[i].equals("-file2")) {
+ i++;
+ file_s2 = args[i];
} else if(args[i].equals("-wait")) {
waitForKey = true;
}
@@ -750,11 +758,18 @@ public class MovieSimple implements GLEventListener {
origSize = _origSize;
}
final URI streamLoc;
- if( null == url_s ) {
- streamLoc = defURI;
- } else {
+ if( null != url_s ) {
streamLoc = new URI(url_s);
+ } else if( null != file_s1 ) {
+ File movieFile = new File(file_s1);
+ streamLoc = movieFile.toURI();
+ } else if( null != file_s2 ) {
+ streamLoc = IOUtil.toURISimple(new File(file_s2));
+ } else {
+ streamLoc = defURI;
}
+ System.err.println("url_s "+url_s);
+ System.err.println("file_s 1: "+file_s1+", 2: "+file_s2);
System.err.println("stream "+streamLoc);
System.err.println("vid "+vid+", aid "+aid);
System.err.println("textureCount "+textureCount);