[Android] Do not expect Audio by default, if we do not find any ES
Jean-Baptiste Kempf
git at videolan.org
Wed Jul 4 12:40:53 CEST 2012
android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Jul 4 12:09:25 2012 +0200| [4c810176b5a7ea645800a4a5462a3975276cd16a] | committer: Jean-Baptiste Kempf
Do not expect Audio by default, if we do not find any ES
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=4c810176b5a7ea645800a4a5462a3975276cd16a
---
vlc-android/src/org/videolan/vlc/Media.java | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/Media.java b/vlc-android/src/org/videolan/vlc/Media.java
index 71d8f10..b9dfe14 100644
--- a/vlc-android/src/org/videolan/vlc/Media.java
+++ b/vlc-android/src/org/videolan/vlc/Media.java
@@ -129,7 +129,7 @@ public class Media implements Comparable<Media> {
LibVLC mLibVlc = null;
try {
mLibVlc = LibVLC.getInstance();
- mType = TYPE_AUDIO;
+ mType = TYPE_ALL;
TrackInfo[] tracks = mLibVlc.readTracksInfo(mLocation);
@@ -138,9 +138,9 @@ public class Media implements Comparable<Media> {
mType = TYPE_VIDEO;
mWidth = track.Width;
mHeight = track.Height;
- }
-
- if (track.Type == TrackInfo.TYPE_META) {
+ } else if (track.Type == TrackInfo.TYPE_AUDIO){
+ mType = TYPE_AUDIO;
+ } else if (track.Type == TrackInfo.TYPE_META) {
mLength = track.Length;
mTitle = track.Title;
mArtist = Util.getValue(track.Artist, R.string.unknown_artist);
@@ -153,6 +153,19 @@ public class Media implements Comparable<Media> {
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);
+ if( Media.VIDEO_EXTENSIONS.contains(fileExt) ) {
+ mType = TYPE_VIDEO;
+ } else if (Media.AUDIO_EXTENSIONS.contains(fileExt)) {
+ mType = TYPE_AUDIO;
+ }
+ }
+ }
} catch (LibVlcException e) {
e.printStackTrace();
}
More information about the Android
mailing list