diff --git a/.idea/misc.xml b/.idea/misc.xml index 7bfef59..c0f68ed 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,30 @@ + + + + diff --git a/README.md b/README.md index 4826583..ed6a1d8 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ and add the following in the dependent module: ```gradle dependencies { - implementation 'com.github.masterwok:libvlc-android-sdk:3.0.11' + implementation 'com.github.masterwok:libvlc-android-sdk:3.0.13' } ``` unless you're a fan of large APKs, you'll probably want to add the following to the build.gradle of your app so an APK is generated per ABI: diff --git a/buildlibvlc.sh b/buildlibvlc.sh index 7731a7f..0833902 100755 --- a/buildlibvlc.sh +++ b/buildlibvlc.sh @@ -1,6 +1,6 @@ #!/bin/sh -tag='3.0.11' +tag='3.0.13' rootdir=`dirname $0` diff --git a/libvlc/src/main/java/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/main/java/org/videolan/libvlc/MediaPlayer.java index ef52a9f..aa43608 100644 --- a/libvlc/src/main/java/org/videolan/libvlc/MediaPlayer.java +++ b/libvlc/src/main/java/org/videolan/libvlc/MediaPlayer.java @@ -1193,6 +1193,7 @@ protected synchronized Event onEventNative(int eventType, long arg1, long arg2, @Override protected void onReleaseNative() { + mWindow.detachViews(); registerAudioPlug(false); if (mMedia != null) diff --git a/libvlc/src/main/java/org/videolan/libvlc/RendererDiscoverer.java b/libvlc/src/main/java/org/videolan/libvlc/RendererDiscoverer.java index 8b9af22..f079a82 100644 --- a/libvlc/src/main/java/org/videolan/libvlc/RendererDiscoverer.java +++ b/libvlc/src/main/java/org/videolan/libvlc/RendererDiscoverer.java @@ -78,6 +78,7 @@ public void stop() { if (isReleased()) throw new IllegalStateException("MediaDiscoverer is released"); setEventListener(null); nativeStop(); + release(); } public void setEventListener(EventListener listener) { @@ -111,7 +112,7 @@ protected Event onEventNative(int eventType, long arg1, long arg2, float argf1) private final LongSparseArray index = new LongSparseArray<>(); private synchronized RendererItem insertItemFromEvent(long arg1) { - final RendererItem item = new RendererItem(this, arg1); + final RendererItem item = nativeNewItem(arg1); index.put(arg1, item); return item; } @@ -138,4 +139,5 @@ private static Description createDescriptionFromNative(String name, String longN private native boolean nativeStart(); private native void nativeStop(); private static native Description[] nativeList(LibVLC libVLC); + private native RendererItem nativeNewItem(long ref); } diff --git a/libvlc/src/main/java/org/videolan/libvlc/RendererItem.java b/libvlc/src/main/java/org/videolan/libvlc/RendererItem.java index 0d1d7ba..d9c1b6d 100644 --- a/libvlc/src/main/java/org/videolan/libvlc/RendererItem.java +++ b/libvlc/src/main/java/org/videolan/libvlc/RendererItem.java @@ -15,17 +15,6 @@ public class RendererItem extends VLCObject { final int flags; private final long ref; - RendererItem (RendererDiscoverer rd, long ref) { - super(rd); - final RendererItem item = nativeNewItem(rd, ref); - name = item == null ? null : item.name; - displayName = item == null ? null : item.displayName; - this.type = item == null ? null : item.type; - this.iconUrl = item == null ? null : item.iconUrl; - this.flags = item == null ? 0 : item.flags; - this.ref = item == null ? ref : item.ref; - } - RendererItem(String name, String type, String iconUrl, int flags, long ref) { final int index = name.lastIndexOf('-'); this.name = name; @@ -57,6 +46,5 @@ protected Event(int type) { } } - private native RendererItem nativeNewItem(RendererDiscoverer rd, long ref); private native void nativeReleaseItem(); } diff --git a/libvlc/src/main/java/org/videolan/libvlc/VLCObject.java b/libvlc/src/main/java/org/videolan/libvlc/VLCObject.java index a221951..1144434 100644 --- a/libvlc/src/main/java/org/videolan/libvlc/VLCObject.java +++ b/libvlc/src/main/java/org/videolan/libvlc/VLCObject.java @@ -91,6 +91,12 @@ public final void release() { } } + @Override + protected synchronized void finalize() { + if (!isReleased()) + throw new AssertionError("VLCObject (" + getClass().getName() + ") finalized but not natively released (" + mNativeRefCount + " refs)"); + } + /** * Set an event listener. * Events are sent via the android main thread. diff --git a/libvlc/src/main/java/org/videolan/libvlc/util/AndroidUtil.java b/libvlc/src/main/java/org/videolan/libvlc/util/AndroidUtil.java index 9eee443..6c84f92 100644 --- a/libvlc/src/main/java/org/videolan/libvlc/util/AndroidUtil.java +++ b/libvlc/src/main/java/org/videolan/libvlc/util/AndroidUtil.java @@ -27,18 +27,19 @@ public class AndroidUtil { - public static final boolean isOOrLater = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O; - public static final boolean isNougatOrLater = isOOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; - public static final boolean isMarshMallowOrLater = isNougatOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; - public static final boolean isLolliPopOrLater = isMarshMallowOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; - public static final boolean isKitKatOrLater = isLolliPopOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; - public static final boolean isJellyBeanMR2OrLater = isKitKatOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2; - public static final boolean isJellyBeanMR1OrLater = isJellyBeanMR2OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1; - public static final boolean isJellyBeanOrLater = isJellyBeanMR1OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; - public static final boolean isICSOrLater = isJellyBeanOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH; - public static final boolean isHoneycombMr2OrLater = isICSOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2; - public static final boolean isHoneycombMr1OrLater = isHoneycombMr2OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1; - public static final boolean isHoneycombOrLater = isHoneycombMr1OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; + public static final boolean isPOrLater = android.os.Build.VERSION.SDK_INT > 27; + public static final boolean isOOrLater = isPOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O; + public static final boolean isNougatOrLater = isOOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; + public static final boolean isMarshMallowOrLater = isNougatOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; + public static final boolean isLolliPopOrLater = isMarshMallowOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; + public static final boolean isKitKatOrLater = isLolliPopOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; + public static final boolean isJellyBeanMR2OrLater = isKitKatOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2; + public static final boolean isJellyBeanMR1OrLater = isJellyBeanMR2OrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1; + public static final boolean isJellyBeanOrLater = isJellyBeanMR1OrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; + public static final boolean isICSOrLater = isJellyBeanOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH; + public static final boolean isHoneycombMr2OrLater = isICSOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2; + public static final boolean isHoneycombMr1OrLater = isHoneycombMr2OrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1; + public static final boolean isHoneycombOrLater = isHoneycombMr1OrLater || android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB; public static File UriToFile(Uri uri) { return new File(uri.getPath().replaceFirst("file://", "")); diff --git a/libvlc/src/main/java/org/videolan/libvlc/util/VLCUtil.java b/libvlc/src/main/java/org/videolan/libvlc/util/VLCUtil.java index f83a8bc..b512c33 100644 --- a/libvlc/src/main/java/org/videolan/libvlc/util/VLCUtil.java +++ b/libvlc/src/main/java/org/videolan/libvlc/util/VLCUtil.java @@ -63,8 +63,8 @@ public static String[] getABIList21() { @SuppressWarnings("deprecation") public static String[] getABIList() { final String[] abis = new String[2]; - abis[0] = Build.CPU_ABI; - abis[1] = Build.CPU_ABI2; + abis[0] = android.os.Build.CPU_ABI; + abis[1] = android.os.Build.CPU_ABI2; return abis; } diff --git a/libvlc/src/main/jniLibs/arm64-v8a/libanw.21.so b/libvlc/src/main/jniLibs/arm64-v8a/libanw.21.so index 0bb11ae..93c8acc 100644 Binary files a/libvlc/src/main/jniLibs/arm64-v8a/libanw.21.so and b/libvlc/src/main/jniLibs/arm64-v8a/libanw.21.so differ diff --git a/libvlc/src/main/jniLibs/arm64-v8a/libjniloader.so b/libvlc/src/main/jniLibs/arm64-v8a/libjniloader.so index 36d0048..d940634 100644 Binary files a/libvlc/src/main/jniLibs/arm64-v8a/libjniloader.so and b/libvlc/src/main/jniLibs/arm64-v8a/libjniloader.so differ diff --git a/libvlc/src/main/jniLibs/arm64-v8a/libvlcjni.so b/libvlc/src/main/jniLibs/arm64-v8a/libvlcjni.so index 255b340..20f657d 100644 Binary files a/libvlc/src/main/jniLibs/arm64-v8a/libvlcjni.so and b/libvlc/src/main/jniLibs/arm64-v8a/libvlcjni.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.10.so b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.10.so index f58f851..ccd5609 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.10.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.10.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.13.so b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.13.so index 25c06c0..0c3dba5 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.13.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.13.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.14.so b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.14.so index 46f5911..1e3529b 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.14.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.14.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.18.so b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.18.so index 28df48f..1b87634 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.18.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.18.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.21.so b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.21.so index 547ae27..4858cc2 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libanw.21.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libanw.21.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.10.so b/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.10.so index a0e415f..fa469d0 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.10.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.10.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.13.so b/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.13.so index 7006b3e..81ed636 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.13.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.13.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.14.so b/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.14.so index 659522e..26c30cd 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.14.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libiomx.14.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libjniloader.so b/libvlc/src/main/jniLibs/armeabi-v7a/libjniloader.so index 58c3096..7da34f1 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libjniloader.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libjniloader.so differ diff --git a/libvlc/src/main/jniLibs/armeabi-v7a/libvlcjni.so b/libvlc/src/main/jniLibs/armeabi-v7a/libvlcjni.so index 333c974..fd90487 100644 Binary files a/libvlc/src/main/jniLibs/armeabi-v7a/libvlcjni.so and b/libvlc/src/main/jniLibs/armeabi-v7a/libvlcjni.so differ diff --git a/libvlc/src/main/jniLibs/x86/libanw.10.so b/libvlc/src/main/jniLibs/x86/libanw.10.so index a6d88bb..a533398 100644 Binary files a/libvlc/src/main/jniLibs/x86/libanw.10.so and b/libvlc/src/main/jniLibs/x86/libanw.10.so differ diff --git a/libvlc/src/main/jniLibs/x86/libanw.13.so b/libvlc/src/main/jniLibs/x86/libanw.13.so index 9f1495c..03217c7 100644 Binary files a/libvlc/src/main/jniLibs/x86/libanw.13.so and b/libvlc/src/main/jniLibs/x86/libanw.13.so differ diff --git a/libvlc/src/main/jniLibs/x86/libanw.14.so b/libvlc/src/main/jniLibs/x86/libanw.14.so index bb2a586..d8781bc 100644 Binary files a/libvlc/src/main/jniLibs/x86/libanw.14.so and b/libvlc/src/main/jniLibs/x86/libanw.14.so differ diff --git a/libvlc/src/main/jniLibs/x86/libanw.18.so b/libvlc/src/main/jniLibs/x86/libanw.18.so index b5cf50c..e528fb5 100644 Binary files a/libvlc/src/main/jniLibs/x86/libanw.18.so and b/libvlc/src/main/jniLibs/x86/libanw.18.so differ diff --git a/libvlc/src/main/jniLibs/x86/libanw.21.so b/libvlc/src/main/jniLibs/x86/libanw.21.so index 0627292..02207ef 100644 Binary files a/libvlc/src/main/jniLibs/x86/libanw.21.so and b/libvlc/src/main/jniLibs/x86/libanw.21.so differ diff --git a/libvlc/src/main/jniLibs/x86/libiomx.10.so b/libvlc/src/main/jniLibs/x86/libiomx.10.so index dc7f5a4..bc325c8 100644 Binary files a/libvlc/src/main/jniLibs/x86/libiomx.10.so and b/libvlc/src/main/jniLibs/x86/libiomx.10.so differ diff --git a/libvlc/src/main/jniLibs/x86/libiomx.13.so b/libvlc/src/main/jniLibs/x86/libiomx.13.so index 52197f0..3d2a4ea 100644 Binary files a/libvlc/src/main/jniLibs/x86/libiomx.13.so and b/libvlc/src/main/jniLibs/x86/libiomx.13.so differ diff --git a/libvlc/src/main/jniLibs/x86/libiomx.14.so b/libvlc/src/main/jniLibs/x86/libiomx.14.so index 45d0d0e..7da398a 100644 Binary files a/libvlc/src/main/jniLibs/x86/libiomx.14.so and b/libvlc/src/main/jniLibs/x86/libiomx.14.so differ diff --git a/libvlc/src/main/jniLibs/x86/libjniloader.so b/libvlc/src/main/jniLibs/x86/libjniloader.so index ea4ac6c..bf57906 100644 Binary files a/libvlc/src/main/jniLibs/x86/libjniloader.so and b/libvlc/src/main/jniLibs/x86/libjniloader.so differ diff --git a/libvlc/src/main/jniLibs/x86/libvlcjni.so b/libvlc/src/main/jniLibs/x86/libvlcjni.so index d31734e..d9a4e61 100644 Binary files a/libvlc/src/main/jniLibs/x86/libvlcjni.so and b/libvlc/src/main/jniLibs/x86/libvlcjni.so differ diff --git a/libvlc/src/main/jniLibs/x86_64/libanw.21.so b/libvlc/src/main/jniLibs/x86_64/libanw.21.so index 07a4954..13b230b 100644 Binary files a/libvlc/src/main/jniLibs/x86_64/libanw.21.so and b/libvlc/src/main/jniLibs/x86_64/libanw.21.so differ diff --git a/libvlc/src/main/jniLibs/x86_64/libjniloader.so b/libvlc/src/main/jniLibs/x86_64/libjniloader.so index 6f10647..681025b 100644 Binary files a/libvlc/src/main/jniLibs/x86_64/libjniloader.so and b/libvlc/src/main/jniLibs/x86_64/libjniloader.so differ diff --git a/libvlc/src/main/jniLibs/x86_64/libvlcjni.so b/libvlc/src/main/jniLibs/x86_64/libvlcjni.so index 4ce00c1..05e94d8 100644 Binary files a/libvlc/src/main/jniLibs/x86_64/libvlcjni.so and b/libvlc/src/main/jniLibs/x86_64/libvlcjni.so differ