Skip to content

Commit

Permalink
Merge branch '3.0.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
masterwok committed Oct 7, 2018
2 parents 68f2643 + 21300c5 commit 076524b
Show file tree
Hide file tree
Showing 35 changed files with 52 additions and 29 deletions.
25 changes: 25 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion buildlibvlc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

tag='3.0.11'
tag='3.0.13'

rootdir=`dirname $0`

Expand Down
1 change: 1 addition & 0 deletions libvlc/src/main/java/org/videolan/libvlc/MediaPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void stop() {
if (isReleased()) throw new IllegalStateException("MediaDiscoverer is released");
setEventListener(null);
nativeStop();
release();
}

public void setEventListener(EventListener listener) {
Expand Down Expand Up @@ -111,7 +112,7 @@ protected Event onEventNative(int eventType, long arg1, long arg2, float argf1)

private final LongSparseArray<RendererItem> 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;
}
Expand All @@ -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);
}
12 changes: 0 additions & 12 deletions libvlc/src/main/java/org/videolan/libvlc/RendererItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ public class RendererItem extends VLCObject<RendererItem.Event> {
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;
Expand Down Expand Up @@ -57,6 +46,5 @@ protected Event(int type) {
}
}

private native RendererItem nativeNewItem(RendererDiscoverer rd, long ref);
private native void nativeReleaseItem();
}
6 changes: 6 additions & 0 deletions libvlc/src/main/java/org/videolan/libvlc/VLCObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 13 additions & 12 deletions libvlc/src/main/java/org/videolan/libvlc/util/AndroidUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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://", ""));
Expand Down
4 changes: 2 additions & 2 deletions libvlc/src/main/java/org/videolan/libvlc/util/VLCUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading

0 comments on commit 076524b

Please sign in to comment.