Skip to content

Commit 78ce1ca

Browse files
committed
master - Bumped to 3.0.11
1 parent 507d514 commit 78ce1ca

25 files changed

+87
-14
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

buildlibvlc.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh
22

3+
tag='3.0.11'
4+
35
rootdir=`dirname $0`
46

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

1923
sh -c "cd ${rootdir}/vlc-android && ./compile.sh -l $*"

libvlc/src/main/java/org/videolan/libvlc/AWindow.java

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import android.os.Handler;
2727
import android.os.Looper;
2828
import android.support.annotation.MainThread;
29+
import android.util.Log;
2930
import android.view.Surface;
3031
import android.view.SurfaceHolder;
3132
import android.view.SurfaceView;
@@ -44,7 +45,7 @@ public class AWindow implements IVLCVout {
4445
private static final int ID_SUBTITLES = 1;
4546
private static final int ID_MAX = 2;
4647

47-
public interface SurfaceCallback {
48+
interface SurfaceCallback {
4849
@MainThread
4950
void onSurfacesCreated(AWindow vout);
5051
@MainThread
@@ -185,7 +186,8 @@ public void onSurfaceTextureUpdated(SurfaceTexture surface) {
185186
};
186187
}
187188

188-
private final TextureView.SurfaceTextureListener mSurfaceTextureListener = createSurfaceTextureListener();
189+
private final TextureView.SurfaceTextureListener mSurfaceTextureListener =
190+
AndroidUtil.isICSOrLater ? createSurfaceTextureListener() : null;
189191
}
190192

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

246248
private void setView(int id, TextureView view) {
249+
if (!AndroidUtil.isICSOrLater)
250+
throw new IllegalArgumentException("TextureView not implemented in this android version");
247251
ensureInitState();
248252
if (view == null)
249253
throw new NullPointerException("view is null");
@@ -531,7 +535,7 @@ private void unregisterNative() {
531535
}
532536

533537
/**
534-
* This method is only used for HoneyComb and before since ANativeWindow_setBuffersGeometry doesn't work before.
538+
* This method is only used for ICS and before since ANativeWindow_setBuffersGeometry doesn't work before.
535539
* It is synchronous.
536540
*
537541
* @param surface surface returned by getVideoSurface or getSubtitlesSurface
@@ -542,7 +546,57 @@ private void unregisterNative() {
542546
*/
543547
@SuppressWarnings("unused") /* used by JNI */
544548
private boolean setBuffersGeometry(final Surface surface, final int width, final int height, final int format) {
545-
return false;
549+
if (AndroidUtil.isICSOrLater)
550+
return false;
551+
if (width * height == 0)
552+
return false;
553+
Log.d(TAG, "configureSurface: " + width + "x" + height);
554+
555+
synchronized (mNativeLock) {
556+
if (mNativeLock.buffersGeometryConfigured || mNativeLock.buffersGeometryAbort)
557+
return false;
558+
}
559+
560+
mHandler.post(new Runnable() {
561+
private SurfaceHelper getSurfaceHelper(Surface surface) {
562+
for (int id = 0; id < ID_MAX; ++id) {
563+
final SurfaceHelper surfaceHelper = mSurfaceHelpers[id];
564+
if (surfaceHelper != null && surfaceHelper.getSurface() == surface)
565+
return surfaceHelper;
566+
}
567+
return null;
568+
}
569+
570+
@Override
571+
public void run() {
572+
final SurfaceHelper surfaceHelper = getSurfaceHelper(surface);
573+
final SurfaceHolder surfaceHolder = surfaceHelper != null ? surfaceHelper.getSurfaceHolder() : null;
574+
575+
if (surfaceHolder != null) {
576+
if (surfaceHolder.getSurface().isValid()) {
577+
if (format != 0)
578+
surfaceHolder.setFormat(format);
579+
surfaceHolder.setFixedSize(width, height);
580+
}
581+
}
582+
583+
synchronized (mNativeLock) {
584+
mNativeLock.buffersGeometryConfigured = true;
585+
mNativeLock.notifyAll();
586+
}
587+
}
588+
});
589+
590+
try {
591+
synchronized (mNativeLock) {
592+
while (!mNativeLock.buffersGeometryConfigured && !mNativeLock.buffersGeometryAbort)
593+
mNativeLock.wait();
594+
mNativeLock.buffersGeometryConfigured = false;
595+
}
596+
} catch (InterruptedException e) {
597+
return false;
598+
}
599+
return true;
546600
}
547601

548602
/**

libvlc/src/main/java/org/videolan/libvlc/LibVLC.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import android.os.Build;
2525
import android.util.Log;
2626

27+
import org.videolan.libvlc.util.AndroidUtil;
2728
import org.videolan.libvlc.util.HWDecoderUtil;
2829

2930
import java.util.ArrayList;
@@ -75,6 +76,20 @@ public LibVLC(Context context, ArrayList<String> options) {
7576
options.add("RV16");
7677
}
7778
}
79+
80+
/* XXX: HACK to remove when we drop 2.3 support: force android_display vout */
81+
if (!AndroidUtil.isHoneycombOrLater) {
82+
boolean setVout = true;
83+
for (String option : options) {
84+
if (option.startsWith("--vout")) {
85+
setVout = false;
86+
break;
87+
}
88+
}
89+
if (setVout)
90+
options.add("--vout=android_display,none");
91+
}
92+
7893
nativeNew(options.toArray(new String[options.size()]), context.getDir("vlc", Context.MODE_PRIVATE).getAbsolutePath());
7994
}
8095

libvlc/src/main/java/org/videolan/libvlc/MediaPlayer.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,6 @@ public boolean setAmp(int index, float amp) {
372372
private boolean mAudioDigitalOutputEnabled = false;
373373
private String mAudioPlugOutputDevice = "stereo";
374374

375-
private boolean mCanDoPassthrough;
376-
377375
private final AWindow mWindow = new AWindow(new AWindow.SurfaceCallback() {
378376
@Override
379377
public void onSurfacesCreated(AWindow vout) {
@@ -404,8 +402,7 @@ public void onSurfacesDestroyed(AWindow vout) {
404402
});
405403

406404
private synchronized void updateAudioOutputDevice(long encodingFlags, String defaultDevice) {
407-
mCanDoPassthrough = encodingFlags != 0;
408-
final String newDeviceId = mAudioDigitalOutputEnabled && mCanDoPassthrough ? "encoded:" + encodingFlags : defaultDevice;
405+
final String newDeviceId = mAudioDigitalOutputEnabled && encodingFlags != 0 ? "encoded:" + encodingFlags : defaultDevice;
409406
if (!newDeviceId.equals(mAudioPlugOutputDevice)) {
410407
mAudioPlugOutputDevice = newDeviceId;
411408
setAudioOutputDeviceInternal(mAudioPlugOutputDevice, false);
@@ -1204,10 +1201,6 @@ protected void onReleaseNative() {
12041201
nativeRelease();
12051202
}
12061203

1207-
public boolean canDoPassthrough() {
1208-
return mCanDoPassthrough;
1209-
}
1210-
12111204
/* JNI */
12121205
private native void nativeNewFromLibVlc(LibVLC libVLC, AWindow window);
12131206
private native void nativeNewFromMedia(Media media, AWindow window);

libvlc/src/main/java/org/videolan/libvlc/util/AndroidUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public class AndroidUtil {
3535
public static final boolean isJellyBeanMR2OrLater = isKitKatOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
3636
public static final boolean isJellyBeanMR1OrLater = isJellyBeanMR2OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
3737
public static final boolean isJellyBeanOrLater = isJellyBeanMR1OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
38+
public static final boolean isICSOrLater = isJellyBeanOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
39+
public static final boolean isHoneycombMr2OrLater = isICSOrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2;
40+
public static final boolean isHoneycombMr1OrLater = isHoneycombMr2OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
41+
public static final boolean isHoneycombOrLater = isHoneycombMr1OrLater || Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
3842

3943
public static File UriToFile(Uri uri) {
4044
return new File(uri.getPath().replaceFirst("file://", ""));

libvlc/src/main/java/org/videolan/libvlc/util/HWDecoderUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public static Decoder getDecoderFromDevice() {
143143
*/
144144
if (AndroidUtil.isJellyBeanMR2OrLater)
145145
return Decoder.ALL;
146-
else {
146+
else if (AndroidUtil.isHoneycombOrLater) {
147147
for (DecoderBySOC decBySOC : sDecoderBySOCList) {
148148
final String prop = getSystemPropertyCached(decBySOC.key);
149149
if (prop != null) {

0 commit comments

Comments
 (0)