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

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