提交 86042c9a authored 作者: kongdywang's avatar kongdywang

update to 12.8.1 & Enhance rendering compatibility & player widget's delegate not required now

(cherry picked from commit 89c907eea1f9aceaf7c4df83c78d9605dd65fc27)
上级 78c06073
#### Version: 12.8.1 2025.10.23
##### Features:
- Enhance rendering compatibility.
#### Version: 12.8.0 2025.09.19
##### Features:
......
......@@ -5,7 +5,7 @@ buildLog() {
}
inputVersion=$1
export VERSION_NAME="12.8.0"
export VERSION_NAME="12.8.1"
if [ -n "$inputVersion" ]; then
VERSION_NAME=$inputVersion
fi
......
......@@ -4,7 +4,7 @@ rootProject.ext {
supportSdkVersion = "26.0.1"
minSdkVersion = 19
targetSdkVersion = 28
playerVersion = "12.8.0"
playerVersion = "12.8.1"
compat = "androidx.appcompat:appcompat:1.6.1"
/**
......
......@@ -6,7 +6,6 @@ import android.opengl.EGLConfig;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.opengl.GLES30;
import android.os.Handler;
import android.os.HandlerThread;
import android.view.Surface;
......@@ -29,11 +28,12 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
private SurfaceTexture mSurfaceTexture;
private FTXTextureRender mTextureRender;
private Surface mInputSurface;
private Surface mOutPutSurface;
private EGLDisplay mEGLDisplay = EGL14.EGL_NO_DISPLAY;
private EGLContext mEGLContext = EGL14.EGL_NO_CONTEXT;
private final EGLContext mEGLContext = EGL14.EGL_NO_CONTEXT;
private EGLContext mEGLContextEncoder = EGL14.EGL_NO_CONTEXT;
private EGLSurface mEGLSurface = EGL14.EGL_NO_SURFACE;
private final EGLSurface mEGLSurface = EGL14.EGL_NO_SURFACE;
private EGLSurface mEGLSurfaceEncoder = EGL14.EGL_NO_SURFACE;
private EGLContext mEGLSavedContext = EGL14.EGL_NO_CONTEXT;
......@@ -98,12 +98,14 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
private synchronized void startDrawSurface() {
try {
if (!mStart) {
LiteavLog.e(TAG, "end....... ");
LiteavLog.e(TAG, "draw thread is dead");
return;
}
saveCurrentEglEnvironment();
if (!makeCurrent(1)) {
LiteavLog.e(TAG, "makeCurrent error");
return;
}
if (!mOutPutSurface.isValid()) {
return;
}
......@@ -137,7 +139,6 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
}
if (!makeCurrent(1)) {
LiteavLog.e(TAG, "makeCurrent error");
bRet = false;
break;
}
......@@ -211,30 +212,23 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
private boolean eglSetup(Surface surface) {
mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
LiteavLog.e(TAG, "unable to get EGL10 display");
checkEglError("unable to get EGL10 display");
return false;
}
int[] version = new int[2];
if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
LiteavLog.e(TAG, "unable to initialize EGL10");
checkEglError("unable to initialize EGL10");
return false;
}
int[] maxSamples = new int[1];
GLES30.glGetIntegerv(GLES30.GL_MAX_SAMPLES, maxSamples, 0);
//noinspection ExtractMethodRecommender
final int samples = Math.min(4, maxSamples[0]);
// Configure EGL for pbuffer and OpenGL ES 2.0, 24-bit RGB.
int[] attribList = new int[]{
EGL14.EGL_RED_SIZE, 8,
EGL14.EGL_GREEN_SIZE, 8,
EGL14.EGL_BLUE_SIZE, 8,
EGL14.EGL_ALPHA_SIZE, 8,
EGL14.EGL_DEPTH_SIZE, 8,
EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
EGL14.EGL_SURFACE_TYPE, EGL14.EGL_WINDOW_BIT,
EGL14.EGL_SAMPLE_BUFFERS, 1,
EGL14.EGL_SAMPLES, samples,
EGL14.EGL_NONE
};
......@@ -242,13 +236,13 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
EGLConfig[] eglConfigs = new EGLConfig[1];
if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, eglConfigs, 0,
eglConfigs.length, numEglConfigs, 0)) {
LiteavLog.e(TAG, "eglChooseConfig error");
checkEglError("eglChooseConfig error");
return false;
}
// Configure context for OpenGL ES 2.0.
//6、创建 EglContext
int[] attrib_list = new int[]{
EGL14.EGL_CONTEXT_CLIENT_VERSION, 3,
EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
EGL14.EGL_NONE
};
......@@ -271,6 +265,7 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
LiteavLog.e(TAG, "surface was null");
return false;
}
mOutPutSurface = surface;
return true;
}
......@@ -279,6 +274,8 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
LiteavLog.e(TAG, "checkEglError: " + msg + "error: " + error);
return false;
} else {
LiteavLog.e(TAG, msg);
}
return true;
......@@ -287,16 +284,15 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
public boolean makeCurrent(int index) {
if (index == 0) {
if (!EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) {
LiteavLog.e(TAG, "eglMakeCurrent failed");
checkEglError("makeCurrent");
return false;
}
} else {
if (!EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurfaceEncoder, mEGLSurfaceEncoder, mEGLContextEncoder)) {
LiteavLog.e(TAG, "eglMakeCurrent failed");
checkEglError("makeCurrent");
return false;
}
}
return true;
}
......@@ -313,11 +309,6 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
mEGLSavedContext = EGL14.eglGetCurrentContext();
mEGLSaveDrawSurface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
mEGLSaveReadSurface = EGL14.eglGetCurrentSurface(EGL14.EGL_READ);
// // 检查有效性
// if (mEGLSavedDisplay == EGL14.EGL_NO_DISPLAY || mEGLSavedContext == EGL14.EGL_NO_CONTEXT) {
// LiteavLog.w(TAG, "Saving invalid EGL state");
// }
} catch (Exception e) {
LiteavLog.e(TAG, "Save EGL error: " + e);
resetSavedEnvironment();
......
package com.tencent.vod.flutter.player.render.gl;
import android.opengl.GLES11Ext;
import android.opengl.GLES30;
import android.opengl.GLES20;
import android.opengl.Matrix;
import com.tencent.liteav.base.util.LiteavLog;
......@@ -82,10 +82,10 @@ public class FTXTextureRender {
*/
public void surfaceCreated() {
mVideoFragmentProgram = TXGlUtilVideo.createProgram(VERTEX_SHADER, VIDEO_FRAGMENT_SHADER);
maPositionHandle = GLES30.glGetAttribLocation(mVideoFragmentProgram, "aPosition");
maTexCoordHandle = GLES30.glGetAttribLocation(mVideoFragmentProgram, "aTextureCoord");
muMVPMatrixHandle = GLES30.glGetUniformLocation(mVideoFragmentProgram, "uMVPMatrix");
maTextureHandle = GLES30.glGetUniformLocation(mVideoFragmentProgram, "sTexture");
maPositionHandle = GLES20.glGetAttribLocation(mVideoFragmentProgram, "aPosition");
maTexCoordHandle = GLES20.glGetAttribLocation(mVideoFragmentProgram, "aTextureCoord");
muMVPMatrixHandle = GLES20.glGetUniformLocation(mVideoFragmentProgram, "uMVPMatrix");
maTextureHandle = GLES20.glGetUniformLocation(mVideoFragmentProgram, "sTexture");
textureID[0] = initTex();
}
......@@ -95,8 +95,8 @@ public class FTXTextureRender {
}
public void deleteTexture() {
GLES30.glDeleteProgram(mVideoFragmentProgram);
GLES30.glDeleteTextures(1, textureID, 0);
GLES20.glDeleteProgram(mVideoFragmentProgram);
GLES20.glDeleteTextures(1, textureID, 0);
}
/**
......@@ -106,17 +106,17 @@ public class FTXTextureRender {
*/
public int initTex() {
int[] tex = new int[1];
GLES30.glGenTextures(1, tex, 0);
GLES30.glActiveTexture(GLES30.GL_TEXTURE0);
GLES30.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex[0]);
GLES30.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GLES30.GL_TEXTURE_WRAP_S, GLES30.GL_CLAMP_TO_EDGE);
GLES30.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GLES30.GL_TEXTURE_WRAP_T, GLES30.GL_CLAMP_TO_EDGE);
GLES30.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GLES30.GL_TEXTURE_MIN_FILTER, GLES30.GL_LINEAR);
GLES30.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GLES30.GL_TEXTURE_MAG_FILTER, GLES30.GL_LINEAR);
GLES20.glGenTextures(1, tex, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex[0]);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
return tex[0];
}
......@@ -201,8 +201,8 @@ public class FTXTextureRender {
}
public void cleanDrawCache() {
GLES30.glViewport(0, 0, mPortWidth, mPortHeight);
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT);
GLES20.glViewport(0, 0, mPortWidth, mPortHeight);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
}
/**
......@@ -211,30 +211,30 @@ public class FTXTextureRender {
public void drawFrame() {
cleanDrawCache();
// video frame
GLES30.glUseProgram(mVideoFragmentProgram);
GLES20.glUseProgram(mVideoFragmentProgram);
// OpenGL rotates counterclockwise, here it needs to be modified to rotate clockwise
GLES30.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mResultMatrix, 0);
GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mResultMatrix, 0);
GLES30.glActiveTexture(GLES30.GL_TEXTURE0);
GLES30.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureID[0]);
GLES30.glUniform1i(maTextureHandle, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureID[0]);
GLES20.glUniform1i(maTextureHandle, 0);
// Enable the "aPosition" vertex attribute.
GLES30.glEnableVertexAttribArray(maPositionHandle);
GLES20.glEnableVertexAttribArray(maPositionHandle);
// Connect vertexBuffer to "aPosition".
GLES30.glVertexAttribPointer(maPositionHandle, 3,
GLES30.GL_FLOAT, false, 3 * FLOAT_SIZE_BYTES, FULL_RECTANGLE_BUF);
GLES20.glVertexAttribPointer(maPositionHandle, 3,
GLES20.GL_FLOAT, false, 3 * FLOAT_SIZE_BYTES, FULL_RECTANGLE_BUF);
// Enable the "aTextureCoord" vertex attribute.
GLES30.glEnableVertexAttribArray(maTexCoordHandle);
GLES20.glEnableVertexAttribArray(maTexCoordHandle);
// Connect texBuffer to "aTextureCoord".
GLES30.glVertexAttribPointer(maTexCoordHandle, 4,
GLES30.GL_FLOAT, false, 4 * FLOAT_SIZE_BYTES, FULL_RECTANGLE_TEX_BUF);
GLES20.glVertexAttribPointer(maTexCoordHandle, 4,
GLES20.GL_FLOAT, false, 4 * FLOAT_SIZE_BYTES, FULL_RECTANGLE_TEX_BUF);
// Draw the rect.
GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
// Done -- disable vertex array, texture, and program.
GLES30.glDisableVertexAttribArray(maPositionHandle);
GLES30.glDisableVertexAttribArray(maTexCoordHandle);
GLES30.glUseProgram(0);
GLES20.glDisableVertexAttribArray(maPositionHandle);
GLES20.glDisableVertexAttribArray(maTexCoordHandle);
GLES20.glUseProgram(0);
}
}
......@@ -30,21 +30,11 @@ class _DemoShortVideoPlayerState extends State<DemoShortVideoPlayer> with Widget
void _loadData() async {
// check license
final ShortVideoDataLoader loader = ShortVideoDataLoader();
if (!isLicenseSuc.isCompleted) {
SuperPlayerPlugin.setGlobalLicense(LICENSE_URL, LICENSE_KEY);
await isLicenseSuc.future;
loader.getPageListDataOneByOneFunction((dataModels) {
setState(() {
superPlayerModelList = dataModels;
});
loader.getPageListDataOneByOneFunction((dataModels) {
setState(() {
superPlayerModelList = dataModels;
});
} else {
loader.getPageListDataOneByOneFunction((dataModels) {
setState(() {
superPlayerModelList = dataModels;
});
});
}
});
}
@override
......
......@@ -299,14 +299,7 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto
void playCurrentModel(SuperPlayerModel model, double startTime) async {
currentVideoModel = model;
await _controller.setStartTime(startTime);
// check license
if (!isLicenseSuc.isCompleted) {
SuperPlayerPlugin.setGlobalLicense(LICENSE_URL, LICENSE_KEY);
await isLicenseSuc.future;
await _controller.playWithModelNeedLicence(model);
} else {
await _controller.playWithModelNeedLicence(model);
}
await _controller.playWithModelNeedLicence(model);
}
void playVideo(SuperPlayerModel model) {
......
......@@ -65,14 +65,7 @@ class _DemoTXLivePlayerState extends State<DemoTXLivePlayer> with WidgetsBinding
});
_controller.setRenderMode(FTXPlayerRenderMode.ADJUST_RESOLUTION);
if (!isLicenseSuc.isCompleted) {
SuperPlayerPlugin.setGlobalLicense(LICENSE_URL, LICENSE_KEY);
await isLicenseSuc.future;
await _controller.startLivePlay(_url);
} else {
await _controller.startLivePlay(_url);
}
await _controller.startLivePlay(_url);
}
@override
......
......@@ -76,13 +76,7 @@ class _DemoTXVodPlayerState extends State<DemoTXVodPlayer> with WidgetsBindingOb
await _controller.setConfig(FTXVodPlayConfig());
await _controller.setRenderMode(_renderMode);
if (!isLicenseSuc.isCompleted) {
SuperPlayerPlugin.setGlobalLicense(LICENSE_URL, LICENSE_KEY);
await isLicenseSuc.future;
await _controller.startVodPlay(_url);
} else {
await _controller.startVodPlay(_url);
}
await _controller.startVodPlay(_url);
}
@override
......
......@@ -113,7 +113,6 @@ class _MyAppState extends State<MyApp> {
return MaterialApp(
localizationsDelegates: [
AppLocalizationDelegate.delegate,
SuperPlayerWidgetLocals.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
......
......@@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'super_player'
s.version = '12.8.0'
s.version = '12.8.1'
s.summary = 'The super_player Flutter plugin is one of the sub-product SDKs of the audio/video terminal SDK (Tencent Cloud Video on Demand).'
s.description = <<-DESC
player plugin.
......
......@@ -2,5 +2,5 @@
part of SuperPlayer;
abstract class FPlayerPckInfo {
static const String PLAYER_VERSION = "12.8.0";
static const String PLAYER_VERSION = "12.8.1";
}
\ No newline at end of file
name: super_player
description: The super_player Flutter plugin is one of the sub-product SDKs of the audio/video terminal SDK (Tencent Cloud Video on Demand).
version: 12.8.0
version: 12.8.1
homepage: https://github.com/LiteAVSDK/Player_Flutter
environment:
......
......@@ -3,5 +3,5 @@ part of demo_super_player_lib;
class PlayerConstants {
static const PKG_NAME = "superplayer_widget";
static const String PLAYER_WIDGET_VERSION = "12.8.0";
static const String PLAYER_WIDGET_VERSION = "12.8.1";
}
......@@ -8,8 +8,11 @@ int manualOrientationDirection = TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT;
class SuperPlayerView extends StatefulWidget {
final SuperPlayerController _controller;
final SuperPlayerRenderMode renderMode;
LocalizationsDelegate<dynamic>? customLocalDelegate;
SuperPlayerView(this._controller, {Key? viewKey, this.renderMode = SuperPlayerRenderMode.ADJUST_RESOLUTION}) : super(key: viewKey);
SuperPlayerView(this._controller,
{Key? viewKey, this.renderMode = SuperPlayerRenderMode.ADJUST_RESOLUTION, this.customLocalDelegate})
: super(key: viewKey);
@override
State<StatefulWidget> createState() => SuperPlayerViewState();
......@@ -437,9 +440,20 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(left: false, right: false, top: false, bottom: false, minimum: EdgeInsets.zero,
child: _getNoPaddingBody(context)),
return Localizations.override(
context: context,
delegates: [
widget.customLocalDelegate ?? SuperPlayerWidgetLocals.delegate
],
child: Scaffold(
body: SafeArea(
left: false,
right: false,
top: false,
bottom: false,
minimum: EdgeInsets.zero,
child: _getNoPaddingBody(context)),
),
);
}
......
name: superplayer_widget
description: superplayer,base on vodplayer
version: 12.8.0
version: 12.8.1
environment:
sdk: '>=2.17.0 <4.0.0'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论