Commit 63f2bfb7 authored by Sébastien Toque's avatar Sébastien Toque
Browse files

renaming leftover of *Manager

DatabaseManager to MediaDatabase
ThumbnailerManager to Thumbnailer
EventManager to EventHandler
parent b9bd2dbd
...@@ -205,7 +205,7 @@ static void releaseMediaPlayer(JNIEnv *env, jobject thiz) ...@@ -205,7 +205,7 @@ static void releaseMediaPlayer(JNIEnv *env, jobject thiz)
*/ */
JavaVM *myVm; JavaVM *myVm;
static jobject eventManagerInstance = NULL; static jobject eventHandlerInstance = NULL;
static jobject debugBufferInstance = NULL; static jobject debugBufferInstance = NULL;
static pthread_mutex_t vout_android_lock; static pthread_mutex_t vout_android_lock;
...@@ -244,7 +244,7 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data) ...@@ -244,7 +244,7 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data)
bool isAttached = false; bool isAttached = false;
if (eventManagerInstance == NULL) if (eventHandlerInstance == NULL)
return; return;
if ((*myVm)->GetEnv(myVm, (void**) &env, JNI_VERSION_1_2) < 0) { if ((*myVm)->GetEnv(myVm, (void**) &env, JNI_VERSION_1_2) < 0) {
...@@ -301,18 +301,18 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data) ...@@ -301,18 +301,18 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data)
} }
/* Get the object class */ /* Get the object class */
jclass cls = (*env)->GetObjectClass(env, eventManagerInstance); jclass cls = (*env)->GetObjectClass(env, eventHandlerInstance);
if (!cls) { if (!cls) {
LOGE("EventManager: failed to get class reference"); LOGE("EventHandler: failed to get class reference");
goto end; goto end;
} }
/* Find the callback ID */ /* Find the callback ID */
jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V"); jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");
if (methodID) { if (methodID) {
(*env)->CallVoidMethod(env, eventManagerInstance, methodID, ev->type, bundle); (*env)->CallVoidMethod(env, eventHandlerInstance, methodID, ev->type, bundle);
} else { } else {
LOGE("EventManager: failed to get the callback method"); LOGE("EventHandler: failed to get the callback method");
} }
end: end:
...@@ -582,34 +582,34 @@ void Java_org_videolan_vlc_LibVLC_nativeDestroy(JNIEnv *env, jobject thiz) ...@@ -582,34 +582,34 @@ void Java_org_videolan_vlc_LibVLC_nativeDestroy(JNIEnv *env, jobject thiz)
setLong(env, thiz, "mLibVlcInstance", 0); setLong(env, thiz, "mLibVlcInstance", 0);
} }
void Java_org_videolan_vlc_LibVLC_detachEventManager(JNIEnv *env, jobject thiz) void Java_org_videolan_vlc_LibVLC_detachEventHandler(JNIEnv *env, jobject thiz)
{ {
if (eventManagerInstance != NULL) { if (eventHandlerInstance != NULL) {
(*env)->DeleteGlobalRef(env, eventManagerInstance); (*env)->DeleteGlobalRef(env, eventHandlerInstance);
eventManagerInstance = NULL; eventHandlerInstance = NULL;
} }
} }
void Java_org_videolan_vlc_LibVLC_setEventManager(JNIEnv *env, jobject thiz, jobject eventManager) void Java_org_videolan_vlc_LibVLC_setEventHandler(JNIEnv *env, jobject thiz, jobject eventHandler)
{ {
if (eventManagerInstance != NULL) { if (eventHandlerInstance != NULL) {
(*env)->DeleteGlobalRef(env, eventManagerInstance); (*env)->DeleteGlobalRef(env, eventHandlerInstance);
eventManagerInstance = NULL; eventHandlerInstance = NULL;
} }
jclass cls = (*env)->GetObjectClass(env, eventManager); jclass cls = (*env)->GetObjectClass(env, eventHandler);
if (!cls) { if (!cls) {
LOGE("setEventManager: failed to get class reference"); LOGE("setEventHandler: failed to get class reference");
return; return;
} }
jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V"); jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");
if (!methodID) { if (!methodID) {
LOGE("setEventManager: failed to get the callback method"); LOGE("setEventHandler: failed to get the callback method");
return; return;
} }
eventManagerInstance = (*env)->NewGlobalRef(env, eventManager); eventHandlerInstance = (*env)->NewGlobalRef(env, eventHandler);
} }
jobjectArray Java_org_videolan_vlc_LibVLC_readMediaMeta(JNIEnv *env, jobjectArray Java_org_videolan_vlc_LibVLC_readMediaMeta(JNIEnv *env,
......
...@@ -90,7 +90,7 @@ public class AudioService extends Service { ...@@ -90,7 +90,7 @@ public class AudioService extends Service {
private Stack<Media> mPrevious; private Stack<Media> mPrevious;
private Media mCurrentMedia; private Media mCurrentMedia;
private HashMap<IAudioServiceCallback, Integer> mCallback; private HashMap<IAudioServiceCallback, Integer> mCallback;
private EventHandler mEventManager; private EventHandler mEventHandler;
private boolean mShuffling = false; private boolean mShuffling = false;
private RepeatType mRepeating = RepeatType.None; private RepeatType mRepeating = RepeatType.None;
private boolean mDetectHeadset = true; private boolean mDetectHeadset = true;
...@@ -133,7 +133,7 @@ public class AudioService extends Service { ...@@ -133,7 +133,7 @@ public class AudioService extends Service {
mCallback = new HashMap<IAudioServiceCallback, Integer>(); mCallback = new HashMap<IAudioServiceCallback, Integer>();
mMediaList = new ArrayList<Media>(); mMediaList = new ArrayList<Media>();
mPrevious = new Stack<Media>(); mPrevious = new Stack<Media>();
mEventManager = EventHandler.getInstance(); mEventHandler = EventHandler.getInstance();
mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(), mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(),
RemoteControlClientReceiver.class.getName()); RemoteControlClientReceiver.class.getName());
...@@ -351,7 +351,7 @@ public class AudioService extends Service { ...@@ -351,7 +351,7 @@ public class AudioService extends Service {
/** /**
* Handle libvlc asynchronous events * Handle libvlc asynchronous events
*/ */
private final Handler mEventHandler = new AudioServiceEventHandler(this); private final Handler mVlcEventHandler = new AudioServiceEventHandler(this);
private static class AudioServiceEventHandler extends WeakHandler<AudioService> { private static class AudioServiceEventHandler extends WeakHandler<AudioService> {
public AudioServiceEventHandler(AudioService fragment) { public AudioServiceEventHandler(AudioService fragment) {
...@@ -536,7 +536,7 @@ public class AudioService extends Service { ...@@ -536,7 +536,7 @@ public class AudioService extends Service {
private void stop() { private void stop() {
mLibVLC.stop(); mLibVLC.stop();
mEventManager.removeHandler(mEventHandler); mEventHandler.removeHandler(mVlcEventHandler);
setRemoteControlClientPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED); setRemoteControlClientPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
mCurrentMedia = null; mCurrentMedia = null;
mMediaList.clear(); mMediaList.clear();
...@@ -754,7 +754,7 @@ public class AudioService extends Service { ...@@ -754,7 +754,7 @@ public class AudioService extends Service {
mLibVLCPlaylistActive = libvlcBacked; mLibVLCPlaylistActive = libvlcBacked;
Log.v(TAG, "Loading position " + ((Integer)position).toString() + " in " + mediaPathList.toString()); Log.v(TAG, "Loading position " + ((Integer)position).toString() + " in " + mediaPathList.toString());
mEventManager.addHandler(mEventHandler); mEventHandler.addHandler(mVlcEventHandler);
mMediaList.clear(); mMediaList.clear();
mPrevious.clear(); mPrevious.clear();
...@@ -801,7 +801,7 @@ public class AudioService extends Service { ...@@ -801,7 +801,7 @@ public class AudioService extends Service {
if(!mLibVLC.isPlaying()) if(!mLibVLC.isPlaying())
return; return;
mEventManager.addHandler(mEventHandler); mEventHandler.addHandler(mVlcEventHandler);
mMediaList.clear(); mMediaList.clear();
mPrevious.clear(); mPrevious.clear();
// Prevent re-parsing the media, which would mean losing the connection // Prevent re-parsing the media, which would mean losing the connection
......
/***************************************************************************** /*****************************************************************************
* EventManager.java * EventHandler.java
***************************************************************************** *****************************************************************************
* Copyright © 2011-2012 VLC authors and VideoLAN * Copyright © 2011-2012 VLC authors and VideoLAN
* *
......
...@@ -202,7 +202,7 @@ public class LibVLC { ...@@ -202,7 +202,7 @@ public class LibVLC {
} }
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
nativeInit(pref.getBoolean("enable_verbose_mode", true)); nativeInit(pref.getBoolean("enable_verbose_mode", true));
setEventManager(EventHandler.getInstance()); setEventHandler(EventHandler.getInstance());
mIsInitialized = true; mIsInitialized = true;
} }
} }
...@@ -214,7 +214,7 @@ public class LibVLC { ...@@ -214,7 +214,7 @@ public class LibVLC {
public void destroy() { public void destroy() {
Log.v(TAG, "Destroying LibVLC instance"); Log.v(TAG, "Destroying LibVLC instance");
nativeDestroy(); nativeDestroy();
detachEventManager(); detachEventHandler();
mIsInitialized = false; mIsInitialized = false;
} }
...@@ -515,7 +515,7 @@ public class LibVLC { ...@@ -515,7 +515,7 @@ public class LibVLC {
*/ */
private native long getLengthFromLocation(long instance, String mrl); private native long getLengthFromLocation(long instance, String mrl);
private native void setEventManager(EventHandler eventManager); private native void setEventHandler(EventHandler eventHandler);
private native void detachEventManager(); private native void detachEventHandler();
} }
/***************************************************************************** /*****************************************************************************
* DatabaseManager.java * MediaDatabase.java
***************************************************************************** *****************************************************************************
* Copyright © 2011-2012 VLC authors and VideoLAN * Copyright © 2011-2012 VLC authors and VideoLAN
* *
...@@ -41,7 +41,7 @@ import android.graphics.BitmapFactory; ...@@ -41,7 +41,7 @@ import android.graphics.BitmapFactory;
import android.util.Log; import android.util.Log;
public class MediaDatabase { public class MediaDatabase {
public final static String TAG = "VLC/DatabaseManager"; public final static String TAG = "VLC/MediaDatabase";
private static MediaDatabase instance; private static MediaDatabase instance;
......
/***************************************************************************** /*****************************************************************************
* ThumbnailerManager.java * Thumbnailer.java
***************************************************************************** *****************************************************************************
* Copyright © 2011-2012 VLC authors and VideoLAN * Copyright © 2011-2012 VLC authors and VideoLAN
* *
...@@ -40,7 +40,7 @@ import android.util.Log; ...@@ -40,7 +40,7 @@ import android.util.Log;
import android.view.Display; import android.view.Display;
public class Thumbnailer implements Runnable { public class Thumbnailer implements Runnable {
public final static String TAG = "VLC/ThumbnailerManager"; public final static String TAG = "VLC/Thumbnailer";
private VideoGridFragment mVideoGridFragment; private VideoGridFragment mVideoGridFragment;
......
...@@ -94,7 +94,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable ...@@ -94,7 +94,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
private VideoListAdapter mVideoAdapter; private VideoListAdapter mVideoAdapter;
private MediaLibrary mMediaLibrary; private MediaLibrary mMediaLibrary;
private Thumbnailer mThumbnailerManager; private Thumbnailer mThumbnailer;
private VideoGridAnimator mAnimator; private VideoGridAnimator mAnimator;
/* All subclasses of Fragment must include a public empty constructor. */ /* All subclasses of Fragment must include a public empty constructor. */
...@@ -110,7 +110,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable ...@@ -110,7 +110,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
/* Load the thumbnailer */ /* Load the thumbnailer */
FragmentActivity activity = getActivity(); FragmentActivity activity = getActivity();
if (activity != null) if (activity != null)
mThumbnailerManager = new Thumbnailer(activity, activity.getWindowManager().getDefaultDisplay()); mThumbnailer = new Thumbnailer(activity, activity.getWindowManager().getDefaultDisplay());
} }
@Override @Override
...@@ -150,8 +150,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable ...@@ -150,8 +150,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
mMediaLibrary.removeUpdateHandler(mHandler); mMediaLibrary.removeUpdateHandler(mHandler);
/* Stop the thumbnailer */ /* Stop the thumbnailer */
if (mThumbnailerManager != null) if (mThumbnailer != null)
mThumbnailerManager.stop(); mThumbnailer.stop();
} }
@Override @Override
...@@ -168,8 +168,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable ...@@ -168,8 +168,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
mAnimator.animate(); mAnimator.animate();
/* Start the thumbnailer */ /* Start the thumbnailer */
if (mThumbnailerManager != null) if (mThumbnailer != null)
mThumbnailerManager.start(this); mThumbnailer.start(this);
} }
@Override @Override
...@@ -181,8 +181,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable ...@@ -181,8 +181,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
if (mThumbnailerManager != null) if (mThumbnailer != null)
mThumbnailerManager.clearJobs(); mThumbnailer.clearJobs();
mBarrier.reset(); mBarrier.reset();
mVideoAdapter.clear(); mVideoAdapter.clear();
} }
...@@ -376,8 +376,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable ...@@ -376,8 +376,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
private void updateList() { private void updateList() {
List<Media> itemList = mMediaLibrary.getVideoItems(); List<Media> itemList = mMediaLibrary.getVideoItems();
if (mThumbnailerManager != null) if (mThumbnailer != null)
mThumbnailerManager.clearJobs(); mThumbnailer.clearJobs();
else else
Log.w(TAG, "Can't generate thumbnails, the thumbnailer is missing"); Log.w(TAG, "Can't generate thumbnails, the thumbnailer is missing");
...@@ -387,8 +387,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable ...@@ -387,8 +387,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
for (Media item : itemList) { for (Media item : itemList) {
if (item.getType() == Media.TYPE_VIDEO) { if (item.getType() == Media.TYPE_VIDEO) {
mVideoAdapter.add(item); mVideoAdapter.add(item);
if (mThumbnailerManager != null && item.getPicture() == null && !item.isPictureParsed()) if (mThumbnailer != null && item.getPicture() == null && !item.isPictureParsed())
mThumbnailerManager.addJob(item); mThumbnailer.addJob(item);
} }
} }
mVideoAdapter.sort(); mVideoAdapter.sort();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment