Commit b6a7a7b0 authored by Sébastien Toque's avatar Sébastien Toque
Browse files

LibVLC: use an interface instead of VideoPlayerActivity

parent 4e25b568
/*****************************************************************************
* 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);
}
......@@ -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();
......
......@@ -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;
......
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