From 68b2dad19bd6d84f18b22f967ce320b448e8a270 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 30 Dec 2023 21:18:16 +0100 Subject: GLMediaPlayer/FFMPEGMediaPlayer: Add chapter metadata support and use com.jogamp.common.av.PTS.millisToTimeStr(..) Chapter metadata is now supported via our FFMPEGMediaPlayer implementation. Added public method: 'Chapters[] GLMediaPlayer.getChapters()' --- .../util/av/impl/FFMPEGDynamicLibraryBundleInfo.java | 12 +++++++----- .../jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 17 +++++++++++++++-- .../jogamp/opengl/util/av/impl/FFMPEGNatives.java | 6 ++++++ .../jogamp/opengl/util/av/impl/FFMPEGv0400Natives.java | 11 +++++++++++ .../jogamp/opengl/util/av/impl/FFMPEGv0500Natives.java | 11 +++++++++++ .../jogamp/opengl/util/av/impl/FFMPEGv0600Natives.java | 11 +++++++++++ 6 files changed, 61 insertions(+), 7 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/util/av/impl') 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 9b1782993..05a0ddb64 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java @@ -52,7 +52,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { private static final List glueLibNames = new ArrayList(); // none - private static final int symbolCount = 60; + private static final int symbolCount = 61; private static final String[] symbolNames = { "avutil_version", "avformat_version", @@ -91,6 +91,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "av_samples_get_buffer_size", "av_get_bytes_per_sample", // 51.4.0 "av_opt_set_int", // 51.12.0 + "av_dict_iterate", // 57.42.100 "av_dict_get", "av_dict_count", // 54.* (opt) "av_dict_set", @@ -99,7 +100,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "av_channel_layout_uninit", // >= 59 (opt) "av_channel_layout_describe", // >= 59 (opt) "av_opt_set_chlayout", // >= 59 - /* +16 = 39 */ + /* +16 = 40 */ // libavformat "avformat_alloc_context", @@ -116,11 +117,11 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "avformat_network_init", // 53.13.0 (opt) "avformat_network_deinit", // 53.13.0 (opt) "avformat_find_stream_info", // 53.3.0 (opt) - /* +14 = 53 */ + /* +14 = 54 */ // libavdevice "avdevice_register_all", // supported in all versions (opt) - /* +1 = 54 */ + /* +1 = 55 */ // libswresample "av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample! @@ -129,7 +130,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "swr_free", "swr_convert", "swr_get_out_samples", - /* +6 = 60 */ + /* +6 = 61 */ }; // optional symbol names @@ -138,6 +139,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "av_dict_count", // 54.* (opt) // libavutil + "av_dict_iterate", // >= 57.42.100 "av_channel_layout_default", // >= 59 (opt) "av_channel_layout_uninit", // >= 59 (opt) "av_channel_layout_describe", // >= 59 (opt) 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 8124ca6ca..f091056c2 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -43,7 +43,6 @@ import com.jogamp.common.av.TimeFrameI; import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.SecurityUtil; -import com.jogamp.common.util.VersionNumber; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.opengl.util.GLPixelStorageModes; import com.jogamp.opengl.util.av.GLMediaPlayer; @@ -413,6 +412,21 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { natives.setStream0(moviePtr, resStreamLocS, isCameraInput, vid, sizes, rw, rh, rr, aid, aMaxChannelCount, aPrefSampleRate); } + @Override + protected void updateMetadata() { + final Chapter[] chapters = new Chapter[natives.getChapterCount0(moviePtr)]; + for(int i=0; i