Skip to content

Commit

Permalink
add log
Browse files Browse the repository at this point in the history
  • Loading branch information
zengjiale2 committed Jan 20, 2025
1 parent 5ad9805 commit ac43cc2
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/src/main/java/com/yy/yyeva/player/EvaDemoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ class EvaDemoActivity : Activity(), IEvaAnimListener {
ELog.i(TAG, "onVideoComplete")
}

override fun onVideoPlayFinish() {
ELog.i(TAG, "onVideoPlayFinish")
}

/**
* 播放器被销毁情况下会调用
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ class EvaDownloadDemoActivity : Activity(), IEvaAnimListener {
ELog.i(TAG, "onVideoComplete")
}

override fun onVideoPlayFinish() {
ELog.i(TAG, "onVideoPlayFinish")
}

/**
* 播放器被销毁情况下会调用
*/
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/yy/yyeva/player/EvaKeyDemoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ class EvaKeyDemoActivity : Activity(), IEvaAnimListener {
ELog.i(TAG, "onVideoComplete")
}

override fun onVideoPlayFinish() {
ELog.i(TAG, "onVideoPlayFinish")
}

/**
* 播放器被销毁情况下会调用
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ class EvaKeyListDemoActivity : Activity(), IEvaAnimListener {
ELog.i(TAG, "onVideoComplete")
}

override fun onVideoPlayFinish() {
ELog.i(TAG, "onVideoPlayFinish")
}

/**
* 播放器被销毁情况下会调用
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ class EvaKeyRecyclerAdapter():RecyclerView.Adapter<EvaKeyRecyclerAdapter.EvaKeyH
ELog.i(TAG, "onVideoComplete")
}

override fun onVideoPlayFinish() {
ELog.i(TAG, "onVideoPlayFinish")
}

override fun onVideoDestroy() {
ELog.i(TAG, "onVideoDestroy")
}
Expand Down
3 changes: 2 additions & 1 deletion yyevac/src/main/cpp/yyevajni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ JNIEXPORT void JNICALL YYEVA(videoSizeChange)(
JNIEXPORT jint JNICALL YYEVA(initRender)(
JNIEnv *env, jobject instance, jint controllerId,
jobject surface, jboolean isNeedYUV, jboolean isNormalMp4, jboolean isVideoRecord) {
ELOGV("initRender");
lock_guard<mutex> auto_lock(mtx);
//创建window
ANativeWindow *window = ANativeWindow_fromSurface(env,surface);
Expand Down Expand Up @@ -478,7 +479,7 @@ JNIEXPORT void JNICALL YYEVA(stopRecord)(
JNIEXPORT void JNICALL YYEVA(setLog)(
JNIEnv *env,
jobject instance, jobject log) {
ELOGV("nativeSetListener");
ELOGV("setLog");

JavaVM *javaVm;
if (env->GetJavaVM(&javaVm) != JNI_OK) {
Expand Down
2 changes: 2 additions & 0 deletions yyevac/src/main/java/com/yy/yyeva/EvaAnimPlayer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class EvaAnimPlayer(val evaAnimView: IEvaAnimView) {
}

fun startPlay(evaFileContainer: IEvaFileContainer) {
ELog.i(TAG, "startPlay")
isStartRunning = true
prepareDecoder()
if (decoder?.prepareThread() == false) {
Expand Down Expand Up @@ -170,5 +171,6 @@ class EvaAnimPlayer(val evaAnimView: IEvaAnimView) {
isLoop = this@EvaAnimPlayer.isLoop
}
}
ELog.i(TAG, "prepareDecoder")
}
}
7 changes: 7 additions & 0 deletions yyevac/src/main/java/com/yy/yyeva/decoder/EvaDecoder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ abstract class Decoder(val playerEva: EvaAnimPlayer) : IEvaAnimListener {
}

fun preparePlay(videoWidth: Int, videoHeight: Int) {
ELog.i(TAG, "preparePlay $videoWidth, $videoHeight")
playerEva.configManager.defaultConfig(videoWidth, videoHeight)
playerEva.configManager.config?.apply {
// render?.setAnimConfig(this)
Expand Down Expand Up @@ -165,6 +166,12 @@ abstract class Decoder(val playerEva: EvaAnimPlayer) : IEvaAnimListener {
playerEva.evaAnimListener?.onVideoComplete(lastFrame)
}

override fun onVideoPlayFinish() {
ELog.i(TAG, "onVideoPlayFinish")
playerEva.evaAnimListener?.onVideoPlayFinish()
}


override fun onVideoDestroy() {
ELog.i(TAG, "onVideoDestroy")
playerEva.evaAnimListener?.onVideoDestroy()
Expand Down
2 changes: 2 additions & 0 deletions yyevac/src/main/java/com/yy/yyeva/decoder/EvaHardDecoder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import android.opengl.GLES20
import android.os.Environment
import com.yy.yyeva.EvaAnimPlayer
import com.yy.yyeva.util.EvaConstant
import com.yy.yyeva.view.EvaAudioPlayer
import java.nio.ByteBuffer
import java.nio.ByteOrder

Expand Down Expand Up @@ -116,6 +117,7 @@ class EvaHardDecoder(playerEva: EvaAnimPlayer) : Decoder(playerEva), SurfaceText
}

private fun startPlay(evaFileContainer: IEvaFileContainer) {
ELog.i(TAG, "startPlay")
var extractor: MediaExtractor? = null
var decoder: MediaCodec? = null
var format: MediaFormat? = null
Expand Down
2 changes: 2 additions & 0 deletions yyevac/src/main/java/com/yy/yyeva/inter/IEvaAnimListener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ interface IEvaAnimListener {
*/
fun onVideoComplete(lastFrame: Boolean = false)

fun onVideoPlayFinish()

/**
* 视频被销毁
*/
Expand Down
4 changes: 4 additions & 0 deletions yyevac/src/main/java/com/yy/yyeva/view/EvaAnimView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ open class EvaAnimView @JvmOverloads constructor(context: Context, attrs: Attrib
evaAnimListener?.onVideoComplete()
}

override fun onVideoPlayFinish() {
evaAnimListener?.onVideoPlayFinish()
}

override fun onVideoDestroy() {
hide()
evaAnimListener?.onVideoDestroy()
Expand Down
6 changes: 6 additions & 0 deletions yyevac/src/main/java/com/yy/yyeva/view/EvaAnimViewV3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ open class EvaAnimViewV3 @JvmOverloads constructor(context: Context, attrs: Attr
evaAnimListener?.onVideoComplete(lastFrame)
}

override fun onVideoPlayFinish() {
ELog.i(TAG, "onVideoPlayFinish")
evaAnimListener?.onVideoPlayFinish()
}

override fun onVideoDestroy() {
hide()
evaAnimListener?.onVideoDestroy()
Expand Down Expand Up @@ -368,6 +373,7 @@ open class EvaAnimViewV3 @JvmOverloads constructor(context: Context, attrs: Attr
ELog.e(TAG, "AnimView is GONE, can't play")
return@ui
}
ELog.i(TAG, "startPlay ${evaFileContainer.getFile()?.absolutePath}")
if (!playerEva.isRunning()) {
lastEvaFile = evaFileContainer
playerEva.startPlay(evaFileContainer)
Expand Down

0 comments on commit ac43cc2

Please sign in to comment.