mirror of
https://github.com/videolan/vlc-android
synced 2024-12-12 19:24:41 +08:00
Ml: Subscriptions add nbMedia new API
This commit is contained in:
parent
762d336e2d
commit
46c5f37616
@ -2303,7 +2303,7 @@ getSubscriptionNbUnplayedMedia(JNIEnv *env, jobject thiz, jobject medialibrary,
|
||||
{
|
||||
AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, medialibrary);
|
||||
medialibrary::SubscriptionPtr subscriptionPtr = aml->subscription(id);
|
||||
if (subscriptionPtr == nullptr) return false;
|
||||
if (subscriptionPtr == nullptr) return -1;
|
||||
return subscriptionPtr->nbUnplayedMedia();
|
||||
}
|
||||
|
||||
@ -2368,6 +2368,15 @@ getSubscriptionMedia(JNIEnv* env, jobject thiz, jobject ml, jlong id, jint sorti
|
||||
return subsRefs;
|
||||
}
|
||||
|
||||
jint getSubscriptionNbMedia(JNIEnv* env, jobject thiz, jobject ml, jlong id)
|
||||
{
|
||||
AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, ml);
|
||||
medialibrary::SubscriptionPtr subscriptionPtr = aml->subscription(id);
|
||||
if (subscriptionPtr == nullptr) return -1;
|
||||
return subscriptionPtr->nbMedia();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* JNI stuff
|
||||
*/
|
||||
@ -2600,7 +2609,8 @@ static JNINativeMethod subscription_methods[] = {
|
||||
{"nativeGetChildSubscriptions", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZZ)[Lorg/videolan/medialibrary/interfaces/media/Subscription;", (void*)getChildSubscriptions},
|
||||
{"nativeGetParent", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)Lorg/videolan/medialibrary/interfaces/media/Subscription;", (void*)getParent},
|
||||
{"nativeSubscriptionRefresh", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)Z", (void*)refresh},
|
||||
{"nativeGetSubscriptionMedia", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZZ)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getSubscriptionMedia}
|
||||
{"nativeGetSubscriptionMedia", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZZ)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getSubscriptionMedia},
|
||||
{"nativeGetSubscriptionNbMedia", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)I", (void*)getSubscriptionNbMedia},
|
||||
};
|
||||
|
||||
/* This function is called when a thread attached to the Java VM is canceled or
|
||||
|
@ -34,4 +34,5 @@ public abstract class Subscription {
|
||||
public abstract Subscription getParent();
|
||||
public abstract MediaWrapper[] getMedia(int sortingCriteria, boolean desc, boolean includeMissing);
|
||||
public abstract boolean refresh();
|
||||
public abstract int getNbMedia();
|
||||
}
|
||||
|
@ -75,6 +75,12 @@ public class SubscriptionImpl extends Subscription {
|
||||
return nativeGetSubscriptionMedia(ml, id, sortingCriteria, desc, includeMissing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNbMedia() {
|
||||
final Medialibrary ml = Medialibrary.getInstance();
|
||||
return nativeGetSubscriptionNbMedia(ml, id);
|
||||
}
|
||||
|
||||
private native int nativeSubscriptionNewMediaNotification(Medialibrary ml, long id);
|
||||
private native boolean nativeSetSubscriptionNewMediaNotification(Medialibrary ml, long id, int value);
|
||||
private native long nativeGetSubscriptionCachedSize(Medialibrary ml, long id);
|
||||
@ -85,4 +91,5 @@ public class SubscriptionImpl extends Subscription {
|
||||
private native Subscription nativeGetParent(Medialibrary ml, long id);
|
||||
private native boolean nativeSubscriptionRefresh(Medialibrary ml, long id);
|
||||
private native MediaWrapper[] nativeGetSubscriptionMedia(Medialibrary ml, long id, int sortingCriteria, boolean desc, boolean includeMissing);
|
||||
private native int nativeGetSubscriptionNbMedia(Medialibrary ml, long id);
|
||||
}
|
||||
|
@ -63,4 +63,9 @@ public class StubSubscription extends Subscription {
|
||||
public boolean refresh() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNbMedia() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user