Commit e5b92522 authored by Thomas Guillem's avatar Thomas Guillem

update with last LibVLC API

parent 725ec7aa
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......
......@@ -32,7 +32,7 @@ import org.videolan.libvlc.MediaPlayer;
import java.util.ArrayList;
public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback {
public class JavaActivity extends AppCompatActivity implements IVLCVout.OnNewVideoLayoutListener {
private static final boolean ENABLE_SUBTITLES = true;
private static final String TAG = "JavaActivity";
private static final String SAMPLE_URL = "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v";
......@@ -97,8 +97,7 @@ public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback
vlcVout.setVideoView(mVideoSurface);
if (mSubtitlesSurface != null)
vlcVout.setSubtitlesView(mSubtitlesSurface);
vlcVout.attachViews();
mMediaPlayer.getVLCVout().addCallback(this);
vlcVout.attachViews(this);
Media media = new Media(mLibVLC, Uri.parse(SAMPLE_URL));
mMediaPlayer.setMedia(media);
......@@ -138,7 +137,6 @@ public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback
mMediaPlayer.stop();
mMediaPlayer.getVLCVout().detachViews();
mMediaPlayer.getVLCVout().removeCallback(this);
}
private void updateVideoSurfaces() {
if (mVideoWidth * mVideoHeight == 0)
......@@ -232,7 +230,7 @@ public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public void onNewLayout(IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
public void onNewVideoLayout(IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
mVideoWidth = width;
mVideoHeight = height;
mVideoVisibleWidth = visibleWidth;
......@@ -241,12 +239,4 @@ public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback
mVideoSarDen = sarDen;
updateVideoSurfaces();
}
@Override
public void onSurfacesCreated(IVLCVout vlcVout) {
}
@Override
public void onSurfacesDestroyed(IVLCVout vlcVout) {
}
}
......@@ -55,8 +55,6 @@ Java_org_videolan_nativesample_NativeActivity_nativeCreate(
static const char *pp_argv[] = {
"-vvv",
"--aout", "android_audiotrack",
"--androidwindow-chroma", "RV32",
"--audio-resampler", "soxr",
};
p_ctx->p_libvlc = libvlc_new(sizeof(pp_argv)/sizeof(*pp_argv), pp_argv);
......
......@@ -27,11 +27,11 @@ import android.widget.FrameLayout;
import android.widget.Toast;
import org.videolan.libvlc.AWindow;
import org.videolan.libvlc.AWindowNativeHandler;
import org.videolan.libvlc.IVLCVout;
@SuppressWarnings("JniMissingFunction")
public class NativeActivity extends AppCompatActivity implements IVLCVout.Callback {
public class NativeActivity extends AppCompatActivity implements IVLCVout.Callback,
IVLCVout.OnNewVideoLayoutListener {
private static final boolean ENABLE_SUBTITLES = true;
private static final String TAG = "NativeActivity";
private static final int SURFACE_BEST_FIT = 0;
......@@ -140,7 +140,7 @@ public class NativeActivity extends AppCompatActivity implements IVLCVout.Callba
mAWindow.setVideoView(mVideoSurface);
if (mSubtitlesSurface != null)
mAWindow.setSubtitlesView(mSubtitlesSurface);
mAWindow.attachViews();
mAWindow.attachViews(this);
if (mOnLayoutChangeListener == null) {
mOnLayoutChangeListener = new View.OnLayoutChangeListener() {
......@@ -269,7 +269,7 @@ public class NativeActivity extends AppCompatActivity implements IVLCVout.Callba
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public void onNewLayout(IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
public void onNewVideoLayout(IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
mVideoWidth = width;
mVideoHeight = height;
mVideoVisibleWidth = visibleWidth;
......@@ -282,7 +282,7 @@ public class NativeActivity extends AppCompatActivity implements IVLCVout.Callba
@Override
public void onSurfacesCreated(IVLCVout vlcVout) {
if (!mNativeStarted) {
if (!nativeStart(mAWindow.getNativeHandler())) {
if (!nativeStart(mAWindow)) {
Toast.makeText(this, "Couldn't start LibVLC", Toast.LENGTH_LONG).show();
finish();
return;
......@@ -301,6 +301,6 @@ public class NativeActivity extends AppCompatActivity implements IVLCVout.Callba
private long mInstance;
private native boolean nativeCreate();
private native void nativeDestroy();
private native boolean nativeStart(AWindowNativeHandler aWindowNative);
private native boolean nativeStart(AWindow aWindowNative);
private native void nativeStop();
}
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