[Android] [PATCH 04/14] refactor Media/MediaList/MediaListPlayer

Thomas Guillem thomas at gllm.fr
Fri Jan 16 17:12:04 CET 2015


Prepare for new Media* class that follow libvlc API.

Rename Media to MediaWrapper since it's a wrapper of the future Media class,
and also a wrapper of MediaDatabase elements.

Move these classes from libvlc to vlc-android since these classes depends too
much of the vlc application. Indeed there are mainly used by MediaDatabase that
belongs to application and not the lib.
---
 libvlc/src/org/videolan/libvlc/EventHandler.java   |   2 +-
 libvlc/src/org/videolan/libvlc/LibVLC.java         |   3 +-
 libvlc/src/org/videolan/libvlc/Media.aidl          |  23 --
 libvlc/src/org/videolan/libvlc/Media.java          | 443 --------------------
 libvlc/src/org/videolan/libvlc/MediaList.java      | 159 --------
 .../src/org/videolan/libvlc/MediaListPlayer.java   |  89 ----
 .../src/org/videolan/vlc/MediaDatabase.java        |  22 +-
 vlc-android/src/org/videolan/vlc/MediaGroup.java   |  25 +-
 vlc-android/src/org/videolan/vlc/MediaLibrary.java |  41 +-
 vlc-android/src/org/videolan/vlc/MediaWrapper.aidl |  23 ++
 vlc-android/src/org/videolan/vlc/MediaWrapper.java | 446 +++++++++++++++++++++
 .../src/org/videolan/vlc/MediaWrapperList.java     | 159 ++++++++
 .../org/videolan/vlc/MediaWrapperListPlayer.java   |  91 +++++
 vlc-android/src/org/videolan/vlc/Thumbnailer.java  |   7 +-
 .../src/org/videolan/vlc/audio/AudioService.java   |  40 +-
 .../videolan/vlc/audio/AudioServiceController.java |  10 +-
 .../src/org/videolan/vlc/gui/DirectoryAdapter.java |   4 +-
 .../src/org/videolan/vlc/gui/HistoryAdapter.java   |  10 +-
 .../src/org/videolan/vlc/gui/SearchFragment.java   |  14 +-
 .../org/videolan/vlc/gui/SearchResultAdapter.java  |  10 +-
 .../vlc/gui/audio/AudioAlbumsSongsFragment.java    |  10 +-
 .../vlc/gui/audio/AudioBrowserFragment.java        |  10 +-
 .../vlc/gui/audio/AudioBrowserListAdapter.java     |  32 +-
 .../org/videolan/vlc/gui/audio/AudioPlayer.java    |   6 +-
 .../vlc/gui/audio/AudioPlaylistAdapter.java        |  14 +-
 .../src/org/videolan/vlc/gui/audio/AudioUtil.java  |  12 +-
 .../videolan/vlc/gui/audio/MediaComparators.java   |  30 +-
 .../videolan/vlc/gui/video/MediaInfoFragment.java  |   4 +-
 .../vlc/gui/video/VideoBrowserInterface.java       |   4 +-
 .../videolan/vlc/gui/video/VideoGridFragment.java  |  26 +-
 .../videolan/vlc/gui/video/VideoListAdapter.java   |  18 +-
 .../vlc/gui/video/VideoPlayerActivity.java         |  14 +-
 .../org/videolan/vlc/interfaces/IAudioService.aidl |   4 +-
 .../vlc/interfaces/IAudioServiceCallback.aidl      |   4 +-
 .../src/org/videolan/vlc/util/BitmapUtil.java      |   4 +-
 vlc-android/src/org/videolan/vlc/util/Util.java    |  22 +-
 36 files changed, 917 insertions(+), 918 deletions(-)
 delete mode 100644 libvlc/src/org/videolan/libvlc/Media.aidl
 delete mode 100644 libvlc/src/org/videolan/libvlc/Media.java
 delete mode 100644 libvlc/src/org/videolan/libvlc/MediaList.java
 delete mode 100644 libvlc/src/org/videolan/libvlc/MediaListPlayer.java
 create mode 100644 vlc-android/src/org/videolan/vlc/MediaWrapper.aidl
 create mode 100644 vlc-android/src/org/videolan/vlc/MediaWrapper.java
 create mode 100644 vlc-android/src/org/videolan/vlc/MediaWrapperList.java
 create mode 100644 vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java

diff --git a/libvlc/src/org/videolan/libvlc/EventHandler.java b/libvlc/src/org/videolan/libvlc/EventHandler.java
index 6242b2d..2141439 100644
--- a/libvlc/src/org/videolan/libvlc/EventHandler.java
+++ b/libvlc/src/org/videolan/libvlc/EventHandler.java
@@ -97,7 +97,7 @@ public class EventHandler {
     private ArrayList<Handler> mEventHandler;
     private static EventHandler mInstance;
 
-    EventHandler() {
+    public EventHandler() {
         mEventHandler = new ArrayList<Handler>();
     }
 
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 8e881da..a67e2f7 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -796,6 +796,5 @@ public class LibVLC {
     public native int setWindowSize(int width, int height);
 
     /* MediaList */
-    protected native void loadPlaylist(String mrl, ArrayList<String> items);
-    protected native int expandMedia(ArrayList<String> children);
+    public native int expandMedia(ArrayList<String> children);
 }
diff --git a/libvlc/src/org/videolan/libvlc/Media.aidl b/libvlc/src/org/videolan/libvlc/Media.aidl
deleted file mode 100644
index 9b30419..0000000
--- a/libvlc/src/org/videolan/libvlc/Media.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*****************************************************************************
- * Media.aidl
- *****************************************************************************
- * Copyright © 2015 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.libvlc;
-
-parcelable Media;
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
deleted file mode 100644
index 27fd804..0000000
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*****************************************************************************
- * Media.java
- *****************************************************************************
- * Copyright © 2011-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.libvlc;
-
-import java.util.Locale;
-
-import org.videolan.libvlc.util.Extensions;
-
-import android.graphics.Bitmap;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.text.TextUtils;
-import android.util.Log;
-
-public class Media implements Parcelable {
-    public final static String TAG = "VLC/LibVLC/Media";
-
-    public final static int TYPE_ALL = -1;
-    public final static int TYPE_VIDEO = 0;
-    public final static int TYPE_AUDIO = 1;
-    public final static int TYPE_GROUP = 2;
-
-    /** Metadata from libvlc_media */
-    protected String mTitle;
-    private String mArtist;
-    private String mGenre;
-    private String mCopyright;
-    private String mAlbum;
-    private int mTrackNumber;
-    private String mAlbumArtist;
-    private String mDescription;
-    private String mRating;
-    private String mDate;
-    private String mSettings;
-    private String mNowPlaying;
-    private String mPublisher;
-    private String mEncodedBy;
-    private String mTrackID;
-    private String mArtworkURL;
-
-    public final static int libvlc_meta_Title       = 0;
-    public final static int libvlc_meta_Artist      = 1;
-    public final static int libvlc_meta_Genre       = 2;
-//    public final static int libvlc_meta_Copyright   = 3;
-    public final static int libvlc_meta_Album       = 4;
-//    public final static int libvlc_meta_TrackNumber = 5;
-//    public final static int libvlc_meta_Description = 6;
-//    public final static int libvlc_meta_Rating      = 7;
-//    public final static int libvlc_meta_Date        = 8;
-//    public final static int libvlc_meta_Setting     = 9;
-//    public final static int libvlc_meta_URL         = 10;
-//    public final static int libvlc_meta_Language    = 11;
-    public final static int libvlc_meta_NowPlaying  = 12;
-//    public final static int libvlc_meta_Publisher   = 13;
-//    public final static int libvlc_meta_EncodedBy   = 14;
-    public final static int libvlc_meta_ArtworkURL  = 15;
-//    public final static int libvlc_meta_TrackID     = 16;
-//    public final static int libvlc_meta_TrackTotal  = 17;
-//    public final static int libvlc_meta_Director    = 18;
-//    public final static int libvlc_meta_Season      = 19;
-//    public final static int libvlc_meta_Episode     = 20;
-//    public final static int libvlc_meta_ShowName    = 21;
-//    public final static int libvlc_meta_Actors      = 22;
-    public final static int libvlc_meta_AlbumArtist = 23;
-//    public final static int libvlc_meta_DiscNumber  = 24;
-
-    private final String mLocation;
-    private String mFilename;
-    private long mTime = 0;
-    private int mAudioTrack = -1;
-    private int mSpuTrack = -2;
-    private long mLength = 0;
-    private int mType;
-    private int mWidth = 0;
-    private int mHeight = 0;
-    private Bitmap mPicture;
-    private boolean mIsPictureParsed;
-    private int mFlags = 0;
-
-    /**
-     * Create a new Media
-     * @param libVLC A pointer to the libVLC instance. Should not be NULL
-     * @param URI The URI of the media.
-     */
-    public Media(LibVLC libVLC, String URI) {
-        if(libVLC == null)
-            throw new NullPointerException("libVLC was null");
-
-        mLocation = URI;
-
-        mType = TYPE_ALL;
-        TrackInfo[] tracks = libVLC.readTracksInfo(mLocation);
-
-        extractTrackInfo(tracks);
-    }
-
-    private void extractTrackInfo(TrackInfo[] tracks) {
-        if (tracks == null) {
-            mTitle = null;
-            mArtist = null;
-            mAlbum = null;
-            mGenre = null;
-            mAlbumArtist = null;
-            return;
-        }
-
-        for (TrackInfo track : tracks) {
-            if (track.Type == TrackInfo.TYPE_VIDEO) {
-                mType = TYPE_VIDEO;
-                mWidth = track.Width;
-                mHeight = track.Height;
-            } else if (mType == TYPE_ALL && track.Type == TrackInfo.TYPE_AUDIO){
-                mType = TYPE_AUDIO;
-            } else if (track.Type == TrackInfo.TYPE_META) {
-                mLength = track.Length;
-                mTitle = track.Title != null ? track.Title.trim() : null;
-                mArtist = track.Artist != null ? track.Artist.trim() : null;
-                mAlbum = track.Album != null ? track.Album.trim() : null;
-                mGenre = track.Genre != null ? track.Genre.trim() : null;
-                mAlbumArtist = track.AlbumArtist != null ? track.AlbumArtist.trim() : null;
-                mArtworkURL = track.ArtworkURL;
-                mNowPlaying = track.NowPlaying;
-                if (!TextUtils.isEmpty(track.TrackNumber)) {
-                    try {
-                        mTrackNumber = Integer.parseInt(track.TrackNumber);
-                    } catch (NumberFormatException ignored) {
-                    }
-                }
-                Log.d(TAG, "Title " + mTitle);
-                Log.d(TAG, "Artist " + mArtist);
-                Log.d(TAG, "Genre " + mGenre);
-                Log.d(TAG, "Album " + mAlbum);
-            }
-        }
-
-        /* No useful ES found */
-        if (mType == TYPE_ALL) {
-            int dotIndex = mLocation.lastIndexOf(".");
-            if (dotIndex != -1) {
-                String fileExt = mLocation.substring(dotIndex).toLowerCase(Locale.ENGLISH);
-                if( Extensions.VIDEO.contains(fileExt) ) {
-                    mType = TYPE_VIDEO;
-                } else if (Extensions.AUDIO.contains(fileExt)) {
-                    mType = TYPE_AUDIO;
-                }
-            }
-        }
-    }
-
-    private void init(long time, long length, int type,
-                      Bitmap picture, String title, String artist, String genre, String album, String albumArtist,
-                      int width, int height, String artworkURL, int audio, int spu, int trackNumber) {
-        mFilename = null;
-        mTime = time;
-        mAudioTrack = audio;
-        mSpuTrack = spu;
-        mLength = length;
-        mType = type;
-        mPicture = picture;
-        mWidth = width;
-        mHeight = height;
-
-        mTitle = title;
-        mArtist = artist;
-        mGenre = genre;
-        mAlbum = album;
-        mAlbumArtist = albumArtist;
-        mArtworkURL = artworkURL;
-        mTrackNumber = trackNumber;
-    }
-
-    public Media(String location, long time, long length, int type,
-                 Bitmap picture, String title, String artist, String genre, String album, String albumArtist,
-                 int width, int height, String artworkURL, int audio, int spu, int trackNumber) {
-        mLocation = location;
-        init(time, length, type, picture, title, artist, genre, album, albumArtist,
-             width, height, artworkURL, audio, spu, trackNumber);
-    }
-
-    public Media(Parcel in) {
-        mLocation = in.readString();
-        init(in.readLong(),
-             in.readLong(),
-             in.readInt(),
-             (Bitmap) in.readParcelable(Bitmap.class.getClassLoader()),
-             in.readString(),
-             in.readString(),
-             in.readString(),
-             in.readString(),
-             in.readString(),
-             in.readInt(),
-             in.readInt(),
-             in.readString(),
-             in.readInt(),
-             in.readInt(),
-             in.readInt());
-    }
-
-    public String getLocation() {
-        return mLocation;
-    }
-
-    public void updateMeta(LibVLC libVLC) {
-        mTitle = libVLC.getMeta(libvlc_meta_Title);
-        mArtist = libVLC.getMeta(libvlc_meta_Artist);
-        mGenre = libVLC.getMeta(libvlc_meta_Genre);
-        mAlbum = libVLC.getMeta(libvlc_meta_Album);
-        mAlbumArtist = libVLC.getMeta(libvlc_meta_AlbumArtist);
-        mNowPlaying = libVLC.getMeta(libvlc_meta_NowPlaying);
-        mArtworkURL = libVLC.getMeta(libvlc_meta_ArtworkURL);
-    }
-
-    public String getFileName() {
-        if (mFilename == null) {
-            mFilename = LibVlcUtil.URItoFileName(mLocation);
-        }
-        return mFilename;
-    }
-
-    public long getTime() {
-        return mTime;
-    }
-
-    public void setTime(long time) {
-        mTime = time;
-    }
-
-    public int getAudioTrack() {
-        return mAudioTrack;
-    }
-
-    public void setAudioTrack(int track) {
-        mAudioTrack = track;
-    }
-
-    public int getSpuTrack() {
-        return mSpuTrack;
-    }
-
-    public void setSpuTrack(int track) {
-        mSpuTrack = track;
-    }
-
-    public long getLength() {
-        return mLength;
-    }
-
-    public int getType() {
-        return mType;
-    }
-
-    public int getWidth() {
-        return mWidth;
-    }
-
-    public int getHeight() {
-        return mHeight;
-    }
-
-    /**
-     * Returns the raw picture object. Likely to be NULL in VLC for Android
-     * due to lazy-loading.
-     *
-     * Use {@link org.videolan.vlc.util.Bitmap#getPictureFromCache(Media)} instead.
-     *
-     * @return The raw picture or NULL
-     */
-    public Bitmap getPicture() {
-        return mPicture;
-    }
-
-    /**
-     * Sets the raw picture object.
-     *
-     * In VLC for Android, use {@link org.videolan.vlc.MediaDatabase#setPicture(Media, Bitmap)} instead.
-     *
-     * @param p
-     */
-    public void setPicture(Bitmap p) {
-        mPicture = p;
-    }
-
-    public boolean isPictureParsed() {
-        return mIsPictureParsed;
-    }
-
-    public void setPictureParsed(boolean isParsed) {
-        mIsPictureParsed = isParsed;
-    }
-
-    public String getTitle() {
-        if (mTitle != null && mType != TYPE_VIDEO)
-            return mTitle;
-        else {
-            String fileName = getFileName();
-            if (fileName == null)
-                return "";
-            int end = fileName.lastIndexOf(".");
-            if (end <= 0)
-                return fileName;
-            return fileName.substring(0, end);
-        }
-    }
-
-    public String getReferenceArtist() {
-        return mAlbumArtist == null ? mArtist : mAlbumArtist;
-    }
-
-    public String getArtist() {
-        return mArtist;
-    }
-
-    public Boolean isArtistUnknown() {
-        return mArtist == null;
-    }
-
-    public String getGenre() {
-        if (mGenre == null)
-            return null;
-        else if (mGenre.length() > 1)/* Make genres case insensitive via normalisation */
-            return Character.toUpperCase(mGenre.charAt(0)) + mGenre.substring(1).toLowerCase(Locale.getDefault());
-        else
-            return mGenre;
-    }
-
-    public String getCopyright() {
-        return mCopyright;
-    }
-
-    public String getAlbum() {
-        return mAlbum;
-    }
-
-    public String getAlbumArtist() {
-        return mAlbumArtist;
-    }
-
-    public Boolean isAlbumUnknown() {
-        return mAlbum == null;
-    }
-
-    public int getTrackNumber() {
-        return mTrackNumber;
-    }
-
-    public String getDescription() {
-        return mDescription;
-    }
-
-    public String getRating() {
-        return mRating;
-    }
-
-    public String getDate() {
-        return mDate;
-    }
-
-    public String getSettings() {
-        return mSettings;
-    }
-
-    public String getNowPlaying() {
-        return mNowPlaying;
-    }
-
-    public String getPublisher() {
-        return mPublisher;
-    }
-
-    public String getEncodedBy() {
-        return mEncodedBy;
-    }
-
-    public String getTrackID() {
-        return mTrackID;
-    }
-
-    public String getArtworkURL() {
-        return mArtworkURL;
-    }
-
-    public void addFlags(int flags) {
-        mFlags |= flags;
-    }
-    public void setFlags(int flags) {
-        mFlags = flags;
-    }
-    public int getFlags() {
-        return mFlags;
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    @Override
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeValue(getLocation());
-        dest.writeLong(getTime());
-        dest.writeLong(getLength());
-        dest.writeInt(getType());
-        dest.writeParcelable(getPicture(), flags);
-        dest.writeValue(getTitle());
-        dest.writeValue(getArtist());
-        dest.writeValue(getGenre());
-        dest.writeValue(getAlbum());
-        dest.writeValue(getAlbumArtist());
-        dest.writeInt(getWidth());
-        dest.writeInt(getHeight());
-        dest.writeValue(getArtworkURL());
-        dest.writeInt(getAudioTrack());
-        dest.writeInt(getSpuTrack());
-        dest.writeInt(getTrackNumber());
-    }
-
-    public static final Parcelable.Creator<Media> CREATOR = new Parcelable.Creator<Media>() {
-        public Media createFromParcel(Parcel in) {
-            return new Media(in);
-        }
-        public Media[] newArray(int size) {
-            return new Media[size];
-        }
-    };
-}
diff --git a/libvlc/src/org/videolan/libvlc/MediaList.java b/libvlc/src/org/videolan/libvlc/MediaList.java
deleted file mode 100644
index 8419c5c..0000000
--- a/libvlc/src/org/videolan/libvlc/MediaList.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*****************************************************************************
- * MediaList.java
- *****************************************************************************
- * Copyright © 2013 VLC authors and VideoLAN
- * Copyright © 2013 Edward Wang
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.libvlc;
-
-import java.util.ArrayList;
-
-import android.os.Bundle;
-
-/**
- * Java/JNI wrapper for the libvlc_media_list_t structure.
- */
-public class MediaList {
-    private static final String TAG = "VLC/LibVLC/MediaList";
-
-
-    /* TODO: add locking */
-    private ArrayList<Media> mInternalList;
-    private LibVLC mLibVLC; // Used to create new objects that require a libvlc instance
-    private EventHandler mEventHandler;
-
-    public MediaList(LibVLC libVLC) {
-        mEventHandler = new EventHandler(); // used in init() below to fire events at the correct targets
-        mInternalList = new ArrayList<Media>();
-        mLibVLC = libVLC;
-    }
-
-    public void add(Media media) {
-        mInternalList.add(media);
-    }
-
-    /**
-     * Clear the media list. (remove all media)
-     */
-    public void clear() {
-        // Signal to observers of media being deleted.
-        for(int i = 0; i < mInternalList.size(); i++) {
-            signal_list_event(EventHandler.CustomMediaListItemDeleted, i, mInternalList.get(i).getLocation());
-        }
-        mInternalList.clear();
-    }
-
-    private boolean isValid(int position) {
-        return position >= 0 && position < mInternalList.size();
-    }
-
-    public void insert(int position, String mrl) {
-        insert(position, new Media(mLibVLC, mrl));
-    }
-    public void insert(int position, Media media) {
-        mInternalList.add(position, media);
-        signal_list_event(EventHandler.CustomMediaListItemAdded, position, media.getLocation());
-    }
-
-    /**
-     * Move a media from one position to another
-     *
-     * @param startPosition start position
-     * @param endPosition end position
-     * @throws IndexOutOfBoundsException
-     */
-    public void move(int startPosition, int endPosition) {
-        if (!(isValid(startPosition)
-              && endPosition >= 0 && endPosition <= mInternalList.size()))
-            throw new IndexOutOfBoundsException("Indexes out of range");
-
-        Media toMove = mInternalList.get(startPosition);
-        mInternalList.remove(startPosition);
-        if (startPosition >= endPosition)
-            mInternalList.add(endPosition, toMove);
-        else
-            mInternalList.add(endPosition - 1, toMove);
-        Bundle b = new Bundle();
-        b.putInt("index_before", startPosition);
-        b.putInt("index_after", endPosition);
-        mEventHandler.callback(EventHandler.CustomMediaListItemMoved, b);
-    }
-
-    public void remove(int position) {
-        if (!isValid(position))
-            return;
-        String uri = mInternalList.get(position).getLocation();
-        mInternalList.remove(position);
-        signal_list_event(EventHandler.CustomMediaListItemDeleted, position, uri);
-    }
-
-    public void remove(String location) {
-        for (int i = 0; i < mInternalList.size(); ++i) {
-            String uri = mInternalList.get(i).getLocation();
-            if (uri.equals(location)) {
-                mInternalList.remove(i);
-                signal_list_event(EventHandler.CustomMediaListItemDeleted, i, uri);
-                i--;
-            }
-        }
-    }
-
-    public int size() {
-        return mInternalList.size();
-    }
-
-    public Media getMedia(int position) {
-        if (!isValid(position))
-            return null;
-        return mInternalList.get(position);
-    }
-
-    /**
-     * @param position The index of the media in the list
-     * @return null if not found
-     */
-    public String getMRL(int position) {
-        if (!isValid(position))
-            return null;
-        return mInternalList.get(position).getLocation();
-    }
-
-    public EventHandler getEventHandler() {
-        return mEventHandler;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("LibVLC Media List: {");
-        for(int i = 0; i < size(); i++) {
-            sb.append(((Integer)i).toString());
-            sb.append(": ");
-            sb.append(getMRL(i));
-            sb.append(", ");
-        }
-        sb.append("}");
-        return sb.toString();
-    }
-
-    private void signal_list_event(int event, int position, String uri) {
-        Bundle b = new Bundle();
-        b.putString("item_uri", uri);
-        b.putInt("item_index", position);
-        mEventHandler.callback(event, b);
-    }
-}
diff --git a/libvlc/src/org/videolan/libvlc/MediaListPlayer.java b/libvlc/src/org/videolan/libvlc/MediaListPlayer.java
deleted file mode 100644
index a7fa532..0000000
--- a/libvlc/src/org/videolan/libvlc/MediaListPlayer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*****************************************************************************
- * MediaListPlayer.java
- *****************************************************************************
- * Copyright © 2015 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.libvlc;
-
-import java.util.ArrayList;
-
-
-public class MediaListPlayer {
-
-    private int mPlayerIndex = 0;
-    final private LibVLC mLibVLC;
-    final private MediaList mMediaList;
-
-    public MediaListPlayer(LibVLC libVLC) {
-        mLibVLC = libVLC;
-        mMediaList = new MediaList(libVLC);
-    }
-
-    public MediaList getMediaList() {
-        return mMediaList;
-    }
-
-    /**
-     * Play a media from the media list (playlist)
-     *
-     * @param position The index of the media
-     */
-    public void playIndex(int position) {
-        String mrl = mMediaList.getMRL(position);
-        if (mrl == null)
-            return;
-
-        final Media media = mMediaList.getMedia(position);
-        String[] options = mLibVLC.getMediaOptions(media != null ? media.getFlags() : 0);
-        mPlayerIndex = position;
-        mLibVLC.playMRL(mrl, options);
-    }
-
-    /**
-     * Expand and continue playing the current media.
-     *
-     * @return the index of the media was expanded, and -1 if no media was expanded
-     */
-   public int expandAndPlay() {
-       int r = expand();
-       if(r == 0)
-           playIndex(mPlayerIndex);
-       return r;
-   }
-
-   /**
-    * Expand the current media.
-    * @return the index of the media was expanded, and -1 if no media was expanded
-    */
-   public int expand() {
-       ArrayList<String> children = new ArrayList<String>();
-       int ret = mLibVLC.expandMedia(children);
-       if(ret == 0) {
-           mMediaList.remove(mPlayerIndex);
-           for(String mrl : children) {
-               mMediaList.insert(mPlayerIndex, mrl);
-           }
-       }
-       return ret;
-   }
-
-   public int expand(int index) {
-       mPlayerIndex = index;
-       return expand();
-   }
-}
diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index 5926c97..55eb1ab 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -31,8 +31,6 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 
-import org.videolan.libvlc.Media;
-
 import android.content.ContentValues;
 import android.content.Context;
 import android.database.Cursor;
@@ -478,7 +476,7 @@ public class MediaDatabase {
      * Add a new media to the database. The picture can only added by update.
      * @param media which you like to add to the database
      */
-    public synchronized void addMedia(Media media) {
+    public synchronized void addMedia(MediaWrapper media) {
 
         ContentValues values = new ContentValues();
 
@@ -556,7 +554,7 @@ public class MediaDatabase {
         String[] queryColumns = new String[]{MEDIA_LOCATION, MEDIA_TITLE, MEDIA_ALBUM, MEDIA_ARTIST, MEDIA_TYPE};
         String queryString = MEDIA_TITLE+" LIKE ? OR "+MEDIA_ALBUM+" LIKE ? OR "+MEDIA_ARTIST+" LIKE ?";
         String [] queryArgs;
-        if (type != Media.TYPE_ALL) {
+        if (type != MediaWrapper.TYPE_ALL) {
             queryString = "( " + queryString + " ) AND " + MEDIA_TYPE + "=?";
             queryArgs = new String[]{"%"+filter+"%", "%"+filter+"%", "%"+filter+"%", String.valueOf(type)};
         } else
@@ -573,10 +571,10 @@ public class MediaDatabase {
         return mediaList;
     }
 
-    public synchronized HashMap<String, Media> getMedias() {
+    public synchronized HashMap<String, MediaWrapper> getMedias() {
 
         Cursor cursor;
-        HashMap<String, Media> medias = new HashMap<String, Media>();
+        HashMap<String, MediaWrapper> medias = new HashMap<String, MediaWrapper>();
         int chunk_count = 0;
         int count = 0;
 
@@ -606,7 +604,7 @@ public class MediaDatabase {
             if (cursor.moveToFirst()) {
                 do {
                     String location = cursor.getString(14);
-                    Media media = new Media(location,
+                    MediaWrapper media = new MediaWrapper(location,
                             cursor.getLong(0),      // MEDIA_TIME
                             cursor.getLong(1),      // MEDIA_LENGTH
                             cursor.getInt(2),       // MEDIA_TYPE
@@ -650,7 +648,7 @@ public class MediaDatabase {
                     MEDIA_TIME, //1 long
                     MEDIA_TABLE_NAME,
                     MEDIA_TYPE,
-                    Media.TYPE_VIDEO,
+                    MediaWrapper.TYPE_VIDEO,
                     CHUNK_SIZE,
                     chunk_count * CHUNK_SIZE), null);
 
@@ -670,10 +668,10 @@ public class MediaDatabase {
         return times;
     }
 
-    public synchronized Media getMedia(String location) {
+    public synchronized MediaWrapper getMedia(String location) {
 
         Cursor cursor;
-        Media media = null;
+        MediaWrapper media = null;
 
         try {
             cursor = mDb.query(
@@ -702,7 +700,7 @@ public class MediaDatabase {
             return null;
         }
         if (cursor.moveToFirst()) {
-            media = new Media(location,
+            media = new MediaWrapper(location,
                     cursor.getLong(0),
                     cursor.getLong(1),
                     cursor.getInt(2),
@@ -946,7 +944,7 @@ public class MediaDatabase {
         mDb.delete(MEDIA_TABLE_NAME, null, null);
     }
 
-    public static void setPicture(Media m, Bitmap p) {
+    public static void setPicture(MediaWrapper m, Bitmap p) {
         Log.d(TAG, "Setting new picture for " + m.getTitle());
         try {
             getInstance().updateMedia(
diff --git a/vlc-android/src/org/videolan/vlc/MediaGroup.java b/vlc-android/src/org/videolan/vlc/MediaGroup.java
index ff4fac6..646fb42 100644
--- a/vlc-android/src/org/videolan/vlc/MediaGroup.java
+++ b/vlc-android/src/org/videolan/vlc/MediaGroup.java
@@ -23,23 +23,22 @@ package org.videolan.vlc;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.videolan.libvlc.Media;
 import org.videolan.vlc.util.BitmapUtil;
 
-public class MediaGroup extends Media {
+public class MediaGroup extends MediaWrapper {
 
     public final static String TAG = "VLC/MediaGroup";
 
     public final static int MIN_GROUP_LENGTH = 6;
 
-    private ArrayList<Media> mMedias;
+    private ArrayList<MediaWrapper> mMedias;
 
-    public MediaGroup(Media media)
+    public MediaGroup(MediaWrapper media)
     {
         super(media.getLocation(),
                 media.getTime(),
                 media.getLength(),
-                Media.TYPE_GROUP,
+                MediaWrapper.TYPE_GROUP,
                 BitmapUtil.getPictureFromCache(media),
                 media.getTitle(),
                 media.getArtist(),
@@ -52,19 +51,19 @@ public class MediaGroup extends Media {
                 media.getAudioTrack(),
                 media.getSpuTrack(),
                 media.getTrackNumber());
-        mMedias = new ArrayList<Media>();
+        mMedias = new ArrayList<MediaWrapper>();
         mMedias.add(media);
     }
 
-    public void add(Media media) {
+    public void add(MediaWrapper media) {
         mMedias.add(media);
     }
 
-    public Media getMedia() {
+    public MediaWrapper getMedia() {
         return mMedias.size() == 1 ? mMedias.get(0) : this;
     }
 
-    public Media getFirstMedia() {
+    public MediaWrapper getFirstMedia() {
         return mMedias.get(0);
     }
 
@@ -72,19 +71,19 @@ public class MediaGroup extends Media {
         return mMedias.size();
     }
 
-    public void merge(Media media, String title) {
+    public void merge(MediaWrapper media, String title) {
         mMedias.add(media);
         this.mTitle = title;
     }
 
-    public static List<MediaGroup> group(List<Media> mediaList) {
+    public static List<MediaGroup> group(List<MediaWrapper> mediaList) {
         ArrayList<MediaGroup> groups = new ArrayList<MediaGroup>();
-        for (Media media : mediaList)
+        for (MediaWrapper media : mediaList)
             insertInto(groups, media);
         return groups;
     }
 
-    private static void insertInto(ArrayList<MediaGroup> groups, Media media)
+    private static void insertInto(ArrayList<MediaGroup> groups, MediaWrapper media)
     {
         for (MediaGroup mediaGroup : groups) {
             String group = mediaGroup.getTitle();
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 34c29f6..bc94389 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -35,7 +35,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcException;
-import org.videolan.libvlc.Media;
 import org.videolan.libvlc.util.Extensions;
 import org.videolan.vlc.gui.MainActivity;
 import org.videolan.vlc.util.AndroidDevices;
@@ -55,7 +54,7 @@ public class MediaLibrary {
     public static final int MEDIA_ITEMS_UPDATED = 100;
 
     private static MediaLibrary mInstance;
-    private final ArrayList<Media> mItemList;
+    private final ArrayList<MediaWrapper> mItemList;
     private final ArrayList<Handler> mUpdateHandler;
     private final ReadWriteLock mItemListLock;
     private boolean isStopping = false;
@@ -83,7 +82,7 @@ public class MediaLibrary {
 
     private MediaLibrary() {
         mInstance = this;
-        mItemList = new ArrayList<Media>();
+        mItemList = new ArrayList<MediaWrapper>();
         mUpdateHandler = new ArrayList<Handler>();
         mItemListLock = new ReentrantReadWriteLock();
     }
@@ -134,8 +133,8 @@ public class MediaLibrary {
         mUpdateHandler.remove(handler);
     }
 
-    public ArrayList<Media> searchMedia(String query, int type){
-        ArrayList<Media> mediaList = new ArrayList<Media>();
+    public ArrayList<MediaWrapper> searchMedia(String query, int type){
+        ArrayList<MediaWrapper> mediaList = new ArrayList<MediaWrapper>();
         ArrayList<String> pathList = MediaDatabase.getInstance().searchMedia(query, type);
         if (!pathList.isEmpty()){
             for (String path : pathList) {
@@ -145,12 +144,12 @@ public class MediaLibrary {
         return mediaList;
     }
 
-    public ArrayList<Media> getVideoItems() {
-        ArrayList<Media> videoItems = new ArrayList<Media>();
+    public ArrayList<MediaWrapper> getVideoItems() {
+        ArrayList<MediaWrapper> videoItems = new ArrayList<MediaWrapper>();
         mItemListLock.readLock().lock();
         for (int i = 0; i < mItemList.size(); i++) {
-            Media item = mItemList.get(i);
-            if (item != null && item.getType() == Media.TYPE_VIDEO) {
+            MediaWrapper item = mItemList.get(i);
+            if (item != null && item.getType() == MediaWrapper.TYPE_VIDEO) {
                 videoItems.add(item);
             }
         }
@@ -158,12 +157,12 @@ public class MediaLibrary {
         return videoItems;
     }
 
-    public ArrayList<Media> getAudioItems() {
-        ArrayList<Media> audioItems = new ArrayList<Media>();
+    public ArrayList<MediaWrapper> getAudioItems() {
+        ArrayList<MediaWrapper> audioItems = new ArrayList<MediaWrapper>();
         mItemListLock.readLock().lock();
         for (int i = 0; i < mItemList.size(); i++) {
-            Media item = mItemList.get(i);
-            if (item.getType() == Media.TYPE_AUDIO) {
+            MediaWrapper item = mItemList.get(i);
+            if (item.getType() == MediaWrapper.TYPE_AUDIO) {
                 audioItems.add(item);
             }
         }
@@ -171,14 +170,14 @@ public class MediaLibrary {
         return audioItems;
     }
 
-    public ArrayList<Media> getMediaItems() {
+    public ArrayList<MediaWrapper> getMediaItems() {
         return mItemList;
     }
 
-    public Media getMediaItem(String location) {
+    public MediaWrapper getMediaItem(String location) {
         mItemListLock.readLock().lock();
         for (int i = 0; i < mItemList.size(); i++) {
-            Media item = mItemList.get(i);
+            MediaWrapper item = mItemList.get(i);
             if (item.getLocation().equals(location)) {
                 mItemListLock.readLock().unlock();
                 return item;
@@ -188,10 +187,10 @@ public class MediaLibrary {
         return null;
     }
 
-    public ArrayList<Media> getMediaItems(List<String> pathList) {
-        ArrayList<Media> items = new ArrayList<Media>();
+    public ArrayList<MediaWrapper> getMediaItems(List<String> pathList) {
+        ArrayList<MediaWrapper> items = new ArrayList<MediaWrapper>();
         for (int i = 0; i < pathList.size(); i++) {
-            Media item = getMediaItem(pathList.get(i));
+            MediaWrapper item = getMediaItem(pathList.get(i));
             items.add(item);
         }
         return items;
@@ -234,7 +233,7 @@ public class MediaLibrary {
             directories.addAll(mediaDirs);
 
             // get all existing media items
-            HashMap<String, Media> existingMedias = DBManager.getMedias();
+            HashMap<String, MediaWrapper> existingMedias = DBManager.getMedias();
 
             // list of all added files
             HashSet<String> addedLocations = new HashSet<String>();
@@ -320,7 +319,7 @@ public class MediaLibrary {
                     } else {
                         mItemListLock.writeLock().lock();
                         // create new media item
-                        Media m = new Media(libVlcInstance, fileURI);
+                        MediaWrapper m = new MediaWrapper(libVlcInstance, fileURI);
                         mItemList.add(m);
                         // Add this item to database
                         MediaDatabase db = MediaDatabase.getInstance();
diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapper.aidl b/vlc-android/src/org/videolan/vlc/MediaWrapper.aidl
new file mode 100644
index 0000000..c6c0fb4
--- /dev/null
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapper.aidl
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * MediaWrapper.aidl
+ *****************************************************************************
+ * Copyright © 2015 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.vlc;
+
+parcelable MediaWrapper;
diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapper.java b/vlc-android/src/org/videolan/vlc/MediaWrapper.java
new file mode 100644
index 0000000..96ee0d1
--- /dev/null
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapper.java
@@ -0,0 +1,446 @@
+/*****************************************************************************
+ * MediaWrapper.java
+ *****************************************************************************
+ * Copyright © 2011-2015 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.vlc;
+
+import java.util.Locale;
+
+import org.videolan.libvlc.util.Extensions;
+import org.videolan.libvlc.LibVLC;
+import org.videolan.libvlc.LibVlcUtil;
+import org.videolan.libvlc.TrackInfo;
+
+import android.graphics.Bitmap;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.text.TextUtils;
+import android.util.Log;
+
+public class MediaWrapper implements Parcelable {
+    public final static String TAG = "VLC/MediaWrapper";
+
+    public final static int TYPE_ALL = -1;
+    public final static int TYPE_VIDEO = 0;
+    public final static int TYPE_AUDIO = 1;
+    public final static int TYPE_GROUP = 2;
+
+    /** Metadata from libvlc_media */
+    protected String mTitle;
+    private String mArtist;
+    private String mGenre;
+    private String mCopyright;
+    private String mAlbum;
+    private int mTrackNumber;
+    private String mAlbumArtist;
+    private String mDescription;
+    private String mRating;
+    private String mDate;
+    private String mSettings;
+    private String mNowPlaying;
+    private String mPublisher;
+    private String mEncodedBy;
+    private String mTrackID;
+    private String mArtworkURL;
+
+    public final static int libvlc_meta_Title       = 0;
+    public final static int libvlc_meta_Artist      = 1;
+    public final static int libvlc_meta_Genre       = 2;
+//    public final static int libvlc_meta_Copyright   = 3;
+    public final static int libvlc_meta_Album       = 4;
+//    public final static int libvlc_meta_TrackNumber = 5;
+//    public final static int libvlc_meta_Description = 6;
+//    public final static int libvlc_meta_Rating      = 7;
+//    public final static int libvlc_meta_Date        = 8;
+//    public final static int libvlc_meta_Setting     = 9;
+//    public final static int libvlc_meta_URL         = 10;
+//    public final static int libvlc_meta_Language    = 11;
+    public final static int libvlc_meta_NowPlaying  = 12;
+//    public final static int libvlc_meta_Publisher   = 13;
+//    public final static int libvlc_meta_EncodedBy   = 14;
+    public final static int libvlc_meta_ArtworkURL  = 15;
+//    public final static int libvlc_meta_TrackID     = 16;
+//    public final static int libvlc_meta_TrackTotal  = 17;
+//    public final static int libvlc_meta_Director    = 18;
+//    public final static int libvlc_meta_Season      = 19;
+//    public final static int libvlc_meta_Episode     = 20;
+//    public final static int libvlc_meta_ShowName    = 21;
+//    public final static int libvlc_meta_Actors      = 22;
+    public final static int libvlc_meta_AlbumArtist = 23;
+//    public final static int libvlc_meta_DiscNumber  = 24;
+
+    private final String mLocation;
+    private String mFilename;
+    private long mTime = 0;
+    private int mAudioTrack = -1;
+    private int mSpuTrack = -2;
+    private long mLength = 0;
+    private int mType;
+    private int mWidth = 0;
+    private int mHeight = 0;
+    private Bitmap mPicture;
+    private boolean mIsPictureParsed;
+    private int mFlags = 0;
+
+    /**
+     * Create a new Media
+     * @param libVLC A pointer to the libVLC instance. Should not be NULL
+     * @param URI The URI of the media.
+     */
+    public MediaWrapper(LibVLC libVLC, String URI) {
+        if(libVLC == null)
+            throw new NullPointerException("libVLC was null");
+
+        mLocation = URI;
+
+        mType = TYPE_ALL;
+        TrackInfo[] tracks = libVLC.readTracksInfo(mLocation);
+
+        extractTrackInfo(tracks);
+    }
+
+    private void extractTrackInfo(TrackInfo[] tracks) {
+        if (tracks == null) {
+            mTitle = null;
+            mArtist = null;
+            mAlbum = null;
+            mGenre = null;
+            mAlbumArtist = null;
+            return;
+        }
+
+        for (TrackInfo track : tracks) {
+            if (track.Type == TrackInfo.TYPE_VIDEO) {
+                mType = TYPE_VIDEO;
+                mWidth = track.Width;
+                mHeight = track.Height;
+            } else if (mType == TYPE_ALL && track.Type == TrackInfo.TYPE_AUDIO){
+                mType = TYPE_AUDIO;
+            } else if (track.Type == TrackInfo.TYPE_META) {
+                mLength = track.Length;
+                mTitle = track.Title != null ? track.Title.trim() : null;
+                mArtist = track.Artist != null ? track.Artist.trim() : null;
+                mAlbum = track.Album != null ? track.Album.trim() : null;
+                mGenre = track.Genre != null ? track.Genre.trim() : null;
+                mAlbumArtist = track.AlbumArtist != null ? track.AlbumArtist.trim() : null;
+                mArtworkURL = track.ArtworkURL;
+                mNowPlaying = track.NowPlaying;
+                if (!TextUtils.isEmpty(track.TrackNumber)) {
+                    try {
+                        mTrackNumber = Integer.parseInt(track.TrackNumber);
+                    } catch (NumberFormatException ignored) {
+                    }
+                }
+                Log.d(TAG, "Title " + mTitle);
+                Log.d(TAG, "Artist " + mArtist);
+                Log.d(TAG, "Genre " + mGenre);
+                Log.d(TAG, "Album " + mAlbum);
+            }
+        }
+
+        /* No useful ES found */
+        if (mType == TYPE_ALL) {
+            int dotIndex = mLocation.lastIndexOf(".");
+            if (dotIndex != -1) {
+                String fileExt = mLocation.substring(dotIndex).toLowerCase(Locale.ENGLISH);
+                if( Extensions.VIDEO.contains(fileExt) ) {
+                    mType = TYPE_VIDEO;
+                } else if (Extensions.AUDIO.contains(fileExt)) {
+                    mType = TYPE_AUDIO;
+                }
+            }
+        }
+    }
+
+    private void init(long time, long length, int type,
+                      Bitmap picture, String title, String artist, String genre, String album, String albumArtist,
+                      int width, int height, String artworkURL, int audio, int spu, int trackNumber) {
+        mFilename = null;
+        mTime = time;
+        mAudioTrack = audio;
+        mSpuTrack = spu;
+        mLength = length;
+        mType = type;
+        mPicture = picture;
+        mWidth = width;
+        mHeight = height;
+
+        mTitle = title;
+        mArtist = artist;
+        mGenre = genre;
+        mAlbum = album;
+        mAlbumArtist = albumArtist;
+        mArtworkURL = artworkURL;
+        mTrackNumber = trackNumber;
+    }
+
+    public MediaWrapper(String location, long time, long length, int type,
+                 Bitmap picture, String title, String artist, String genre, String album, String albumArtist,
+                 int width, int height, String artworkURL, int audio, int spu, int trackNumber) {
+        mLocation = location;
+        init(time, length, type, picture, title, artist, genre, album, albumArtist,
+             width, height, artworkURL, audio, spu, trackNumber);
+    }
+
+    public MediaWrapper(Parcel in) {
+        mLocation = in.readString();
+        init(in.readLong(),
+             in.readLong(),
+             in.readInt(),
+             (Bitmap) in.readParcelable(Bitmap.class.getClassLoader()),
+             in.readString(),
+             in.readString(),
+             in.readString(),
+             in.readString(),
+             in.readString(),
+             in.readInt(),
+             in.readInt(),
+             in.readString(),
+             in.readInt(),
+             in.readInt(),
+             in.readInt());
+    }
+
+    public String getLocation() {
+        return mLocation;
+    }
+
+    public void updateMeta(LibVLC libVLC) {
+        mTitle = libVLC.getMeta(libvlc_meta_Title);
+        mArtist = libVLC.getMeta(libvlc_meta_Artist);
+        mGenre = libVLC.getMeta(libvlc_meta_Genre);
+        mAlbum = libVLC.getMeta(libvlc_meta_Album);
+        mAlbumArtist = libVLC.getMeta(libvlc_meta_AlbumArtist);
+        mNowPlaying = libVLC.getMeta(libvlc_meta_NowPlaying);
+        mArtworkURL = libVLC.getMeta(libvlc_meta_ArtworkURL);
+    }
+
+    public String getFileName() {
+        if (mFilename == null) {
+            mFilename = LibVlcUtil.URItoFileName(mLocation);
+        }
+        return mFilename;
+    }
+
+    public long getTime() {
+        return mTime;
+    }
+
+    public void setTime(long time) {
+        mTime = time;
+    }
+
+    public int getAudioTrack() {
+        return mAudioTrack;
+    }
+
+    public void setAudioTrack(int track) {
+        mAudioTrack = track;
+    }
+
+    public int getSpuTrack() {
+        return mSpuTrack;
+    }
+
+    public void setSpuTrack(int track) {
+        mSpuTrack = track;
+    }
+
+    public long getLength() {
+        return mLength;
+    }
+
+    public int getType() {
+        return mType;
+    }
+
+    public int getWidth() {
+        return mWidth;
+    }
+
+    public int getHeight() {
+        return mHeight;
+    }
+
+    /**
+     * Returns the raw picture object. Likely to be NULL in VLC for Android
+     * due to lazy-loading.
+     *
+     * Use {@link org.videolan.vlc.util.Bitmap#getPictureFromCache(MediaWrapper)} instead.
+     *
+     * @return The raw picture or NULL
+     */
+    public Bitmap getPicture() {
+        return mPicture;
+    }
+
+    /**
+     * Sets the raw picture object.
+     *
+     * In VLC for Android, use {@link org.videolan.vlc.MediaDatabase#setPicture(MediaWrapper, Bitmap)} instead.
+     *
+     * @param p
+     */
+    public void setPicture(Bitmap p) {
+        mPicture = p;
+    }
+
+    public boolean isPictureParsed() {
+        return mIsPictureParsed;
+    }
+
+    public void setPictureParsed(boolean isParsed) {
+        mIsPictureParsed = isParsed;
+    }
+
+    public String getTitle() {
+        if (mTitle != null && mType != TYPE_VIDEO)
+            return mTitle;
+        else {
+            String fileName = getFileName();
+            if (fileName == null)
+                return "";
+            int end = fileName.lastIndexOf(".");
+            if (end <= 0)
+                return fileName;
+            return fileName.substring(0, end);
+        }
+    }
+
+    public String getReferenceArtist() {
+        return mAlbumArtist == null ? mArtist : mAlbumArtist;
+    }
+
+    public String getArtist() {
+        return mArtist;
+    }
+
+    public Boolean isArtistUnknown() {
+        return mArtist == null;
+    }
+
+    public String getGenre() {
+        if (mGenre == null)
+            return null;
+        else if (mGenre.length() > 1)/* Make genres case insensitive via normalisation */
+            return Character.toUpperCase(mGenre.charAt(0)) + mGenre.substring(1).toLowerCase(Locale.getDefault());
+        else
+            return mGenre;
+    }
+
+    public String getCopyright() {
+        return mCopyright;
+    }
+
+    public String getAlbum() {
+        return mAlbum;
+    }
+
+    public String getAlbumArtist() {
+        return mAlbumArtist;
+    }
+
+    public Boolean isAlbumUnknown() {
+        return mAlbum == null;
+    }
+
+    public int getTrackNumber() {
+        return mTrackNumber;
+    }
+
+    public String getDescription() {
+        return mDescription;
+    }
+
+    public String getRating() {
+        return mRating;
+    }
+
+    public String getDate() {
+        return mDate;
+    }
+
+    public String getSettings() {
+        return mSettings;
+    }
+
+    public String getNowPlaying() {
+        return mNowPlaying;
+    }
+
+    public String getPublisher() {
+        return mPublisher;
+    }
+
+    public String getEncodedBy() {
+        return mEncodedBy;
+    }
+
+    public String getTrackID() {
+        return mTrackID;
+    }
+
+    public String getArtworkURL() {
+        return mArtworkURL;
+    }
+
+    public void addFlags(int flags) {
+        mFlags |= flags;
+    }
+    public void setFlags(int flags) {
+        mFlags = flags;
+    }
+    public int getFlags() {
+        return mFlags;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeValue(getLocation());
+        dest.writeLong(getTime());
+        dest.writeLong(getLength());
+        dest.writeInt(getType());
+        dest.writeParcelable(getPicture(), flags);
+        dest.writeValue(getTitle());
+        dest.writeValue(getArtist());
+        dest.writeValue(getGenre());
+        dest.writeValue(getAlbum());
+        dest.writeValue(getAlbumArtist());
+        dest.writeInt(getWidth());
+        dest.writeInt(getHeight());
+        dest.writeValue(getArtworkURL());
+        dest.writeInt(getAudioTrack());
+        dest.writeInt(getSpuTrack());
+        dest.writeInt(getTrackNumber());
+    }
+
+    public static final Parcelable.Creator<MediaWrapper> CREATOR = new Parcelable.Creator<MediaWrapper>() {
+        public MediaWrapper createFromParcel(Parcel in) {
+            return new MediaWrapper(in);
+        }
+        public MediaWrapper[] newArray(int size) {
+            return new MediaWrapper[size];
+        }
+    };
+}
diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapperList.java b/vlc-android/src/org/videolan/vlc/MediaWrapperList.java
new file mode 100644
index 0000000..33b0c7e
--- /dev/null
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapperList.java
@@ -0,0 +1,159 @@
+/*****************************************************************************
+ * MediaWrapperList.java
+ *****************************************************************************
+ * Copyright © 2013-2015 VLC authors and VideoLAN
+ * Copyright © 2013 Edward Wang
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.vlc;
+
+import java.util.ArrayList;
+
+import org.videolan.libvlc.EventHandler;
+import org.videolan.libvlc.LibVLC;
+
+import android.os.Bundle;
+
+public class MediaWrapperList {
+    private static final String TAG = "VLC/MediaWrapperList";
+
+
+    /* TODO: add locking */
+    private ArrayList<MediaWrapper> mInternalList;
+    private LibVLC mLibVLC; // Used to create new objects that require a libvlc instance
+    private EventHandler mEventHandler;
+
+    public MediaWrapperList(LibVLC libVLC) {
+        mEventHandler = new EventHandler(); // used in init() below to fire events at the correct targets
+        mInternalList = new ArrayList<MediaWrapper>();
+        mLibVLC = libVLC;
+    }
+
+    public void add(MediaWrapper media) {
+        mInternalList.add(media);
+    }
+
+    /**
+     * Clear the media list. (remove all media)
+     */
+    public void clear() {
+        // Signal to observers of media being deleted.
+        for(int i = 0; i < mInternalList.size(); i++) {
+            signal_list_event(EventHandler.CustomMediaListItemDeleted, i, mInternalList.get(i).getLocation());
+        }
+        mInternalList.clear();
+    }
+
+    private boolean isValid(int position) {
+        return position >= 0 && position < mInternalList.size();
+    }
+
+    public void insert(int position, String mrl) {
+        insert(position, new MediaWrapper(mLibVLC, mrl));
+    }
+    public void insert(int position, MediaWrapper media) {
+        mInternalList.add(position, media);
+        signal_list_event(EventHandler.CustomMediaListItemAdded, position, media.getLocation());
+    }
+
+    /**
+     * Move a media from one position to another
+     *
+     * @param startPosition start position
+     * @param endPosition end position
+     * @throws IndexOutOfBoundsException
+     */
+    public void move(int startPosition, int endPosition) {
+        if (!(isValid(startPosition)
+              && endPosition >= 0 && endPosition <= mInternalList.size()))
+            throw new IndexOutOfBoundsException("Indexes out of range");
+
+        MediaWrapper toMove = mInternalList.get(startPosition);
+        mInternalList.remove(startPosition);
+        if (startPosition >= endPosition)
+            mInternalList.add(endPosition, toMove);
+        else
+            mInternalList.add(endPosition - 1, toMove);
+        Bundle b = new Bundle();
+        b.putInt("index_before", startPosition);
+        b.putInt("index_after", endPosition);
+        mEventHandler.callback(EventHandler.CustomMediaListItemMoved, b);
+    }
+
+    public void remove(int position) {
+        if (!isValid(position))
+            return;
+        String uri = mInternalList.get(position).getLocation();
+        mInternalList.remove(position);
+        signal_list_event(EventHandler.CustomMediaListItemDeleted, position, uri);
+    }
+
+    public void remove(String location) {
+        for (int i = 0; i < mInternalList.size(); ++i) {
+            String uri = mInternalList.get(i).getLocation();
+            if (uri.equals(location)) {
+                mInternalList.remove(i);
+                signal_list_event(EventHandler.CustomMediaListItemDeleted, i, uri);
+                i--;
+            }
+        }
+    }
+
+    public int size() {
+        return mInternalList.size();
+    }
+
+    public MediaWrapper getMedia(int position) {
+        if (!isValid(position))
+            return null;
+        return mInternalList.get(position);
+    }
+
+    /**
+     * @param position The index of the media in the list
+     * @return null if not found
+     */
+    public String getMRL(int position) {
+        if (!isValid(position))
+            return null;
+        return mInternalList.get(position).getLocation();
+    }
+
+    public EventHandler getEventHandler() {
+        return mEventHandler;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("LibVLC Media List: {");
+        for(int i = 0; i < size(); i++) {
+            sb.append(((Integer)i).toString());
+            sb.append(": ");
+            sb.append(getMRL(i));
+            sb.append(", ");
+        }
+        sb.append("}");
+        return sb.toString();
+    }
+
+    private void signal_list_event(int event, int position, String uri) {
+        Bundle b = new Bundle();
+        b.putString("item_uri", uri);
+        b.putInt("item_index", position);
+        mEventHandler.callback(event, b);
+    }
+}
diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java b/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java
new file mode 100644
index 0000000..f2fd81d
--- /dev/null
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * MediaWrapperListPlayer.java
+ *****************************************************************************
+ * Copyright © 2015 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.vlc;
+
+import java.util.ArrayList;
+
+import org.videolan.libvlc.LibVLC;
+
+
+public class MediaWrapperListPlayer {
+
+    private int mPlayerIndex = 0;
+    final private LibVLC mLibVLC;
+    final private MediaWrapperList mMediaList;
+
+    public MediaWrapperListPlayer(LibVLC libVLC) {
+        mLibVLC = libVLC;
+        mMediaList = new MediaWrapperList(libVLC);
+    }
+
+    public MediaWrapperList getMediaList() {
+        return mMediaList;
+    }
+
+    /**
+     * Play a media from the media list (playlist)
+     *
+     * @param position The index of the media
+     */
+    public void playIndex(int position) {
+        String mrl = mMediaList.getMRL(position);
+        if (mrl == null)
+            return;
+
+        final MediaWrapper media = mMediaList.getMedia(position);
+        String[] options = mLibVLC.getMediaOptions(media != null ? media.getFlags() : 0);
+        mPlayerIndex = position;
+        mLibVLC.playMRL(mrl, options);
+    }
+
+    /**
+     * Expand and continue playing the current media.
+     *
+     * @return the index of the media was expanded, and -1 if no media was expanded
+     */
+   public int expandAndPlay() {
+       int r = expand();
+       if(r == 0)
+           playIndex(mPlayerIndex);
+       return r;
+   }
+
+   /**
+    * Expand the current media.
+    * @return the index of the media was expanded, and -1 if no media was expanded
+    */
+   public int expand() {
+       ArrayList<String> children = new ArrayList<String>();
+       int ret = mLibVLC.expandMedia(children);
+       if(ret == 0) {
+           mMediaList.remove(mPlayerIndex);
+           for(String mrl : children) {
+               mMediaList.insert(mPlayerIndex, mrl);
+           }
+       }
+       return ret;
+   }
+
+   public int expand(int index) {
+       mPlayerIndex = index;
+       return expand();
+   }
+}
diff --git a/vlc-android/src/org/videolan/vlc/Thumbnailer.java b/vlc-android/src/org/videolan/vlc/Thumbnailer.java
index 22280d6..4799509 100644
--- a/vlc-android/src/org/videolan/vlc/Thumbnailer.java
+++ b/vlc-android/src/org/videolan/vlc/Thumbnailer.java
@@ -31,7 +31,6 @@ import java.util.concurrent.locks.ReentrantLock;
 
 import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcException;
-import org.videolan.libvlc.Media;
 import org.videolan.vlc.gui.video.VideoBrowserInterface;
 import org.videolan.vlc.util.BitmapUtil;
 import org.videolan.vlc.util.VLCInstance;
@@ -48,7 +47,7 @@ public class Thumbnailer implements Runnable {
 
     private VideoBrowserInterface mVideoBrowser;
 
-    private final Queue<Media> mItems = new LinkedList<Media>();
+    private final Queue<MediaWrapper> mItems = new LinkedList<MediaWrapper>();
 
     private boolean isStopping = false;
     private final Lock lock = new ReentrantLock();
@@ -114,7 +113,7 @@ public class Thumbnailer implements Runnable {
      * Add a new id of the file browser item to create its thumbnail.
      * @param id the if of the file browser item.
      */
-    public void addJob(Media item) {
+    public void addJob(MediaWrapper item) {
         if(BitmapUtil.getPictureFromCache(item) != null || item.isPictureParsed())
             return;
         lock.lock();
@@ -160,7 +159,7 @@ public class Thumbnailer implements Runnable {
                 break;
             }
             total = totalCount;
-            Media item = mItems.poll();
+            MediaWrapper item = mItems.poll();
             lock.unlock();
 
             if (mVideoBrowser != null) {
diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index 93f8a4b..c8475ec 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -44,10 +44,10 @@ import org.videolan.libvlc.EventHandler;
 import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcException;
 import org.videolan.libvlc.LibVlcUtil;
-import org.videolan.libvlc.Media;
-import org.videolan.libvlc.MediaList;
-import org.videolan.libvlc.MediaListPlayer;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaDatabase;
+import org.videolan.vlc.MediaWrapperList;
+import org.videolan.vlc.MediaWrapperListPlayer;
 import org.videolan.vlc.R;
 import org.videolan.vlc.RemoteControlClientReceiver;
 import org.videolan.vlc.VLCApplication;
@@ -123,7 +123,7 @@ public class AudioService extends Service {
     public static final int NEXT_ITEM = 3;
 
     private LibVLC mLibVLC;
-    private MediaListPlayer mMediaListPlayer;
+    private MediaWrapperListPlayer mMediaListPlayer;
     private HashMap<IAudioServiceCallback, Integer> mCallback;
     private EventHandler mEventHandler;
     private OnAudioFocusChangeListener audioFocusListener;
@@ -170,7 +170,7 @@ public class AudioService extends Service {
         } catch (LibVlcException e) {
             e.printStackTrace();
         }
-        mMediaListPlayer = new MediaListPlayer(mLibVLC);
+        mMediaListPlayer = new MediaWrapperListPlayer(mLibVLC);
 
         mCallback = new HashMap<IAudioServiceCallback, Integer>();
         mCurrentIndex = -1;
@@ -479,7 +479,7 @@ public class AudioService extends Service {
                     String location = service.mMediaListPlayer.getMediaList().getMRL(service.mCurrentIndex);
                     long length = service.mLibVLC.getLength();
                     MediaDatabase dbManager = MediaDatabase.getInstance();
-                    Media m = dbManager.getMedia(location);
+                    MediaWrapper m = dbManager.getMedia(location);
                     /**
                      * 1) There is a media to update
                      * 2) It has a length of 0
@@ -677,7 +677,7 @@ public class AudioService extends Service {
     }
 
     private void executeOnMediaPlayedAdded() {
-        final Media media = mMediaListPlayer.getMediaList().getMedia(mCurrentIndex);
+        final MediaWrapper media = mMediaListPlayer.getMediaList().getMedia(mCurrentIndex);
         for (IAudioServiceCallback callback : mCallback.keySet()) {
             try {
                 callback.onMediaPlayedAdded(media, 0);
@@ -692,7 +692,7 @@ public class AudioService extends Service {
      *
      * @return The current media or null if there is not any.
      */
-    private Media getCurrentMedia() {
+    private MediaWrapper getCurrentMedia() {
         return mMediaListPlayer.getMediaList().getMedia(mCurrentIndex);
     }
 
@@ -738,7 +738,7 @@ public class AudioService extends Service {
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
     private void showNotification() {
         try {
-            Media media = getCurrentMedia();
+            MediaWrapper media = getCurrentMedia();
             if (media == null)
                 return;
             Bitmap cover = AudioUtil.getCover(this, media, 64);
@@ -961,7 +961,7 @@ public class AudioService extends Service {
         if (!LibVlcUtil.isICSOrLater()) // NOP check
             return;
 
-        Media media = getCurrentMedia();
+        MediaWrapper media = getCurrentMedia();
         if (mRemoteControlClient != null && media != null) {
             MetadataEditor editor = mRemoteControlClient.editMetadata(true);
             if (media.getNowPlaying() != null) {
@@ -1031,7 +1031,7 @@ public class AudioService extends Service {
     }
 
     private Bitmap getCover() {
-        Media media = getCurrentMedia();
+        MediaWrapper media = getCurrentMedia();
         return media != null ? AudioUtil.getCover(this, media, 512) : null;
     }
 
@@ -1083,7 +1083,7 @@ public class AudioService extends Service {
         @Override
         public String getArtist() throws RemoteException {
             if (hasCurrentMedia()) {
-                final Media media = getCurrentMedia();
+                final MediaWrapper media = getCurrentMedia();
                 return media.isArtistUnknown() && media.getNowPlaying() != null ?
                         media.getNowPlaying()
                         : Util.getMediaArtist(AudioService.this, media);
@@ -1206,14 +1206,14 @@ public class AudioService extends Service {
 
             mMediaListPlayer.getMediaList().getEventHandler().removeHandler(mListEventHandler);
             mMediaListPlayer.getMediaList().clear();
-            MediaList mediaList = mMediaListPlayer.getMediaList();
+            MediaWrapperList mediaList = mMediaListPlayer.getMediaList();
 
             mPrevious.clear();
 
             MediaDatabase db = MediaDatabase.getInstance();
             for (int i = 0; i < mediaPathList.size(); i++) {
                 String location = mediaPathList.get(i);
-                Media media = db.getMedia(location);
+                MediaWrapper media = db.getMedia(location);
                 if(media == null) {
                     if(!validateLocation(location)) {
                         Log.w(TAG, "Invalid location " + location);
@@ -1221,7 +1221,7 @@ public class AudioService extends Service {
                         continue;
                     }
                     Log.v(TAG, "Creating on-the-fly Media object for " + location);
-                    media = new Media(mLibVLC, location);
+                    media = new MediaWrapper(mLibVLC, location);
                 }
                 if (noVideo)
                     media.addFlags(LibVLC.MEDIA_NO_VIDEO);
@@ -1322,14 +1322,14 @@ public class AudioService extends Service {
             MediaDatabase db = MediaDatabase.getInstance();
             for (int i = 0; i < mediaLocationList.size(); i++) {
                 String location = mediaLocationList.get(i);
-                Media media = db.getMedia(location);
+                MediaWrapper media = db.getMedia(location);
                 if(media == null) {
                     if (!validateLocation(location)) {
                         showToast(getResources().getString(R.string.invalid_location, location), Toast.LENGTH_SHORT);
                         continue;
                     }
                     Log.v(TAG, "Creating on-the-fly Media object for " + location);
-                    media = new Media(mLibVLC, location);
+                    media = new MediaWrapper(mLibVLC, location);
                 }
                 mMediaListPlayer.getMediaList().add(media);
             }
@@ -1364,8 +1364,8 @@ public class AudioService extends Service {
         }
 
         @Override
-        public List<Media> getMedias() {
-            final ArrayList<Media> ml = new ArrayList<Media>();
+        public List<MediaWrapper> getMedias() {
+            final ArrayList<MediaWrapper> ml = new ArrayList<MediaWrapper>();
             for (int i = 0; i < mMediaListPlayer.getMediaList().size(); i++) {
                 ml.add(mMediaListPlayer.getMediaList().getMedia(i));
             }
@@ -1450,7 +1450,7 @@ public class AudioService extends Service {
         i.setAction(ACTION_WIDGET_UPDATE);
 
         if (hasCurrentMedia()) {
-            final Media media = getCurrentMedia();
+            final MediaWrapper media = getCurrentMedia();
             i.putExtra("title", media.getTitle());
             i.putExtra("artist", media.isArtistUnknown() && media.getNowPlaying() != null ?
                     media.getNowPlaying()
diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioServiceController.java b/vlc-android/src/org/videolan/vlc/audio/AudioServiceController.java
index 2901961..df46551 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioServiceController.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioServiceController.java
@@ -25,7 +25,7 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.interfaces.IAudioPlayer;
 import org.videolan.vlc.interfaces.IAudioPlayerControl;
 import org.videolan.vlc.interfaces.IAudioService;
@@ -53,7 +53,7 @@ public class AudioServiceController implements IAudioPlayerControl {
     private final ArrayList<MediaPlayedListener> mMediaPlayedListener;
 
     public interface MediaPlayedListener {
-        public void onMediaPlayedAdded(Media media, int index);
+        public void onMediaPlayedAdded(MediaWrapper media, int index);
         public void onMediaPlayedRemoved(int index);
     }
 
@@ -69,7 +69,7 @@ public class AudioServiceController implements IAudioPlayerControl {
         }
 
         @Override
-        public void onMediaPlayedAdded(Media media, int index) throws RemoteException {
+        public void onMediaPlayedAdded(MediaWrapper media, int index) throws RemoteException {
             updateMediaPlayedAdded(media, index);
         }
 
@@ -239,7 +239,7 @@ public class AudioServiceController implements IAudioPlayerControl {
             player.updateProgress();
     }
 
-    private void updateMediaPlayedAdded(Media media, int index) {
+    private void updateMediaPlayedAdded(MediaWrapper media, int index) {
         for (MediaPlayedListener listener : mMediaPlayedListener) {
             listener.onMediaPlayedAdded(media, index);
         }
@@ -337,7 +337,7 @@ public class AudioServiceController implements IAudioPlayerControl {
     }
 
     @SuppressWarnings("unchecked")
-    public List<Media> getMedias() {
+    public List<MediaWrapper> getMedias() {
         return remoteProcedureCall(mAudioServiceBinder, List.class, null, "getMedias", null, null);
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
index a1645fd..9488a95 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
@@ -29,8 +29,8 @@ import java.util.ListIterator;
 import java.util.regex.Pattern;
 
 import org.videolan.libvlc.LibVLC;
-import org.videolan.libvlc.Media;
 import org.videolan.libvlc.util.Extensions;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.util.AndroidDevices;
@@ -344,7 +344,7 @@ public class DirectoryAdapter extends BaseAdapter {
         String holderText = "";
         if(selectedNode.isFile()) {
             Log.d(TAG, "Loading media " + selectedNode.name);
-            Media m = new Media(LibVLC.getExistingInstance(), getMediaLocation(position));
+            MediaWrapper m = new MediaWrapper(LibVLC.getExistingInstance(), getMediaLocation(position));
             holder.title.setText(m.getTitle());
             holderText = Util.getMediaSubtitle(context, m);
         } else
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
index 2b96c8a..df28c24 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
@@ -22,7 +22,7 @@ package org.videolan.vlc.gui;
 
 import java.util.ArrayList;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.audio.AudioServiceController;
@@ -44,14 +44,14 @@ public class HistoryAdapter extends BaseAdapter implements AudioServiceControlle
 
     private LayoutInflater mInflater;
     private final AudioServiceController mAudioController;
-    private final ArrayList<Media> mMediaList;
+    private final ArrayList<MediaWrapper> mMediaList;
 
     public HistoryAdapter(Context context) {
         mInflater = LayoutInflater.from(context);
 
         mAudioController = AudioServiceController.getInstance();
 
-        mMediaList = new ArrayList<Media>();
+        mMediaList = new ArrayList<MediaWrapper>();
 
         mAudioController.addMediaPlayedListener(this);
     }
@@ -94,7 +94,7 @@ public class HistoryAdapter extends BaseAdapter implements AudioServiceControlle
             holder = (DirectoryAdapter.DirectoryViewHolder) v.getTag();
 
         String holderText = "";
-        Media m = mMediaList.get(position);
+        MediaWrapper m = mMediaList.get(position);
         if (m == null )
             return v;
 
@@ -117,7 +117,7 @@ public class HistoryAdapter extends BaseAdapter implements AudioServiceControlle
     }
 
     @Override
-    public void onMediaPlayedAdded(Media media, int index) {
+    public void onMediaPlayedAdded(MediaWrapper media, int index) {
         mMediaList.add(index, media);
         notifyDataSetChanged();
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java b/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
index da8c950..88c773e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SearchFragment.java
@@ -22,7 +22,7 @@ package org.videolan.vlc.gui;
 
 import java.util.ArrayList;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaDatabase;
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.R;
@@ -105,7 +105,7 @@ public class SearchFragment extends ListFragment {
         mResultAdapter.clear();
         new Thread(new Runnable() {
             public void run() {
-                final ArrayList<Media> mediaList = MediaLibrary.getInstance().searchMedia(key, type);
+                final ArrayList<MediaWrapper> mediaList = MediaLibrary.getInstance().searchMedia(key, type);
                 mHandler.post(new Runnable() {
                     public void run() {
                         int count = mediaList.size();
@@ -158,7 +158,7 @@ public class SearchFragment extends ListFragment {
         @Override
         public void onTextChanged(CharSequence s, int start, int before, int count) {
             if (s.length() > 0) {
-                search(s.toString(), Media.TYPE_ALL);
+                search(s.toString(), MediaWrapper.TYPE_ALL);
             } else {
                 showSearchHistory();
             }
@@ -198,15 +198,15 @@ public class SearchFragment extends ListFragment {
             db.addSearchhistoryItem(mSearchText.getText().toString());
 
             // open media in the player
-            Media item = (Media) getListView().getItemAtPosition(position);
+            MediaWrapper item = (MediaWrapper) getListView().getItemAtPosition(position);
             if (item != null) {
-                if (item.getType() == Media.TYPE_VIDEO) {
+                if (item.getType() == MediaWrapper.TYPE_VIDEO) {
                     VideoPlayerActivity.start(getActivity(), item.getLocation());
                 } else {
                     ArrayList<String> arr = new ArrayList<String>();
                     for (int i = 0; i < getListAdapter().getCount(); i++) {
-                        Media audioItem = (Media) getListAdapter().getItem(i);
-                        if (audioItem.getType() == Media.TYPE_AUDIO)
+                        MediaWrapper audioItem = (MediaWrapper) getListAdapter().getItem(i);
+                        if (audioItem.getType() == MediaWrapper.TYPE_AUDIO)
                             arr.add(audioItem.getLocation());
                     }
                     AudioServiceController.getInstance().load(arr, arr.indexOf(item.getLocation()));
diff --git a/vlc-android/src/org/videolan/vlc/gui/SearchResultAdapter.java b/vlc-android/src/org/videolan/vlc/gui/SearchResultAdapter.java
index 6eb7a36..ea7d7b3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SearchResultAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SearchResultAdapter.java
@@ -22,7 +22,7 @@ package org.videolan.vlc.gui;
 
 import java.util.Comparator;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 
 import android.content.Context;
 import android.view.LayoutInflater;
@@ -31,8 +31,8 @@ import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
 import android.widget.TextView;
 
-public class SearchResultAdapter extends ArrayAdapter<Media>
-        implements Comparator<Media> {
+public class SearchResultAdapter extends ArrayAdapter<MediaWrapper>
+        implements Comparator<MediaWrapper> {
 
     public SearchResultAdapter(Context context) {
         super(context, 0);
@@ -51,14 +51,14 @@ public class SearchResultAdapter extends ArrayAdapter<Media>
         } else
             holder = (ViewHolder) view.getTag();
 
-        Media item = getItem(position);
+        MediaWrapper item = getItem(position);
         holder.text.setText(item.getTitle());
 
         return view;
     }
 
     @Override
-    public int compare(Media object1, Media object2) {
+    public int compare(MediaWrapper object1, MediaWrapper object2) {
         return object1.getTitle().compareToIgnoreCase(object2.getTitle());
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
index 457871c..e6fdaac 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -25,7 +25,7 @@ import java.util.Collections;
 import java.util.List;
 
 import org.videolan.libvlc.LibVlcUtil;
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.R;
 import org.videolan.vlc.audio.AudioServiceController;
@@ -81,7 +81,7 @@ public class AudioAlbumsSongsFragment extends Fragment implements SwipeRefreshLa
     public final static String EXTRA_NAME2 = "name2";
     public final static String EXTRA_MODE = "mode";
 
-    private ArrayList<Media> mediaList;
+    private ArrayList<MediaWrapper> mediaList;
     private String mTitle;
 
     TabHost mTabHost;
@@ -91,7 +91,7 @@ public class AudioAlbumsSongsFragment extends Fragment implements SwipeRefreshLa
     /* All subclasses of Fragment must include a public empty constructor. */
     public AudioAlbumsSongsFragment() { }
 
-    public void setMediaList(ArrayList<Media> mediaList, String title) {
+    public void setMediaList(ArrayList<MediaWrapper> mediaList, String title) {
         this.mediaList = mediaList;
         mTitle = title;
     }
@@ -296,7 +296,7 @@ public class AudioAlbumsSongsFragment extends Fragment implements SwipeRefreshLa
                         @Override
                         public void run(Object o) {
                             AudioBrowserListAdapter.ListItem listItem = (AudioBrowserListAdapter.ListItem)o;
-                            Media media = listItem.mMediaList.get(0);
+                            MediaWrapper media = listItem.mMediaList.get(0);
                             mMediaLibrary.getMediaItems().remove(media);
                             mSongsAdapter.removeMedia(media);
                             mAlbumsAdapter.removeMedia(media);
@@ -355,7 +355,7 @@ public class AudioAlbumsSongsFragment extends Fragment implements SwipeRefreshLa
                     @Override
                     public void run() {
                         for (int i = 0; i < mediaList.size(); ++i) {
-                            Media media = mediaList.get(i);
+                            MediaWrapper media = mediaList.get(i);
                             mAlbumsAdapter.addSeparator(Util.getMediaReferenceArtist(activity, media), media);
                             mAlbumsAdapter.add(Util.getMediaAlbum(activity, media), null, media);
                             mSongsAdapter.addSeparator(Util.getMediaAlbum(activity, media), media);
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 8f3c120..0389eb7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -51,7 +51,7 @@ import android.widget.PopupMenu;
 import android.widget.PopupMenu.OnMenuItemClickListener;
 
 import org.videolan.libvlc.LibVlcUtil;
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.R;
 import org.videolan.vlc.audio.AudioServiceController;
@@ -83,7 +83,7 @@ public class AudioBrowserFragment extends Fragment implements SwipeRefreshLayout
     private AudioServiceController mAudioController;
     private MediaLibrary mMediaLibrary;
 
-    List<Media> mAudioList;
+    List<MediaWrapper> mAudioList;
     private AudioBrowserListAdapter mArtistsAdapter;
     private AudioBrowserListAdapter mAlbumsAdapter;
     private AudioBrowserListAdapter mSongsAdapter;
@@ -302,7 +302,7 @@ public class AudioBrowserFragment extends Fragment implements SwipeRefreshLayout
     OnItemClickListener artistListListener = new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> av, View v, int p, long id) {
-            ArrayList<Media> mediaList = mArtistsAdapter.getMedia(p);
+            ArrayList<MediaWrapper> mediaList = mArtistsAdapter.getMedia(p);
             MainActivity activity = (MainActivity)getActivity();
             AudioAlbumsSongsFragment frag = (AudioAlbumsSongsFragment)activity.showSecondaryFragment("albumsSongs");
             if (frag != null) {
@@ -322,7 +322,7 @@ public class AudioBrowserFragment extends Fragment implements SwipeRefreshLayout
     OnItemClickListener genreListListener = new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> av, View v, int p, long id) {
-            ArrayList<Media> mediaList = mGenresAdapter.getMedia(p);
+            ArrayList<MediaWrapper> mediaList = mGenresAdapter.getMedia(p);
             MainActivity activity = (MainActivity)getActivity();
             AudioAlbumsSongsFragment frag = (AudioAlbumsSongsFragment)activity.showSecondaryFragment("albumsSongs");
             if (frag != null) {
@@ -389,7 +389,7 @@ public class AudioBrowserFragment extends Fragment implements SwipeRefreshLayout
                         @Override
                         public void run(Object o) {
                             AudioBrowserListAdapter.ListItem listItem = (AudioBrowserListAdapter.ListItem)o;
-                            Media media = listItem.mMediaList.get(0);
+                            MediaWrapper media = listItem.mMediaList.get(0);
                             mMediaLibrary.getMediaItems().remove(media);
                             mAudioController.removeLocation(media.getLocation());
                             updateLists();
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
index 0e3aafb..b79d0bd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
@@ -28,7 +28,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.R;
 import org.videolan.vlc.util.BitmapCache;
 import org.videolan.vlc.util.Util;
@@ -84,11 +84,11 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
     class ListItem {
         public String mTitle;
         public String mSubTitle;
-        public ArrayList<Media> mMediaList;
+        public ArrayList<MediaWrapper> mMediaList;
         public boolean mIsSeparator;
 
-        public ListItem(String title, String subTitle, Media media, boolean isSeparator) {
-            mMediaList = new ArrayList<Media>();
+        public ListItem(String title, String subTitle, MediaWrapper media, boolean isSeparator) {
+            mMediaList = new ArrayList<MediaWrapper>();
             if (media != null)
                 mMediaList.add(media);
             mTitle = title;
@@ -110,7 +110,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
         mAlignMode = Integer.valueOf(preferences.getString("audio_title_alignment", "0"));
     }
 
-    public void add(String title, String subTitle, Media media) {
+    public void add(String title, String subTitle, MediaWrapper media) {
         if(title == null) return;
         title = title.trim();
         if(subTitle != null) subTitle = subTitle.trim();
@@ -123,13 +123,13 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
         }
     }
 
-    public void addAll(List<Media> mediaList, final int type) {
-        final LinkedList<Media> list = new LinkedList<Media>(mediaList);
+    public void addAll(List<MediaWrapper> mediaList, final int type) {
+        final LinkedList<MediaWrapper> list = new LinkedList<MediaWrapper>(mediaList);
         mContext.runOnUiThread(new Runnable() {
             @Override
             public void run() {
                 String title, subTitle;
-                for (Media media : list) {
+                for (MediaWrapper media : list) {
                     switch (type){
                         case TYPE_ALBUMS:
                             title = Util.getMediaAlbum(mContext, media);
@@ -217,7 +217,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
         }
     }
 
-    public void addSeparator(String title, Media media) {
+    public void addSeparator(String title, MediaWrapper media) {
         if(title == null) return;
         title = title.trim();
         if (mSeparatorItemMap.containsKey(title))
@@ -234,7 +234,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
         for (ListItem album : mSeparatorItemMap.values()){
             mItems.add(album);
             Collections.sort(album.mMediaList, MediaComparators.byTrackNumber);
-            for (Media media : album.mMediaList)
+            for (MediaWrapper media : album.mMediaList)
                 add(media.getTitle(), null, media);
         }
     }
@@ -244,7 +244,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
      * Remove also all the list items that contain only this media.
      * @param media the media to remove
      */
-    public void removeMedia(Media media) {
+    public void removeMedia(MediaWrapper media) {
         for (int i = 0; i < mItems.size(); ++i) {
             ListItem item = mItems.get(i);
             if (item.mMediaList == null)
@@ -312,7 +312,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
 
         RelativeLayout.LayoutParams paramsCover;
         if (mItemType == ITEM_WITH_COVER) {
-            Media media = mItems.get(position).mMediaList.get(0);
+            MediaWrapper media = mItems.get(position).mMediaList.get(0);
             Bitmap cover = AudioUtil.getCover(v.getContext(), media, 64);
             if (cover == null)
                 cover = BitmapCache.GetFromResource(v, R.drawable.icon);
@@ -462,9 +462,9 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
         return sections.toArray();
     }
 
-    public ArrayList<Media> getMedia(int position) {
+    public ArrayList<MediaWrapper> getMedia(int position) {
         // Return all the media of a list item list.
-        ArrayList<Media> mediaList = new ArrayList<Media>();
+        ArrayList<MediaWrapper> mediaList = new ArrayList<MediaWrapper>();
         if (!mItems.get(position).mIsSeparator)
             mediaList.addAll(mItems.get(position).mMediaList);
         return mediaList;
@@ -478,7 +478,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
         // Return all the media locations of a list item list.
         ArrayList<String> locations = new ArrayList<String>();
         if (isEnabled(position)) {
-            ArrayList<Media> mediaList = mItems.get(position).mMediaList;
+            ArrayList<MediaWrapper> mediaList = mItems.get(position).mMediaList;
             if (sortByTrackNumber)
                 Collections.sort(mediaList, MediaComparators.byTrackNumber);
             for (int i = 0; i < mediaList.size(); ++i)
@@ -503,7 +503,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
                 if(position == i && !mItems.get(i).mMediaList.isEmpty())
                     outputPosition = outputList.size();
 
-                for(Media k : mItems.get(i).mMediaList) {
+                for(MediaWrapper k : mItems.get(i).mMediaList) {
                     outputList.add(k.getLocation());
                 }
             }
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index ac592d6..d3655a6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -25,7 +25,7 @@ import java.util.List;
 import android.content.Context;
 import android.content.Intent;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.R;
 import org.videolan.vlc.audio.AudioServiceController;
 import org.videolan.vlc.audio.RepeatType;
@@ -389,12 +389,12 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
 
         mSongsListAdapter.clear();
 
-        final List<Media> audioList = mAudioController.getMedias();
+        final List<MediaWrapper> audioList = mAudioController.getMedias();
         final String currentItem = mAudioController.getCurrentMediaLocation();
 
         if (audioList != null) {
             for (int i = 0; i < audioList.size(); i++) {
-                final Media media = audioList.get(i);
+                final MediaWrapper media = audioList.get(i);
                 if (currentItem != null && currentItem.equals(media.getLocation()))
                     currentIndex = i;
                 mSongsListAdapter.add(media);
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
index 239cd4c..83bb146 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
@@ -23,7 +23,7 @@ package org.videolan.vlc.gui.audio;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.R;
 import org.videolan.vlc.util.Util;
 import org.videolan.vlc.widget.AudioPlaylistItemViewGroup;
@@ -44,9 +44,9 @@ import android.widget.ImageButton;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
-public class AudioPlaylistAdapter extends ArrayAdapter<Media> {
+public class AudioPlaylistAdapter extends ArrayAdapter<MediaWrapper> {
 
-    private ArrayList<Media> mMediaList;
+    private ArrayList<MediaWrapper> mMediaList;
     private int mCurrentIndex;
     private Context mContext;
     private int mAlignMode;
@@ -54,20 +54,20 @@ public class AudioPlaylistAdapter extends ArrayAdapter<Media> {
     public AudioPlaylistAdapter(Context context) {
         super(context, 0);
         mContext = context;
-        mMediaList = new ArrayList<Media>();
+        mMediaList = new ArrayList<MediaWrapper>();
         mCurrentIndex = -1;
         SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
         mAlignMode = Integer.valueOf(preferences.getString("audio_title_alignment", "0"));
     }
 
     @Override
-    public void add(Media m) {
+    public void add(MediaWrapper m) {
         mMediaList.add(m);
         super.add(m);
     }
 
     @Override
-    public void remove(Media m) {
+    public void remove(MediaWrapper m) {
         mMediaList.remove(m);
         super.remove(m);
     }
@@ -107,7 +107,7 @@ public class AudioPlaylistAdapter extends ArrayAdapter<Media> {
         holder.layoutFooter.setVisibility(LinearLayout.VISIBLE);
         holder.itemGroup.scrollTo(1);
 
-        Media media = getItem(position);
+        MediaWrapper media = getItem(position);
         final String title = media.getTitle();
         final String artist = Util.getMediaSubtitle(mContext, media);
         final int pos = position;
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
index bfd3edb..41ebc09 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
@@ -31,7 +31,7 @@ import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
 
 import org.videolan.libvlc.LibVlcUtil;
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.util.AndroidDevices;
@@ -74,7 +74,7 @@ public class AudioUtil {
      */
     public static String PLAYLIST_DIR = null;
 
-    public static void setRingtone(Media song, Context context){
+    public static void setRingtone(MediaWrapper song, Context context){
         File newringtone = LibVlcUtil.URItoFile(song.getLocation());
         if(newringtone == null || (newringtone != null && !newringtone.exists())) {
             Toast.makeText(context.getApplicationContext(),context.getString(R.string.ringtone_error), Toast.LENGTH_SHORT).show();
@@ -152,7 +152,7 @@ public class AudioUtil {
             dir.delete();
     }
 
-    private static String getCoverFromMediaStore(Context context, Media media) {
+    private static String getCoverFromMediaStore(Context context, MediaWrapper media) {
         final String album = media.getAlbum();
         if (album == null)
             return null;
@@ -177,7 +177,7 @@ public class AudioUtil {
         return null;
     }
 
-    private static String getCoverFromVlc(Context context, Media media) throws NoSuchAlgorithmException, UnsupportedEncodingException {
+    private static String getCoverFromVlc(Context context, MediaWrapper media) throws NoSuchAlgorithmException, UnsupportedEncodingException {
         String artworkURL = media.getArtworkURL();
         if (artworkURL != null && artworkURL.startsWith("file://")) {
             return Uri.decode(artworkURL).replace("file://", "");
@@ -212,7 +212,7 @@ public class AudioUtil {
         return null;
     }
 
-    private static String getCoverFromFolder(Context context, Media media) {
+    private static String getCoverFromFolder(Context context, MediaWrapper media) {
         File f = LibVlcUtil.URItoFile(media.getLocation());
         if (f != null && f.getParentFile() != null && f.getParentFile().listFiles() != null)
             for (File s : f.getParentFile().listFiles()) {
@@ -224,7 +224,7 @@ public class AudioUtil {
     }
 
     @SuppressLint("NewApi")
-    public synchronized static Bitmap getCover(Context context, Media media, int width) {
+    public synchronized static Bitmap getCover(Context context, MediaWrapper media, int width) {
         String coverPath = null;
         Bitmap cover = null;
         String cachePath = null;
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/MediaComparators.java b/vlc-android/src/org/videolan/vlc/gui/audio/MediaComparators.java
index eefe497..0fa318b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/MediaComparators.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/MediaComparators.java
@@ -21,7 +21,7 @@ package org.videolan.vlc.gui.audio;
 
 import java.util.Comparator;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 
 public class MediaComparators {
 
@@ -35,32 +35,32 @@ public class MediaComparators {
         return String.CASE_INSENSITIVE_ORDER.compare(s1, s2);
     }
 
-    public static final Comparator<Media> byName = new Comparator<Media>() {
+    public static final Comparator<MediaWrapper> byName = new Comparator<MediaWrapper>() {
         @Override
-        public int compare(Media m1, Media m2) {
+        public int compare(MediaWrapper m1, MediaWrapper m2) {
             return nullInsensitiveStringCompare(m1.getTitle(), m2.getTitle());
         };
     };
 
-    public static final Comparator<Media> byMRL = new Comparator<Media>() {
+    public static final Comparator<MediaWrapper> byMRL = new Comparator<MediaWrapper>() {
         @Override
-        public int compare(Media m1, Media m2) {
+        public int compare(MediaWrapper m1, MediaWrapper m2) {
             return nullInsensitiveStringCompare(m1.getLocation(), m2.getLocation());
         };
     };
 
-    public static final Comparator<Media> byLength = new Comparator<Media>() {
+    public static final Comparator<MediaWrapper> byLength = new Comparator<MediaWrapper>() {
         @Override
-        public int compare(Media m1, Media m2) {
+        public int compare(MediaWrapper m1, MediaWrapper m2) {
             if(m1.getLength() > m2.getLength()) return -1;
             if(m1.getLength() < m2.getLength()) return 1;
             else return 0;
         };
     };
 
-    public static final Comparator<Media> byAlbum = new Comparator<Media>() {
+    public static final Comparator<MediaWrapper> byAlbum = new Comparator<MediaWrapper>() {
         @Override
-        public int compare(Media m1, Media m2) {
+        public int compare(MediaWrapper m1, MediaWrapper m2) {
             int res = nullInsensitiveStringCompare(m1.getAlbum(), m2.getAlbum());
             if (res == 0)
                 res = byMRL.compare(m1, m2);
@@ -68,9 +68,9 @@ public class MediaComparators {
         };
     };
 
-    public static final Comparator<Media> byArtist = new Comparator<Media>() {
+    public static final Comparator<MediaWrapper> byArtist = new Comparator<MediaWrapper>() {
         @Override
-        public int compare(Media m1, Media m2) {
+        public int compare(MediaWrapper m1, MediaWrapper m2) {
             int res = nullInsensitiveStringCompare(m1.getReferenceArtist(), m2.getReferenceArtist());
             if (res == 0)
                 res = byAlbum.compare(m1, m2);
@@ -78,9 +78,9 @@ public class MediaComparators {
         };
     };
 
-    public static final Comparator<Media> byGenre = new Comparator<Media>() {
+    public static final Comparator<MediaWrapper> byGenre = new Comparator<MediaWrapper>() {
         @Override
-        public int compare(Media m1, Media m2) {
+        public int compare(MediaWrapper m1, MediaWrapper m2) {
             int res = nullInsensitiveStringCompare(m1.getGenre(), m2.getGenre());
             if (res == 0)
                 res = byArtist.compare(m1, m2);
@@ -88,9 +88,9 @@ public class MediaComparators {
         };
     };
 
-    public static final Comparator<Media> byTrackNumber = new Comparator<Media>() {
+    public static final Comparator<MediaWrapper> byTrackNumber = new Comparator<MediaWrapper>() {
         @Override
-        public int compare(Media m1, Media m2) {
+        public int compare(MediaWrapper m1, MediaWrapper m2) {
             if(m1.getTrackNumber() < m2.getTrackNumber()) return -1;
             if(m1.getTrackNumber() > m2.getTrackNumber()) return 1;
             else return 0;
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
index 8b2ca81..c231c8c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
@@ -26,9 +26,9 @@ import java.nio.ByteBuffer;
 import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcException;
 import org.videolan.libvlc.LibVlcUtil;
-import org.videolan.libvlc.Media;
 import org.videolan.libvlc.TrackInfo;
 import org.videolan.libvlc.util.Extensions;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.R;
 import org.videolan.vlc.gui.MainActivity;
@@ -61,7 +61,7 @@ public class MediaInfoFragment extends ListFragment {
     public final static String TAG = "VLC/MediaInfoFragment";
     LibVLC mLibVlc = null;
 
-    private Media mItem;
+    private MediaWrapper mItem;
     private Bitmap mImage;
     private TextView mLengthView;
     private TextView mSizeView;
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoBrowserInterface.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoBrowserInterface.java
index 69219ab..84b97e7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoBrowserInterface.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoBrowserInterface.java
@@ -2,7 +2,7 @@ package org.videolan.vlc.gui.video;
 
 import java.util.concurrent.BrokenBarrierException;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 
 public interface VideoBrowserInterface {
     public static final long HEADER_VIDEO = 0;
@@ -17,7 +17,7 @@ public interface VideoBrowserInterface {
 	public static final String AUDIO_FILTER = "filter";
 
 	public void resetBarrier();
-	public void setItemToUpdate(Media item);
+	public void setItemToUpdate(MediaWrapper item);
 	public void await() throws InterruptedException, BrokenBarrierException;
 	public void updateItem();
 	public void updateList();
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 1cb3233..fdc8937 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -59,8 +59,8 @@ import android.widget.TextView;
 import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcException;
 import org.videolan.libvlc.LibVlcUtil;
-import org.videolan.libvlc.Media;
 import org.videolan.libvlc.TrackInfo;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaDatabase;
 import org.videolan.vlc.MediaGroup;
 import org.videolan.vlc.MediaLibrary;
@@ -96,7 +96,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
     protected GridView mGridView;
     protected TextView mTextViewNomedia;
     protected View mViewNomedia;
-    protected Media mItemToUpdate;
+    protected MediaWrapper mItemToUpdate;
     protected String mGroup;
     protected final CyclicBarrier mBarrier = new CyclicBarrier(2);
 
@@ -281,7 +281,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
 
     @Override
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-        Media media = mVideoAdapter.getItem(position);
+        MediaWrapper media = mVideoAdapter.getItem(position);
         if (media instanceof MediaGroup) {
             MainActivity activity = (MainActivity)getActivity();
             VideoGridFragment frag = (VideoGridFragment)activity.showSecondaryFragment("videoGroupList");
@@ -293,16 +293,16 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
             playVideo(media, false);
     }
 
-    protected void playVideo(Media media, boolean fromStart) {
+    protected void playVideo(MediaWrapper media, boolean fromStart) {
         VideoPlayerActivity.start(getActivity(), media.getLocation(), fromStart);
     }
 
-    protected void playAudio(Media media) {
+    protected void playAudio(MediaWrapper media) {
         mAudioController.load(media.getLocation(), true);
     }
 
     private boolean handleContextItemSelected(MenuItem menu, int position) {
-        Media media = mVideoAdapter.getItem(position);
+        MediaWrapper media = mVideoAdapter.getItem(position);
         switch (menu.getItemId())
         {
         case R.id.video_list_play_from_start:
@@ -325,7 +325,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
                     new VLCRunnable(media) {
                         @Override
                         public void run(Object o) {
-                            Media media = (Media) o;
+                            MediaWrapper media = (MediaWrapper) o;
                             mMediaLibrary.getMediaItems().remove(media);
                             mVideoAdapter.remove(media);
                             mAudioController.removeLocation(media.getLocation());
@@ -341,7 +341,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
     public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
         // Do not show the menu of media group.
         AdapterContextMenuInfo info = (AdapterContextMenuInfo)menuInfo;
-        Media media = mVideoAdapter.getItem(info.position);
+        MediaWrapper media = mVideoAdapter.getItem(info.position);
         if (media instanceof MediaGroup)
             return;
         MenuInflater inflater = getActivity().getMenuInflater();
@@ -349,7 +349,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
         setContextMenuItems(menu, media);
     }
 
-    private void setContextMenuItems(Menu menu, Media media) {
+    private void setContextMenuItems(Menu menu, MediaWrapper media) {
         long lastTime = media.getTime();
         if (lastTime > 0)
             menu.findItem(R.id.video_list_play_from_start).setVisible(true);
@@ -383,7 +383,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
 
         PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
         popupMenu.getMenuInflater().inflate(R.menu.video_list, popupMenu.getMenu());
-        Media media = mVideoAdapter.getItem(position);
+        MediaWrapper media = mVideoAdapter.getItem(position);
         setContextMenuItems(popupMenu.getMenu(), media);
         popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
             @Override
@@ -418,7 +418,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
     public void updateList() {
         if (!mSwipeRefreshLayout.isRefreshing())
             mSwipeRefreshLayout.setRefreshing(true);
-        final List<Media> itemList = mMediaLibrary.getVideoItems();
+        final List<MediaWrapper> itemList = mMediaLibrary.getVideoItems();
 
         if (mThumbnailer != null)
             mThumbnailer.clearJobs();
@@ -434,7 +434,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
                 public void run() {
                     if (mGroup != null || itemList.size() <= 10) {
                         mVideoAdapter.setNotifyOnChange(false);
-                        for (Media item : itemList) {
+                        for (MediaWrapper item : itemList) {
                             if (mGroup == null || item.getTitle().startsWith(mGroup)) {
                                 mVideoAdapter.add(item);
                                 if (mThumbnailer != null)
@@ -485,7 +485,7 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
         mVideoAdapter.sortBy(sortby);
     }
 
-    public void setItemToUpdate(Media item) {
+    public void setItemToUpdate(MediaWrapper item) {
         mItemToUpdate = item;
         mHandler.sendEmptyMessage(VideoListHandler.UPDATE_ITEM);
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index 7d29359..bcbf634 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -24,7 +24,7 @@ import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Locale;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaGroup;
 import org.videolan.vlc.R;
 import org.videolan.vlc.util.BitmapCache;
@@ -45,8 +45,8 @@ import android.widget.ImageView;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 
-public class VideoListAdapter extends ArrayAdapter<Media>
-                                 implements Comparator<Media> {
+public class VideoListAdapter extends ArrayAdapter<MediaWrapper>
+                                 implements Comparator<MediaWrapper> {
 
     public final static int SORT_BY_TITLE = 0;
     public final static int SORT_BY_LENGTH = 1;
@@ -64,7 +64,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
 
     public final static String TAG = "VLC/MediaLibraryAdapter";
 
-    public synchronized void update(Media item) {
+    public synchronized void update(MediaWrapper item) {
         int position = getPosition(item);
         if (position != -1) {
             remove(item);
@@ -76,7 +76,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
         boolean notify = false;
         // update times
         for (int i = 0; i < getCount(); ++i) {
-            Media media = getItem(i);
+            MediaWrapper media = getItem(i);
             Long time = times.get(media.getLocation());
             if (time != null) {
                 media.setTime(time);
@@ -118,7 +118,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
     }
 
     @Override
-    public int compare(Media item1, Media item2) {
+    public int compare(MediaWrapper item1, MediaWrapper item2) {
         int compare = 0;
         switch (mSortBy) {
             case SORT_BY_TITLE:
@@ -174,7 +174,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
             }
         });
 
-        Media media = getItem(position);
+        MediaWrapper media = getItem(position);
 
         /* Thumbnail */
         Bitmap thumbnail = BitmapUtil.getPictureFromCache(media);
@@ -202,7 +202,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
         return v;
     }
 
-    private void fillGroupView(ViewHolder holder, Media media) {
+    private void fillGroupView(ViewHolder holder, MediaWrapper media) {
         MediaGroup mediaGroup = (MediaGroup) media;
         int size = mediaGroup.size();
         String text = getContext().getResources().getQuantityString(R.plurals.videos_quantity, size, size);
@@ -213,7 +213,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
         holder.progress.setVisibility(View.INVISIBLE);
     }
 
-    private void fillVideoView(ViewHolder holder, Media media) {
+    private void fillVideoView(ViewHolder holder, MediaWrapper media) {
         /* Time / Duration */
         if (media.getLength() > 0) {
             long lastTime = media.getTime();
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index d1e497d..0337d5e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -43,9 +43,9 @@ import org.videolan.libvlc.IVideoPlayer;
 import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcException;
 import org.videolan.libvlc.LibVlcUtil;
-import org.videolan.libvlc.Media;
-import org.videolan.libvlc.MediaListPlayer;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaDatabase;
+import org.videolan.vlc.MediaWrapperListPlayer;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.audio.AudioServiceController;
@@ -150,7 +150,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
     private MediaRouter.SimpleCallback mMediaRouterCallback;
     private SecondaryDisplay mPresentation;
     private LibVLC mLibVLC;
-    private MediaListPlayer mMediaListPlayer;
+    private MediaWrapperListPlayer mMediaListPlayer;
     private String mLocation;
     private GestureDetectorCompat mDetector;
 
@@ -376,7 +376,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
             Log.d(TAG, "LibVLC initialisation failed");
             return;
         }
-        mMediaListPlayer = new MediaListPlayer(mLibVLC);
+        mMediaListPlayer = new MediaWrapperListPlayer(mLibVLC);
 
         mSurfaceView = (SurfaceView) findViewById(R.id.player_surface);
         mSurfaceHolder = mSurfaceView.getHolder();
@@ -2159,7 +2159,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
         int time = (int) mLibVLC.getTime();
         int length = (int) mLibVLC.getLength();
         if (length == 0) {
-            Media media = MediaDatabase.getInstance().getMedia(mLocation);
+            MediaWrapper media = MediaDatabase.getInstance().getMedia(mLocation);
             if (media != null)
                 length = (int) media.getLength();
         }
@@ -2367,7 +2367,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
             mMediaListPlayer.playIndex(savedIndexPosition);
         } else if (mLocation != null && mLocation.length() > 0 && !dontParse) {
             AudioServiceController.getInstance().stop(); // Stop the previous playback.
-            mMediaListPlayer.getMediaList().add(new Media(mLibVLC, mLocation));
+            mMediaListPlayer.getMediaList().add(new MediaWrapper(mLibVLC, mLocation));
             savedIndexPosition = mMediaListPlayer.getMediaList().size() - 1;
             mMediaListPlayer.playIndex(savedIndexPosition);
         }
@@ -2375,7 +2375,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
 
         if (mLocation != null && mLocation.length() > 0 && !dontParse) {
             // restore last position
-            Media media = MediaDatabase.getInstance().getMedia(mLocation);
+            MediaWrapper media = MediaDatabase.getInstance().getMedia(mLocation);
             if(media != null) {
                 // in media library
                 if(media.getTime() > 0 && !fromStart)
diff --git a/vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl b/vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl
index cf78bff..a2b5fc0 100644
--- a/vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl
+++ b/vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl
@@ -20,7 +20,7 @@
 
 package org.videolan.vlc.interfaces;
 import org.videolan.vlc.interfaces.IAudioServiceCallback;
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 
 interface IAudioService {
     void play();
@@ -35,7 +35,7 @@ interface IAudioService {
     void moveItem(int positionStart, int positionEnd);
     void remove(int position);
     void removeLocation(String location);
-    List<Media> getMedias();
+    List<MediaWrapper> getMedias();
     List<String> getMediaLocations();
     String getCurrentMediaLocation();
     boolean isPlaying();
diff --git a/vlc-android/src/org/videolan/vlc/interfaces/IAudioServiceCallback.aidl b/vlc-android/src/org/videolan/vlc/interfaces/IAudioServiceCallback.aidl
index 7497c1d..8f66af0 100644
--- a/vlc-android/src/org/videolan/vlc/interfaces/IAudioServiceCallback.aidl
+++ b/vlc-android/src/org/videolan/vlc/interfaces/IAudioServiceCallback.aidl
@@ -19,11 +19,11 @@
  *****************************************************************************/
 
 package org.videolan.vlc.interfaces;
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 
 interface IAudioServiceCallback {
     void update();
     void updateProgress();
-    void onMediaPlayedAdded(in Media media, int index);
+    void onMediaPlayedAdded(in MediaWrapper media, int index);
     void onMediaPlayedRemoved(int index);
 }
diff --git a/vlc-android/src/org/videolan/vlc/util/BitmapUtil.java b/vlc-android/src/org/videolan/vlc/util/BitmapUtil.java
index 3a43dae..cdf3dd7 100644
--- a/vlc-android/src/org/videolan/vlc/util/BitmapUtil.java
+++ b/vlc-android/src/org/videolan/vlc/util/BitmapUtil.java
@@ -20,7 +20,7 @@
 
 package org.videolan.vlc.util;
 
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaDatabase;
 import org.videolan.vlc.VLCApplication;
 
@@ -79,7 +79,7 @@ public class BitmapUtil {
         return bitmap;
     }
 
-    public static Bitmap getPictureFromCache(Media media)
+    public static Bitmap getPictureFromCache(MediaWrapper media)
     {
         // mPicture is not null only if passed through
         // the ctor which is deprecated by now.
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 7c77b2a..e030de4 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcUtil;
-import org.videolan.libvlc.Media;
+import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
@@ -103,10 +103,10 @@ public class Util {
      * @param mrl MRL of the media
      * @return A media object from the media library or newly created
      */
-    public static Media getOrCreateMedia(LibVLC libVLC, String mrl) {
-        Media mlItem = MediaLibrary.getInstance().getMediaItem(mrl);
+    public static MediaWrapper getOrCreateMedia(LibVLC libVLC, String mrl) {
+        MediaWrapper mlItem = MediaLibrary.getInstance().getMediaItem(mrl);
         if(mlItem == null)
-            mlItem = new Media(libVLC, mrl);
+            mlItem = new MediaWrapper(libVLC, mrl);
         return mlItem;
     }
 
@@ -210,34 +210,34 @@ public class Util {
         }
     }
 
-    public static String getMediaArtist(Context ctx, Media media) {
+    public static String getMediaArtist(Context ctx, MediaWrapper media) {
         final String artist = media.getArtist();
         return artist != null ? artist : getMediaString(ctx, R.string.unknown_artist);
     }
 
-    public static String getMediaReferenceArtist(Context ctx, Media media) {
+    public static String getMediaReferenceArtist(Context ctx, MediaWrapper media) {
         final String artist = media.getReferenceArtist();
         return artist != null ? artist : getMediaString(ctx, R.string.unknown_artist);
     }
 
-    public static String getMediaAlbumArtist(Context ctx, Media media) {
+    public static String getMediaAlbumArtist(Context ctx, MediaWrapper media) {
         final String albumArtist = media.getAlbumArtist();
         return albumArtist != null ? albumArtist : getMediaString(ctx, R.string.unknown_artist);
     }
 
-    public static String getMediaAlbum(Context ctx, Media media) {
+    public static String getMediaAlbum(Context ctx, MediaWrapper media) {
         final String album = media.getAlbum();
         return album != null ? album : getMediaString(ctx, R.string.unknown_album);
 
     }
 
-    public static String getMediaGenre(Context ctx, Media media) {
+    public static String getMediaGenre(Context ctx, MediaWrapper media) {
         final String genre = media.getGenre();
         return genre != null ? genre : getMediaString(ctx, R.string.unknown_genre);
     }
 
-    public static String getMediaSubtitle(Context ctx, Media media) {
-        if (media.getType() == Media.TYPE_VIDEO)
+    public static String getMediaSubtitle(Context ctx, MediaWrapper media) {
+        if (media.getType() == MediaWrapper.TYPE_VIDEO)
             return "";
         else
             return media.getNowPlaying() != null
-- 
2.1.3



More information about the Android mailing list