Commit 632cb95e authored by Thomas Guillem's avatar Thomas Guillem

LibVLC: remove onHardwareAccelerationError event

The VLC core is now capable of handling this error.
parent ae08ccd5
......@@ -539,16 +539,5 @@ public class AWindow implements IVLCVout {
}
});
}
@Override
public void sendHardwareAccelerationError() {
mHandler.post(new Runnable() {
@Override
public void run() {
for (IVLCVout.Callback cb : mIVLCVoutCallbacks)
cb.onHardwareAccelerationError(AWindow.this);
}
});
}
};
}
\ No newline at end of file
......@@ -94,12 +94,4 @@ public abstract class AWindowNativeHandler {
*/
@SuppressWarnings("unused") /* Used by JNI */
protected abstract 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 */
protected abstract void sendHardwareAccelerationError();
}
\ No newline at end of file
......@@ -57,12 +57,6 @@ 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);
}
/**
......
......@@ -432,7 +432,6 @@
<string name="allow_sdraw_overlays_description">VLC needs you to grant this permission display your video in a popup over other applications.</string>
<string name="permission_ask_again">Grant permission</string>
<string name="exit_app">Close VLC</string>
<string name="hardware_acceleration_error">hardware acceleration error, switching to software decoding</string>
<!-- PLugins -->
<string name="plugins">Plugins</string>
......
......@@ -533,10 +533,6 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
mSwitchingToVideo = false;
}
@Override
public void onHardwareAccelerationError(IVLCVout vlcVout) {
}
private final Media.EventListener mMediaListener = new Media.EventListener() {
@Override
public void onEvent(Media.Event event) {
......
......@@ -207,8 +207,6 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
@Override public void onSurfacesDestroyed(IVLCVout vlcVout) {}
@Override public void onHardwareAccelerationError(IVLCVout vlcVout) {}
@Override
public void update() {}
......
......@@ -213,7 +213,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
private static final int RESET_BACK_LOCK = 6;
private static final int CHECK_VIDEO_TRACKS = 7;
private static final int LOADING_ANIMATION = 8;
private static final int HW_ERROR = 1000; // TODO REMOVE
private static final int LOADING_ANIMATION_DELAY = 1000;
......@@ -270,7 +269,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
*/
private boolean mSwitchingView;
private boolean mSwitchToPopup;
private boolean mHardwareAccelerationError;
private boolean mHasSubItems = false;
// size of the video
......@@ -466,7 +464,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mHandler.sendEmptyMessageDelayed(LOADING_ANIMATION, LOADING_ANIMATION_DELAY);
mSwitchingView = false;
mHardwareAccelerationError = false;
mAskResume = mSettings.getBoolean("dialog_confirm_resume", false);
mDisplayRemainingTime = mSettings.getBoolean(KEY_REMAINING_TIME_DISPLAY, false);
......@@ -1653,9 +1650,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
case LOADING_ANIMATION:
startLoading();
break;
case HW_ERROR:
handleHardwareAccelerationError();
break;
}
return true;
}
......@@ -1725,28 +1719,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mAlertDialog.show();
}
private void handleHardwareAccelerationError() {
mHardwareAccelerationError = true;
if (mSwitchingView)
return;
Toast.makeText(VLCApplication.getAppContext(), R.string.hardware_acceleration_error, Toast.LENGTH_LONG).show();
final boolean wasPaused = !mService.isPlaying();
final long oldTime = mService.getTime();
int position = mService.getCurrentMediaPosition();
List<MediaWrapper> list = new ArrayList<>(mService.getMedias());
final MediaWrapper mw = list.get(position);
mService.stop();
if(!isFinishing()) {
if (wasPaused)
mw.addFlags(MediaWrapper.MEDIA_PAUSED);
mw.addFlags(MediaWrapper.MEDIA_NO_HWACCEL);
mw.addFlags(MediaWrapper.MEDIA_VIDEO);
mService.load(list, position);
if (oldTime > 0)
seek(oldTime);
}
}
private void handleVout(int voutCount) {
final IVLCVout vlcVout = mService.getVLCVout();
if (vlcVout.areViewsAttached() && voutCount == 0) {
......@@ -1758,7 +1730,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
}
public void switchToPopupMode() {
if (mHardwareAccelerationError || mService == null)
if (mService == null)
return;
mSwitchingView = true;
mSwitchToPopup = true;
......@@ -1766,7 +1738,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
}
public void switchToAudioMode(boolean showUI) {
if (mHardwareAccelerationError || mService == null)
if (mService == null)
return;
mSwitchingView = true;
// Show the MainActivity if it is not in background.
......@@ -2971,7 +2943,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
media = new MediaWrapper(mUri);
if (mWasPaused)
media.addFlags(MediaWrapper.MEDIA_PAUSED);
if (mHardwareAccelerationError || intent.hasExtra(PLAY_DISABLE_HARDWARE))
if (intent.hasExtra(PLAY_DISABLE_HARDWARE))
media.addFlags(MediaWrapper.MEDIA_NO_HWACCEL);
media.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
media.addFlags(MediaWrapper.MEDIA_VIDEO);
......@@ -3445,11 +3417,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
public void onSurfacesDestroyed(IVLCVout vlcVout) {
}
@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