From 9d1ee2b69fc943559a17dcd5d59984f8bba15296 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 5 Apr 2012 03:22:04 +0200 Subject: GLMediaPlayer: Use URLConnection to clarify emphasize passing an available connected URL. API doc: Useing html table for state chart --- .../jogamp/opengl/omx/OMXGLMediaPlayer.java | 26 +++++----------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java') diff --git a/src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java index 1005abd80..99639ae62 100644 --- a/src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/omx/OMXGLMediaPlayer.java @@ -1,16 +1,14 @@ package jogamp.opengl.omx; -import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; +import java.net.URL; import javax.media.opengl.GL; import javax.media.opengl.GLContext; import javax.media.opengl.GLException; import com.jogamp.opengl.av.GLMediaEventListener; -import com.jogamp.opengl.av.GLMediaPlayer.TextureFrame; import jogamp.opengl.av.EGLMediaPlayerImpl; import jogamp.opengl.egl.EGL; @@ -69,25 +67,11 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { if(0==moviePtr) { throw new GLException("OMX native instance null"); } - String path=null; - if (url.getProtocol() == null || "file".equals(url.getProtocol())) { - // CV only accepts absolute paths - try { - File file = new File(url.getPath()); - if (!file.exists()) { - throw new FileNotFoundException(file.toString()); - } - path = file.getCanonicalPath(); - System.out.println("setURL: path "+path); - } catch (Exception e) { - e.printStackTrace(); - throw new IOException(e); - } - } - path = replaceAll(path, "\\", "/").trim(); - if(null==path) { - throw new IOException("Couldn't parse stream URL: "+url); + final URL url = urlConn.getURL(); + if(!url.getProtocol().equals("file")) { + throw new IOException("Only file URLs are allowed: "+url); } + final String path=url.getPath(); System.out.println("setURL: clean path "+path); System.out.println("setURL: p1 "+this); -- cgit v1.2.3