[Android] Implement isPresent for media groups

Nicolas Pomepuy git at videolan.org
Thu Jun 10 09:40:57 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Feb  1 16:13:46 2021 +0100| [6d002a8b507ca5c82770828f428274b086ffc23f] | committer: Nicolas Pomepuy

Implement isPresent for media groups

> https://code.videolan.org/videolan/vlc-android/commit/6d002a8b507ca5c82770828f428274b086ffc23f
---

 buildsystem/compile-medialibrary.sh                     |  2 +-
 medialibrary/jni/medialibrary.cpp                       |  2 +-
 medialibrary/jni/utils.cpp                              |  2 +-
 .../medialibrary/interfaces/media/VideoGroup.java       | 17 ++++++++++++++++-
 .../org/videolan/medialibrary/media/VideoGroupImpl.java |  4 ++--
 .../org/videolan/medialibrary/stubs/StubVideoGroup.java |  4 ++--
 6 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/buildsystem/compile-medialibrary.sh b/buildsystem/compile-medialibrary.sh
index 54816d62c..9bf7e76dc 100755
--- a/buildsystem/compile-medialibrary.sh
+++ b/buildsystem/compile-medialibrary.sh
@@ -4,7 +4,7 @@
 # ARGUMENTS #
 #############
 
-MEDIALIBRARY_HASH=15b693d5d86e5ffce763cb212dcb966ab590a022
+MEDIALIBRARY_HASH=e915b79ae51ec76cf045d1096d4657a07dc6beee
 
 while [ $# -gt 0 ]; do
   case $1 in
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 132c5586e..dc3cd8349 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -2348,7 +2348,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)
     GET_ID(GetMethodID,
            ml_fields.VideoGroup.initID,
            ml_fields.VideoGroup.clazz,
-           "<init>", "(JLjava/lang/String;I)V");
+           "<init>", "(JLjava/lang/String;II)V");
 
     GET_CLASS(ml_fields.Bookmark.clazz, "org/videolan/medialibrary/media/BookmarkImpl", true);
     if (env->RegisterNatives(ml_fields.Bookmark.clazz, bookmark_methods, sizeof(bookmark_methods) / sizeof(bookmark_methods[0])) < 0) {
diff --git a/medialibrary/jni/utils.cpp b/medialibrary/jni/utils.cpp
index f54a38176..bfd8839ac 100644
--- a/medialibrary/jni/utils.cpp
+++ b/medialibrary/jni/utils.cpp
@@ -163,7 +163,7 @@ convertVideoGroupObject(JNIEnv* env, fields *fields, medialibrary::MediaGroupPtr
 {
     jstring name = env->NewStringUTF(videogroupPtr->name().c_str());
     jobject item = env->NewObject(fields->VideoGroup.clazz, fields->VideoGroup.initID,
-                          (jlong) videogroupPtr->id(), name, (jint)videogroupPtr->nbVideo());
+                          (jlong) videogroupPtr->id(), name, (jint)videogroupPtr->nbVideo(), (jint)videogroupPtr->nbPresentVideo());
     env->DeleteLocalRef(name);
     return item;
 }
diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/media/VideoGroup.java b/medialibrary/src/org/videolan/medialibrary/interfaces/media/VideoGroup.java
index ee9870718..f439c3c1b 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/media/VideoGroup.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/media/VideoGroup.java
@@ -13,10 +13,13 @@ import org.videolan.medialibrary.media.MediaLibraryItem;
 public abstract class VideoGroup extends MediaLibraryItem {
 
     public int mCount;
+    public int mPresentCount;
+    public boolean isNetwork = false;
 
-    public VideoGroup(long id, String name, int count) {
+    public VideoGroup(long id, String name, int count, int presentCount) {
         super(id, name);
         mCount = count;
+        mPresentCount = presentCount;
     }
 
     abstract public MediaWrapper[] media(int sort, boolean desc, boolean includeMissing, int nbItems, int offset);
@@ -38,6 +41,10 @@ public abstract class VideoGroup extends MediaLibraryItem {
         return mCount;
     }
 
+    public int getPresentCount() {
+        return mPresentCount;
+    }
+
     @Override
     public MediaWrapper[] getTracks() {
         return new MediaWrapper[0];
@@ -53,6 +60,14 @@ public abstract class VideoGroup extends MediaLibraryItem {
         return TYPE_VIDEO_GROUP;
     }
 
+    public boolean isNetwork() {
+        return isNetwork;
+    }
+
+    public void setNetwork(boolean network) {
+        isNetwork = network;
+    }
+
     @Override
     public void writeToParcel(Parcel parcel, int i) {
         super.writeToParcel(parcel, i);
diff --git a/medialibrary/src/org/videolan/medialibrary/media/VideoGroupImpl.java b/medialibrary/src/org/videolan/medialibrary/media/VideoGroupImpl.java
index b1f29839c..682e67f79 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/VideoGroupImpl.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/VideoGroupImpl.java
@@ -13,8 +13,8 @@ import org.videolan.medialibrary.interfaces.media.VideoGroup;
 public class VideoGroupImpl extends VideoGroup {
 
     @SuppressWarnings("unused") /* Used from JNI */
-    VideoGroupImpl(long id, String name, int count) {
-        super(id, name, count);
+    VideoGroupImpl(long id, String name, int count, int presentCount) {
+        super(id, name, count, presentCount);
     }
 
     public VideoGroupImpl(Parcel in) {
diff --git a/medialibrary/src/org/videolan/medialibrary/stubs/StubVideoGroup.java b/medialibrary/src/org/videolan/medialibrary/stubs/StubVideoGroup.java
index 28e1f1b76..b34e793fc 100644
--- a/medialibrary/src/org/videolan/medialibrary/stubs/StubVideoGroup.java
+++ b/medialibrary/src/org/videolan/medialibrary/stubs/StubVideoGroup.java
@@ -6,8 +6,8 @@ import org.videolan.medialibrary.interfaces.media.MediaWrapper;
 import org.videolan.medialibrary.interfaces.media.VideoGroup;
 
 public class StubVideoGroup extends VideoGroup {
-    public StubVideoGroup(String name, int count) {
-        super(0L, name, count);
+    public StubVideoGroup(String name, int count, int presentCount) {
+        super(0L, name, count, presentCount);
     }
 
     public StubVideoGroup(Parcel in) {



More information about the Android mailing list