[Android] LibVLC: use an interface instead of VideoPlayerActivity
Sébastien Toque
git at videolan.org
Sun May 12 14:39:57 CEST 2013
vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Thu May 9 13:33:36 2013 +0200| [b6a7a7b0624d8158d2b5853d2b988298e5dd88f2] | committer: Sébastien Toque
LibVLC: use an interface instead of VideoPlayerActivity
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b6a7a7b0624d8158d2b5853d2b988298e5dd88f2
---
.../src/org/videolan/libvlc/IVideoPlayer.java | 33 ++++++++++++++++++++
vlc-android/src/org/videolan/libvlc/LibVLC.java | 3 +-
.../vlc/gui/video/VideoPlayerActivity.java | 4 ++-
3 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/libvlc/IVideoPlayer.java b/vlc-android/src/org/videolan/libvlc/IVideoPlayer.java
new file mode 100644
index 0000000..bf912f5
--- /dev/null
+++ b/vlc-android/src/org/videolan/libvlc/IVideoPlayer.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * IVideoPlayer.java
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+public interface IVideoPlayer {
+ /**
+ * This method is called by native vout to request a surface resize when frame size doesn't match surface size.
+ * The new surface width must be aligned on 4 pixels for RV32, 8 pixels for RV16, and 16 pixels for YV12.
+ * @param width Frame width
+ * @param height Frame height
+ * @param sar_num Surface aspect ratio numerator
+ * @param sar_den Surface aspect ratio denominator
+ */
+ void setSurfaceSize(int width, int height, int sar_num, int sar_den);
+}
diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
index a6927ee..92a27ae 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Map;
import org.videolan.vlc.VLCApplication;
-import org.videolan.vlc.gui.video.VideoPlayerActivity;
import android.content.SharedPreferences;
import android.os.Build;
@@ -59,7 +58,7 @@ public class LibVLC {
/** Check in libVLC already initialized otherwise crash */
private boolean mIsInitialized = false;
- public native void attachSurface(Surface surface, VideoPlayerActivity player, int width, int height);
+ public native void attachSurface(Surface surface, IVideoPlayer player, int width, int height);
public native void detachSurface();
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 895c24b..a9bed40 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -27,6 +27,7 @@ import java.net.URLDecoder;
import java.util.Map;
import org.videolan.libvlc.EventHandler;
+import org.videolan.libvlc.IVideoPlayer;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.vlc.AudioServiceController;
@@ -89,7 +90,7 @@ import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
-public class VideoPlayerActivity extends Activity {
+public class VideoPlayerActivity extends Activity implements IVideoPlayer {
public final static String TAG = "VLC/VideoPlayerActivity";
@@ -488,6 +489,7 @@ public class VideoPlayerActivity extends Activity {
super.onConfigurationChanged(newConfig);
}
+ @Override
public void setSurfaceSize(int width, int height, int sar_num, int sar_den) {
if (width * height == 0)
return;
More information about the Android
mailing list