mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Move GStreamer initialization to a path shared by ServoSurface and ServoView
This commit is contained in:
parent
a4789defc4
commit
e3c98802eb
3 changed files with 17 additions and 10 deletions
|
@ -7,11 +7,14 @@ package com.mozilla.servoview;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.freedesktop.gstreamer.GStreamer;
|
||||
|
||||
public class Servo {
|
||||
private static final String LOGTAG = "Servo";
|
||||
private AssetManager mAssetMgr;
|
||||
|
@ -27,7 +30,9 @@ public class Servo {
|
|||
String args,
|
||||
String url,
|
||||
String logstr,
|
||||
int width, int height, float density, boolean log) {
|
||||
int width, int height,
|
||||
float density, boolean log,
|
||||
Context context) {
|
||||
|
||||
mRunCallback = runCallback;
|
||||
|
||||
|
@ -38,6 +43,12 @@ public class Servo {
|
|||
mRunCallback.inGLThread(() -> {
|
||||
mJNI.init(activity, args, url, logstr, cbs, width, height, density, log);
|
||||
});
|
||||
|
||||
try {
|
||||
GStreamer.init(context);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String version() {
|
||||
|
|
|
@ -7,6 +7,7 @@ package com.mozilla.servoview;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.opengl.EGL14;
|
||||
import android.opengl.EGLConfig;
|
||||
|
@ -206,7 +207,8 @@ public class ServoSurface {
|
|||
inUIThread(() -> {
|
||||
final boolean showLogs = true;
|
||||
String uri = mInitialUri == null ? null : mInitialUri;
|
||||
mServo = new Servo(this, surface, mClient, mActivity, mServoArgs, uri, mServoLog, mWidth, mHeight, 1, showLogs);
|
||||
mServo = new Servo(this, surface, mClient, mActivity, mServoArgs, uri, mServoLog,
|
||||
mWidth, mHeight, 1 /* density */, showLogs, (Context) mActivity);
|
||||
});
|
||||
|
||||
Looper.loop();
|
||||
|
|
|
@ -26,8 +26,6 @@ import com.mozilla.servoview.Servo.RunCallback;
|
|||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import org.freedesktop.gstreamer.GStreamer;
|
||||
|
||||
public class ServoView extends GLSurfaceView
|
||||
implements
|
||||
GestureDetector.OnGestureListener,
|
||||
|
@ -148,12 +146,8 @@ public class ServoView extends GLSurfaceView
|
|||
|
||||
inGLThread(() -> {
|
||||
String uri = mInitialUri == null ? null : mInitialUri.toString();
|
||||
mServo = new Servo(this, this, mClient, mActivity, mServoArgs, uri, mServoLog, width, height, density, showLogs);
|
||||
try {
|
||||
GStreamer.init((Context) mActivity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mServo = new Servo(this, this, mClient, mActivity, mServoArgs, uri,
|
||||
mServoLog, width, height, density, showLogs, (Context) mActivity);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue