diff options
author | Sven Gothel <[email protected]> | 2023-12-18 05:49:02 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-12-18 05:49:02 +0100 |
commit | d99c2d8b28470d335ab5b30124ef8b0607b3b90f (patch) | |
tree | dffb5903953588f13739913898882cf4d5be79e5 /src/jogl/classes | |
parent | 121260d2b7bc4f57a16ca53ed1b08082d7977bbe (diff) |
GLMediaPlayer: Add printNativeInfo(..) exposing used native library information (if any), FFMPEG* utilizes NativeLibrary.get[Native]LibraryPath()
Diffstat (limited to 'src/jogl/classes')
6 files changed, 90 insertions, 38 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java index 740d0fda8..8d2287acc 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java @@ -33,6 +33,7 @@ import com.jogamp.opengl.GLException; import jogamp.opengl.Debug; +import java.io.PrintStream; import java.util.List; import com.jogamp.common.av.AudioFormat; @@ -412,6 +413,9 @@ public interface GLMediaPlayer extends TextureSequence { } } + /** Print native library information of used implementation to given out PrintStream. */ + public void printNativeInfo(final PrintStream out); + public int getTextureCount(); /** Sets the texture unit. Defaults to 0. */ diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java index bc31b6aea..5fc406a72 100644 --- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java +++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java @@ -28,6 +28,7 @@ package jogamp.opengl.android.av; import java.io.IOException; +import java.io.PrintStream; import java.util.List; import com.jogamp.opengl.GL; @@ -118,6 +119,11 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } @Override + public final void printNativeInfo(final PrintStream out) { + out.println("AndroidGLMediaPlayerAPI14: available "+available); + } + + @Override protected final boolean setPlaySpeedImpl(final float rate) { // FIXME return false; diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index bf30c7c57..e493689da 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -1810,7 +1810,6 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } private final String getPerfStringImpl(final long currentMillis, final PTS video_pts, final boolean use_audio, final PTS audio_pts, final int audio_queued_ms, final int autio_pts_lb) { - final float tt = getDuration() / 1000.0f; final int audio_dequeued_ms = getAudioDequeued(audio_queued_ms); // d_vpts > 0: video too fast (in front of SCR) repeat frame, < 0: video too slow (behind SCR) drop frame diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java index d616020e7..9b2b3869c 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java @@ -28,6 +28,7 @@ package jogamp.opengl.util.av; import java.io.IOException; +import java.io.PrintStream; import java.net.URLConnection; import java.nio.ByteBuffer; @@ -60,6 +61,11 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { } @Override + public final void printNativeInfo(final PrintStream out) { + out.println("NullGLMediaPlayer: available true"); + } + + @Override protected final boolean setPlaySpeedImpl(final float rate) { return false; } diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java index 95b5d3b9f..9b1782993 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 JogAmp Community. All rights reserved. + * Copyright 2012-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -39,6 +39,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.DynamicLibraryBundle; import com.jogamp.common.os.DynamicLibraryBundleInfo; +import com.jogamp.common.os.NativeLibrary; import com.jogamp.common.util.RunnableExecutor; import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.VersionNumber; @@ -155,6 +156,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "swr_get_out_samples", }; + /** 5: util, format, codec, device, swresample */ private static final int LIB_COUNT = 5; private static final int LIB_IDX_UTI = 0; private static final int LIB_IDX_FMT = 1; @@ -167,11 +169,33 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { private static final long[] symbolAddr = new long[symbolCount]; private static final boolean ready; private static final boolean libsCFUSLoaded; - static final VersionNumber avCodecVersion; - static final VersionNumber avFormatVersion; - static final VersionNumber avUtilVersion; - static final VersionNumber avDeviceVersion; - static final VersionNumber swResampleVersion; + public static class VersionedLib { + public final NativeLibrary lib; + public final VersionNumber version; + public VersionedLib(final NativeLibrary lib, final VersionNumber version) { + this.lib = lib; + this.version = version; + } + @Override + public String toString() { + final String ls; + if( null != lib ) { + if( null != lib.getNativeLibraryPath() ) { + ls = "nlp '"+lib.getNativeLibraryPath()+"'"; + } else { + ls = "vlp '"+lib.getLibraryPath()+"'"; + } + } else { + ls = "n/a"; + } + return ls+", "+version; + } + } + static final VersionedLib avUtil; + static final VersionedLib avFormat; + static final VersionedLib avCodec; + static final VersionedLib avDevice; + static final VersionedLib swResample; private static final FFMPEGNatives natives; private static final PrivilegedAction<DynamicLibraryBundle> privInitSymbolsAction = new PrivilegedAction<DynamicLibraryBundle>() { @@ -198,10 +222,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { } }; /** - * @param versions 5: util, format, codec, swresample + * @param versions 5: util, format, codec, device, swresample * @return */ - private static final boolean initSymbols(final VersionNumber[] versions) { + private static final boolean initSymbols(final VersionNumber[] versions, final List<NativeLibrary> nativeLibs) { for(int i=0; i<libLoaded.length; i++) { libLoaded[i] = false; } @@ -213,6 +237,8 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { if( null == dl ) { return false; } + nativeLibs.clear(); + nativeLibs.addAll(dl.getToolLibraries()); // optional symbol name set final Set<String> optionalSymbolNameSet = new HashSet<String>(); @@ -250,19 +276,20 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { GLProfile.initSingleton(); boolean _ready = false; - /** util, format, codec, swresample */ + /** 5: util, format, codec, device, swresample */ final VersionNumber[] _versions = new VersionNumber[LIB_COUNT]; + final List<NativeLibrary> _nativeLibs = new ArrayList<NativeLibrary>(); try { - _ready = initSymbols(_versions); + _ready = initSymbols(_versions, _nativeLibs); } catch (final Throwable t) { ExceptionUtils.dumpThrowable("", t); } libsCFUSLoaded = libLoaded[LIB_IDX_COD] && libLoaded[LIB_IDX_FMT] && libLoaded[LIB_IDX_UTI] && libLoaded[LIB_IDX_SWR]; - avUtilVersion = _versions[LIB_IDX_UTI]; - avFormatVersion = _versions[LIB_IDX_FMT]; - avCodecVersion = _versions[LIB_IDX_COD]; - avDeviceVersion = _versions[LIB_IDX_DEV]; - swResampleVersion = _versions[LIB_IDX_SWR]; + avUtil = new VersionedLib(_nativeLibs.get(LIB_IDX_UTI), _versions[LIB_IDX_UTI]); + avFormat = new VersionedLib(_nativeLibs.get(LIB_IDX_FMT), _versions[LIB_IDX_FMT]); + avCodec = new VersionedLib(_nativeLibs.get(LIB_IDX_COD), _versions[LIB_IDX_COD]); + avDevice = new VersionedLib(_nativeLibs.get(LIB_IDX_DEV), _versions[LIB_IDX_DEV]); + swResample = new VersionedLib(_nativeLibs.get(LIB_IDX_SWR), _versions[LIB_IDX_SWR]); if(!libsCFUSLoaded) { String missing = ""; if( !libLoaded[LIB_IDX_COD] ) { @@ -285,11 +312,11 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { natives = null; ready = false; } else { - final int avCodecMajor = avCodecVersion.getMajor(); - final int avFormatMajor = avFormatVersion.getMajor(); - final int avUtilMajor = avUtilVersion.getMajor(); - final int avDeviceMajor = avDeviceVersion.getMajor(); - final int swResampleMajor = swResampleVersion.getMajor(); + final int avUtilMajor = avUtil.version.getMajor(); + final int avFormatMajor = avFormat.version.getMajor(); + final int avCodecMajor = avCodec.version.getMajor(); + final int avDeviceMajor = avDevice.version.getMajor(); + final int swResampleMajor = swResample.version.getMajor(); if( avCodecMajor == 58 && avFormatMajor == 58 && ( avDeviceMajor == 58 || avDeviceMajor == 0 ) && avUtilMajor == 56 && swResampleMajor == 3) { // Exact match: ffmpeg 4.x.y natives = new FFMPEGv0400Natives(); 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 91b8f38aa..8124ca6ca 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 JogAmp Community. All rights reserved. + * Copyright 2012-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -29,6 +29,7 @@ package jogamp.opengl.util.av.impl; import java.io.IOException; +import java.io.PrintStream; import java.nio.ByteBuffer; import java.security.PrivilegedAction; @@ -53,6 +54,7 @@ import jogamp.opengl.GLContextImpl; import jogamp.opengl.util.av.AudioSampleFormat; import jogamp.opengl.util.av.GLMediaPlayerImpl; import jogamp.opengl.util.av.VideoPixelFormat; +import jogamp.opengl.util.av.impl.FFMPEGDynamicLibraryBundleInfo.VersionedLib; /*** * Implementation utilizes <a href="http://ffmpeg.org/">FFmpeg</a> which is ubiquitous @@ -223,18 +225,18 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { avDeviceMajorVersionCC = 0; swResampleMajorVersionCC = 0; } - final VersionNumber avCodecVersion = FFMPEGDynamicLibraryBundleInfo.avCodecVersion; - final VersionNumber avFormatVersion = FFMPEGDynamicLibraryBundleInfo.avFormatVersion; - final VersionNumber avUtilVersion = FFMPEGDynamicLibraryBundleInfo.avUtilVersion; - final VersionNumber avDeviceVersion = FFMPEGDynamicLibraryBundleInfo.avDeviceVersion; - final VersionNumber swResampleVersion = FFMPEGDynamicLibraryBundleInfo.swResampleVersion; + final VersionedLib avCodec = FFMPEGDynamicLibraryBundleInfo.avCodec; + final VersionedLib avFormat = FFMPEGDynamicLibraryBundleInfo.avFormat; + final VersionedLib avUtil = FFMPEGDynamicLibraryBundleInfo.avUtil; + final VersionedLib avDevice = FFMPEGDynamicLibraryBundleInfo.avDevice; + final VersionedLib swResample = FFMPEGDynamicLibraryBundleInfo.swResample; final boolean avDeviceLoaded = FFMPEGDynamicLibraryBundleInfo.avDeviceLoaded(); final boolean swResampleLoaded = FFMPEGDynamicLibraryBundleInfo.swResampleLoaded(); - final int avCodecMajor = avCodecVersion.getMajor(); - final int avFormatMajor = avFormatVersion.getMajor(); - final int avUtilMajor = avUtilVersion.getMajor(); - final int avDeviceMajor = avDeviceVersion.getMajor(); - final int swResampleMajor = swResampleVersion.getMajor(); + final int avCodecMajor = avCodec.version.getMajor(); + final int avFormatMajor = avFormat.version.getMajor(); + final int avUtilMajor = avUtil.version.getMajor(); + final int avDeviceMajor = avDevice.version.getMajor(); + final int swResampleMajor = swResample.version.getMajor(); libAVVersionGood = avCodecMajorVersionCC == avCodecMajor && avFormatMajorVersionCC == avFormatMajor && avUtilMajorVersionCC == avUtilMajor && @@ -244,12 +246,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { System.err.println("FFmpeg Not Matching Compile-Time / Runtime Major-Version"); } if( !libAVVersionGood || DEBUG ) { - System.err.println("FFmpeg Codec : "+avCodecVersion+" [cc "+avCodecMajorVersionCC+"]"); - System.err.println("FFmpeg Format : "+avFormatVersion+" [cc "+avFormatMajorVersionCC+"]"); - System.err.println("FFmpeg Util : "+avUtilVersion+" [cc "+avUtilMajorVersionCC+"]"); - System.err.println("FFmpeg Device : "+avDeviceVersion+" [cc "+avDeviceMajorVersionCC+", loaded "+avDeviceLoaded+"]"); - System.err.println("FFmpeg Resample: "+swResampleVersion+" [cc "+swResampleMajorVersionCC+", loaded "+swResampleLoaded+"]"); - System.err.println("FFmpeg Class : "+(null!= natives ? natives.getClass().getSimpleName() : "n/a")); + printNativeInfoImpl(System.err); } } else { natives = null; @@ -265,6 +262,19 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { public static final boolean isAvailable() { return available; } + private static final void printNativeInfoImpl(final PrintStream out) { + out.println("FFmpeg Codec : "+FFMPEGDynamicLibraryBundleInfo.avCodec+" [cc "+avCodecMajorVersionCC+"]"); + out.println("FFmpeg Format : "+FFMPEGDynamicLibraryBundleInfo.avFormat+" [cc "+avFormatMajorVersionCC+"]"); + out.println("FFmpeg Util : "+FFMPEGDynamicLibraryBundleInfo.avUtil+" [cc "+avUtilMajorVersionCC+"]"); + out.println("FFmpeg Device : "+FFMPEGDynamicLibraryBundleInfo.avDevice+" [cc "+avDeviceMajorVersionCC+", loaded "+FFMPEGDynamicLibraryBundleInfo.avDeviceLoaded()+"]"); + out.println("FFmpeg Resample: "+FFMPEGDynamicLibraryBundleInfo.swResample+" [cc "+swResampleMajorVersionCC+", loaded "+FFMPEGDynamicLibraryBundleInfo.swResampleLoaded()+"]"); + out.println("FFmpeg Class : "+(null!= natives ? natives.getClass().getSimpleName() : "n/a")); + } + @Override + public final void printNativeInfo(final PrintStream out) { + printNativeInfoImpl(out); + } + // // General // |