Skip to content

Commit

Permalink
master - Bumped to 3.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
masterwok committed Jul 10, 2018
1 parent 507d514 commit 78ce1ca
Show file tree
Hide file tree
Showing 25 changed files with 87 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions buildlibvlc.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

tag='3.0.11'

rootdir=`dirname $0`

checkfail()
Expand All @@ -14,6 +16,8 @@ if [ ! -d "${rootdir}/vlc-android" ]; then
echo "VLC Android source not found, cloning"
git clone http://code.videolan.org/videolan/vlc-android.git
checkfail "git clone"
git -C ${rootdir}/vlc-android checkout tags/${tag}
checkfail "git checkout"
fi

sh -c "cd ${rootdir}/vlc-android && ./compile.sh -l $*"
Expand Down
62 changes: 58 additions & 4 deletions libvlc/src/main/java/org/videolan/libvlc/AWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.MainThread;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
Expand All @@ -44,7 +45,7 @@ public class AWindow implements IVLCVout {
private static final int ID_SUBTITLES = 1;
private static final int ID_MAX = 2;

public interface SurfaceCallback {
interface SurfaceCallback {
@MainThread
void onSurfacesCreated(AWindow vout);
@MainThread
Expand Down Expand Up @@ -185,7 +186,8 @@ public void onSurfaceTextureUpdated(SurfaceTexture surface) {
};
}

private final TextureView.SurfaceTextureListener mSurfaceTextureListener = createSurfaceTextureListener();
private final TextureView.SurfaceTextureListener mSurfaceTextureListener =
AndroidUtil.isICSOrLater ? createSurfaceTextureListener() : null;
}

private final static int SURFACE_STATE_INIT = 0;
Expand Down Expand Up @@ -244,6 +246,8 @@ private void setView(int id, SurfaceView view) {
}

private void setView(int id, TextureView view) {
if (!AndroidUtil.isICSOrLater)
throw new IllegalArgumentException("TextureView not implemented in this android version");
ensureInitState();
if (view == null)
throw new NullPointerException("view is null");
Expand Down Expand Up @@ -531,7 +535,7 @@ private void unregisterNative() {
}

/**
* This method is only used for HoneyComb and before since ANativeWindow_setBuffersGeometry doesn't work before.
* This method is only used for ICS and before since ANativeWindow_setBuffersGeometry doesn't work before.
* It is synchronous.
*
* @param surface surface returned by getVideoSurface or getSubtitlesSurface
Expand All @@ -542,7 +546,57 @@ private void unregisterNative() {
*/
@SuppressWarnings("unused") /* used by JNI */
private boolean setBuffersGeometry(final Surface surface, final int width, final int height, final int format) {
return false;
if (AndroidUtil.isICSOrLater)
return false;
if (width * height == 0)
return false;
Log.d(TAG, "configureSurface: " + width + "x" + height);

synchronized (mNativeLock) {
if (mNativeLock.buffersGeometryConfigured || mNativeLock.buffersGeometryAbort)
return false;
}

mHandler.post(new Runnable() {
private SurfaceHelper getSurfaceHelper(Surface surface) {
for (int id = 0; id < ID_MAX; ++id) {
final SurfaceHelper surfaceHelper = mSurfaceHelpers[id];
if (surfaceHelper != null && surfaceHelper.getSurface() == surface)
return surfaceHelper;
}
return null;
}

@Override
public void run() {
final SurfaceHelper surfaceHelper = getSurfaceHelper(surface);
final SurfaceHolder surfaceHolder = surfaceHelper != null ? surfaceHelper.getSurfaceHolder() : null;

if (surfaceHolder != null) {
if (surfaceHolder.getSurface().isValid()) {
if (format != 0)
surfaceHolder.setFormat(format);
surfaceHolder.setFixedSize(width, height);
}
}

synchronized (mNativeLock) {
mNativeLock.buffersGeometryConfigured = true;
mNativeLock.notifyAll();
}
}
});

try {
synchronized (mNativeLock) {
while (!mNativeLock.buffersGeometryConfigured && !mNativeLock.buffersGeometryAbort)
mNativeLock.wait();
mNativeLock.buffersGeometryConfigured = false;
}
} catch (InterruptedException e) {
return false;
}
return true;
}

/**
Expand Down
15 changes: 15 additions & 0 deletions libvlc/src/main/java/org/videolan/libvlc/LibVLC.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.os.Build;
import android.util.Log;

import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.libvlc.util.HWDecoderUtil;

import java.util.ArrayList;
Expand Down Expand Up @@ -75,6 +76,20 @@ public LibVLC(Context context, ArrayList<String> options) {
options.add("RV16");
}
}

/* XXX: HACK to remove when we drop 2.3 support: force android_display vout */
if (!AndroidUtil.isHoneycombOrLater) {
boolean setVout = true;
for (String option : options) {
if (option.startsWith("--vout")) {
setVout = false;
break;
}
}
if (setVout)
options.add("--vout=android_display,none");
}

nativeNew(options.toArray(new String[options.size()]), context.getDir("vlc", Context.MODE_PRIVATE).getAbsolutePath());
}

Expand Down
9 changes: 1 addition & 8 deletions libvlc/src/main/java/org/videolan/libvlc/MediaPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ public boolean setAmp(int index, float amp) {
private boolean mAudioDigitalOutputEnabled = false;
private String mAudioPlugOutputDevice = "stereo";

private boolean mCanDoPassthrough;

private final AWindow mWindow = new AWindow(new AWindow.SurfaceCallback() {
@Override
public void onSurfacesCreated(AWindow vout) {
Expand Down Expand Up @@ -404,8 +402,7 @@ public void onSurfacesDestroyed(AWindow vout) {
});

private synchronized void updateAudioOutputDevice(long encodingFlags, String defaultDevice) {
mCanDoPassthrough = encodingFlags != 0;
final String newDeviceId = mAudioDigitalOutputEnabled && mCanDoPassthrough ? "encoded:" + encodingFlags : defaultDevice;
final String newDeviceId = mAudioDigitalOutputEnabled && encodingFlags != 0 ? "encoded:" + encodingFlags : defaultDevice;
if (!newDeviceId.equals(mAudioPlugOutputDevice)) {
mAudioPlugOutputDevice = newDeviceId;
setAudioOutputDeviceInternal(mAudioPlugOutputDevice, false);
Expand Down Expand Up @@ -1204,10 +1201,6 @@ protected void onReleaseNative() {
nativeRelease();
}

public boolean canDoPassthrough() {
return mCanDoPassthrough;
}

/* JNI */
private native void nativeNewFromLibVlc(LibVLC libVLC, AWindow window);
private native void nativeNewFromMedia(Media media, AWindow window);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public class AndroidUtil {
public static final boolean isJellyBeanMR2OrLater = isKitKatOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
public static final boolean isJellyBeanMR1OrLater = isJellyBeanMR2OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
public static final boolean isJellyBeanOrLater = isJellyBeanMR1OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
public static final boolean isICSOrLater = isJellyBeanOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
public static final boolean isHoneycombMr2OrLater = isICSOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2;
public static final boolean isHoneycombMr1OrLater = isHoneycombMr2OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
public static final boolean isHoneycombOrLater = isHoneycombMr1OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;

public static File UriToFile(Uri uri) {
return new File(uri.getPath().replaceFirst("file://", ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static Decoder getDecoderFromDevice() {
*/
if (AndroidUtil.isJellyBeanMR2OrLater)
return Decoder.ALL;
else {
else if (AndroidUtil.isHoneycombOrLater) {
for (DecoderBySOC decBySOC : sDecoderBySOCList) {
final String prop = getSystemPropertyCached(decBySOC.key);
if (prop != null) {
Expand Down
Loading

0 comments on commit 78ce1ca

Please sign in to comment.