Commit d01d7d44 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Medialibrary: Rename Medialibrary

parent 6ad44dbf
......@@ -16,7 +16,7 @@ static JavaVM *myVm;
static fields ml_fields;
static bool m_IsInitialized = false;
#define CLASSPATHNAME "org/videolan/medialibrary/Medialibrary"
#define CLASSPATHNAME "org/videolan/medialibrary/MedialibraryImpl"
static inline void throw_IllegalStateException(JNIEnv *env, const char *p_error);
static inline void throw_IllegalArgumentException(JNIEnv *env, const char *p_error);
......@@ -1963,81 +1963,81 @@ static JNINativeMethod methods[] = {
};
static JNINativeMethod media_methods[] = {
{"nativeGetMediaLongMetadata", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JI)J", (void*)getMediaLongMetadata },
{"nativeGetMediaStringMetadata", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JI)Ljava/lang/String;", (void*)getMediaStringMetadata },
{"nativeSetMediaStringMetadata", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JILjava/lang/String;)V", (void*)setMediaStringMetadata },
{"nativeSetMediaLongMetadata", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIJ)V", (void*)setMediaLongMetadata },
{"nativeSetMediaThumbnail", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;)V", (void*)setMediaThumbnail },
{"nativeSetMediaTitle", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;)V", (void*)setMediaTitle },
{"nativeRemoveFromHistory", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)V", (void*)removeMediaFromHistory },
{"nativeRequestThumbnail", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIIIF)V", (void*)requestThumbnail },
{"nativeGetMediaLongMetadata", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JI)J", (void*)getMediaLongMetadata },
{"nativeGetMediaStringMetadata", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JI)Ljava/lang/String;", (void*)getMediaStringMetadata },
{"nativeSetMediaStringMetadata", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JILjava/lang/String;)V", (void*)setMediaStringMetadata },
{"nativeSetMediaLongMetadata", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIJ)V", (void*)setMediaLongMetadata },
{"nativeSetMediaThumbnail", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;)V", (void*)setMediaThumbnail },
{"nativeSetMediaTitle", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;)V", (void*)setMediaTitle },
{"nativeRemoveFromHistory", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)V", (void*)removeMediaFromHistory },
{"nativeRequestThumbnail", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIIIF)V", (void*)requestThumbnail },
};
static JNINativeMethod album_methods[] = {
{"nativeGetTracks", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getTracksFromAlbum },
{"nativeGetPagedTracks", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedTracksFromAlbum },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchFromAlbum },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;)I", (void*)getSearchFromAlbumCount },
{"nativeGetTracksCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)I", (void*)getTracksFromAlbumCount },
{"nativeGetTracks", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getTracksFromAlbum },
{"nativeGetPagedTracks", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedTracksFromAlbum },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchFromAlbum },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;)I", (void*)getSearchFromAlbumCount },
{"nativeGetTracksCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)I", (void*)getTracksFromAlbumCount },
};
static JNINativeMethod artist_methods[] = {
{"nativeGetMedia", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getMediaFromArtist },
{"nativeGetAlbums", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)getAlbumsFromArtist },
{"nativeGetPagedMedia", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedMediaFromArtist },
{"nativeGetPagedAlbums", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)getPagedAlbumsFromArtist },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchFromArtist },
{"nativeSearchAlbums", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)searchAlbumsFromArtist },
{"nativeGetTracksCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)I", (void*)getArtistTracksCount },
{"nativeGetAlbumsCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)I", (void*)getArtistAlbumsCount },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;)I", (void*)getSearchFromArtistCount },
{"nativeGetSearchAlbumCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;)I", (void*)getSearchAlbumFromArtistCount },
{"nativeGetMedia", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getMediaFromArtist },
{"nativeGetAlbums", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)getAlbumsFromArtist },
{"nativeGetPagedMedia", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedMediaFromArtist },
{"nativeGetPagedAlbums", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)getPagedAlbumsFromArtist },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchFromArtist },
{"nativeSearchAlbums", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)searchAlbumsFromArtist },
{"nativeGetTracksCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)I", (void*)getArtistTracksCount },
{"nativeGetAlbumsCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)I", (void*)getArtistAlbumsCount },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;)I", (void*)getSearchFromArtistCount },
{"nativeGetSearchAlbumCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;)I", (void*)getSearchAlbumFromArtistCount },
};
static JNINativeMethod genre_methods[] = {
{"nativeGetTracks", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JZIZ)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getMediaFromGenre },
{"nativeGetAlbums", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)getAlbumsFromGenre },
{"nativeGetArtists", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/AbstractArtist;", (void*)getArtistsFromGenre },
{"nativeGetPagedTracks", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JZIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedMediaFromGenre },
{"nativeGetPagedAlbums", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)getPagedAlbumsFromGenre },
{"nativeGetPagedArtists", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractArtist;", (void*)getPagedArtistsFromGenre },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchMediaFromGenre },
{"nativeSearchAlbums", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)searchAlbumsFromGenre },
{"nativeGetTracksCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)I", (void*)getGenreTracksCount },
{"nativeGetAlbumsCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)I", (void*)getGenreAlbumsCount },
{"nativeGetArtistsCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)I", (void*)getGenreArtistsCount },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;)I", (void*)getSearchMediaFromGenreCount },
{"nativeGetSearchAlbumCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;)I", (void*)getSearchAlbumsFromGenreCount },
{"nativeGetTracks", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JZIZ)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getMediaFromGenre },
{"nativeGetAlbums", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)getAlbumsFromGenre },
{"nativeGetArtists", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZ)[Lorg/videolan/medialibrary/interfaces/media/AbstractArtist;", (void*)getArtistsFromGenre },
{"nativeGetPagedTracks", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JZIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedMediaFromGenre },
{"nativeGetPagedAlbums", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)getPagedAlbumsFromGenre },
{"nativeGetPagedArtists", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractArtist;", (void*)getPagedArtistsFromGenre },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchMediaFromGenre },
{"nativeSearchAlbums", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractAlbum;", (void*)searchAlbumsFromGenre },
{"nativeGetTracksCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)I", (void*)getGenreTracksCount },
{"nativeGetAlbumsCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)I", (void*)getGenreAlbumsCount },
{"nativeGetArtistsCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)I", (void*)getGenreArtistsCount },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;)I", (void*)getSearchMediaFromGenreCount },
{"nativeGetSearchAlbumCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;)I", (void*)getSearchAlbumsFromGenreCount },
};
static JNINativeMethod folder_methods[] = {
{"nativeMedia", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)mediaFromFolder },
{"nativeSubfolders", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractFolder;", (void*)subFolders },
{"nativeMediaCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JI)I", (void*)mediaFromFolderCount },
{"nativeSubfoldersCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JI)I", (void*)subFoldersCount },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;IIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchMediaFromFolder },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;I)I", (void*)getSearchMediaFromFolderCount },
{"nativeMedia", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)mediaFromFolder },
{"nativeSubfolders", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JIZII)[Lorg/videolan/medialibrary/interfaces/media/AbstractFolder;", (void*)subFolders },
{"nativeMediaCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JI)I", (void*)mediaFromFolderCount },
{"nativeSubfoldersCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JI)I", (void*)subFoldersCount },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;IIZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchMediaFromFolder },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;I)I", (void*)getSearchMediaFromFolderCount },
};
static JNINativeMethod videogroup_methods[] = {
{"nativeMedia", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;Ljava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedMediaFromvideoGroup },
// {"nativeMediaCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JI)I", (void*)getvideoGroupMediaCount },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;Ljava/lang/String;Ljava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchFromvideoGroup },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;Ljava/lang/String;Ljava/lang/String;)I", (void*)getSearchFromvideoGroupCount },
{"nativeMedia", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;Ljava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedMediaFromvideoGroup },
// {"nativeMediaCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JI)I", (void*)getvideoGroupMediaCount },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;Ljava/lang/String;Ljava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchFromvideoGroup },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;Ljava/lang/String;Ljava/lang/String;)I", (void*)getSearchFromvideoGroupCount },
};
static JNINativeMethod playlist_methods[] = {
{"nativeGetTracks", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getMediaFromPlaylist },
{"nativeGetPagedTracks", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedMediaFromPlaylist },
{"nativeGetTracksCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)I", (void*)getPlaylistTracksCount },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchFromPlaylist },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JLjava/lang/String;)I", (void*)getSearchFromPlaylistCount },
{"nativePlaylistAppend", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JJ)Z", (void*)playlistAppend },
{"nativePlaylistAppendGroup", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J[J)Z", (void*)playlistAppendGroup },
{"nativePlaylistAdd", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JJI)Z", (void*)playlistAdd },
{"nativePlaylistMove", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JII)Z", (void*)playlistMove },
{"nativePlaylistRemove", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;JI)Z", (void*)playlistRemove },
{"nativePlaylistDelete", "(Lorg/videolan/medialibrary/interfaces/AbstractMedialibrary;J)Z", (void*)playlistDelete },
{"nativeGetTracks", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getMediaFromPlaylist },
{"nativeGetPagedTracks", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getPagedMediaFromPlaylist },
{"nativeGetTracksCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)I", (void*)getPlaylistTracksCount },
{"nativeSearch", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;IZII)[Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)searchFromPlaylist },
{"nativeGetSearchCount", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JLjava/lang/String;)I", (void*)getSearchFromPlaylistCount },
{"nativePlaylistAppend", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JJ)Z", (void*)playlistAppend },
{"nativePlaylistAppendGroup", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J[J)Z", (void*)playlistAppendGroup },
{"nativePlaylistAdd", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JJI)Z", (void*)playlistAdd },
{"nativePlaylistMove", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JII)Z", (void*)playlistMove },
{"nativePlaylistRemove", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;JI)Z", (void*)playlistRemove },
{"nativePlaylistDelete", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;J)Z", (void*)playlistDelete },
};
/* This function is called when a thread attached to the Java VM is canceled or
......
......@@ -5,7 +5,7 @@ import android.net.Uri;
import android.os.Parcel;
import org.videolan.libvlc.interfaces.IMedia;
import org.videolan.medialibrary.interfaces.AbstractMedialibrary;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.interfaces.media.AbstractAlbum;
import org.videolan.medialibrary.interfaces.media.AbstractArtist;
import org.videolan.medialibrary.interfaces.media.AbstractFolder;
......@@ -32,11 +32,11 @@ import org.videolan.medialibrary.stubs.StubVideoGroup;
public class MLServiceLocator {
private static LocatorMode sMode = LocatorMode.VLC_ANDROID;
private static volatile AbstractMedialibrary instance;
private static volatile Medialibrary instance;
public static void setLocatorMode(LocatorMode mode) {
if (instance != null && mode != sMode) {
throw new IllegalStateException("LocatorMode must be set before AbstractMedialibrary initialization");
throw new IllegalStateException("LocatorMode must be set before Medialibrary initialization");
}
MLServiceLocator.sMode = mode;
}
......@@ -48,9 +48,9 @@ public class MLServiceLocator {
TESTS,
}
public static synchronized AbstractMedialibrary getAbstractMedialibrary() {
public static synchronized Medialibrary getAbstractMedialibrary() {
if (instance == null) {
instance = sMode == LocatorMode.VLC_ANDROID ? new Medialibrary() : new StubMedialibrary();
instance = sMode == LocatorMode.VLC_ANDROID ? new MedialibraryImpl() : new StubMedialibrary();
}
return instance;
}
......
/*****************************************************************************
* Medialibrary.java
* MedialibraryImpl.java
*****************************************************************************
* Copyright © 2017-2018 VLC authors and VideoLAN
* Copyright © 2017-2019 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -30,7 +30,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import org.videolan.libvlc.LibVLC;
import org.videolan.medialibrary.interfaces.AbstractMedialibrary;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.interfaces.media.AbstractAlbum;
import org.videolan.medialibrary.interfaces.media.AbstractArtist;
import org.videolan.medialibrary.interfaces.media.AbstractFolder;
......@@ -42,7 +42,7 @@ import org.videolan.medialibrary.media.SearchAggregate;
import java.io.File;
public class Medialibrary extends AbstractMedialibrary {
public class MedialibraryImpl extends Medialibrary {
private static final String TAG = "VLC/JMedialibrary";
public int init(Context context) {
......@@ -230,7 +230,7 @@ public class Medialibrary extends AbstractMedialibrary {
@WorkerThread
public AbstractAlbum[] getAlbums() {
return getAlbums(AbstractMedialibrary.SORT_DEFAULT, false);
return getAlbums(Medialibrary.SORT_DEFAULT, false);
}
@WorkerThread
......@@ -259,7 +259,7 @@ public class Medialibrary extends AbstractMedialibrary {
@WorkerThread
public AbstractArtist[] getArtists(boolean all) {
return getArtists(all, AbstractMedialibrary.SORT_DEFAULT, false);
return getArtists(all, Medialibrary.SORT_DEFAULT, false);
}
@WorkerThread
......@@ -286,7 +286,7 @@ public class Medialibrary extends AbstractMedialibrary {
@WorkerThread
public AbstractGenre[] getGenres() {
return getGenres(AbstractMedialibrary.SORT_DEFAULT, false);
return getGenres(Medialibrary.SORT_DEFAULT, false);
}
@WorkerThread
......@@ -314,7 +314,7 @@ public class Medialibrary extends AbstractMedialibrary {
@WorkerThread
public AbstractPlaylist[] getPlaylists() {
return getPlaylists(AbstractMedialibrary.SORT_DEFAULT, false);
return getPlaylists(Medialibrary.SORT_DEFAULT, false);
}
@WorkerThread
......
/*****************************************************************************
* Medialibrary.java
*****************************************************************************
* Copyright © 2019 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
package org.videolan.medialibrary.interfaces;
import android.Manifest;
......@@ -30,7 +50,7 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
abstract public class AbstractMedialibrary {
abstract public class Medialibrary {
// Sorting
public final static int SORT_DEFAULT = 0;
......@@ -91,7 +111,7 @@ abstract public class AbstractMedialibrary {
protected static Context sContext;
public static LiveData<MediaWrapper> lastThumb = new SingleEvent<>();
protected static final AbstractMedialibrary instance = MLServiceLocator.getAbstractMedialibrary();
protected static final Medialibrary instance = MLServiceLocator.getAbstractMedialibrary();
public static Context getContext() {
return sContext;
......@@ -117,7 +137,7 @@ abstract public class AbstractMedialibrary {
}
@NonNull
public static AbstractMedialibrary getInstance() {
public static Medialibrary getInstance() {
return instance;
}
......
......@@ -7,12 +7,12 @@ import android.text.TextUtils;
import org.videolan.libvlc.util.VLCUtil;
import org.videolan.medialibrary.R;
import org.videolan.medialibrary.MLServiceLocator;
import org.videolan.medialibrary.interfaces.AbstractMedialibrary;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.media.MediaLibraryItem;
public abstract class AbstractAlbum extends MediaLibraryItem {
public static class SpecialRes {
public static String UNKNOWN_ALBUM = AbstractMedialibrary.getContext().getString(R.string.unknown_album);
public static String UNKNOWN_ALBUM = Medialibrary.getContext().getString(R.string.unknown_album);
}
protected int releaseYear;
......@@ -88,7 +88,7 @@ public abstract class AbstractAlbum extends MediaLibraryItem {
@Override
public MediaWrapper[] getTracks() {
return getTracks(AbstractMedialibrary.SORT_ALBUM, false);
return getTracks(Medialibrary.SORT_ALBUM, false);
}
@Override
......
......@@ -6,7 +6,7 @@ import android.os.Parcelable;
import org.videolan.libvlc.util.VLCUtil;
import org.videolan.medialibrary.R;
import org.videolan.medialibrary.MLServiceLocator;
import org.videolan.medialibrary.interfaces.AbstractMedialibrary;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.media.MediaLibraryItem;
abstract public class AbstractArtist extends MediaLibraryItem {
......@@ -16,8 +16,8 @@ abstract public class AbstractArtist extends MediaLibraryItem {
private String musicBrainzId;
public static class SpecialRes {
public static String UNKNOWN_ARTIST = AbstractMedialibrary.getContext().getString(R.string.unknown_artist);
public static String VARIOUS_ARTISTS = AbstractMedialibrary.getContext().getString(R.string.various_artists);
public static String UNKNOWN_ARTIST = Medialibrary.getContext().getString(R.string.unknown_artist);
public static String VARIOUS_ARTISTS = Medialibrary.getContext().getString(R.string.various_artists);
}
public AbstractArtist(long id, String name, String shortBio, String artworkMrl, String musicBrainzId) {
......@@ -65,12 +65,12 @@ abstract public class AbstractArtist extends MediaLibraryItem {
}
public AbstractAlbum[] getAlbums() {
return getAlbums(AbstractMedialibrary.SORT_DEFAULT, false);
return getAlbums(Medialibrary.SORT_DEFAULT, false);
}
@Override
public MediaWrapper[] getTracks() {
return getTracks(AbstractMedialibrary.SORT_ALBUM, true);
return getTracks(Medialibrary.SORT_ALBUM, true);
}
@Override
......
......@@ -4,7 +4,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import org.videolan.medialibrary.MLServiceLocator;
import org.videolan.medialibrary.interfaces.AbstractMedialibrary;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.media.MediaLibraryItem;
public abstract class AbstractGenre extends MediaLibraryItem {
......@@ -33,13 +33,13 @@ public abstract class AbstractGenre extends MediaLibraryItem {
}
public AbstractAlbum[] getAlbums() {
return getAlbums(AbstractMedialibrary.SORT_DEFAULT, false);
return getAlbums(Medialibrary.SORT_DEFAULT, false);
}
public AbstractArtist[] getArtists() {
return getArtists(AbstractMedialibrary.SORT_DEFAULT, false);
return getArtists(Medialibrary.SORT_DEFAULT, false);
}
public MediaWrapper[] getTracks() {
return getTracks(false, AbstractMedialibrary.SORT_ALBUM, false);
return getTracks(false, Medialibrary.SORT_ALBUM, false);
}
@Override
public int getItemType() {
......
......@@ -2,7 +2,7 @@ package org.videolan.medialibrary.media;
import android.os.Parcel;
import org.videolan.medialibrary.interfaces.AbstractMedialibrary;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.interfaces.media.AbstractAlbum;
import org.videolan.medialibrary.interfaces.media.AbstractArtist;
import org.videolan.medialibrary.interfaces.media.MediaWrapper;
......@@ -20,27 +20,27 @@ public class Album extends AbstractAlbum {
}
public int getRealTracksCount() {
AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetTracksCount(ml, mId) : 0;
}
public MediaWrapper[] getTracks(int sort, boolean desc) {
AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
return ml.isInitiated() ? nativeGetTracks(ml, mId, sort, desc) : AbstractMedialibrary.EMPTY_COLLECTION;
Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetTracks(ml, mId, sort, desc) : Medialibrary.EMPTY_COLLECTION;
}
public MediaWrapper[] getPagedTracks(int sort, boolean desc, int nbItems, int offset) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
return ml.isInitiated() ? nativeGetPagedTracks(ml, mId, sort, desc, nbItems, offset) : AbstractMedialibrary.EMPTY_COLLECTION;
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetPagedTracks(ml, mId, sort, desc, nbItems, offset) : Medialibrary.EMPTY_COLLECTION;
}
public MediaWrapper[] searchTracks(String query, int sort, boolean desc, int nbItems, int offset) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
return ml.isInitiated() ? nativeSearch(ml, mId, query, sort, desc, nbItems, offset) : AbstractMedialibrary.EMPTY_COLLECTION;
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeSearch(ml, mId, query, sort, desc, nbItems, offset) : Medialibrary.EMPTY_COLLECTION;
}
public int searchTracksCount(String query) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetSearchCount(ml, mId, query) : 0;
}
......@@ -49,9 +49,9 @@ public class Album extends AbstractAlbum {
return null;
}
private native MediaWrapper[] nativeGetTracks(AbstractMedialibrary ml, long mId, int sort, boolean desc);
private native MediaWrapper[] nativeGetPagedTracks(AbstractMedialibrary ml, long mId, int sort, boolean desc, int nbItems, int offset);
private native MediaWrapper[] nativeSearch(AbstractMedialibrary ml, long mId, String query, int sort, boolean desc, int nbItems, int offset);
private native int nativeGetTracksCount(AbstractMedialibrary ml, long id);
private native int nativeGetSearchCount(AbstractMedialibrary ml, long mId, String query);
private native MediaWrapper[] nativeGetTracks(Medialibrary ml, long mId, int sort, boolean desc);
private native MediaWrapper[] nativeGetPagedTracks(Medialibrary ml, long mId, int sort, boolean desc, int nbItems, int offset);
private native MediaWrapper[] nativeSearch(Medialibrary ml, long mId, String query, int sort, boolean desc, int nbItems, int offset);
private native int nativeGetTracksCount(Medialibrary ml, long id);
private native int nativeGetSearchCount(Medialibrary ml, long mId, String query);
}
......@@ -2,7 +2,7 @@ package org.videolan.medialibrary.media;
import android.os.Parcel;
import org.videolan.medialibrary.interfaces.AbstractMedialibrary;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.interfaces.media.AbstractAlbum;
import org.videolan.medialibrary.interfaces.media.AbstractArtist;
import org.videolan.medialibrary.interfaces.media.MediaWrapper;
......@@ -21,65 +21,65 @@ public class Artist extends AbstractArtist {
}
public AbstractAlbum[] getAlbums(int sort, boolean desc) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetAlbums(ml, mId, sort, desc) : new AbstractAlbum[0];
}
@NonNull
public AbstractAlbum[] getPagedAlbums(int sort, boolean desc, int nbItems, int offset) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetPagedAlbums(ml, mId, sort, desc, nbItems, offset) : new AbstractAlbum[0];
}
public AbstractAlbum[] searchAlbums(String query, int sort, boolean desc, int nbItems, int offset) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeSearchAlbums(ml, mId, query, sort, desc, nbItems, offset) : new AbstractAlbum[0];
}
public int searchAlbumsCount(String query) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetSearchAlbumCount(ml, mId, query) : 0;
}
public MediaWrapper[] searchTracks(String query, int sort, boolean desc, int nbItems, int offset) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
return ml.isInitiated() ? nativeSearch(ml, mId, query, sort, desc, nbItems, offset) : AbstractMedialibrary.EMPTY_COLLECTION;
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeSearch(ml, mId, query, sort, desc, nbItems, offset) : Medialibrary.EMPTY_COLLECTION;
}
public int searchTracksCount(String query) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetSearchCount(ml, mId, query) : 0;
}
public int getAlbumsCount() {
AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetAlbumsCount(ml, mId) : 0;
}
public MediaWrapper[] getTracks(int sort, boolean desc) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
return ml.isInitiated() ? nativeGetMedia(ml, mId, sort, desc) : AbstractMedialibrary.EMPTY_COLLECTION;
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetMedia(ml, mId, sort, desc) : Medialibrary.EMPTY_COLLECTION;
}
public MediaWrapper[] getPagedTracks(int sort, boolean desc, int nbItems, int offset) {
final AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
return ml.isInitiated() ? nativeGetPagedMedia(ml, mId, sort, desc, nbItems, offset) : AbstractMedialibrary.EMPTY_COLLECTION;
final Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetPagedMedia(ml, mId, sort, desc, nbItems, offset) : Medialibrary.EMPTY_COLLECTION;
}
@Override
public int getTracksCount() {
AbstractMedialibrary ml = AbstractMedialibrary.getInstance();
Medialibrary ml = Medialibrary.getInstance();
return ml.isInitiated() ? nativeGetTracksCount(ml, mId) : 0;
}
private native AbstractAlbum[] nativeGetAlbums(AbstractMedialibrary ml, long mId, int sort, boolean desc);
private native MediaWrapper[] nativeGetMedia(AbstractMedialibrary ml, long mId, int sort, boolean desc);
private native AbstractAlbum[] nativeGetPagedAlbums(AbstractMedialibrary ml, long mId, int sort, boolean desc, int nbItems, int offset);
private native MediaWrapper[] nativeGetPagedMedia(AbstractMedialibrary ml, long mId, int sort, boolean desc, int nbItems, int offset);
private native AbstractAlbum[] nativeSearchAlbums(AbstractMedialibrary ml, long mId, String query, int sort, boolean desc, int nbItems, int offset);
private native MediaWrapper[] nativeSearch(AbstractMedialibrary ml, long mId, String query, int sort, boolean desc, int nbItems, int offset);
private native int nativeGetTracksCount(AbstractMedialibrary ml, long mId);
private native int nativeGetAlbumsCount(AbstractMedialibrary ml, long mId);
private native int nativeGetSearchCount(AbstractMedialibrary ml, long mId, String query);
private native int nativeGetSearchAlbumCount(AbstractMedialibrary ml, long mId, String query);
private native AbstractAlbum[] nativeGetAlbums(Medialibrary ml, long mId, int sort, boolean desc);
private native MediaWrapper[] nativeGetMedia(Medialibrary ml, long mId, int sort, boolean desc);
private native AbstractAlbum[] nativeGetPagedAlbums(Medialibrary ml, long mId, int sort, boolean desc, int nbItems, int offset);
private native MediaWrapper[] nativeGetPagedMedia(Medialibrary ml, long mId, int sort, boolean desc, int nbItems, int offset);
private native AbstractAlbum[] nativeSearchAlbums(Medialibrary ml, long mId, String query, int sort, boolean desc, int nbItems, int offset);
private native MediaWrapper[] nativeSearch(Medialibrary ml, long mId, String query, int sort, boolean desc, int nbItems, int offset);
private native int nativeGetTracksCount(Medialibrary ml, long mId);
private native int nativeGetAlbumsCount(Medialibrary ml, long mId);
private native int nativeGetSearchCount(Medialibrary ml, long mId, String query);
private native int nativeGetSearchAlbumCount(Medialibrary ml, long mId, String query);
}
......@@ -4,7 +4,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import org.videolan.medialibrary.interfaces.AbstractMedialibrary;
import org.videolan.medialibrary.interfaces.Medialibrary;
import org.videolan.medialibrary.interfaces.media.MediaWrapper;
public class DummyItem extends MediaLibraryItem {
......@@ -22,7 +22,7 @@ public class DummyItem extends MediaLibraryItem {
@Override
public MediaWrapper[] getTracks() {
return AbstractMedialibrary.EMPTY_COLLECTION;
return Medialibrary.EMPTY_COLLECTION;
}
@Override
......