Commit bfa9c131 authored by Thomas Guillem's avatar Thomas Guillem

LibVLC: remove eventHardwareAccelerationError

Replace it with IVLCVout.onHardwareAccelerationError.
parent a95dfdaf
......@@ -479,38 +479,3 @@ int aout_get_native_sample_rate(void)
int sample_rate = (*p_env)->CallStaticIntMethod (p_env, cls, method, 3); // AudioManager.STREAM_MUSIC
return sample_rate;
}
/* TODO REMOVE */
static jobject error_obj = NULL;
pthread_mutex_t error_obj_lock;
void Java_org_videolan_libvlc_LibVLC_nativeSetOnHardwareAccelerationError(JNIEnv *env, jobject thiz, jobject error_obj_)
{
pthread_mutex_lock(&error_obj_lock);
if (error_obj != NULL)
(*env)->DeleteGlobalRef(env, error_obj);
error_obj = error_obj_ ? (*env)->NewGlobalRef(env, error_obj_) : NULL;
pthread_mutex_unlock(&error_obj_lock);
}
void jni_EventHardwareAccelerationError()
{
JNIEnv *env;
if (!(env = jni_get_env(THREAD_NAME)))
return;
pthread_mutex_lock(&error_obj_lock);
if (error_obj == NULL) {
pthread_mutex_unlock(&error_obj_lock);
return;
}
jclass cls = (*env)->GetObjectClass(env, error_obj);
jmethodID methodId = (*env)->GetMethodID(env, cls, "eventHardwareAccelerationError", "()V");
(*env)->CallVoidMethod(env, error_obj, methodId);
(*env)->DeleteLocalRef(env, cls);
pthread_mutex_unlock(&error_obj_lock);
}
......@@ -8,7 +8,6 @@ Java_org_videolan_libvlc_LibVLC_changeset
Java_org_videolan_libvlc_LibVLC_compiler
Java_org_videolan_libvlc_LibVLC_nativeNew
Java_org_videolan_libvlc_LibVLC_nativeRelease
Java_org_videolan_libvlc_LibVLC_nativeSetOnHardwareAccelerationError
Java_org_videolan_libvlc_LibVLC_nativeSetUserAgent
Java_org_videolan_libvlc_LibVLC_version
Java_org_videolan_libvlc_MediaDiscoverer_nativeList
......
......@@ -526,6 +526,17 @@ public class AWindow implements IAWindowNativeHandler, IVLCVout {
}
});
}
@Override
public void sendHardwareAccelerationError() {
mHandler.post(new Runnable() {
@Override
public void run() {
for (IVLCVout.Callback cb : mIVLCVoutCallbacks)
cb.onHardwareAccelerationError(AWindow.this);
}
});
}
public native void nativeOnMouseEvent(long nativeHandle, int action, int button, int x, int y);
public native void nativeOnWindowSize(long nativeHandle, int width, int height);
}
\ No newline at end of file
......@@ -94,4 +94,12 @@ public interface IAWindowNativeHandler {
*/
@SuppressWarnings("unused") /* Used by JNI */
void setWindowLayout(int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen);
/**
* TODO: temporary method, will be removed when VLC can handle decoder fallback
* This call will result of {@link IVLCVout.Callback#onHardwareAccelerationError} being called from the main thread.
*
*/
@SuppressWarnings("unused") /* Used by JNI */
void sendHardwareAccelerationError();
}
\ No newline at end of file
......@@ -57,6 +57,12 @@ public interface IVLCVout {
*/
@MainThread
void onSurfacesDestroyed(IVLCVout vlcVout);
/**
* TODO: temporary method, will be removed when VLC can handle decoder fallback
*/
@MainThread
void onHardwareAccelerationError(IVLCVout vlcVout);
}
/**
......
......@@ -40,10 +40,6 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
/** Native crash handler */
private static OnNativeCrashListener sOnNativeCrashListener;
public interface HardwareAccelerationError {
void eventHardwareAccelerationError(); // TODO REMOVE
}
/**
* Create a LibVLC withs options
*
......@@ -92,11 +88,6 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
this(null);
}
public void setOnHardwareAccelerationError(HardwareAccelerationError error) {
nativeSetOnHardwareAccelerationError(error);
}
private native void nativeSetOnHardwareAccelerationError(HardwareAccelerationError error);
/**
* Get the libVLC version
* @return the libVLC version string
......
......@@ -540,6 +540,10 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
handleVout();
}
@Override
public void onHardwareAccelerationError(IVLCVout vlcVout) {
}
private final Media.EventListener mMediaListener = new Media.EventListener() {
@Override
public void onEvent(Media.Event event) {
......
......@@ -132,7 +132,7 @@ import java.util.Date;
import java.util.List;
public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.Callback,
GestureDetector.OnDoubleTapListener, IDelayController, LibVLC.HardwareAccelerationError,
GestureDetector.OnDoubleTapListener, IDelayController,
PlaybackService.Client.Callback, PlaybackService.Callback, PlaylistAdapter.IPlayer, OnClickListener, View.OnLongClickListener {
public final static String TAG = "VLC/VideoPlayerActivity";
......@@ -723,8 +723,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
initUI();
LibVLC().setOnHardwareAccelerationError(this);
loadMedia();
// Add any selected subtitle file from the file picker
......@@ -820,8 +818,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mMute)
mute(false);
LibVLC().setOnHardwareAccelerationError(null);
mPlaybackStarted = false;
mService.removeCallback(this);
......@@ -1599,11 +1595,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mAlertDialog.show();
}
@Override
public void eventHardwareAccelerationError() {
mHandler.sendEmptyMessage(HW_ERROR);
}
private void handleHardwareAccelerationError() {
mHardwareAccelerationError = true;
if (mSwitchingView)
......@@ -3187,6 +3178,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mSurfacesAttached = false;
}
@Override
public void onHardwareAccelerationError(IVLCVout vlcVout) {
mHandler.sendEmptyMessage(HW_ERROR);
}
private BroadcastReceiver mServiceReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
......
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