修正gradle文件

This commit is contained in:
Raymond Yang
2023-01-18 14:47:46 +08:00
parent ca3744f8be
commit 8288bc57c5
8 changed files with 107 additions and 85 deletions
+2 -2
View File
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 32
compileSdkVersion 33
defaultConfig {
minSdkVersion 15
targetSdkVersion 32
targetSdkVersion 33
versionCode 1
versionName "1.0"
@@ -10,16 +10,15 @@ import android.view.SurfaceView;
import org.freedesktop.gstreamer.GStreamer;
public class GstLibrary implements SurfaceHolder.Callback {
import java.io.Closeable;
import java.io.IOException;
public class GstLibrary implements Closeable {
final Context mAppContext;
private GstCallback gstCallback;
private GStreamerSurfaceView surfaceView;
private final Handler mainHandler = new Handler(Looper.getMainLooper());
private final String rtspUrl;
public GstLibrary(Context context, String rtspUrl) {
@@ -61,18 +60,11 @@ public class GstLibrary implements SurfaceHolder.Callback {
nativeSurfaceFinalize();
}
public void release() {
nativeFinalize();
}
public void setOnStatusChangeListener(GstCallback callback) {
this.gstCallback = callback;
}
public void setSurfaceView(GStreamerSurfaceView surfaceView) {
this.surfaceView = surfaceView;
SurfaceHolder holder = this.surfaceView.getHolder();
holder.addCallback(this);
public void setSurfaceHolder(SurfaceHolder holder) {
nativeSurfaceInit(holder.getSurface());
}
@@ -110,11 +102,11 @@ public class GstLibrary implements SurfaceHolder.Callback {
// Inform the video surface about the new size and recalculate the layout.
private void onMediaSizeChanged (int width, int height) {
Log.i ("GStreamer", "Media size changed to " + width + "x" + height);
mainHandler.post(() -> {
/*mainHandler.post(() -> {
surfaceView.media_width = width;
surfaceView.media_height = height;
surfaceView.requestLayout();
});
});*/
}
static {
@@ -123,18 +115,12 @@ public class GstLibrary implements SurfaceHolder.Callback {
nativeClassInit();
}
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Log.d("GStreamer", "Surface changed to format " + format + " width " + width + " height " + height);
}
public void surfaceCreated(SurfaceHolder holder) {
Log.d("GStreamer", "Surface created: " + holder.getSurface());
nativeSurfaceInit (holder.getSurface());
}
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d("GStreamer", "Surface destroyed");
nativePause();
nativeSurfaceFinalize();
@Override
public void close() throws IOException {
try {
nativeFinalize();
} catch (Exception e) {
e.printStackTrace();
}
}
}