diff options
author | Sven Göthel <sgothel@jausoft.com> | 2024-01-27 07:36:07 +0100 |
---|---|---|
committer | Sven Göthel <sgothel@jausoft.com> | 2024-01-27 07:36:07 +0100 |
commit | 7fe9da9d2b5b7475ea3878b0a8d23f485bb19dff (patch) | |
tree | 754038a85a573ce1ea682bfa2f5407071e12b500 /src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java | |
parent | a8e382bf6ebc7d405ef2479dae97762d9b7e2967 (diff) |
GLMediaPlayer: Add initial subtitle support, track audio/video/subtitle streams and languages and add convenient switchStream(..) entry.
audio/video/subtitle streams and language metadata is maintained by arrays holding the stream-IDs and language string identifier.
Implementation added in FFMPEGPlayer for these data-sets.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java index 5fc406a72..3900e4089 100644 --- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java +++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java @@ -281,7 +281,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } @Override - protected final void initStreamImpl(final int vid, final int aid) throws IOException { + protected final void initStreamImpl(final int vid, final int aid, int sid) throws IOException { if( null == getUri() ) { return; } @@ -323,12 +323,23 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } catch (final IOException ioe) { throw new IOException("MediaPlayer failed to process stream <"+getUri().toString()+">: "+ioe.getMessage(), ioe); } - final int r_aid = GLMediaPlayer.STREAM_ID_NONE == aid ? GLMediaPlayer.STREAM_ID_NONE : 1 /* fake */; + final int r_aid; + final int[] r_aids; + final String[] r_alangs; + if( GLMediaPlayer.STREAM_ID_NONE == aid ) { + r_aid = GLMediaPlayer.STREAM_ID_NONE; + r_aids = new int[0]; + r_alangs = new String[0]; + } else { + r_aid = 1; // fake + r_aids = new int[] { 1 }; // fake + r_alangs = new String[] { "n/a" }; + } final String icodec = "android"; - updateAttributes(0 /* fake */, r_aid, - mp.getVideoWidth(), mp.getVideoHeight(), 0, - 0, 0, 0f, - 0, 0, mp.getDuration(), icodec, icodec); + updateAttributes(new int[] { 0 }, new String[] { "und" }, 0 /* fake */, + r_aids, r_alangs, r_aid, + new int[0], new String[0], GLMediaPlayer.STREAM_ID_NONE, + mp.getVideoWidth(), mp.getVideoHeight(), 0, 0, 0, 0f, 0, 0, mp.getDuration(), icodec, icodec); /** mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override @@ -361,11 +372,10 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } } } - updateAttributes(0 /* fake */, GLMediaPlayer.STREAM_ID_NONE, - size.width, size.height, - 0, 0, 0, - fpsRange[1]/1000f, - 0, 0, 0, icodec, icodec); + updateAttributes(new int[]{0}, new String[] { "und" }, 0 /* fake */, + new int[0], new String[0], GLMediaPlayer.STREAM_ID_NONE, + new int[0], new String[0], GLMediaPlayer.STREAM_ID_NONE, + size.width, size.height, 0, 0, 0, fpsRange[1]/1000f, 0, 0, 0, icodec, icodec); } } private static String camSz2Str(final Camera.Size csize) { |