Browse Source

first commit

hexleo 5 years ago
commit
8ed98254c8
100 changed files with 9034 additions and 0 deletions
  1. 16 0
      .gitignore
  2. 12 0
      Android/PlayerProj/.gitignore
  3. 1 0
      Android/PlayerProj/animplayer/.gitignore
  4. 36 0
      Android/PlayerProj/animplayer/build.gradle
  5. 21 0
      Android/PlayerProj/animplayer/proguard-rules.pro
  6. 33 0
      Android/PlayerProj/animplayer/publish.gradle
  7. 2 0
      Android/PlayerProj/animplayer/src/main/AndroidManifest.xml
  8. 92 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimConfig.kt
  9. 156 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimConfigManager.kt
  10. 143 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimPlayer.kt
  11. 270 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimView.kt
  12. 203 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AudioPlayer.kt
  13. 64 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Constant.kt
  14. 151 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Decoder.kt
  15. 111 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/EGLUtil.kt
  16. 98 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/FileContainer.kt
  17. 262 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/HardDecoder.kt
  18. 160 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Render.kt
  19. 43 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/RenderConstant.kt
  20. 74 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/IAnimListener.kt
  21. 33 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/IFetchResource.kt
  22. 24 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/OnResourceClickListener.kt
  23. 66 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskAnimPlugin.kt
  24. 74 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskConfig.kt
  25. 130 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskRender.kt
  26. 114 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskShader.kt
  27. 83 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Frame.kt
  28. 225 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixAnimPlugin.kt
  29. 151 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixRender.kt
  30. 94 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixShader.kt
  31. 55 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixTouch.kt
  32. 37 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Resource.kt
  33. 123 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Src.kt
  34. 119 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/plugin/AnimPluginManager.kt
  35. 48 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/plugin/IAnimPlugin.kt
  36. 54 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/ALog.kt
  37. 62 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/BitmapUtil.kt
  38. 50 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/GlFloatArray.kt
  39. 58 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/MediaUtil.kt
  40. 74 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/ShaderUtil.kt
  41. 81 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/SpeedControlUtil.kt
  42. 84 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/TexCoordsUtil.kt
  43. 58 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/TextureLoadUtil.kt
  44. 64 0
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/VertexUtil.kt
  45. 3 0
      Android/PlayerProj/animplayer/src/main/res/values/strings.xml
  46. 17 0
      Android/PlayerProj/animplayer/src/test/java/com/tencent/qgame/animplayer/ExampleUnitTest.java
  47. 1 0
      Android/PlayerProj/animtool/.gitignore
  48. 18 0
      Android/PlayerProj/animtool/build.gradle
  49. 295 0
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/AnimTool.java
  50. 38 0
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/CommonArg.java
  51. 117 0
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/GetAlphaFrame.java
  52. 88 0
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Main.java
  53. 94 0
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Md5Util.java
  54. 155 0
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Mp4BoxTool.java
  55. 22 0
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/TLog.java
  56. 1 0
      Android/PlayerProj/app/.gitignore
  57. 36 0
      Android/PlayerProj/app/build.gradle
  58. 21 0
      Android/PlayerProj/app/proguard-rules.pro
  59. 29 0
      Android/PlayerProj/app/src/main/AndroidManifest.xml
  60. BIN
      Android/PlayerProj/app/src/main/assets/demo.mp4
  61. BIN
      Android/PlayerProj/app/src/main/assets/mask_blur_demo.mp4
  62. BIN
      Android/PlayerProj/app/src/main/assets/mask_trunk_demo.mp4
  63. BIN
      Android/PlayerProj/app/src/main/assets/vapx.mp4
  64. 44 0
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/MainActivity.kt
  65. 289 0
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimActiveDemoActivity.kt
  66. 220 0
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimSimpleDemoActivity.kt
  67. 289 0
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimVapxDemoActivity.kt
  68. 109 0
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/FileUtil.kt
  69. BIN
      Android/PlayerProj/app/src/main/res/drawable/bg.png
  70. BIN
      Android/PlayerProj/app/src/main/res/drawable/head1.png
  71. BIN
      Android/PlayerProj/app/src/main/res/drawable/head2.png
  72. 74 0
      Android/PlayerProj/app/src/main/res/drawable/ic_launcher_background.xml
  73. BIN
      Android/PlayerProj/app/src/main/res/drawable/icon.png
  74. 37 0
      Android/PlayerProj/app/src/main/res/layout/activity_anim_simple_demo.xml
  75. 39 0
      Android/PlayerProj/app/src/main/res/layout/activity_main.xml
  76. 6 0
      Android/PlayerProj/app/src/main/res/values/colors.xml
  77. 3 0
      Android/PlayerProj/app/src/main/res/values/strings.xml
  78. 7 0
      Android/PlayerProj/app/src/main/res/values/styles.xml
  79. 17 0
      Android/PlayerProj/app/src/test/java/com/tencent/qgame/playerproj/ExampleUnitTest.kt
  80. 59 0
      Android/PlayerProj/bintrayv1.gradle
  81. 29 0
      Android/PlayerProj/build.gradle
  82. 15 0
      Android/PlayerProj/gradle.properties
  83. BIN
      Android/PlayerProj/gradle/wrapper/gradle-wrapper.jar
  84. 5 0
      Android/PlayerProj/gradle/wrapper/gradle-wrapper.properties
  85. 172 0
      Android/PlayerProj/gradlew
  86. 84 0
      Android/PlayerProj/gradlew.bat
  87. 42 0
      Android/PlayerProj/installv1.gradle
  88. 37 0
      Android/PlayerProj/maven.gradle
  89. 1 0
      Android/PlayerProj/settings.gradle
  90. 113 0
      Android/README.md
  91. 2 0
      CONTRIBUTING.md
  92. 122 0
      Introduction.md
  93. 1259 0
      LICENSE.txt
  94. 168 0
      QGVAPlayer.podspec
  95. 54 0
      README.md
  96. 865 0
      iOS/QGVAPlayer/QGVAPlayer.xcodeproj/project.pbxproj
  97. 7 0
      iOS/QGVAPlayer/QGVAPlayer.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  98. 8 0
      iOS/QGVAPlayer/QGVAPlayer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  99. BIN
      iOS/QGVAPlayer/QGVAPlayer.xcodeproj/project.xcworkspace/xcuserdata/chanceguo.xcuserdatad/UserInterfaceState.xcuserstate
  100. 14 0
      iOS/QGVAPlayer/QGVAPlayer.xcodeproj/xcuserdata/chanceguo.xcuserdatad/xcschemes/xcschememanagement.plist

+ 16 - 0
.gitignore

@@ -0,0 +1,16 @@
+# dependencies
+node_modules
+# logs
+npm-debug.log
+
+# Nuxt generate
+.vscode
+
+.idea
+
+# sw.*
+
+.cache
+
+#mac cache 
+.DS_Store

+ 12 - 0
Android/PlayerProj/.gitignore

@@ -0,0 +1,12 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches/build_file_checksums.ser
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+.idea
+.DS_Store
+/build
+/captures
+.externalNativeBuild

+ 1 - 0
Android/PlayerProj/animplayer/.gitignore

@@ -0,0 +1 @@
+/build

+ 36 - 0
Android/PlayerProj/animplayer/build.gradle

@@ -0,0 +1,36 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+// 内部maven上传
+apply from: file("../maven.gradle")
+
+android {
+    compileSdkVersion 28
+
+
+
+    defaultConfig {
+        minSdkVersion 16
+        targetSdkVersion 28
+        versionCode 1
+        versionName "1.0"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+    }
+
+}
+
+dependencies {
+    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") {
+        exclude module: 'annotations'
+    }
+}
+
+// jcenter 上传(这个要在底部)
+// apply from: file("publish.gradle")

+ 21 - 0
Android/PlayerProj/animplayer/proguard-rules.pro

@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 33 - 0
Android/PlayerProj/animplayer/publish.gradle

@@ -0,0 +1,33 @@
+ext {
+    // 此处填写刚才建立的maven仓库的仓库名称
+    bintrayRepo = 'maven'
+    // library的group id
+    publishedGroupId = 'com.egame.vap'
+    // library网站地址
+    siteUrl = 'https://github.com/Tencent/vap'
+    // library仓库地址
+    gitUrl = 'https://github.com/Tencent/vap'
+
+    // 注册时候的bintray username
+    developerId = 'hexleo'
+    // 开发者名称
+    developerName = 'hexleo'
+    // 开发者邮箱
+    developerEmail = 'wanghailiang333@gmail.com'
+
+    // 开源许可证(这里是Apache 2.0)
+    licenseName = 'MIT'
+    licenseUrl = 'http://opensource.org/licenses/MIT'
+    allLicenses = ["MIT"]
+
+    // library artifact(单个module一般就填写library name)
+    artifact = 'animplayer'
+    libraryName = 'animplayer'
+    libraryVersion = '2.0.6'
+    libraryDescription = ''
+    // bintrayName 是你在网页Repository页面能看到的名称
+    bintrayName = 'vap'
+}
+
+apply from: '../installv1.gradle'
+apply from: '../bintrayv1.gradle'

+ 2 - 0
Android/PlayerProj/animplayer/src/main/AndroidManifest.xml

@@ -0,0 +1,2 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="com.tencent.qgame.animplayer"/>

+ 92 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimConfig.kt

@@ -0,0 +1,92 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.graphics.Bitmap
+import android.graphics.MaskFilter
+import com.tencent.qgame.animplayer.mask.MaskConfig
+import com.tencent.qgame.animplayer.util.ALog
+import org.json.JSONException
+import org.json.JSONObject
+
+/**
+ * vapc里读取出来的基础配置
+ */
+class AnimConfig {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.AnimConfig"
+    }
+
+    val version = 2 // 不同版本号不兼容
+    var totalFrames = 0 // 总帧数
+    var width = 0 // 需要显示视频的真实宽高
+    var height = 0
+    var videoWidth = 0 // 视频实际宽高
+    var videoHeight = 0
+    var orien = Constant.ORIEN_DEFAULT // 0-兼容模式 1-竖屏 2-横屏
+    var fps = 0
+    var isMix = false // 是否为融合动画
+    var alphaPointRect = PointRect(0, 0 ,0 ,0) // alpha区域
+    var rgbPointRect = PointRect(0, 0, 0, 0) // rgb区域
+    var isDefaultConfig = false // 没有vapc配置时默认逻辑
+    var defaultVideoMode = Constant.VIDEO_MODE_SPLIT_HORIZONTAL
+
+    var maskConfig: MaskConfig ?= null
+    var jsonConfig: JSONObject? = null
+
+
+    /**
+     * @return 解析是否成功,失败按默认配置走
+     */
+    fun parse(json: JSONObject): Boolean {
+        return try {
+            json.getJSONObject("info").apply {
+                val v = getInt("v")
+                if (version != v) {
+                    ALog.e(TAG, "current version=$version target=$v")
+                    return false
+                }
+                totalFrames = getInt("f")
+                width = getInt("w")
+                height = getInt("h")
+                videoWidth = getInt("videoW")
+                videoHeight = getInt("videoH")
+                orien = getInt("orien")
+                fps = getInt("fps")
+                isMix = getInt("isVapx") == 1
+                val a = getJSONArray("aFrame") ?: return false
+                alphaPointRect = PointRect(a.getInt(0), a.getInt(1), a.getInt(2), a.getInt(3))
+                val c = getJSONArray("rgbFrame") ?: return false
+                rgbPointRect = PointRect(c.getInt(0), c.getInt(1), c.getInt(2), c.getInt(3))
+            }
+            true
+        } catch (e : JSONException) {
+            ALog.e(TAG, "json parse fail $e", e)
+            false
+        }
+    }
+
+    override fun toString(): String {
+        return "AnimConfig(version=$version, totalFrames=$totalFrames, width=$width, height=$height, videoWidth=$videoWidth, videoHeight=$videoHeight, orien=$orien, fps=$fps, isMix=$isMix, alphaPointRect=$alphaPointRect, rgbPointRect=$rgbPointRect, isDefaultConfig=$isDefaultConfig)"
+    }
+
+
+}
+
+
+data class PointRect(val x: Int, val y: Int, val w: Int, val h: Int)
+data class RefVec2(val w: Int, val h: Int) //参考宽&高

+ 156 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimConfigManager.kt

@@ -0,0 +1,156 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.os.SystemClock
+import com.tencent.qgame.animplayer.util.ALog
+import org.json.JSONObject
+import java.nio.charset.Charset
+
+/**
+ * 配置管理
+ */
+class AnimConfigManager(val player: AnimPlayer) {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.AnimConfigManager"
+    }
+
+    var config: AnimConfig? = null
+    var isParsingConfig = false // 是否正在读取配置
+
+    /**
+     * 解析配置
+     * @return true 解析成功 false 解析失败
+     */
+    fun parseConfig(fileContainer: FileContainer, defaultVideoMode: Int, defaultFps: Int): Int {
+        try {
+            isParsingConfig = true
+            // 解析vapc
+            val time = SystemClock.elapsedRealtime()
+            val result = parse(fileContainer, defaultVideoMode, defaultFps)
+            ALog.i(TAG, "parseConfig cost=${SystemClock.elapsedRealtime() - time}ms")
+            if (!result) {
+                isParsingConfig = false
+                return Constant.REPORT_ERROR_TYPE_PARSE_CONFIG
+            }
+            // 插件解析配置
+            val resultCode = config?.let {
+                player.pluginManager.onConfigCreate(it)
+            } ?: Constant.OK
+            isParsingConfig = false
+            return resultCode
+        } catch (e : Throwable) {
+            ALog.e(TAG, "parseConfig error $e", e)
+            isParsingConfig = false
+            return Constant.REPORT_ERROR_TYPE_PARSE_CONFIG
+        }
+    }
+
+    /**
+     * 默认配置解析(兼容老视频格式)
+     */
+    fun defaultConfig(_videoWidth: Int, _videoHeight: Int) {
+        if (config?.isDefaultConfig == false) return
+        config?.apply {
+            videoWidth = _videoWidth
+            videoHeight = _videoHeight
+            if (defaultVideoMode == Constant.VIDEO_MODE_SPLIT_VERTICAL) { // 上下对齐
+                width = _videoWidth
+                height = _videoHeight / 2
+                alphaPointRect = PointRect(0, 0, width, height)
+                rgbPointRect = PointRect(0, height, width, height)
+            } else { // 默认左右对齐
+                width = _videoWidth / 2
+                height = _videoHeight
+                alphaPointRect = PointRect(0, 0, width, height)
+                rgbPointRect = PointRect(width, 0, width, height)
+            }
+        }
+    }
+
+
+    private fun parse(fileContainer: FileContainer, defaultVideoMode: Int, defaultFps: Int): Boolean {
+
+        val config = AnimConfig()
+        this.config = config
+
+
+        // 查找vapc box
+        fileContainer.startRandomRead()
+        val boxHead = ByteArray(8)
+        var head: BoxHead? = null
+        var vapcStartIndex: Long = 0
+        while (fileContainer.read(boxHead, 0, boxHead.size) == 8) {
+            val h = parseBoxHead(boxHead) ?: break
+            if ("vapc" == h.type) {
+                h.startIndex = vapcStartIndex
+                head = h
+                break
+            }
+            vapcStartIndex += h.length
+            fileContainer.skip(h.length - 8L)
+        }
+
+        if (head == null) {
+            ALog.e(TAG, "vapc box head not found")
+            // 按照默认配置生成config
+            config.apply {
+                isDefaultConfig = true
+                this.defaultVideoMode = defaultVideoMode
+                fps = defaultFps
+            }
+            return true
+        }
+
+        // 读取vapc box
+        val vapcBuf = ByteArray(head.length - 8) // ps: OOM exception
+        fileContainer.read(vapcBuf, 0 , vapcBuf.size)
+        fileContainer.closeRandomRead()
+
+        val json = String(vapcBuf, 0, vapcBuf.size, Charset.forName("UTF-8"))
+        val jsonObj = JSONObject(json)
+        config.jsonConfig = jsonObj
+        val result = config.parse(jsonObj)
+        if (defaultFps > 0) {
+            config.fps = defaultFps
+        }
+        player.fps = config.fps
+        return result
+    }
+
+    private fun parseBoxHead(boxHead: ByteArray): BoxHead? {
+        if (boxHead.size != 8) return null
+        val head = BoxHead()
+        var length: Int = 0
+        length = length or (boxHead[0].toInt() and 0xff shl 24)
+        length = length or (boxHead[1].toInt() and 0xff shl 16)
+        length = length or (boxHead[2].toInt() and 0xff shl 8)
+        length = length or (boxHead[3].toInt() and 0xff)
+        head.length = length
+        head.type = String(boxHead, 4, 4, Charset.forName("US-ASCII"))
+        return head
+    }
+
+    private class BoxHead {
+        var startIndex: Long = 0
+        var length: Int = 0
+        var type: String? = null
+    }
+
+
+
+}

+ 143 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimPlayer.kt

@@ -0,0 +1,143 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import com.tencent.qgame.animplayer.inter.IAnimListener
+import com.tencent.qgame.animplayer.mask.MaskConfig
+import com.tencent.qgame.animplayer.plugin.AnimPluginManager
+import com.tencent.qgame.animplayer.util.ALog
+
+class AnimPlayer(val animView: AnimView) {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.AnimPlayer"
+    }
+
+    var animListener: IAnimListener? = null
+    var decoder: Decoder? = null
+    var audioPlayer: AudioPlayer? = null
+    var fps: Int = 0
+        set(value) {
+            decoder?.fps = value
+            field = value
+        }
+    var playLoop: Int = 0
+        set(value) {
+            decoder?.playLoop = value
+            audioPlayer?.playLoop = value
+            field = value
+        }
+    var supportMaskBoolean : Boolean = false
+    var maskEdgeBlurBoolean : Boolean = false
+    // 视频模式
+    var videoMode: Int = Constant.VIDEO_MODE_SPLIT_HORIZONTAL
+    var isDetachedFromWindow = false
+    var isSurfaceAvailable = false
+    var startRunnable: Runnable? = null
+    val configManager = AnimConfigManager(this)
+    val pluginManager = AnimPluginManager(this)
+
+    fun onSurfaceTextureDestroyed() {
+        isSurfaceAvailable = false
+        decoder?.destroy()
+        audioPlayer?.destroy()
+    }
+
+    fun onSurfaceTextureAvailable(width: Int, height: Int) {
+        isSurfaceAvailable = true
+        startRunnable?.run()
+        startRunnable = null
+    }
+
+
+    fun onSurfaceTextureSizeChanged(width: Int, height: Int) {
+        decoder?.onSurfaceSizeChanged(width, height)
+    }
+
+    fun startPlay(fileContainer: FileContainer) {
+        prepareDecoder()
+        if (isRunning()) {
+            ALog.i(TAG, "is running can not start")
+            return
+        }
+
+        if (decoder?.prepareThread() == false) {
+            decoder?.onFailed(Constant.REPORT_ERROR_TYPE_CREATE_THREAD, Constant.ERROR_MSG_CREATE_THREAD)
+            return
+        }
+        // 在线程中解析配置
+        decoder?.renderThread?.handler?.post {
+            val result = configManager.parseConfig(fileContainer, videoMode, fps)
+            if (result != Constant.OK) {
+                decoder?.onFailed(result, Constant.getErrorMsg(result))
+                return@post
+            }
+            ALog.i(TAG, "parse ${configManager.config}")
+            val config = configManager.config
+            // 如果是默认配置,因为信息不完整onVideoConfigReady不会被调用
+            if (config != null && (config.isDefaultConfig || animListener?.onVideoConfigReady(config) == true)) {
+                innerStartPlay(fileContainer)
+            } else {
+                ALog.i(TAG, "onVideoConfigReady return false")
+            }
+        }
+    }
+
+    private fun innerStartPlay(fileContainer: FileContainer) {
+        synchronized(AnimPlayer::class.java) {
+            if (isSurfaceAvailable) {
+                decoder?.start(fileContainer)
+                audioPlayer?.start(fileContainer)
+            } else {
+                 startRunnable = Runnable {
+                    innerStartPlay(fileContainer)
+                }
+                animView.prepareTextureView()
+            }
+        }
+    }
+
+    fun stopPlay() {
+        decoder?.stop()
+        audioPlayer?.stop()
+    }
+
+    fun isRunning(): Boolean {
+        return (decoder?.isRunning ?: false) || configManager.isParsingConfig
+    }
+
+    private fun prepareDecoder() {
+        if (decoder == null) {
+            decoder = HardDecoder(this).apply {
+                playLoop = this@AnimPlayer.playLoop
+                fps = this@AnimPlayer.fps
+            }
+        }
+        if (audioPlayer == null) {
+            audioPlayer = AudioPlayer(this).apply {
+                playLoop = this@AnimPlayer.playLoop
+            }
+        }
+    }
+
+    fun updateMaskConfig(maskConfig: MaskConfig?) {
+        configManager.config?.maskConfig = configManager.config?.maskConfig ?: MaskConfig()
+        configManager.config?.maskConfig?.safeSetMaskBitmapAndReleasePre(maskConfig?.alphaMaskBitmap)
+        configManager.config?.maskConfig?.maskPositionPair = maskConfig?.maskPositionPair
+        configManager.config?.maskConfig?.maskTexPair = maskConfig?.maskTexPair
+    }
+
+}

+ 270 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimView.kt

@@ -0,0 +1,270 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.content.Context
+import android.content.res.AssetManager
+import android.graphics.SurfaceTexture
+import android.os.Build
+import android.os.Handler
+import android.os.Looper
+import android.util.AttributeSet
+import android.view.MotionEvent
+import android.view.TextureView
+import android.view.View
+import android.view.ViewGroup
+import android.widget.FrameLayout
+import com.tencent.qgame.animplayer.inter.IAnimListener
+import com.tencent.qgame.animplayer.inter.IFetchResource
+import com.tencent.qgame.animplayer.inter.OnResourceClickListener
+import com.tencent.qgame.animplayer.mask.MaskConfig
+import com.tencent.qgame.animplayer.util.ALog
+import java.io.File
+
+open class AnimView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0):
+    FrameLayout(context, attrs, defStyleAttr),
+    TextureView.SurfaceTextureListener {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.AnimView"
+    }
+    private val uiHandler by lazy { Handler(Looper.getMainLooper()) }
+    private var surface: SurfaceTexture? = null
+    private var player: AnimPlayer? = null
+    private var animListener: IAnimListener? = null
+    private var innerTextureView: TextureView? = null
+    private var lastFile: FileContainer? = null
+    // 代理监听
+    private val animProxyListener by lazy {
+        object : IAnimListener {
+
+            override fun onVideoConfigReady(config: AnimConfig): Boolean {
+                return animListener?.onVideoConfigReady(config) ?: super.onVideoConfigReady(config)
+            }
+
+            override fun onVideoStart() {
+                animListener?.onVideoStart()
+            }
+
+            override fun onVideoRender(frameIndex: Int, config: AnimConfig?) {
+                animListener?.onVideoRender(frameIndex, config)
+            }
+
+            override fun onVideoComplete() {
+                hide()
+                animListener?.onVideoComplete()
+            }
+
+            override fun onVideoDestroy() {
+                hide()
+                animListener?.onVideoDestroy()
+            }
+
+            override fun onFailed(errorType: Int, errorMsg: String?) {
+                animListener?.onFailed(errorType, errorMsg)
+            }
+
+        }
+    }
+
+
+    init {
+        hide()
+        player = AnimPlayer(this)
+        player?.animListener = animProxyListener
+    }
+
+
+    fun prepareTextureView() {
+        uiHandler.post {
+            removeAllViews()
+            innerTextureView = TextureView(context).apply {
+                isOpaque = false
+                surfaceTextureListener = this@AnimView
+                layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
+            }
+            addView(innerTextureView)
+        }
+    }
+
+    fun getSurfaceTexture(): SurfaceTexture? {
+        return innerTextureView?.surfaceTexture ?: surface
+    }
+
+    override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) {
+        ALog.i(TAG, "onSurfaceTextureSizeChanged $width x $height")
+        player?.onSurfaceTextureSizeChanged(width, height)
+    }
+
+    override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) {
+    }
+
+    override fun onSurfaceTextureDestroyed(surface: SurfaceTexture?): Boolean {
+        ALog.i(TAG, "onSurfaceTextureDestroyed")
+        player?.onSurfaceTextureDestroyed()
+        uiHandler.post {
+            innerTextureView?.surfaceTextureListener = null
+            innerTextureView = null
+            removeAllViews()
+        }
+        return !belowKitKat()
+    }
+
+    override fun onSurfaceTextureAvailable(surface: SurfaceTexture?, width: Int, height: Int) {
+        ALog.i(TAG, "onSurfaceTextureAvailable")
+        this.surface = surface
+        player?.onSurfaceTextureAvailable(width, height)
+    }
+
+    override fun onAttachedToWindow() {
+        ALog.i(TAG, "onAttachedToWindow")
+        super.onAttachedToWindow()
+        player?.isDetachedFromWindow = false
+        // 自动恢复播放
+        if ((player?.playLoop ?: 0) > 0) {
+            lastFile?.apply {
+                startPlay(this)
+            }
+        }
+    }
+
+    override fun onDetachedFromWindow() {
+        ALog.i(TAG, "onDetachedFromWindow")
+        super.onDetachedFromWindow()
+        if (belowKitKat()) {
+            release()
+        }
+        player?.isDetachedFromWindow = true
+        player?.onSurfaceTextureDestroyed()
+    }
+
+    override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
+        val res = isRunning() && ev != null && player?.pluginManager?.onDispatchTouchEvent(ev) == true
+        return if (!res) super.dispatchTouchEvent(ev) else true
+    }
+
+    open fun setAnimListener(animListener: IAnimListener?) {
+        this.animListener = animListener
+    }
+
+    open fun setFetchResource(fetchResource: IFetchResource?) {
+        player?.pluginManager?.getMixAnimPlugin()?.resourceRequest = fetchResource
+    }
+
+    open fun setOnResourceClickListener(resourceClickListener: OnResourceClickListener?) {
+        player?.pluginManager?.getMixAnimPlugin()?.resourceClickListener = resourceClickListener
+    }
+
+    /**
+     * 兼容方案,优先保证表情显示
+     */
+    open fun enableAutoTxtColorFill(enable: Boolean) {
+        player?.pluginManager?.getMixAnimPlugin()?.autoTxtColorFill = enable
+    }
+
+    fun setLoop(playLoop: Int) {
+        player?.playLoop = playLoop
+    }
+
+    fun supportMask(isSupport : Boolean, isEdgeBlur : Boolean) {
+        player?.supportMaskBoolean = isSupport
+        player?.maskEdgeBlurBoolean = isEdgeBlur
+    }
+
+    fun updateMaskConfig(maskConfig: MaskConfig?) {
+        player?.updateMaskConfig(maskConfig)
+    }
+
+    // 兼容老版本视频模式
+    @Deprecated("Compatible older version mp4")
+    fun setVideoMode(mode: Int) {
+        player?.videoMode = mode
+    }
+
+    fun setFps(fps: Int) {
+        player?.fps = fps
+    }
+
+    fun startPlay(file: File) {
+        try {
+            val fileContainer = FileContainer(file)
+            startPlay(fileContainer)
+        } catch (e: Throwable) {
+            animProxyListener.onFailed(Constant.REPORT_ERROR_TYPE_FILE_ERROR, Constant.ERROR_MSG_FILE_ERROR)
+        }
+    }
+
+    fun startPlay(assetManager: AssetManager, assetsPath: String) {
+        try {
+            val fileContainer = FileContainer(assetManager, assetsPath)
+            startPlay(fileContainer)
+        } catch (e: Throwable) {
+            animProxyListener.onFailed(Constant.REPORT_ERROR_TYPE_FILE_ERROR, Constant.ERROR_MSG_FILE_ERROR)
+        }
+    }
+
+
+    fun startPlay(fileContainer: FileContainer) {
+        ui {
+            if (visibility != View.VISIBLE) {
+                ALog.e(TAG, "AnimView is GONE, can't play")
+                return@ui
+            }
+            lastFile = fileContainer
+            if (player?.isRunning() == false) {
+                player?.startPlay(fileContainer)
+            } else {
+                ALog.i(TAG, "is running can not start")
+            }
+        }
+    }
+
+
+    fun stopPlay() {
+        player?.stopPlay()
+    }
+
+    fun isRunning(): Boolean {
+        return player?.isRunning() ?: false
+    }
+
+    private fun hide() {
+        lastFile?.close()
+        ui {
+            removeAllViews()
+        }
+    }
+
+    private fun ui(f:()->Unit) {
+        if (Looper.myLooper() == Looper.getMainLooper()) f() else uiHandler.post { f() }
+    }
+
+    /**
+     * fix Error detachFromGLContext crash
+     */
+    private fun belowKitKat(): Boolean {
+        return Build.VERSION.SDK_INT <= 19
+    }
+
+    private fun release() {
+        try {
+            surface?.release()
+        } catch (error: Throwable) {
+            ALog.e(TAG, "failed to release mSurfaceTexture= $surface: ${error.message}", error)
+        }
+        surface = null
+    }
+}

+ 203 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AudioPlayer.kt

@@ -0,0 +1,203 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.media.*
+import com.tencent.qgame.animplayer.util.ALog
+import com.tencent.qgame.animplayer.util.MediaUtil
+import java.lang.RuntimeException
+
+class AudioPlayer(val player: AnimPlayer) {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.AudioPlayer"
+    }
+
+    var extractor: MediaExtractor? = null
+    var decoder: MediaCodec? = null
+    var audioTrack: AudioTrack? = null
+    val decodeThread = HandlerHolder(null, null)
+    var isRunning = false
+    var playLoop = 0
+    var isStopReq = false
+    var needDestroy = false
+
+
+
+    private fun prepareThread(): Boolean {
+        return Decoder.createThread(decodeThread, "anim_audio_thread")
+    }
+
+    fun start(fileContainer: FileContainer) {
+        isStopReq = false
+        needDestroy = false
+        if (!prepareThread()) return
+        if (isRunning) {
+            stop()
+        }
+        isRunning = true
+        decodeThread.handler?.post {
+            try {
+                startPlay(fileContainer)
+            } catch (e: Throwable) {
+                ALog.e(TAG, "Audio exception=$e", e)
+                release()
+            }
+        }
+    }
+
+    fun stop() {
+        isStopReq = true
+    }
+
+    private fun startPlay(fileContainer: FileContainer) {
+        val extractor = MediaUtil.getExtractor(fileContainer)
+        this.extractor = extractor
+        val audioIndex = MediaUtil.selectAudioTrack(extractor)
+        if (audioIndex < 0) {
+            ALog.e(TAG, "cannot find audio track")
+            release()
+            return
+        }
+        extractor.selectTrack(audioIndex)
+        val format = extractor.getTrackFormat(audioIndex)
+        val mime =format.getString(MediaFormat.KEY_MIME)
+        val decoder = MediaCodec.createDecoderByType(mime).apply {
+            configure(format, null, null, 0)
+            start()
+        }
+        this.decoder = decoder
+
+        val decodeInputBuffers = decoder.inputBuffers
+        var decodeOutputBuffers = decoder.outputBuffers
+
+        val bufferInfo = MediaCodec.BufferInfo()
+        val sampleRate = format.getInteger(MediaFormat.KEY_SAMPLE_RATE)
+        val channelConfig = getChannelConfig(format.getInteger(MediaFormat.KEY_CHANNEL_COUNT))
+
+        val bufferSize = AudioTrack.getMinBufferSize(sampleRate, channelConfig, AudioFormat.ENCODING_PCM_16BIT)
+        val audioTrack = AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, channelConfig, AudioFormat.ENCODING_PCM_16BIT, bufferSize, AudioTrack.MODE_STREAM)
+        this.audioTrack = audioTrack
+        val state = audioTrack.getState()
+        if (state != AudioTrack.STATE_INITIALIZED) {
+            release()
+            ALog.e(TAG, "init audio track failure")
+            return
+        }
+        audioTrack.play()
+        val timeOutUs = 1000L
+        var isEOS = false
+        while (!isStopReq) {
+            if (!isEOS) {
+                val inputIndex = decoder.dequeueInputBuffer(timeOutUs)
+                if (inputIndex >= 0) {
+                    val inputBuffer = decodeInputBuffers[inputIndex]
+                    inputBuffer.clear()
+                    val sampleSize = extractor.readSampleData(inputBuffer, 0)
+                    if (sampleSize < 0) {
+                        isEOS = true
+                        decoder.queueInputBuffer(inputIndex, 0, 0, 0, MediaCodec.BUFFER_FLAG_END_OF_STREAM)
+                    } else {
+                        decoder.queueInputBuffer(inputIndex, 0, sampleSize, 0, 0)
+                        extractor.advance()
+                    }
+                }
+            }
+            val outputIndex = decoder.dequeueOutputBuffer(bufferInfo, 0)
+            if (outputIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+                decodeOutputBuffers = decoder.outputBuffers
+            }
+            if (outputIndex > 0) {
+                val outputBuffer = decodeOutputBuffers[outputIndex]
+                val chunkPCM = ByteArray(bufferInfo.size)
+                outputBuffer.get(chunkPCM)
+                outputBuffer.clear()
+                audioTrack.write(chunkPCM, 0, bufferInfo.size)
+                decoder.releaseOutputBuffer(outputIndex, false)
+            }
+
+            if (isEOS && bufferInfo.flags and MediaCodec.BUFFER_FLAG_END_OF_STREAM != 0) {
+                if (--playLoop > 0) {
+                    ALog.d(TAG, "Reached EOS, looping -> playLoop")
+                    extractor.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC)
+                    decoder.flush()
+                    isEOS = false
+                } else {
+                    ALog.i(TAG, "decode finish")
+                    release()
+                    break
+                }
+            }
+        }
+        release()
+    }
+
+
+    private fun release() {
+        try {
+            decoder?.apply {
+                stop()
+                release()
+            }
+            decoder = null
+            extractor?.release()
+            extractor = null
+            audioTrack?.apply {
+                pause()
+                flush()
+                stop()
+                release()
+            }
+            audioTrack = null
+        } catch (e: Throwable) {
+            ALog.e(TAG, "release exception=$e", e)
+        }
+        isRunning = false
+        if (needDestroy) {
+            destroyInner()
+        }
+    }
+
+    fun destroy() {
+        needDestroy = true
+        if (isRunning) {
+            stop()
+        } else {
+            destroyInner()
+        }
+    }
+
+    private fun destroyInner() {
+        if (player.isDetachedFromWindow) {
+            ALog.i(TAG, "destroyThread")
+            decodeThread.handler?.removeCallbacksAndMessages(null)
+            decodeThread.thread = Decoder.quitSafely(decodeThread.thread)
+        }
+    }
+
+    private fun getChannelConfig(channelCount: Int): Int {
+        return when (channelCount) {
+            1 -> AudioFormat.CHANNEL_CONFIGURATION_MONO
+            2 -> AudioFormat.CHANNEL_OUT_STEREO
+            3 -> AudioFormat.CHANNEL_OUT_STEREO or AudioFormat.CHANNEL_OUT_FRONT_CENTER
+            4 -> AudioFormat.CHANNEL_OUT_QUAD
+            5 -> AudioFormat.CHANNEL_OUT_QUAD or AudioFormat.CHANNEL_OUT_FRONT_CENTER
+            6 -> AudioFormat.CHANNEL_OUT_5POINT1
+            7 -> AudioFormat.CHANNEL_OUT_5POINT1 or AudioFormat.CHANNEL_OUT_BACK_CENTER
+            else -> throw RuntimeException("Unsupported channel count: $channelCount")
+        }
+    }
+}

+ 64 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Constant.kt

@@ -0,0 +1,64 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+object Constant {
+    const val TAG = "AnimPlayer"
+
+    // 视频适配的屏幕方向
+    const val ORIEN_DEFAULT = 0 // 兼容模式
+    const val ORIEN_PORTRAIT = 1 // 适配竖屏的视频
+    const val ORIEN_LANDSCAPE = 2 // 适配横屏的视频
+
+    // 视频对齐方式 (兼容老版本视频模式)
+    @Deprecated("Compatible older version mp4")
+    const val VIDEO_MODE_SPLIT_HORIZONTAL = 1 // 视频左右对齐
+    @Deprecated("Compatible older version mp4")
+    const val VIDEO_MODE_SPLIT_VERTICAL = 2 // 视频上下对齐
+
+
+    const val OK = 0 // 成功
+
+    const val REPORT_ERROR_TYPE_EXTRACTOR_EXC = 10001 // MediaExtractor exception
+    const val REPORT_ERROR_TYPE_DECODE_EXC = 10002 // MediaCodec exception
+    const val REPORT_ERROR_TYPE_CREATE_THREAD = 10003 // 线程创建失败
+    const val REPORT_ERROR_TYPE_CREATE_RENDER = 10004 // render创建失败
+    const val REPORT_ERROR_TYPE_PARSE_CONFIG = 10005 // 配置解析失败
+    const val REPORT_ERROR_TYPE_CONFIG_PLUGIN_MIX = 10006 // vapx动画资源获取失败
+    const val REPORT_ERROR_TYPE_FILE_ERROR = 10007 // 文件无法读取
+
+    const val ERROR_MSG_EXTRACTOR_EXC = "0x1" // MediaExtractor exception
+    const val ERROR_MSG_DECODE_EXC = "0x2" // MediaCodec exception
+    const val ERROR_MSG_CREATE_THREAD = "0x3" // 线程创建失败
+    const val ERROR_MSG_CREATE_RENDER = "0x4" // render创建失败
+    const val ERROR_MSG_PARSE_CONFIG = "0x5 parse config fail" // 配置解析失败
+    const val ERROR_MSG_CONFIG_PLUGIN_MIX = "0x6 vapx fail" // vapx动画资源获取失败
+    const val ERROR_MSG_FILE_ERROR = "0x7 file can't read" // 文件无法读取
+
+
+    fun getErrorMsg(errorType: Int, errorMsg: String? = null): String {
+        return when(errorType) {
+            REPORT_ERROR_TYPE_EXTRACTOR_EXC -> ERROR_MSG_EXTRACTOR_EXC
+            REPORT_ERROR_TYPE_DECODE_EXC -> ERROR_MSG_DECODE_EXC
+            REPORT_ERROR_TYPE_CREATE_THREAD -> ERROR_MSG_CREATE_THREAD
+            REPORT_ERROR_TYPE_CREATE_RENDER -> ERROR_MSG_CREATE_RENDER
+            REPORT_ERROR_TYPE_PARSE_CONFIG -> ERROR_MSG_PARSE_CONFIG
+            REPORT_ERROR_TYPE_CONFIG_PLUGIN_MIX -> ERROR_MSG_CONFIG_PLUGIN_MIX
+            else -> "unknown"
+        } + " ${errorMsg ?: ""}"
+    }
+
+}

+ 151 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Decoder.kt

@@ -0,0 +1,151 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.os.Build
+import android.os.HandlerThread
+import android.os.Handler
+import com.tencent.qgame.animplayer.inter.IAnimListener
+import com.tencent.qgame.animplayer.util.ALog
+import com.tencent.qgame.animplayer.util.SpeedControlUtil
+
+
+abstract class Decoder(val player: AnimPlayer) : IAnimListener {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.Decoder"
+
+        fun createThread(handlerHolder: HandlerHolder, name: String): Boolean {
+            try {
+                if (handlerHolder.thread == null || handlerHolder.thread?.isAlive == false) {
+                    handlerHolder.thread = HandlerThread(name).apply {
+                        start()
+                        handlerHolder.handler = Handler(looper)
+                    }
+                }
+                return true
+            } catch (e: OutOfMemoryError) {
+                ALog.e(TAG, "createThread OOM", e)
+            }
+            return false
+        }
+
+        fun quitSafely(thread: HandlerThread?): HandlerThread? {
+            thread?.apply {
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+                    thread.quitSafely()
+                } else {
+                    thread.quit()
+                }
+            }
+            return null
+        }
+    }
+
+    var render: Render? = null
+    val renderThread = HandlerHolder(null, null)
+    val decodeThread = HandlerHolder(null, null)
+    private var surfaceWidth = 0
+    private var surfaceHeight = 0
+    var fps: Int = 0
+        set(value) {
+            speedControlUtil.setFixedPlaybackRate(value)
+            field = value
+        }
+    var playLoop = 0 // 循环播放次数
+    var isRunning = false // 是否正在运行
+    var isStopReq = false // 是否需要停止
+    val speedControlUtil by lazy { SpeedControlUtil() }
+
+    abstract fun start(fileContainer: FileContainer)
+
+    fun stop() {
+        isStopReq = true
+    }
+
+    abstract fun destroy()
+
+    fun prepareThread(): Boolean {
+        return createThread(renderThread, "anim_render_thread") && createThread(decodeThread, "anim_decode_thread")
+    }
+
+    fun prepareRender(): Boolean {
+        if (render == null) {
+            ALog.i(TAG, "prepareRender")
+            player.animView.getSurfaceTexture()?.apply {
+                render = Render(this).apply {
+                    updateViewPort(surfaceWidth, surfaceHeight)
+                }
+            }
+        }
+        render?.createTexture()
+        return render != null
+    }
+
+    fun preparePlay(videoWidth: Int, videoHeight: Int) {
+        player.configManager.defaultConfig(videoWidth, videoHeight)
+        player.configManager.config?.apply {
+            render?.setAnimConfig(this)
+        }
+        player.pluginManager.onRenderCreate()
+    }
+
+
+    fun destroyThread() {
+        if (player.isDetachedFromWindow) {
+            ALog.i(TAG, "destroyThread")
+            renderThread.handler?.removeCallbacksAndMessages(null)
+            decodeThread.handler?.removeCallbacksAndMessages(null)
+            renderThread.thread = quitSafely(renderThread.thread)
+            decodeThread.thread = quitSafely(decodeThread.thread)
+            renderThread.handler = null
+            decodeThread.handler = null
+        }
+    }
+
+    fun onSurfaceSizeChanged(width: Int, height: Int) {
+        surfaceWidth = width
+        surfaceHeight = height
+        render?.updateViewPort(width, height)
+    }
+
+    override fun onVideoStart() {
+        ALog.i(TAG, "onVideoStart")
+        player.animListener?.onVideoStart()
+    }
+
+    override fun onVideoRender(frameIndex: Int, config: AnimConfig?) {
+        ALog.d(TAG, "onVideoRender")
+        player.animListener?.onVideoRender(frameIndex, config)
+    }
+
+    override fun onVideoComplete() {
+        ALog.i(TAG, "onVideoComplete")
+        player.animListener?.onVideoComplete()
+    }
+
+    override fun onVideoDestroy() {
+        ALog.i(TAG, "onVideoDestroy")
+        player.animListener?.onVideoDestroy()
+    }
+
+    override fun onFailed(errorType: Int, errorMsg: String?) {
+        ALog.e(TAG, "onFailed errorType=$errorType, errorMsg=$errorMsg")
+        player.animListener?.onFailed(errorType, errorMsg)
+    }
+}
+
+data class HandlerHolder(var thread: HandlerThread?, var handler: Handler?)

+ 111 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/EGLUtil.kt

@@ -0,0 +1,111 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.graphics.SurfaceTexture
+import android.opengl.EGL14
+import android.view.Surface
+import com.tencent.qgame.animplayer.util.ALog
+import javax.microedition.khronos.egl.*
+
+class EGLUtil {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.EGLUtil"
+    }
+
+    private var egl: EGL10? = null
+    private var eglDisplay: EGLDisplay? = null
+    private var eglSurface: EGLSurface? = null
+    private var eglContext: EGLContext? = null
+    private var eglConfig: EGLConfig? = null
+
+    init {
+        eglDisplay = EGL10.EGL_NO_DISPLAY
+        eglSurface = EGL10.EGL_NO_SURFACE
+        eglContext = EGL10.EGL_NO_CONTEXT
+    }
+
+    fun start(surfaceTexture: SurfaceTexture) {
+        try {
+            egl = EGLContext.getEGL() as EGL10
+            eglDisplay = egl?.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY)
+            val version = IntArray(2)
+            egl?.eglInitialize(eglDisplay, version)
+            eglConfig = chooseConfig()
+            eglSurface = egl?.eglCreateWindowSurface(eglDisplay, eglConfig, Surface(surfaceTexture), null)
+            eglContext = createContext(egl, eglDisplay, eglConfig)
+            if (eglSurface == null || eglSurface == EGL10.EGL_NO_SURFACE) {
+                ALog.e(TAG, "error:${Integer.toHexString(egl?.eglGetError() ?: 0)}")
+                return
+            }
+
+            if (egl?.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext) == false) {
+                ALog.e(TAG, "make current error:${Integer.toHexString(egl?.eglGetError() ?: 0)}")
+            }
+        } catch (e: Throwable) {
+            ALog.e(TAG, "error:$e", e)
+        }
+    }
+
+
+    private fun chooseConfig(): EGLConfig? {
+        val configsCount = IntArray(1)
+        val configs = arrayOfNulls<EGLConfig>(1)
+        val attributes =getAttributes()
+        val confSize = 1
+        if (egl?.eglChooseConfig(eglDisplay, attributes, configs, confSize, configsCount) == true) {
+            return configs[0]
+        }
+        return null
+    }
+
+    private fun getAttributes(): IntArray {
+        return intArrayOf(
+            EGL10.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,  //指定渲染api类别
+            EGL10.EGL_RED_SIZE, 8,
+            EGL10.EGL_GREEN_SIZE, 8,
+            EGL10.EGL_BLUE_SIZE, 8,
+            EGL10.EGL_ALPHA_SIZE, 8,
+            EGL10.EGL_DEPTH_SIZE, 0,
+            EGL10.EGL_STENCIL_SIZE, 0,
+            EGL10.EGL_NONE
+        )
+    }
+
+    private fun createContext(egl: EGL10?, eglDisplay: EGLDisplay?, eglConfig: EGLConfig?): EGLContext? {
+        val attrs = intArrayOf(
+            EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
+            EGL10.EGL_NONE
+        )
+        return egl?.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, attrs)
+    }
+
+    fun swapBuffers() {
+        if (eglDisplay == null || eglSurface == null) return
+        egl?.eglSwapBuffers(eglDisplay, eglSurface)
+    }
+
+    fun release() {
+        egl?.apply {
+            eglMakeCurrent(eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT)
+            eglDestroySurface(eglDisplay, eglSurface)
+            eglDestroyContext(eglDisplay, eglContext)
+            eglTerminate(eglDisplay)
+        }
+    }
+
+}

+ 98 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/FileContainer.kt

@@ -0,0 +1,98 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.content.res.AssetFileDescriptor
+import android.content.res.AssetManager
+import android.media.MediaExtractor
+import java.io.File
+import java.io.FileNotFoundException
+import java.io.RandomAccessFile
+
+class FileContainer {
+
+    private var isAssets = false
+
+    private var file: File? = null
+    private var randomAccessFile: RandomAccessFile? = null
+    private var assetFd: AssetFileDescriptor? = null
+    private var assetsInputStream: AssetManager.AssetInputStream? = null
+
+    constructor(file: File) {
+        isAssets = false
+        this.file = file
+        if (!(file.exists() && file.isFile && file.canRead())) throw FileNotFoundException("Unable to read $file")
+    }
+
+    constructor(assetManager: AssetManager, assetsPath: String) {
+        isAssets = true
+        assetFd = assetManager.openFd(assetsPath)
+        assetsInputStream = assetManager.open(assetsPath, AssetManager.ACCESS_STREAMING) as AssetManager.AssetInputStream
+    }
+
+
+    fun setDataSource(extractor: MediaExtractor) {
+        if (isAssets) {
+            val assetFd = this.assetFd ?: return
+            if (assetFd.declaredLength < 0) {
+                extractor.setDataSource(assetFd.fileDescriptor)
+            } else {
+                extractor.setDataSource(assetFd.fileDescriptor, assetFd.startOffset, assetFd.declaredLength)
+            }
+        } else {
+            val file = this.file ?: return
+            extractor.setDataSource(file.toString())
+        }
+    }
+
+    fun startRandomRead() {
+        if (isAssets) return
+        val file = this.file ?: return
+        randomAccessFile = RandomAccessFile(file, "r")
+    }
+
+    fun read(b: ByteArray, off: Int, len: Int):Int {
+        return if (isAssets) {
+            assetsInputStream?.read(b, off, len) ?: -1
+        } else {
+            randomAccessFile?.read(b, off, len) ?: -1
+        }
+    }
+
+    fun skip(pos: Long) {
+        if (isAssets) {
+            assetsInputStream?.skip(pos)
+        } else {
+            randomAccessFile?.skipBytes(pos.toInt())
+        }
+    }
+
+    fun closeRandomRead() {
+        if (isAssets) {
+            assetsInputStream?.close()
+        } else {
+            randomAccessFile?.close()
+        }
+    }
+
+    fun close() {
+        if (isAssets) {
+            assetFd?.close()
+            assetsInputStream?.close()
+        }
+    }
+
+}

+ 262 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/HardDecoder.kt

@@ -0,0 +1,262 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.graphics.SurfaceTexture
+import android.media.MediaCodec
+import android.media.MediaExtractor
+import android.media.MediaFormat
+import android.view.Surface
+import com.tencent.qgame.animplayer.util.ALog
+import com.tencent.qgame.animplayer.util.MediaUtil
+import java.lang.RuntimeException
+
+class HardDecoder(player: AnimPlayer) : Decoder(player), SurfaceTexture.OnFrameAvailableListener {
+
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.HardDecoder"
+    }
+
+    private var glTexture: SurfaceTexture? = null
+    private val bufferInfo by lazy { MediaCodec.BufferInfo() }
+    private var needDestroy = false
+
+    override fun start(fileContainer: FileContainer) {
+        isStopReq = false
+        needDestroy = false
+        isRunning = true
+        renderThread.handler?.post {
+            startPlay(fileContainer)
+        }
+    }
+
+
+    override fun onFrameAvailable(surfaceTexture: SurfaceTexture?) {
+        if (isStopReq) return
+        ALog.d(TAG, "onFrameAvailable")
+        renderThread.handler?.post {
+            try {
+                glTexture?.apply {
+                    updateTexImage()
+                    render?.renderFrame(player.configManager.config)
+                    player.pluginManager.onRendering()
+                    render?.swapBuffers()
+                }
+            } catch (e: Throwable) {
+                ALog.e(TAG, "render exception=$e", e)
+            }
+        }
+    }
+
+    private fun startPlay(fileContainer: FileContainer) {
+        try {
+            if (!prepareRender()) {
+                throw RuntimeException("render create fail")
+            }
+        } catch (t: Throwable) {
+            onFailed(Constant.REPORT_ERROR_TYPE_CREATE_RENDER, "${Constant.ERROR_MSG_CREATE_RENDER} e=$t")
+            return
+        }
+
+        var extractor: MediaExtractor? = null
+        var decoder: MediaCodec? = null
+        var format: MediaFormat? = null
+        var trackIndex = 0
+
+        try {
+            extractor = MediaUtil.getExtractor(fileContainer)
+            trackIndex = MediaUtil.selectVideoTrack(extractor)
+            if (trackIndex < 0) {
+                throw RuntimeException("No video track found")
+            }
+            extractor.selectTrack(trackIndex)
+            format = extractor.getTrackFormat(trackIndex)
+            if (format == null) throw RuntimeException("format is null")
+            val videoWidth = format.getInteger(MediaFormat.KEY_WIDTH)
+            val videoHeight = format.getInteger(MediaFormat.KEY_HEIGHT)
+            ALog.i(TAG, "Video size is $videoWidth x $videoHeight")
+            preparePlay(videoWidth, videoHeight)
+
+            render?.apply {
+                glTexture = SurfaceTexture(getExternalTexture()).apply {
+                    setOnFrameAvailableListener(this@HardDecoder)
+                    setDefaultBufferSize(videoWidth, videoHeight)
+                }
+                clearFrame()
+            }
+
+        } catch (e: Throwable) {
+            ALog.e(TAG, "MediaExtractor exception e=$e", e)
+            onFailed(Constant.REPORT_ERROR_TYPE_EXTRACTOR_EXC, "${Constant.ERROR_MSG_EXTRACTOR_EXC} e=$e")
+            release(decoder, extractor)
+            return
+        }
+
+
+        try {
+            val mime = format.getString(MediaFormat.KEY_MIME)
+            ALog.i(TAG, "Video MIME is $mime")
+            decoder = MediaCodec.createDecoderByType(mime).apply {
+                configure(format, Surface(glTexture), null, 0)
+                start()
+                decodeThread.handler?.post {
+                    try {
+                        startDecode(extractor, this, trackIndex)
+                    } catch (e: Throwable) {
+                        onFailed(Constant.REPORT_ERROR_TYPE_DECODE_EXC, "${Constant.ERROR_MSG_DECODE_EXC} e=$e")
+                        release(decoder, extractor)
+                    }
+                }
+            }
+        } catch (e: Throwable) {
+            ALog.e(TAG, "MediaCodec exception e=$e", e)
+            onFailed(Constant.REPORT_ERROR_TYPE_DECODE_EXC, "${Constant.ERROR_MSG_DECODE_EXC} e=$e")
+            release(decoder, extractor)
+            return
+        }
+    }
+
+
+
+    private fun startDecode(extractor: MediaExtractor ,decoder: MediaCodec, trackIndex: Int) {
+        val TIMEOUT_USEC = 10000L
+        var inputChunk = 0
+        var outputDone = false
+        var inputDone = false
+        var frameIndex = 1
+
+        val decoderInputBuffers = decoder.inputBuffers
+
+        while (!outputDone) {
+            if (isStopReq) {
+                ALog.i(TAG, "stop decode")
+                release(decoder, extractor)
+                return
+            }
+
+            if (!inputDone) {
+                val inputBufIndex = decoder.dequeueInputBuffer(TIMEOUT_USEC)
+                if (inputBufIndex >= 0) {
+                    val inputBuf = decoderInputBuffers[inputBufIndex]
+                    val chunkSize = extractor.readSampleData(inputBuf, 0)
+                    if (chunkSize < 0) {
+                        decoder.queueInputBuffer(inputBufIndex, 0, 0, 0L, MediaCodec.BUFFER_FLAG_END_OF_STREAM)
+                        inputDone = true
+                        ALog.d(TAG, "decode EOS")
+                    } else {
+                        val presentationTimeUs = extractor.sampleTime
+                        decoder.queueInputBuffer(inputBufIndex, 0, chunkSize, presentationTimeUs, 0)
+                        ALog.d(TAG, "submitted frame $inputChunk to dec, size=$chunkSize")
+                        inputChunk++
+                        extractor.advance()
+                    }
+                } else {
+                    ALog.d(TAG, "input buffer not available")
+                }
+            }
+
+            if (!outputDone) {
+                val decoderStatus = decoder.dequeueOutputBuffer(bufferInfo, TIMEOUT_USEC)
+                when {
+                    decoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER -> ALog.d(TAG, "no output from decoder available")
+                    decoderStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED -> ALog.d(TAG, "decoder output buffers changed")
+                    decoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED -> ALog.d(TAG, "decoder output format changed: ${decoder.outputFormat}")
+                    decoderStatus < 0 -> {
+                        throw RuntimeException("unexpected result from decoder.dequeueOutputBuffer: $decoderStatus")
+                    }
+                    else -> {
+                        var loop = 0
+                        if (bufferInfo.flags and MediaCodec.BUFFER_FLAG_END_OF_STREAM != 0) {
+                            loop = --playLoop
+                            outputDone = playLoop <= 0
+                        }
+                        val doRender = !outputDone
+                        if (doRender) {
+                            speedControlUtil.preRender(bufferInfo.presentationTimeUs)
+                        }
+                        decoder.releaseOutputBuffer(decoderStatus, doRender)
+                        if (frameIndex == 1) {
+                            onVideoStart()
+                        }
+                        player.pluginManager.onDecoding(frameIndex)
+                        onVideoRender(frameIndex, player.configManager.config)
+                        frameIndex++
+                        ALog.d(TAG, "decode frameIndex=$frameIndex")
+                        if (loop > 0) {
+                            ALog.d(TAG, "Reached EOD, looping")
+                            extractor.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC)
+                            inputDone = false
+                            decoder.flush()
+                            speedControlUtil.reset()
+                            frameIndex = 1
+                        }
+                        if (outputDone) {
+                            release(decoder, extractor)
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
+    private fun release(decoder: MediaCodec?, extractor: MediaExtractor?) {
+        renderThread.handler?.post {
+            render?.clearFrame()
+            try {
+                ALog.i(TAG, "release")
+                decoder?.apply {
+                    stop()
+                    release()
+                }
+                extractor?.release()
+                glTexture?.release()
+                glTexture = null
+                speedControlUtil.reset()
+                player.pluginManager.onRelease()
+                render?.releaseTexture()
+            } catch (e: Throwable) {
+                ALog.e(TAG, "release e=$e", e)
+            }
+            isRunning = false
+            onVideoComplete()
+            if (needDestroy) {
+                destroyInner()
+            }
+        }
+    }
+
+
+    override fun destroy() {
+        needDestroy = true
+        if (isRunning) {
+            stop()
+        } else {
+            destroyInner()
+        }
+    }
+
+    private fun destroyInner() {
+        renderThread.handler?.post {
+            player.pluginManager.onDestroy()
+            render?.destroy()
+            render = null
+            onVideoDestroy()
+            destroyThread()
+        }
+    }
+}

+ 160 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Render.kt

@@ -0,0 +1,160 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+import android.graphics.SurfaceTexture
+import android.opengl.GLES11Ext
+import android.opengl.GLES20
+import com.tencent.qgame.animplayer.util.GlFloatArray
+import com.tencent.qgame.animplayer.util.ShaderUtil
+import com.tencent.qgame.animplayer.util.TexCoordsUtil
+import com.tencent.qgame.animplayer.util.VertexUtil
+import java.nio.ByteBuffer
+import java.nio.ByteOrder
+import java.nio.ShortBuffer
+
+class Render(surfaceTexture: SurfaceTexture) {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.Render"
+    }
+
+    private val vertexArray = GlFloatArray()
+    private val alphaArray = GlFloatArray()
+    private val rgbArray = GlFloatArray()
+    private var surfaceSizeChanged = false
+    private var surfaceWidth = 0
+    private var surfaceHeight = 0
+    private val eglUtil: EGLUtil = EGLUtil()
+    private var shaderProgram = 0
+    private var genTexture = IntArray(1)
+    private var uTextureLocation: Int = 0
+    private var aPositionLocation: Int = 0
+    private var aTextureAlphaLocation: Int = 0
+    private var aTextureRgbLocation: Int = 0
+
+    init {
+        eglUtil.start(surfaceTexture)
+        initGL()
+    }
+
+    private fun initGL() {
+        compileShader()
+    }
+
+    private fun setVertexBuf(config: AnimConfig) {
+        vertexArray.setArray(VertexUtil.create(config.width, config.height, PointRect(0, 0, config.width, config.height), vertexArray.array))
+    }
+
+    private fun setTexCoords(config: AnimConfig) {
+        val alpha = TexCoordsUtil.create(config.videoWidth, config.videoHeight, config.alphaPointRect, alphaArray.array)
+        val rgb = TexCoordsUtil.create(config.videoWidth, config.videoHeight, config.rgbPointRect, rgbArray.array)
+        alphaArray.setArray(alpha)
+        rgbArray.setArray(rgb)
+    }
+
+    fun createTexture() {
+        GLES20.glGenTextures(genTexture.size, genTexture, 0)
+        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, genTexture[0])
+        GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST.toFloat())
+        GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR.toFloat())
+        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)
+    }
+
+    private fun compileShader() {
+        shaderProgram = ShaderUtil.createProgram(RenderConstant.VERTEX_SHADER, RenderConstant.FRAGMENT_SHADER)
+        uTextureLocation = GLES20.glGetUniformLocation(shaderProgram, "texture")
+        aPositionLocation = GLES20.glGetAttribLocation(shaderProgram, "vPosition")
+        aTextureAlphaLocation = GLES20.glGetAttribLocation(shaderProgram, "vTexCoordinateAlpha")
+        aTextureRgbLocation = GLES20.glGetAttribLocation(shaderProgram, "vTexCoordinateRgb")
+    }
+
+    /**
+     * 设置视频配置
+     */
+    fun setAnimConfig(config: AnimConfig) {
+        setVertexBuf(config)
+        setTexCoords(config)
+    }
+
+    /**
+     * 显示区域大小变化
+     */
+    fun updateViewPort(width: Int, height: Int) {
+        if (width <=0 || height <=0) return
+        surfaceSizeChanged = true
+        surfaceWidth = width
+        surfaceHeight = height
+    }
+
+    fun clearFrame() {
+        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f)
+        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
+        eglUtil.swapBuffers()
+    }
+
+    fun renderFrame(config: AnimConfig?) {
+        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f)
+        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
+        if (surfaceSizeChanged && surfaceWidth>0 && surfaceHeight>0) {
+            surfaceSizeChanged = false
+            GLES20.glViewport(0,0, surfaceWidth, surfaceHeight)
+        }
+        draw()
+    }
+
+    fun swapBuffers() {
+        eglUtil.swapBuffers()
+    }
+
+
+    fun destroy() {
+        releaseTexture()
+        eglUtil.release()
+    }
+
+    fun releaseTexture() {
+        GLES20.glDeleteTextures(genTexture.size, genTexture, 0)
+    }
+
+    /**
+     * mediaCodec渲染使用的
+     */
+    fun getExternalTexture(): Int {
+        return genTexture[0]
+    }
+
+    private fun draw() {
+        GLES20.glUseProgram(shaderProgram)
+        // 设置顶点坐标
+        vertexArray.setVertexAttribPointer(aPositionLocation)
+        // 绑定纹理
+        GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
+        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, genTexture[0])
+        GLES20.glUniform1i(uTextureLocation, 0)
+
+        // 设置纹理坐标
+        // alpha 通道坐标
+        alphaArray.setVertexAttribPointer(aTextureAlphaLocation)
+        // rgb 通道坐标
+        rgbArray.setVertexAttribPointer(aTextureRgbLocation)
+
+        // draw
+        GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4)
+    }
+
+}

+ 43 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/RenderConstant.kt

@@ -0,0 +1,43 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer
+
+
+object RenderConstant {
+
+    const val VERTEX_SHADER = "attribute vec4 vPosition;\n" +
+            "attribute vec4 vTexCoordinateAlpha;\n" +
+            "attribute vec4 vTexCoordinateRgb;\n" +
+            "varying vec2 v_TexCoordinateAlpha;\n" +
+            "varying vec2 v_TexCoordinateRgb;\n" +
+            "\n" +
+            "void main() {\n" +
+            "    v_TexCoordinateAlpha = vec2(vTexCoordinateAlpha.x, vTexCoordinateAlpha.y);\n" +
+            "    v_TexCoordinateRgb = vec2(vTexCoordinateRgb.x, vTexCoordinateRgb.y);\n" +
+            "    gl_Position = vPosition;\n" +
+            "}"
+    const val FRAGMENT_SHADER = "#extension GL_OES_EGL_image_external : require\n" +
+            "precision mediump float;\n" +
+            "uniform samplerExternalOES texture;\n" +
+            "varying vec2 v_TexCoordinateAlpha;\n" +
+            "varying vec2 v_TexCoordinateRgb;\n" +
+            "\n" +
+            "void main () {\n" +
+            "    vec4 alphaColor = texture2D(texture, v_TexCoordinateAlpha);\n" +
+            "    vec4 rgbColor = texture2D(texture, v_TexCoordinateRgb);\n" +
+            "    gl_FragColor = vec4(rgbColor.r, rgbColor.g, rgbColor.b, alphaColor.r);\n" +
+            "}"
+}

+ 74 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/IAnimListener.kt

@@ -0,0 +1,74 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.inter
+
+import com.tencent.qgame.animplayer.AnimConfig
+
+interface IAnimListener {
+
+    /**
+     * 配置准备好后回调
+     * ps:如果是默认配置(没有发现vapc配置),因为信息不完整onVideoConfigReady不会被调用,默认播放
+     * @return true 继续播放 false 结束播放
+     */
+    fun onVideoConfigReady(config: AnimConfig): Boolean {
+        return true // 默认继续播放
+    }
+
+    /**
+     * 开始播放
+     */
+    fun onVideoStart()
+
+
+    /**
+     * 视频渲染每一帧时的回调
+     * @param frameIndex 帧索引
+     */
+    fun onVideoRender(frameIndex: Int, config: AnimConfig?)
+
+    /**
+     * 视频播放结束
+     */
+    fun onVideoComplete()
+
+    /**
+     * 视频被销毁
+     */
+    fun onVideoDestroy()
+
+    /**
+     * 失败回调
+     * @param errorType 错误类型
+     * @param errorMsg 错误消息
+     */
+    fun onFailed(errorType: Int, errorMsg: String?)
+}

+ 33 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/IFetchResource.kt

@@ -0,0 +1,33 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.inter
+
+import android.graphics.Bitmap
+import com.tencent.qgame.animplayer.mix.Resource
+
+/**
+ * 获取资源
+ */
+interface IFetchResource {
+    // 获取图片 (暂时不支持Bitmap.Config.ALPHA_8 主要是因为一些机型opengl兼容问题)
+    fun fetchImage(resource: Resource, result:(Bitmap?) -> Unit)
+
+    // 获取文字
+    fun fetchText(resource: Resource, result:(String?) -> Unit)
+
+    // 资源释放通知
+    fun releaseResource(resources: List<Resource>)
+}

+ 24 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/OnResourceClickListener.kt

@@ -0,0 +1,24 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.inter
+
+import com.tencent.qgame.animplayer.mix.Resource
+
+interface OnResourceClickListener {
+
+    // 返回被点击的资源
+    fun onClick(resource: Resource)
+}

+ 66 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskAnimPlugin.kt

@@ -0,0 +1,66 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mask
+
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.AnimPlayer
+import com.tencent.qgame.animplayer.Constant
+import com.tencent.qgame.animplayer.plugin.IAnimPlugin
+import com.tencent.qgame.animplayer.util.ALog
+
+class MaskAnimPlugin(val player: AnimPlayer): IAnimPlugin {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.MaskAnimPlugin"
+    }
+
+    private var maskRender: MaskRender? = null
+    private var animConfig : AnimConfig ?= null
+
+
+    override fun onConfigCreate(config: AnimConfig): Int {
+        return Constant.OK
+    }
+
+    override fun onRenderCreate() {
+        ALog.i(TAG, "mask render init")
+        maskRender = if(player.supportMaskBoolean) MaskRender(this) else return
+        maskRender?.initMaskShader(player.maskEdgeBlurBoolean)
+    }
+
+    override fun onRendering(frameIndex: Int) {
+        animConfig = if(player.supportMaskBoolean && player.configManager.config is AnimConfig) player.configManager.config else return
+        animConfig?.let {config ->
+            maskRender?.renderFrame(config)
+        }
+    }
+
+
+    override fun onRelease() {
+        destroy()
+    }
+
+    override fun onDestroy() {
+        destroy()
+    }
+
+
+    private fun destroy() {
+        // 强制结束等待
+        animConfig?.maskConfig?.release()
+    }
+    
+}

+ 74 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskConfig.kt

@@ -0,0 +1,74 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mask
+
+import android.graphics.Bitmap
+import com.tencent.qgame.animplayer.PointRect
+import com.tencent.qgame.animplayer.RefVec2
+import com.tencent.qgame.animplayer.util.TextureLoadUtil
+
+class MaskConfig() {
+    var maskTexPair: Pair<PointRect, RefVec2>? = null //遮罩坐标矩形
+    var maskPositionPair: Pair<PointRect, RefVec2>? = null //内容坐标矩形
+
+    constructor(bitmap: Bitmap?, positionPair :Pair<PointRect, RefVec2>?, texPair: Pair<PointRect, RefVec2>?) : this() {
+        maskPositionPair = positionPair
+        maskTexPair = texPair
+        alphaMaskBitmap = bitmap
+    }
+
+    private var maskTexId = 0
+    fun getMaskTexId() : Int {
+        return maskTexId
+    }
+    fun updateMaskTex() : Int {
+        maskTexId = TextureLoadUtil.loadTexture(alphaMaskBitmap)
+        return  maskTexId
+    }
+
+    var alphaMaskBitmap: Bitmap? = null //遮罩
+        private set(value) {
+            field = value
+        }
+    
+    fun safeSetMaskBitmapAndReleasePre(bitmap: Bitmap?) {
+        if (maskTexId > 0)  { //释放
+            TextureLoadUtil.releaseTexure(maskTexId)
+            maskTexId = 0
+        }
+        alphaMaskBitmap = bitmap
+    }
+    
+
+    fun release() {
+        alphaMaskBitmap = null
+        maskTexPair = null
+        maskPositionPair = null
+    }
+
+    override fun equals(other: Any?): Boolean {
+        return other is MaskConfig && this.alphaMaskBitmap != other.alphaMaskBitmap
+                && this.maskTexPair?.first != other.maskTexPair?.first && this.maskTexPair?.second != other.maskTexPair?.second
+                && this.maskPositionPair?.first != other.maskPositionPair?.first && this.maskPositionPair?.second != other.maskPositionPair?.second
+    }
+
+    override fun hashCode(): Int {
+        var result = alphaMaskBitmap?.hashCode() ?: 0
+        result = 31 * result + (maskTexPair?.hashCode() ?: 0)
+        result = 31 * result + (maskPositionPair?.hashCode() ?: 0)
+        return result
+    }
+}

+ 130 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskRender.kt

@@ -0,0 +1,130 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mask
+
+import android.opengl.GLES11Ext
+import android.opengl.GLES20
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.Constant
+import com.tencent.qgame.animplayer.PointRect
+import com.tencent.qgame.animplayer.RefVec2
+import com.tencent.qgame.animplayer.util.GlFloatArray
+import com.tencent.qgame.animplayer.util.TexCoordsUtil
+import com.tencent.qgame.animplayer.util.VertexUtil
+
+/**
+ * vapx 渲染
+ */
+class MaskRender(private val maskAnimPlugin: MaskAnimPlugin) {
+    companion object {
+        private const val TAG = "${Constant.TAG}.MaskRender"
+    }
+
+    var maskShader: MaskShader? = null
+    var vertexArray = GlFloatArray()
+    private var maskArray = GlFloatArray()
+    /**
+     * shader 与 texture初始化
+     */
+    fun initMaskShader(edgeBlur: Boolean) {
+        // shader 初始化
+        maskShader = MaskShader(edgeBlur)
+        GLES20.glDisable(GLES20.GL_DEPTH_TEST) // 关闭深度测试
+    }
+
+    fun renderFrame(config: AnimConfig) {
+        val videoTextureId = maskAnimPlugin.player.decoder?.render?.getExternalTexture() ?: return
+        if (videoTextureId <= 0) return
+        val shader = this.maskShader ?: return
+        var maskTexId: Int = config.maskConfig?.getMaskTexId() ?: return
+        val maskBitmap = config.maskConfig?.alphaMaskBitmap ?: return
+        val maskTexRect = config.maskConfig?.maskTexPair?.first ?: return
+        val maskTexRefVec2 = config.maskConfig?.maskTexPair?.second ?: return
+        val maskPositionRect = config.maskConfig?.maskPositionPair?.first ?: PointRect(
+            0,
+            0,
+            config.width,
+            config.height
+        )
+        val maskPositionRefVec2 =
+            config.maskConfig?.maskPositionPair?.second ?: RefVec2(config.width, config.height)
+        shader.useProgram()
+        // 顶点坐标
+        vertexArray.setArray(
+            VertexUtil.create(
+                maskPositionRefVec2.w,
+                maskPositionRefVec2.h,
+                maskPositionRect,
+                vertexArray.array
+            )
+        )
+        vertexArray.setVertexAttribPointer(shader.aPositionLocation)
+
+        if (maskTexId <= 0 && !maskBitmap.isRecycled) {
+            maskTexId = config.maskConfig?.updateMaskTex() ?: 0
+        }
+        if (maskTexId > 0) {
+            maskArray.setArray(
+                TexCoordsUtil.create(
+                    maskTexRefVec2.w,
+                    maskTexRefVec2.h,
+                    maskTexRect,
+                    maskArray.array
+                )
+            )
+            maskArray.setVertexAttribPointer(shader.aTextureMaskCoordinatesLocation)
+            // 绑定alpha纹理
+            GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
+            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, maskTexId)
+            GLES20.glTexParameterf(
+                GLES20.GL_TEXTURE_2D,
+                GLES20.GL_TEXTURE_MIN_FILTER,
+                GLES20.GL_NEAREST.toFloat()
+            )
+            GLES20.glTexParameterf(
+                GLES20.GL_TEXTURE_2D,
+                GLES20.GL_TEXTURE_MAG_FILTER,
+                GLES20.GL_LINEAR.toFloat()
+            )
+            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.glUniform1i(shader.uTextureMaskUnitLocation, 0)
+
+            GLES20.glEnable(GLES20.GL_BLEND)
+            // 基于源象素alpha通道值的半透明混合函数
+            GLES20.glBlendFuncSeparate(
+                GLES20.GL_ONE,
+                GLES20.GL_SRC_ALPHA,
+                GLES20.GL_ZERO,
+                GLES20.GL_SRC_ALPHA
+            )
+            // draw
+            GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4)
+
+            GLES20.glDisable(GLES20.GL_BLEND)
+        }
+
+    }
+
+}

+ 114 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskShader.kt

@@ -0,0 +1,114 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mask
+
+import android.opengl.GLES20
+import android.util.Log
+import com.tencent.qgame.animplayer.util.ShaderUtil
+
+class MaskShader(edgeBlurBoolean : Boolean) {
+    companion object {
+
+        private const val VERTEX =
+            "attribute vec4 vPosition;\n" +
+                    "attribute vec4 vTexCoordinateAlphaMask;\n" +
+                    "varying vec2 v_TexCoordinateAlphaMask;\n" +
+                    "\n" +
+                    "void main() {\n" +
+                    "    v_TexCoordinateAlphaMask = vec2(vTexCoordinateAlphaMask.x, vTexCoordinateAlphaMask.y);\n" +
+                    "    gl_Position = vPosition;\n" +
+                    "}"
+        //边缘做高斯模糊
+        private const val FRAGMENT_BLUR_EDGE =
+                    "precision mediump float;\n" +
+                    "uniform sampler2D uTextureAlphaMask;\n" +
+                    "varying vec2 v_TexCoordinateAlphaMask;\n" +
+                    "mat3 weight = mat3(0.0625,0.125,0.0625,0.125,0.25,0.125,0.0625,0.125,0.0625);\n " +
+                    "int coreSize=3;\n" +
+                    "float texelOffset = .01;\n" +
+                    "\n" +
+                    "void main() {\n" +
+                    "   float alphaResult = 0.;\n" +
+                    "   for(int y = 0; y < coreSize; y++) {\n" +
+                    "       for(int x = 0;x < coreSize; x++) {\n" +
+                    "           alphaResult += texture2D(uTextureAlphaMask, vec2(v_TexCoordinateAlphaMask.x + (-1.0 + float(x)) * texelOffset,v_TexCoordinateAlphaMask.y + (-1.0 + float(y)) * texelOffset)).a * weight[x][y];\n" +
+                    "       }\n" +
+                    "    }\n" +
+                    "    gl_FragColor = vec4(0, 0, 0, alphaResult);\n" +
+                    "}"
+
+        private const val FRAGMENT_NO_BLUR_EDGE =
+            "precision mediump float;\n" +
+                    "uniform sampler2D uTextureAlphaMask;\n" +
+                    "varying vec2 v_TexCoordinateAlphaMask;\n" +
+                    "\n" +
+                    "void main () {\n" +
+                    "    vec4 alphaMaskColor = texture2D(uTextureAlphaMask, v_TexCoordinateAlphaMask);\n" +
+                    "    gl_FragColor = vec4(0, 0, 0, alphaMaskColor.a);\n" +
+                    "}"
+
+        private const val FRAGMENT_ROW =
+            "precision mediump float;\n" +
+                    "uniform sampler2D uTextureAlphaMask;\n" +
+                    "varying vec2 v_TexCoordinateAlphaMask;\n" +
+                    "vec3 weight = vec3(0.4026,0.2442,0.0545);\n " +
+                    "\n" +
+                    "void main() {\n" +
+                    "   float texelOffset = .01;\n" +
+                    "   vec2 uv[5];\n" +
+                    "   uv[0]= v_TexCoordinateAlphaMask;\n" +
+                    "   uv[1]=vec2(uv[0].x+texelOffset*1.0,  uv[0].y);\n" +
+                    "   uv[2]=vec2(uv[0].x-texelOffset*1.0,  uv[0].y);\n" +
+                    "   uv[3]=vec2(uv[0].x+texelOffset*2.0,  uv[0].y);\n" +
+                    "   uv[4]=vec2(uv[0].x-texelOffset*2.0,  uv[0].y);\n" +
+                    "   float alphaResult = texture2D(uTextureAlphaMask, uv[0]).a * weight[0];\n" +
+                    "   for(int i = 1; i < 3; ++i) {\n" +
+                    "       alphaResult += texture2D(uTextureAlphaMask, uv[2*i-1]).a * weight[i];\n" +
+                    "       alphaResult += texture2D(uTextureAlphaMask, uv[2*i]).a * weight[i];\n" +
+                    "    }\n" +
+                    "    gl_FragColor = vec4(0, 0, 0, alphaResult);\n" +
+                    "}"
+
+        // Uniform constants
+        private const val U_TEXTURE_ALPHA_MASK_UNIT = "uTextureAlphaMask"
+
+        // Attribute constants
+        private const val A_POSITION = "vPosition"
+        private const val A_TEXTURE_MASK_COORDINATES = "vTexCoordinateAlphaMask"
+    }
+
+    // Shader program
+    private val program: Int
+
+    // Uniform locations
+    val uTextureMaskUnitLocation: Int
+    // Attribute locations
+    val aPositionLocation: Int
+    val aTextureMaskCoordinatesLocation: Int
+
+    init {
+        program = if(edgeBlurBoolean) ShaderUtil.createProgram(VERTEX, FRAGMENT_BLUR_EDGE) else ShaderUtil.createProgram(VERTEX, FRAGMENT_NO_BLUR_EDGE)
+        uTextureMaskUnitLocation = GLES20.glGetUniformLocation(program, U_TEXTURE_ALPHA_MASK_UNIT)
+
+        aPositionLocation = GLES20.glGetAttribLocation(program, A_POSITION)
+        aTextureMaskCoordinatesLocation = GLES20.glGetAttribLocation(program, A_TEXTURE_MASK_COORDINATES)
+    }
+
+    fun useProgram() {
+        GLES20.glUseProgram(program)
+    }
+
+}

+ 83 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Frame.kt

@@ -0,0 +1,83 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mix
+
+import android.util.SparseArray
+import com.tencent.qgame.animplayer.PointRect
+import org.json.JSONObject
+
+/**
+ * 单帧
+ */
+class Frame(val index: Int, json: JSONObject) {
+    var srcId = ""
+    var z = 0
+    var frame: PointRect
+    var mFrame: PointRect
+    var mt = 0 // 遮罩旋转角度v2 版本只支持 0 与 90度
+
+    init {
+        srcId = json.getString("srcId")
+        z = json.getInt("z")
+
+        val f = json.getJSONArray("frame")
+        frame = PointRect(f.getInt(0), f.getInt(1), f.getInt(2), f.getInt(3))
+
+        val m = json.getJSONArray("mFrame")
+        mFrame = PointRect(m.getInt(0), m.getInt(1), m.getInt(2), m.getInt(3))
+
+        mt = json.getInt("mt")
+    }
+}
+
+
+/**
+ * 一帧的集合
+ */
+class FrameSet(json: JSONObject) {
+    var index = 0 // 哪一帧
+    val list = ArrayList<Frame>()
+    init {
+        index = json.getInt("i")
+        val objJsonArray = json.getJSONArray("obj")
+        val objLen = objJsonArray?.length() ?: 0
+        for (i in 0 until objLen) {
+            val frameJson = objJsonArray?.getJSONObject(i) ?: continue
+            val frame = Frame(index, frameJson)
+            list.add(frame)
+        }
+        // 绘制顺序排序
+        list.sortBy {it.z}
+    }
+}
+
+/**
+ * 所有帧集合
+ */
+class FrameAll(json: JSONObject) {
+    // 每一帧的集合
+    val map = SparseArray<FrameSet>()
+
+    init {
+        val frameJsonArray = json.getJSONArray("frame")
+        val frameLen = frameJsonArray?.length() ?: 0
+        for (i in 0 until frameLen) {
+            val frameSetJson = frameJsonArray?.getJSONObject(i) ?: continue
+            val frameSet = FrameSet(frameSetJson)
+            map.put(frameSet.index, frameSet)
+        }
+    }
+}

+ 225 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixAnimPlugin.kt

@@ -0,0 +1,225 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mix
+
+import android.graphics.Bitmap
+import android.os.Handler
+import android.os.Looper
+import android.os.SystemClock
+import android.view.MotionEvent
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.AnimPlayer
+import com.tencent.qgame.animplayer.Constant
+import com.tencent.qgame.animplayer.inter.IFetchResource
+import com.tencent.qgame.animplayer.inter.OnResourceClickListener
+import com.tencent.qgame.animplayer.plugin.IAnimPlugin
+import com.tencent.qgame.animplayer.util.ALog
+import com.tencent.qgame.animplayer.util.BitmapUtil
+
+class MixAnimPlugin(val player: AnimPlayer): IAnimPlugin {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.MixAnimPlugin"
+    }
+    var resourceRequest: IFetchResource? = null
+    var resourceClickListener: OnResourceClickListener? = null
+    var srcMap: SrcMap? = null
+    var frameAll: FrameAll? = null
+    var curFrameIndex = -1 // 当前帧
+    private var resultCbCount = 0 // 回调次数
+    private var mixRender:MixRender? = null
+    private val mixTouch by lazy { MixTouch(this) }
+    var autoTxtColorFill = true // 是否启动自动文字填充 默认开启
+
+    // 同步锁
+    private val lock = Object()
+    private var forceStopLock = false
+
+
+    override fun onConfigCreate(config: AnimConfig): Int {
+        if (!config.isMix) return Constant.OK
+        if (resourceRequest == null) {
+            ALog.i(TAG, "IFetchResource is empty")
+            return Constant.REPORT_ERROR_TYPE_CONFIG_PLUGIN_MIX
+        }
+        // step 1 parse src
+        parseSrc(config)
+
+        // step 2 parse frame
+        parseFrame(config)
+
+        // step 3 fetch resource
+        fetchResourceSync()
+
+        // step 4 生成文字bitmap
+        val result = createBitmap()
+        if (!result) {
+            return Constant.REPORT_ERROR_TYPE_CONFIG_PLUGIN_MIX
+        }
+
+        // step 5 check resource
+        ALog.i(TAG, "load resource $resultCbCount")
+        srcMap?.map?.values?.forEach {
+            if (it.bitmap == null) {
+                ALog.e(TAG, "missing src $it")
+                return Constant.REPORT_ERROR_TYPE_CONFIG_PLUGIN_MIX
+            } else if (it.bitmap?.config == Bitmap.Config.ALPHA_8) {
+                ALog.e(TAG, "src $it bitmap must not be ALPHA_8")
+                return Constant.REPORT_ERROR_TYPE_CONFIG_PLUGIN_MIX
+            }
+        }
+        return Constant.OK
+    }
+
+    override fun onRenderCreate() {
+        if (player.configManager.config?.isMix == false) return
+        ALog.i(TAG, "mix render init")
+        mixRender = MixRender(this)
+        mixRender?.init()
+    }
+
+    override fun onRendering(frameIndex: Int) {
+        val config = player.configManager.config ?: return
+        if (!config.isMix) return
+        curFrameIndex = frameIndex
+        val list = frameAll?.map?.get(frameIndex)?.list ?: return
+        list.forEach {frame ->
+            val src = srcMap?.map?.get(frame.srcId) ?: return@forEach
+            mixRender?.renderFrame(config, frame, src)
+        }
+    }
+
+
+    override fun onRelease() {
+        destroy()
+    }
+
+    override fun onDestroy() {
+        destroy()
+    }
+
+    override fun onDispatchTouchEvent(ev: MotionEvent): Boolean {
+        if (player.configManager.config?.isMix == false || resourceClickListener == null) {
+            return super.onDispatchTouchEvent(ev)
+        }
+        mixTouch.onTouchEvent(ev)?.let {resource ->
+            Handler(Looper.getMainLooper()).post {
+                resourceClickListener?.onClick(resource)
+            }
+        }
+        // 只要注册监听则拦截所有事件
+        return true
+    }
+
+    private fun destroy() {
+        // 强制结束等待
+        forceStopLockThread()
+        if (player.configManager.config?.isMix == false) return
+        val resources = ArrayList<Resource>()
+        srcMap?.map?.values?.forEach {src ->
+            mixRender?.release(src.srcTextureId)
+            when(src.srcType) {
+                Src.SrcType.IMG -> resources.add(Resource(src))
+                Src.SrcType.TXT -> src.bitmap?.recycle()
+                else -> {}
+            }
+        }
+        resourceRequest?.releaseResource(resources)
+
+        // 清理
+        curFrameIndex = -1
+        srcMap?.map?.clear()
+        frameAll?.map?.clear()
+    }
+
+    private fun parseSrc(config: AnimConfig) {
+        config.jsonConfig?.apply {
+            srcMap = SrcMap(this)
+        }
+    }
+
+
+    private fun parseFrame(config: AnimConfig) {
+        config.jsonConfig?.apply {
+            frameAll = FrameAll(this)
+        }
+    }
+
+
+    private fun fetchResourceSync() {
+        synchronized(lock) {
+            forceStopLock = false // 开始时不会强制关闭
+        }
+        val time = SystemClock.elapsedRealtime()
+        val totalSrc = srcMap?.map?.size ?: 0
+        ALog.i(TAG, "load resource totalSrc = $totalSrc")
+
+        resultCbCount = 0
+        srcMap?.map?.values?.forEach {src ->
+            if (src.srcType == Src.SrcType.IMG) {
+                ALog.i(TAG, "fetch image ${src.srcId}")
+                resourceRequest?.fetchImage(Resource(src)) {
+                    src.bitmap = it
+                    ALog.i(TAG, "fetch image ${src.srcId} finish bitmap is ${it?.hashCode()}")
+                    resultCall()
+                }
+            } else if (src.srcType == Src.SrcType.TXT) {
+                ALog.i(TAG, "fetch txt ${src.srcId}")
+                resourceRequest?.fetchText(Resource(src)) {
+                    src.txt = it ?: ""
+                    ALog.i(TAG, "fetch text ${src.srcId} finish txt is $it")
+                    resultCall()
+                }
+            }
+        }
+
+        // 同步等待所有资源完成
+        synchronized(lock) {
+            while (resultCbCount < totalSrc && !forceStopLock) {
+                lock.wait()
+            }
+        }
+        ALog.i(TAG, "fetchResourceSync cost=${SystemClock.elapsedRealtime() - time}ms")
+    }
+
+    private fun forceStopLockThread() {
+        synchronized(lock) {
+            forceStopLock = true
+            lock.notifyAll()
+        }
+    }
+
+    private fun resultCall() {
+        synchronized(lock) {
+            resultCbCount++
+            lock.notifyAll()
+        }
+    }
+
+    private fun createBitmap(): Boolean {
+        return try {
+            srcMap?.map?.values?.forEach { src ->
+                if (src.srcType == Src.SrcType.TXT) {
+                    src.bitmap = BitmapUtil.createTxtBitmap(src)
+                }
+            }
+            true
+        } catch (e: OutOfMemoryError) {
+            ALog.e(TAG, "draw text OOM $e", e)
+            false
+        }
+    }
+}

+ 151 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixRender.kt

@@ -0,0 +1,151 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mix
+
+import android.graphics.Bitmap
+import android.opengl.GLES11Ext
+import android.opengl.GLES20
+import android.opengl.GLUtils
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.Constant
+import com.tencent.qgame.animplayer.PointRect
+import com.tencent.qgame.animplayer.RenderConstant
+import com.tencent.qgame.animplayer.util.*
+
+/**
+ * vapx 渲染
+ */
+class MixRender(private val mixAnimPlugin: MixAnimPlugin) {
+    companion object {
+        private const val TAG = "${Constant.TAG}.MixRender"
+    }
+    var shader: MixShader? = null
+    var vertexArray = GlFloatArray()
+    var srcArray = GlFloatArray()
+    var maskArray = GlFloatArray()
+
+    /**
+     * shader 与 texture初始化
+     */
+    fun init() {
+        // shader 初始化
+        shader = MixShader()
+        GLES20.glDisable(GLES20.GL_DEPTH_TEST) // 关闭深度测试
+
+        mixAnimPlugin.srcMap?.map?.values?.forEach {src->
+            ALog.i(TAG, "init srcId=${src.srcId}")
+            src.srcTextureId = TextureLoadUtil.loadTexture(src.bitmap)
+            ALog.i(TAG, "textureProgram=${shader?.program},textureId=${src.srcTextureId}")
+        }
+
+    }
+
+    fun renderFrame(config:AnimConfig, frame:Frame, src: Src) {
+        val videoTextureId = mixAnimPlugin.player.decoder?.render?.getExternalTexture() ?: return
+        if (videoTextureId <= 0) return
+        val shader = this.shader ?: return
+        shader.useProgram()
+        // 定点坐标
+        vertexArray.setArray(VertexUtil.create(config.width, config.height, frame.frame, vertexArray.array))
+        vertexArray.setVertexAttribPointer(shader.aPositionLocation)
+
+        // src 纹理坐标
+        srcArray.setArray(genSrcCoordsArray(srcArray.array, frame.frame.w, frame.frame.h, src.w, src.h, src.fitType))
+        srcArray.setVertexAttribPointer(shader.aTextureSrcCoordinatesLocation)
+        // 绑定 src纹理
+        GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
+        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, src.srcTextureId)
+        GLES20.glUniform1i(shader.uTextureSrcUnitLocation, 0)
+
+        // mask 纹理
+        maskArray.setArray(TexCoordsUtil.create(config.videoWidth, config.videoHeight, frame.mFrame, maskArray.array))
+        if (frame.mt == 90) {
+            maskArray.setArray(TexCoordsUtil.rotate90(maskArray.array))
+        }
+        maskArray.setVertexAttribPointer(shader.aTextureMaskCoordinatesLocation)
+        // 绑定 mask纹理
+        GLES20.glActiveTexture(GLES20.GL_TEXTURE1)
+        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, videoTextureId)
+        GLES20.glUniform1i(shader.uTextureMaskUnitLocation, 1)
+
+        // 属性处理
+        if (src.srcType == Src.SrcType.TXT && mixAnimPlugin.autoTxtColorFill) { // // 文字需要颜色填充
+            GLES20.glUniform1i(shader.uIsFillLocation,  1)
+            val argb = transColor(src.color)
+            GLES20.glUniform4f(shader.uColorLocation, argb[1], argb[2], argb[3], argb[0])
+        } else {
+            GLES20.glUniform1i(shader.uIsFillLocation,  0)
+            GLES20.glUniform4f(shader.uColorLocation, 0f, 0f, 0f, 0f)
+        }
+
+        GLES20.glEnable(GLES20.GL_BLEND)
+        // 基于源象素alpha通道值的半透明混合函数
+        GLES20.glBlendFuncSeparate(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA)
+        // draw
+        GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4)
+
+        GLES20.glDisable(GLES20.GL_BLEND)
+
+    }
+
+    fun release(textureId: Int) {
+        if (textureId != 0) {
+            GLES20.glDeleteTextures(1, intArrayOf(textureId), 0)
+        }
+    }
+
+    private fun genSrcCoordsArray(array: FloatArray, fw: Int, fh: Int, sw: Int, sh: Int, fitType: Src.FitType): FloatArray {
+        return if (fitType == Src.FitType.CENTER_FULL) {
+            if (fw <= sw && fh <= sh) {
+                // 中心对齐,不拉伸
+                val gw = (sw - fw) / 2
+                val gh = (sh - fh) / 2
+                TexCoordsUtil.create(sw, sh, PointRect(gw, gh, fw, fh), array)
+            } else { // centerCrop
+                val fScale = fw * 1.0f / fh
+                val sScale = sw * 1.0f / sh
+                val srcRect = if (fScale > sScale) {
+                    val w = sw
+                    val x = 0
+                    val h = (sw / fScale).toInt()
+                    val y = (sh - h) / 2
+
+                    PointRect(x, y, w, h)
+                } else {
+                    val h = sh
+                    val y = 0
+                    val w = (sh * fScale).toInt()
+                    val x = (sw - w) / 2
+                    PointRect(x, y, w, h)
+                }
+                TexCoordsUtil.create(sw, sh, srcRect, array)
+            }
+        } else { // 默认 fitXY
+            TexCoordsUtil.create(fw, fh, PointRect(0, 0, fw, fh), array)
+        }
+    }
+
+    private fun transColor(color: Int): FloatArray {
+        val argb = FloatArray(4)
+        argb[0] = (color.ushr(24) and 0x000000ff) / 255f
+        argb[1] = (color.ushr(16) and 0x000000ff) / 255f
+        argb[2] = (color.ushr(8) and 0x000000ff) / 255f
+        argb[3] = (color and 0x000000ff) / 255f
+        return argb
+    }
+
+
+}

+ 94 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixShader.kt

@@ -0,0 +1,94 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mix
+
+import android.opengl.GLES20
+import com.tencent.qgame.animplayer.util.ShaderUtil
+
+class MixShader {
+    companion object {
+        private const val VERTEX = "attribute vec4 a_Position;  \n" +
+                "attribute vec2 a_TextureSrcCoordinates;\n" +
+                "attribute vec2 a_TextureMaskCoordinates;\n" +
+                "varying vec2 v_TextureSrcCoordinates;\n" +
+                "varying vec2 v_TextureMaskCoordinates;\n" +
+                "void main()\n" +
+                "{\n" +
+                "    v_TextureSrcCoordinates = a_TextureSrcCoordinates;\n" +
+                "    v_TextureMaskCoordinates = a_TextureMaskCoordinates;\n" +
+                "    gl_Position = a_Position;\n" +
+                "}"
+
+        private const val FRAGMENT = "#extension GL_OES_EGL_image_external : require\n" +
+                "precision mediump float; \n" +
+                "uniform sampler2D u_TextureSrcUnit;\n" +
+                "uniform samplerExternalOES u_TextureMaskUnit;\n" +
+                "uniform int u_isFill;\n" +
+                "uniform vec4 u_Color;\n" +
+                "varying vec2 v_TextureSrcCoordinates;\n" +
+                "varying vec2 v_TextureMaskCoordinates;\n" +
+                "void main()\n" +
+                "{\n" +
+                "    vec4 srcRgba = texture2D(u_TextureSrcUnit, v_TextureSrcCoordinates);\n" +
+                "    vec4 maskRgba = texture2D(u_TextureMaskUnit, v_TextureMaskCoordinates);\n" +
+                "    float isFill = step(0.5, float(u_isFill));\n" +
+                "    vec4 srcRgbaCal = isFill * vec4(u_Color.r, u_Color.g, u_Color.b, srcRgba.a) + (1.0 - isFill) * srcRgba;\n" +
+                "    gl_FragColor = vec4(srcRgbaCal.r, srcRgbaCal.g, srcRgbaCal.b, srcRgba.a * maskRgba.r);\n" +
+                "}"
+
+        // Uniform constants
+        private const val U_TEXTURE_SRC_UNIT = "u_TextureSrcUnit"
+        private const val U_TEXTURE_MASK_UNIT = "u_TextureMaskUnit"
+        private const val U_IS_FILL = "u_isFill"
+        private const val U_COLOR = "u_Color"
+
+        // Attribute constants
+        private const val A_POSITION = "a_Position"
+        private const val A_TEXTURE_SRC_COORDINATES = "a_TextureSrcCoordinates"
+        private const val A_TEXTURE_MASK_COORDINATES = "a_TextureMaskCoordinates"
+    }
+
+    // Shader program
+    val program: Int
+
+    // Uniform locations
+    val uTextureSrcUnitLocation: Int
+    val uTextureMaskUnitLocation: Int
+    val uIsFillLocation: Int
+    val uColorLocation: Int
+
+    // Attribute locations
+    val aPositionLocation: Int
+    val aTextureSrcCoordinatesLocation: Int
+    val aTextureMaskCoordinatesLocation: Int
+
+    init {
+        program = ShaderUtil.createProgram(VERTEX, FRAGMENT)
+        uTextureSrcUnitLocation = GLES20.glGetUniformLocation(program, U_TEXTURE_SRC_UNIT)
+        uTextureMaskUnitLocation = GLES20.glGetUniformLocation(program, U_TEXTURE_MASK_UNIT)
+        uIsFillLocation = GLES20.glGetUniformLocation(program, U_IS_FILL)
+        uColorLocation = GLES20.glGetUniformLocation(program, U_COLOR)
+
+        aPositionLocation = GLES20.glGetAttribLocation(program, A_POSITION)
+        aTextureSrcCoordinatesLocation = GLES20.glGetAttribLocation(program, A_TEXTURE_SRC_COORDINATES)
+        aTextureMaskCoordinatesLocation = GLES20.glGetAttribLocation(program, A_TEXTURE_MASK_COORDINATES)
+    }
+
+    fun useProgram() {
+        GLES20.glUseProgram(program)
+    }
+
+}

+ 55 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixTouch.kt

@@ -0,0 +1,55 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mix
+
+import android.view.MotionEvent
+import com.tencent.qgame.animplayer.PointRect
+
+/**
+ * 触摸事件
+ */
+class MixTouch(private val mixAnimPlugin: MixAnimPlugin) {
+
+    fun onTouchEvent(ev: MotionEvent): Resource? {
+        val viewWith = mixAnimPlugin.player.animView.width
+        val viewHeight = mixAnimPlugin.player.animView.height
+        val videoWith = mixAnimPlugin.player.configManager.config?.width ?: return null
+        val videoHeight = mixAnimPlugin.player.configManager.config?.height ?: return null
+
+        if (viewWith == 0 || viewHeight == 0) return null
+
+        when(ev.action) {
+            MotionEvent.ACTION_UP -> {
+                val x = ev.rawX * videoWith / viewWith
+                val y = ev.rawY * videoHeight / viewHeight
+                val list = mixAnimPlugin.frameAll?.map?.get(mixAnimPlugin.curFrameIndex)?.list
+                list?.forEach {frame ->
+                    val src = mixAnimPlugin.srcMap?.map?.get(frame.srcId) ?: return@forEach
+                    if (calClick(x.toInt(), y.toInt(), frame.frame)) {
+                        return Resource(src)
+                    }
+                }
+            }
+        }
+        return null
+    }
+
+
+    private fun calClick(x: Int, y: Int, frame: PointRect): Boolean {
+        return x >= frame.x && x <= (frame.x + frame.w)
+                && y >= frame.y && y <= (frame.y + frame.h)
+    }
+}

+ 37 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Resource.kt

@@ -0,0 +1,37 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mix
+
+import android.graphics.Bitmap
+
+/**
+ * 资源描述
+ */
+class Resource {
+    var id = ""
+    var type = Src.SrcType.UNKNOWN
+    var loadType = Src.LoadType.UNKNOWN
+    var tag = ""
+    var bitmap: Bitmap? = null
+
+    constructor(src: Src) {
+        id = src.srcId
+        type = src.srcType
+        loadType = src.loadType
+        tag = src.srcTag
+        bitmap = src.bitmap
+    }
+}

+ 123 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Src.kt

@@ -0,0 +1,123 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.mix
+
+import android.graphics.Bitmap
+import android.graphics.Color
+import com.tencent.qgame.animplayer.Constant
+import com.tencent.qgame.animplayer.util.ALog
+import org.json.JSONObject
+
+class Src {
+    companion object {
+        private const val TAG = "${Constant.TAG}.Src"
+    }
+
+    enum class SrcType(val type: String) {
+        UNKNOWN("unknown"),
+        IMG("img"),
+        TXT("txt"),
+    }
+
+    enum class LoadType(val type: String) {
+        UNKNOWN("unknown"),
+        NET("net"), // 网络加载的图片
+        LOCAL("local"), // 本地加载的图片
+    }
+
+    enum class FitType(val type: String) {
+        FIT_XY("fitXY"), // 按原始大小填充纹理
+        CENTER_FULL("centerFull"), // 以纹理中心点放置
+    }
+
+    enum class Style(val style: String) {
+        DEFAULT("default"),
+        BOLD("b"), // 文字粗体
+    }
+
+    var srcId = ""
+    var w = 0
+    var h = 0
+    var srcType = SrcType.UNKNOWN
+    var loadType = LoadType.UNKNOWN
+    var srcTag = ""
+    var bitmap: Bitmap? = null
+    var txt = ""
+    var style = Style.DEFAULT
+    var color: Int = 0
+    var fitType = FitType.FIT_XY
+    var srcTextureId = 0
+
+    constructor(json: JSONObject) {
+        srcId = json.getString("srcId")
+        w = json.getInt("w")
+        h = json.getInt("h")
+        // 可选
+        var colorStr = json.optString("color", "#000000")
+        if (colorStr.isEmpty()) {
+            colorStr = "#000000"
+        }
+        color = Color.parseColor(colorStr)
+        srcTag = json.getString("srcTag")
+        txt = srcTag
+
+        srcType = when(json.getString("srcType")) {
+            SrcType.IMG.type -> SrcType.IMG
+            SrcType.TXT.type -> SrcType.TXT
+            else -> SrcType.UNKNOWN
+        }
+        loadType = when(json.getString("loadType")) {
+            LoadType.NET.type -> LoadType.NET
+            LoadType.LOCAL.type -> LoadType.LOCAL
+            else -> LoadType.UNKNOWN
+        }
+        fitType = when(json.getString("fitType")) {
+            FitType.CENTER_FULL.type -> FitType.CENTER_FULL
+            else -> FitType.FIT_XY
+        }
+
+        // 可选
+        style = when(json.optString("style", "")) {
+            Style.BOLD.style -> Style.BOLD
+            else -> Style.DEFAULT
+        }
+        ALog.i(TAG, "${toString()} color=$colorStr")
+    }
+
+
+
+    override fun toString(): String {
+        return "Src(srcId='$srcId', srcType=$srcType, loadType=$loadType, srcTag='$srcTag', bitmap=$bitmap, txt='$txt')"
+    }
+
+}
+
+
+class SrcMap(json: JSONObject) {
+    val map = HashMap<String, Src>()
+
+    init {
+        val srcJsonArray = json.getJSONArray("src")
+        val srcLen = srcJsonArray?.length() ?: 0
+        for (i in 0 until srcLen) {
+            val srcJson = srcJsonArray?.getJSONObject(i) ?: continue
+            val src = Src(srcJson)
+            if (src.srcType != Src.SrcType.UNKNOWN) { // 不认识的srcType丢弃
+                map[src.srcId] = src
+            }
+        }
+    }
+}

+ 119 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/plugin/AnimPluginManager.kt

@@ -0,0 +1,119 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.plugin
+
+import android.view.MotionEvent
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.AnimPlayer
+import com.tencent.qgame.animplayer.Constant
+import com.tencent.qgame.animplayer.mask.MaskAnimPlugin
+import com.tencent.qgame.animplayer.mix.MixAnimPlugin
+import com.tencent.qgame.animplayer.util.ALog
+
+/**
+ * 动画插件管理
+ */
+class AnimPluginManager(val player: AnimPlayer) {
+    companion object {
+        private const val TAG = "${Constant.TAG}.AnimPluginManager"
+        private const val DIFF_TIMES = 4
+    }
+
+    private val mixAnimPlugin = MixAnimPlugin(player)
+    private val maskAnimPlugin = MaskAnimPlugin(player)
+
+    private val plugins = listOf<IAnimPlugin>(mixAnimPlugin, maskAnimPlugin)
+
+    // 当前渲染的帧
+    private var frameIndex = 0
+    // 当前解码的帧
+    private var decodeIndex = 1
+    // 帧不相同的次数, 连续多次不同则直接使用decodeIndex
+    private var frameDiffTimes = 0
+
+    fun getMixAnimPlugin(): MixAnimPlugin? {
+        return mixAnimPlugin
+    }
+    
+    fun getMaskAnimPlugin() : MaskAnimPlugin? {
+        return maskAnimPlugin
+    }
+
+    fun onConfigCreate(config: AnimConfig): Int {
+        ALog.i(TAG, "onConfigCreate")
+        plugins.forEach {
+            val res = it.onConfigCreate(config)
+            if (res != Constant.OK) {
+                return res
+            }
+        }
+        return Constant.OK
+    }
+
+    fun onRenderCreate() {
+        ALog.i(TAG, "onRenderCreate")
+        frameIndex = 0
+        plugins.forEach {
+            it.onRenderCreate()
+        }
+    }
+
+    fun onDecoding(decodeIndex: Int) {
+        ALog.d(TAG, "onDecoding decodeIndex=$decodeIndex")
+        this.decodeIndex = decodeIndex
+        plugins.forEach {
+            it.onDecoding(decodeIndex)
+        }
+    }
+
+    fun onRendering() {
+        frameIndex++
+        if (decodeIndex > frameIndex + 1 || frameDiffTimes >= DIFF_TIMES) {
+            ALog.i(TAG, "jump frameIndex= $frameIndex,decodeIndex=$decodeIndex,frameDiffTimes=$frameDiffTimes")
+            frameIndex = decodeIndex
+        }
+        if (decodeIndex != frameIndex) {
+            frameDiffTimes++
+        } else {
+            frameDiffTimes = 0
+        }
+        ALog.d(TAG, "onRendering frameIndex=$frameIndex")
+        plugins.forEach {
+            it.onRendering(frameIndex - 1) // 第一帧算0
+        }
+    }
+
+    fun onRelease() {
+        ALog.i(TAG, "onRelease")
+        plugins.forEach {
+            it.onRelease()
+        }
+    }
+
+    fun onDestroy() {
+        ALog.i(TAG, "onDestroy")
+        plugins.forEach {
+            it.onDestroy()
+        }
+    }
+
+    fun onDispatchTouchEvent(ev: MotionEvent): Boolean {
+        plugins.forEach {
+            if (it.onDispatchTouchEvent(ev)) return true
+        }
+        return false
+    }
+}

+ 48 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/plugin/IAnimPlugin.kt

@@ -0,0 +1,48 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.plugin
+
+import android.view.MotionEvent
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.Constant
+
+interface IAnimPlugin {
+
+    // 配置生成
+    fun onConfigCreate(config: AnimConfig): Int {
+        return Constant.OK
+    }
+
+    // 渲染初始化
+    fun onRenderCreate() {}
+
+    // 解码通知
+    fun onDecoding(decodeIndex: Int) {}
+
+    // 每一帧渲染
+    fun onRendering(frameIndex: Int) {}
+
+    // 每次播放完毕
+    fun onRelease() {}
+
+    // 销毁
+    fun onDestroy() {}
+
+    /** 触摸事件
+     * @return false 不拦截 true 拦截
+     */
+    fun onDispatchTouchEvent(ev: MotionEvent): Boolean {return false}
+}

+ 54 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/ALog.kt

@@ -0,0 +1,54 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+object ALog {
+
+    var isDebug = false
+
+    var log: IALog? = null
+
+    fun i(tag: String, msg: String) {
+        log?.i(tag, msg)
+    }
+
+    fun d(tag: String, msg: String) {
+        if (isDebug) {
+            log?.d(tag, msg)
+        }
+    }
+
+    fun e(tag: String, msg: String) {
+        log?.e(tag, msg)
+    }
+
+    fun e(tag: String, msg: String, tr: Throwable) {
+        log?.e(tag, msg, tr)
+    }
+}
+
+
+interface IALog {
+    fun i(tag: String, msg: String) {}
+
+    fun d(tag: String, msg: String) {}
+
+    fun e(tag: String, msg: String) {}
+
+    fun e(tag: String, msg: String, tr: Throwable) {}
+}
+
+

+ 62 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/BitmapUtil.kt

@@ -0,0 +1,62 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+import android.graphics.*
+import android.text.TextPaint
+import com.tencent.qgame.animplayer.mix.Src
+
+object BitmapUtil {
+
+    fun createTxtBitmap(src: Src): Bitmap {
+        val w = src.w
+        val h = src.h
+        // 这里使用ALPHA_8 在opengl渲染的时候图像出现错位
+        val bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)
+        val canvas = Canvas(bitmap)
+        val rect = Rect(0, 0, w, h)
+        val bounds = Rect()
+        var sizeR = 0.8f
+        val paint = TextPaint().apply {
+            textSize = h * sizeR
+            textAlign = Paint.Align.CENTER
+            style = Paint.Style.FILL
+            isAntiAlias = true
+            if (src.style == Src.Style.BOLD) {
+                typeface = Typeface.create(Typeface.DEFAULT, Typeface.BOLD)
+            }
+            color = src.color
+        }
+        val text = src.txt
+        while (sizeR > 0.1f) {
+            paint.getTextBounds(text, 0, text.length, bounds)
+            if (bounds.width() <= rect.width()) {
+                break
+            }
+            sizeR -= 0.1f
+            paint.textSize = h * sizeR
+        }
+        val fontMetrics = paint.fontMetricsInt
+        val top = fontMetrics.top
+        val bottom = fontMetrics.bottom
+        val baseline = rect.centerY() - top/2 - bottom/2
+
+        canvas.drawText(text, rect.centerX().toFloat(), baseline.toFloat(), paint)
+
+        return bitmap
+    }
+
+}

+ 50 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/GlFloatArray.kt

@@ -0,0 +1,50 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+import android.opengl.GLES20
+import java.nio.ByteBuffer
+import java.nio.ByteOrder
+import java.nio.FloatBuffer
+import kotlin.FloatArray
+
+class GlFloatArray {
+
+
+    val array = FloatArray(8)
+
+    private var floatBuffer: FloatBuffer
+
+    init {
+        floatBuffer = ByteBuffer
+            .allocateDirect(array.size * 4)
+            .order(ByteOrder.nativeOrder())
+            .asFloatBuffer()
+            .put(array)
+    }
+
+    fun setArray(array: FloatArray) {
+        floatBuffer.position(0)
+        floatBuffer.put(array)
+    }
+
+
+    fun setVertexAttribPointer(attributeLocation: Int) {
+        floatBuffer.position(0)
+        GLES20.glVertexAttribPointer(attributeLocation, 2, GLES20.GL_FLOAT, false, 0, floatBuffer)
+        GLES20.glEnableVertexAttribArray(attributeLocation)
+    }
+}

+ 58 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/MediaUtil.kt

@@ -0,0 +1,58 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+import android.media.MediaExtractor
+import android.media.MediaFormat
+import com.tencent.qgame.animplayer.Constant
+import com.tencent.qgame.animplayer.FileContainer
+
+object MediaUtil {
+
+    private const val TAG = "${Constant.TAG}.MediaUtil"
+
+    fun getExtractor(file: FileContainer): MediaExtractor {
+        val extractor = MediaExtractor()
+        file.setDataSource(extractor)
+        return extractor
+    }
+
+    fun selectVideoTrack(extractor: MediaExtractor): Int {
+        val numTracks = extractor.trackCount
+        for (i in 0 until numTracks) {
+            val format = extractor.getTrackFormat(i)
+            val mime = format.getString(MediaFormat.KEY_MIME)
+            if (mime.startsWith("video/")) {
+                ALog.d(TAG, "Extractor selected track $i ($mime): $format")
+                return i
+            }
+        }
+        return -1
+    }
+
+    fun selectAudioTrack(extractor: MediaExtractor): Int {
+        val numTracks = extractor.trackCount
+        for (i in 0 until numTracks) {
+            val format = extractor.getTrackFormat(i)
+            val mime = format.getString(MediaFormat.KEY_MIME)
+            if (mime.startsWith("audio/")) {
+                ALog.d(TAG, "Extractor selected track $i ($mime): $format")
+                return i
+            }
+        }
+        return -1
+    }
+}

+ 74 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/ShaderUtil.kt

@@ -0,0 +1,74 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+import android.opengl.GLES20
+import com.tencent.qgame.animplayer.Constant
+
+object ShaderUtil {
+    private const val TAG = "${Constant.TAG}.ShaderUtil"
+
+
+    fun createProgram(vertexSource: String, fragmentSource: String): Int {
+        val vertexShaderHandle = compileShader(GLES20.GL_VERTEX_SHADER, vertexSource)
+        val fragmentShaderHandle = compileShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource)
+        return createAndLinkProgram(vertexShaderHandle, fragmentShaderHandle)
+    }
+
+
+    private fun compileShader(shaderType: Int, shaderSource: String): Int {
+        var shaderHandle = GLES20.glCreateShader(shaderType)
+
+        if (shaderHandle != 0) {
+            GLES20.glShaderSource(shaderHandle, shaderSource)
+            GLES20.glCompileShader(shaderHandle)
+            val compileStatus = IntArray(1)
+            GLES20.glGetShaderiv(shaderHandle, GLES20.GL_COMPILE_STATUS, compileStatus, 0)
+            if (compileStatus[0] == 0) {
+                ALog.e(TAG, "Error compiling shader: " + GLES20.glGetShaderInfoLog(shaderHandle))
+                GLES20.glDeleteShader(shaderHandle)
+                shaderHandle = 0
+            }
+        }
+        if (shaderHandle == 0) {
+            throw RuntimeException("Error creating shader.")
+        }
+        return shaderHandle
+    }
+
+
+    private fun createAndLinkProgram(vertexShaderHandle: Int, fragmentShaderHandle: Int): Int {
+        var programHandle = GLES20.glCreateProgram()
+
+        if (programHandle != 0) {
+            GLES20.glAttachShader(programHandle, vertexShaderHandle)
+            GLES20.glAttachShader(programHandle, fragmentShaderHandle)
+            GLES20.glLinkProgram(programHandle)
+            val linkStatus = IntArray(1)
+            GLES20.glGetProgramiv(programHandle, GLES20.GL_LINK_STATUS, linkStatus, 0)
+            if (linkStatus[0] == 0) {
+                ALog.e(TAG, "Error compiling program: " + GLES20.glGetProgramInfoLog(programHandle))
+                GLES20.glDeleteProgram(programHandle)
+                programHandle = 0
+            }
+        }
+        if (programHandle == 0) {
+            throw RuntimeException("Error creating program.")
+        }
+        return programHandle
+    }
+
+}

+ 81 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/SpeedControlUtil.kt

@@ -0,0 +1,81 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+import com.tencent.qgame.animplayer.Constant
+
+class SpeedControlUtil {
+
+    companion object {
+        private const val TAG = "${Constant.TAG}.SpeedControlUtil"
+    }
+    private val ONE_MILLION = 1000000L
+
+    private var prevPresentUsec: Long = 0
+    private var prevMonoUsec: Long = 0
+    private var fixedFrameDurationUsec: Long = 0
+    private var loopReset = true
+
+    fun setFixedPlaybackRate(fps: Int) {
+        if (fps <=0) return
+        fixedFrameDurationUsec = ONE_MILLION / fps
+    }
+
+    fun preRender(presentationTimeUsec: Long) {
+        if (prevMonoUsec == 0L) {
+            prevMonoUsec = System.nanoTime() / 1000
+            prevPresentUsec = presentationTimeUsec
+        } else {
+            var frameDelta: Long
+            if (loopReset) {
+                prevPresentUsec = presentationTimeUsec - ONE_MILLION / 30
+                loopReset = false
+            }
+            frameDelta = if (fixedFrameDurationUsec != 0L) {
+                fixedFrameDurationUsec
+            } else {
+                presentationTimeUsec - prevPresentUsec
+            }
+            when {
+                frameDelta < 0 -> frameDelta = 0
+                frameDelta > 10 * ONE_MILLION -> frameDelta = 5 * ONE_MILLION
+            }
+
+            val desiredUsec = prevMonoUsec + frameDelta
+            var nowUsec = System.nanoTime() / 1000
+            while (nowUsec < desiredUsec - 100 ) {
+                var sleepTimeUsec = desiredUsec - nowUsec
+                if (sleepTimeUsec > 500000) {
+                    sleepTimeUsec = 500000
+                }
+                try {
+                    Thread.sleep(sleepTimeUsec / 1000, (sleepTimeUsec % 1000).toInt() * 1000)
+                } catch (e: InterruptedException) {
+                    ALog.e(TAG, "e=$e", e)
+                }
+                nowUsec = System.nanoTime() / 1000
+            }
+
+            prevMonoUsec += frameDelta
+            prevPresentUsec += frameDelta
+        }
+    }
+
+    fun reset() {
+        prevPresentUsec = 0
+        prevMonoUsec = 0
+    }
+}

+ 84 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/TexCoordsUtil.kt

@@ -0,0 +1,84 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+import com.tencent.qgame.animplayer.PointRect
+
+/**
+ * 纹理坐标工具
+ * 坐标顺序是倒N
+ */
+object TexCoordsUtil {
+
+    /**
+     * @param width 纹理的宽高
+     * @param height
+     */
+    fun create(width: Int, height: Int, rect: PointRect, array: FloatArray): FloatArray {
+
+        // x0
+        array[0] = rect.x.toFloat() / width
+        // y0
+        array[1] = rect.y.toFloat() / height
+
+        // x1
+        array[2] = rect.x.toFloat() / width
+        // y1
+        array[3] = (rect.y.toFloat() + rect.h) / height
+
+        // x2
+        array[4] = (rect.x.toFloat() + rect.w) / width
+        // y2
+        array[5] = rect.y.toFloat() / height
+
+        // x3
+        array[6] = (rect.x.toFloat() + rect.w) / width
+        // y3
+        array[7] = (rect.y.toFloat() + rect.h) / height
+
+        return array
+    }
+
+
+
+
+    /**
+     * 顺时针90度
+     */
+    fun rotate90(array: FloatArray): FloatArray {
+        // 0->2 1->0 3->1 2->3
+        val tx = array[0]
+        val ty = array[1]
+
+        // 1->0
+        array[0] = array[2]
+        array[1] = array[3]
+
+        // 3->1
+        array[2] = array[6]
+        array[3] = array[7]
+
+        // 2->3
+        array[6] = array[4]
+        array[7] = array[5]
+
+        // 0->2
+        array[4] = tx
+        array[5] = ty
+        return array
+    }
+
+}

+ 58 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/TextureLoadUtil.kt

@@ -0,0 +1,58 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+import android.graphics.Bitmap
+import android.opengl.GLES20
+import android.opengl.GLUtils
+
+object TextureLoadUtil {
+    private const val TAG = "TextureUtil"
+    fun loadTexture(bitmap: Bitmap?): Int {
+        val textureObjectIds = IntArray(1)
+        GLES20.glGenTextures(1, textureObjectIds, 0)
+
+        if (textureObjectIds[0] == 0) {
+            return 0
+        }
+
+        if (bitmap == null) {
+            GLES20.glDeleteTextures(1, textureObjectIds, 0)
+            return 0
+        }
+
+        if (bitmap.isRecycled) {
+            ALog.e(TAG, "bitmap isRecycled")
+            return 0
+        }
+
+        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureObjectIds[0])
+        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_LINEAR)
+        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR)
+        GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0)
+        GLES20.glGenerateMipmap(GLES20.GL_TEXTURE_2D)
+        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0)
+
+        return textureObjectIds[0]
+    }
+    
+    
+    fun releaseTexure(textureId: Int) {
+        if (textureId != 0) {
+            GLES20.glDeleteTextures(1, intArrayOf(textureId), 0)
+        }
+    }
+}

+ 64 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/VertexUtil.kt

@@ -0,0 +1,64 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.animplayer.util
+
+import com.tencent.qgame.animplayer.PointRect
+
+/**
+ * 顶点坐标工具
+ * 坐标顺序是倒N
+ */
+object VertexUtil {
+
+    /**
+     * @param width 画布大大小
+     * @param height
+     */
+    fun create(width: Int, height: Int, rect: PointRect, array: FloatArray): FloatArray {
+
+        // x0
+        array[0] = switchX(rect.x.toFloat() / width)
+        // y0
+        array[1] = switchY(rect.y.toFloat() / height)
+
+        // x1
+        array[2] = switchX(rect.x.toFloat() / width)
+        // y1
+        array[3] = switchY((rect.y.toFloat() + rect.h) / height)
+
+        // x2
+        array[4] = switchX((rect.x.toFloat() + rect.w) / width)
+        // y2
+        array[5] = switchY(rect.y.toFloat() / height)
+
+        // x3
+        array[6] = switchX((rect.x.toFloat() + rect.w) / width)
+        // y3
+        array[7] = switchY((rect.y.toFloat() + rect.h) / height)
+
+        return array
+    }
+
+
+    private fun switchX(x: Float): Float {
+        return x * 2f -1f
+    }
+
+    private fun switchY(y: Float): Float {
+        return ((y * 2f - 2f) * -1f) - 1f
+    }
+
+}

+ 3 - 0
Android/PlayerProj/animplayer/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">animplayer</string>
+</resources>

+ 17 - 0
Android/PlayerProj/animplayer/src/test/java/com/tencent/qgame/animplayer/ExampleUnitTest.java

@@ -0,0 +1,17 @@
+package com.tencent.qgame.animplayer;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+    @Test
+    public void addition_isCorrect() {
+        assertEquals(4, 2 + 2);
+    }
+}

+ 1 - 0
Android/PlayerProj/animtool/.gitignore

@@ -0,0 +1 @@
+/build

+ 18 - 0
Android/PlayerProj/animtool/build.gradle

@@ -0,0 +1,18 @@
+apply plugin: 'java-library'
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+}
+
+sourceCompatibility = "7"
+targetCompatibility = "7"
+buildscript {
+    repositories {
+        mavenCentral()
+    }
+    dependencies {
+    }
+}
+repositories {
+    mavenCentral()
+}

+ 295 - 0
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/AnimTool.java

@@ -0,0 +1,295 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.animtool;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class AnimTool {
+
+    private static final String TAG = "AnimTool";
+
+    private volatile int totalP = 0;
+    private volatile int finishThreadCount = 0;
+    private long time;
+    private GetAlphaFrame getAlphaFrame = new GetAlphaFrame();
+
+
+    /**
+     * @param commonArg
+     * @param needVideo true 生成完整视频 false 只合成帧图片
+     */
+    public void create(final CommonArg commonArg, final boolean needVideo) {
+        createAllFrameImage(commonArg, new Runnable() {
+            @Override
+            public void run() {
+                if (needVideo) {
+                    // 最终生成视频文件
+                    createVideo(commonArg);
+                }
+            }
+        });
+    }
+
+    /**
+     * 参数校验
+     * @param commonArg
+     * @return
+     */
+    private boolean checkCommonArg(CommonArg commonArg) {
+        if (commonArg.totalFrame <= 0) {
+            TLog.i(TAG, "error: totalFrame=" + commonArg.totalFrame);
+            return false;
+        }
+
+        if (commonArg.videoW <= 0 || commonArg.videoH <= 0) {
+            TLog.i(TAG, "error: video size " + commonArg.videoW + "x" + commonArg.videoH);
+            return false;
+        }
+
+        // 宽高必须是16的倍数,某些机行会进行对齐
+        if (commonArg.videoW % 16 != 0 || commonArg.videoH % 16 != 0) {
+            TLog.i(TAG, "error: video size " + commonArg.videoW + "x" + commonArg.videoH + " can not be divisible by 16");
+            return false;
+        }
+
+        File input = new File(commonArg.inputPath);
+        if (!input.exists()) {
+            TLog.i(TAG, "error: input path invalid " + commonArg.inputPath);
+            return false;
+        }
+
+        if (!File.separator.equals(commonArg.inputPath.substring(commonArg.inputPath.length() - 1))) {
+            commonArg.inputPath = commonArg.inputPath + File.separator;
+        }
+        if (!File.separator.equals(commonArg.outputPath.substring(commonArg.outputPath.length() - 1))) {
+            commonArg.outputPath = commonArg.outputPath + File.separator;
+        }
+        return true;
+    }
+
+    private void createAllFrameImage(final CommonArg commonArg, final Runnable finishRunnable) {
+        if (!checkCommonArg(commonArg)) {
+            return;
+        }
+
+        time = System.currentTimeMillis();
+
+        // 检测output文件是否存在,不存在则生成
+        checkDir(commonArg.outputPath);
+        totalP = 0;
+        finishThreadCount = 0;
+        final int threadNum = 16;
+
+        final int[][] threadIndexSet = new int[threadNum][2];
+        final int totalFrame = commonArg.totalFrame;
+        int block = totalFrame / threadNum;
+        for(int i=0; i<threadNum-1; i++) {
+            threadIndexSet[i][0] = i * block;
+            threadIndexSet[i][1] = i * block + block;
+        }
+        threadIndexSet[threadNum-1][0] = (threadNum-1) * block;
+        threadIndexSet[threadNum-1][1] = totalFrame;
+
+        for (int i=0; i<threadNum; i++) {
+            final int k = i;
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    for(int i = threadIndexSet[k][0]; i<threadIndexSet[k][1]; i++) {
+                        synchronized (AnimTool.class) {
+                            totalP++;
+                            TLog.i(TAG, "progress " + (totalP * 1.0f / commonArg.totalFrame));
+                        }
+                        try {
+                            createFrame(commonArg, i);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                    synchronized (AnimTool.class) {
+                        finishThreadCount++;
+                        if (finishThreadCount == threadNum) {
+                            if (finishRunnable != null) {
+                                finishRunnable.run();
+                            }
+                            long cost = System.currentTimeMillis() - time;
+                            TLog.i(TAG,"Finish cost=" + cost);
+                        }
+                    }
+                }
+            }).start();
+        }
+    }
+
+    private void createFrame(CommonArg commonArg, int frameIndex) throws Exception {
+        int w = commonArg.videoW;
+        int h = commonArg.videoH;
+        File inputFile = new File(commonArg.inputPath + String.format("%03d", frameIndex)+".png");
+        GetAlphaFrame.AlphaFrameOut videoFrame = getAlphaFrame.createFrame(commonArg.orin,w, h, inputFile);
+        if (videoFrame == null) {
+            TLog.i(TAG, "frameIndex="+frameIndex +" is empty");
+            return;
+        }
+        // 最后保存图片
+        BufferedImage outBuf = new BufferedImage(videoFrame.outW, videoFrame.outH, BufferedImage.TYPE_INT_ARGB);
+        outBuf.setRGB(0,0, videoFrame.outW, videoFrame.outH, videoFrame.argb, 0, videoFrame.outW);
+
+        File outputFile = new File(commonArg.outputPath  + String.format("%03d", frameIndex) +".png");
+        ImageIO.write(outBuf, "PNG", outputFile);
+    }
+
+
+    private void checkDir(String path) {
+        File file = new File(path);
+        if (!file.exists()) {
+            file.mkdirs();
+        }
+    }
+
+    /**
+     * 创建最终的视频
+     * @param commonArg
+     */
+    private void createVideo(CommonArg commonArg){
+        try {
+            // 创建配置json文件
+            createVapcJson(commonArg);
+            // 创建mp4文件
+            boolean result = createMp4(commonArg);
+            if (!result) {
+                TLog.i(TAG, "createMp4 fail");
+                return;
+            }
+            String input = commonArg.outputPath + "/vapc.json";
+            // 由json变为bin文件
+            mp4BoxTool(input, commonArg.outputPath);
+            // 将bin文件合并到mp4里
+            result = mergeBin2Mp4(commonArg.outputPath + "/vapc.bin", commonArg.outputPath);
+            if (!result) {
+                TLog.i(TAG, "mergeBin2Mp4 fail");
+                return;
+            }
+            // 删除临时视频文件
+            new File(commonArg.outputPath + "/tmp_video.mp4").delete();
+            // 计算文件md5
+            String md5 = new Md5Util().getFileMD5(new File(commonArg.outputPath + "/video.mp4"), commonArg.outputPath);
+            TLog.i(TAG, "md5="+md5);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 创建对应的配置json
+     * @param commonArg
+     */
+    private void createVapcJson(CommonArg commonArg) {
+        String json = "{\"info\":{\"v\":$(v),\"f\":$(f),\"w\":$(w),\"h\":$(h),\"videoW\":$(videoW),\"videoH\":$(videoH),\"orien\":0,\"fps\":$(fps),\"isVapx\":0,\"aFrame\":$(aFrame),\"rgbFrame\":$(rgbFrame)}}";
+        json = json.replace("$(v)", String.valueOf(commonArg.version));
+        json = json.replace("$(f)", String.valueOf(commonArg.totalFrame));
+        json = json.replace("$(w)", String.valueOf(commonArg.videoW));
+        json = json.replace("$(h)", String.valueOf(commonArg.videoH));
+        json = json.replace("$(fps)", String.valueOf(commonArg.fps));
+        int realW = 0;
+        int realH = 0;
+        int cx, cy;
+        String aFrame = "[0,0,"+commonArg.videoW+","+commonArg.videoH+"]";
+        String rgbFrame = "[0,0,0,0]";
+        if (commonArg.orin == CommonArg.ORIN_H) { // 水平对齐
+            realW = 2 * commonArg.videoW;
+            realH = commonArg.videoH;
+            cx = commonArg.videoW;
+            cy = 0;
+        } else { // 上下对齐
+            realW = commonArg.videoW;
+            realH = 2 * commonArg.videoH;
+            cx = 0;
+            cy = commonArg.videoH;
+        }
+        rgbFrame = "["+cx+","+cy+","+commonArg.videoW+","+commonArg.videoH+"]";
+
+        json = json.replace("$(videoW)", String.valueOf(realW));
+        json = json.replace("$(videoH)", String.valueOf(realH));
+        json = json.replace("$(aFrame)", aFrame);
+        json = json.replace("$(rgbFrame)", rgbFrame);
+        try {
+            BufferedWriter writer = new BufferedWriter(new FileWriter(commonArg.outputPath + "/vapc.json"));
+            writer.write(json);
+            writer.flush();
+            writer.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException();
+        }
+        TLog.i(TAG,json);
+
+    }
+
+
+
+
+
+    /**
+     * 创建mp4
+     * @param commonArg
+     * @throws Exception
+     */
+    private boolean createMp4(CommonArg commonArg) throws Exception {
+        String path = commonArg.outputPath;
+        String[] cmd = new String[] {"ffmpeg", "-r", String.valueOf(commonArg.fps),
+                "-i", path + "/%03d.png",
+                "-pix_fmt", "yuv420p",
+                "-vcodec", "libx264",
+                "-b:v", "3000k",
+                "-profile:v", "baseline",
+                "-level", "3.0",
+                "-bf", "0",
+                "-y", path+"/tmp_video.mp4"};
+
+        Process pro = Runtime.getRuntime().exec(cmd);
+        int result = pro.waitFor();
+        TLog.i(TAG, "createMp4 result=" + (result == 0? "success" : "fail"));
+        return result == 0;
+    }
+
+    /**
+     * 合并vapc.bin到mp4里
+     * @param inputFile
+     * @throws Exception
+     */
+    private boolean mergeBin2Mp4(String inputFile, String videoPath) throws Exception{
+        String[] cmd = new String[] {"mp4edit", "--insert", ":"+inputFile+":1", videoPath + "/tmp_video.mp4", videoPath + "/video.mp4"};
+        Process pro = Runtime.getRuntime().exec(cmd);
+        int result = pro.waitFor();
+        TLog.i(TAG, "mergeBin2Mp4 result=" + (result == 0? "success" : "fail"));
+        return result == 0;
+    }
+
+    /**
+     * 生成对应的box bin
+     * 执行 mp4edit --insert :vapc.bin:1 demo_origin.mp4 demo_output.mp4 插入对应box
+     */
+    private void mp4BoxTool(String inputFile, String outputPath) throws Exception {
+        Mp4BoxTool mp4BoxTool = new Mp4BoxTool();
+        mp4BoxTool.create(inputFile, outputPath);
+    }
+
+}

+ 38 - 0
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/CommonArg.java

@@ -0,0 +1,38 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.animtool;
+
+public class CommonArg {
+
+    public static final int ORIN_H = 1; // 左右对齐
+    public static final int ORIN_V = 2; // 上下对齐
+
+    public int version = 2;
+
+    public int orin = ORIN_H;
+
+    public int videoW;
+
+    public int videoH;
+
+    public int totalFrame;
+
+    public int fps = 0;
+
+    public String inputPath; // 输入帧文件地址
+
+    public String outputPath; // 输出地址
+}

+ 117 - 0
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/GetAlphaFrame.java

@@ -0,0 +1,117 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.animtool;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+public class GetAlphaFrame {
+
+    public static final int ORIN_H = 1; // 左右对齐
+    public static final int ORIN_V = 2; // 上下对齐
+
+    public static final int MASK_TEX_GAP = 10; // 遮罩纹理之间的间距,防止光栅化导致边界模糊问题
+
+
+    public static class AlphaFrameOut {
+
+
+        public int orin;
+        public int[] argb;
+        public int w;
+        public int h;
+        public int outW;
+        public int outH;
+
+        // 一帧里纹理开始的位置
+        int lastX;
+        int lastY;
+        int curMaxY;
+
+        public AlphaFrameOut(int orin, int[] argb, int w, int h, int outW, int outH) {
+            this.orin = orin;
+            this.argb = argb;
+            this.w = w;
+            this.h = h;
+            this.outW = outW;
+            this.outH = outH;
+            lastX = MASK_TEX_GAP;
+            lastY = MASK_TEX_GAP;
+            curMaxY = lastY;
+        }
+
+    }
+
+    public AlphaFrameOut createFrame(int orin, int w, int h, File inputFile) throws IOException {
+
+        if (!inputFile.exists()) {
+            return null;
+        }
+
+        int outW = orin == ORIN_H ? w * 2 : w;
+        int outH = orin == ORIN_H ? h : h * 2;
+
+        BufferedImage inputBuf = ImageIO.read(inputFile);
+        int[] inputArgb = inputBuf.getRGB(0, 0, w, h, null, 0, w);
+
+
+        int[] outputArgb = new int[outW * outH];
+
+
+        for (int k=0; k<2; k++) {
+            for (int x = 0; x < w; x++) {
+                for (int y = 0; y < h; y++) {
+                    int outPoint = orin == ORIN_H ? k * w + x + y * outW : k * w * h + x + y * w;
+                    if (k == 0) {
+                        int alpha = inputArgb[x + y * w] >>> 24;
+                        // r = g = b
+                        outputArgb[outPoint] = 0xff000000 + (alpha << 16) + (alpha << 8) + alpha;
+                        // r = b g = 0
+                        // outputArgb[outPoint] = 0xff000000 + (alpha << 16) + (0x00 << 8) + alpha;
+                    } else {
+                        outputArgb[outPoint] = blendBg(inputArgb[x + y * w], 0xff000000);
+                    }
+                }
+            }
+        }
+
+        return new AlphaFrameOut(orin, outputArgb, w, h, outW, outH);
+
+    }
+
+    private int blendBg(int color, int colorBg) {
+        float alpha = (color >>> 24) / 255f;
+
+        float colorR = ((color & 0x00ff0000) >>> 16) / 255f;
+        float colorG = ((color & 0x0000ff00) >>> 8) / 255f;
+        float colorB = ((color & 0x000000ff)) / 255f;
+
+        float colorBgR = ((colorBg & 0x00ff0000) >>> 16) / 255f;
+        float colorBgG = ((colorBg & 0x0000ff00) >>> 8) / 255f;
+        float colorBgB = ((colorBg & 0x000000ff)) / 255f;
+
+        float r = alpha * colorR + (1f - alpha) * colorBgR;
+        float g = alpha * colorG + (1f - alpha) * colorBgG;
+        float b = alpha * colorB + (1f - alpha) * colorBgB;
+
+        return 0xff000000 + ((int)(r * 255f) << 16) + ((int)(g * 255f) << 8) + (int)(b * 255f);
+
+    }
+
+}
+

+ 88 - 0
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Main.java

@@ -0,0 +1,88 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.animtool;
+
+
+
+public class Main {
+
+
+    public static void main(String[] args) throws Exception {
+        animTool();
+    }
+
+
+    /**
+     *
+     * 运行前请先安装ffmpeg与bento4这两个工具
+     *
+     * 生成图片的工具
+     * step 1 填写如下参数,运行后生成中间图片
+     * step 2 进入outputPath目录,运行如下ffmpeg命令(需要预先安装ffmpeng)
+     * ffmpeg -r 24 -i "%03d.png" -pix_fmt yuv420p -vcodec libx264 -b:v 3000k -profile:v baseline -level 3.0 -bf 0 -y demo.mp4
+     *
+     *
+     * -vcodec libx264 h264编码
+     * -b:v 3000K 表示码率为3000K,可以改变码率调节文件大小和视频清晰度
+     * -bf 0 没有B帧
+     * -profile:v baseline baseline模式
+     *
+     * 使用固定码率能使文件更小,但会损失清晰度
+     * 使用-crf 参数可以提高清晰度但文件大小不可控(会变大),推荐值 29(0 最好 51 最差)
+     *
+     *
+     * ps: 项目是普通的java程序,需要在Run Configuration 里加入Application运行项目,并选择animtool项目,接下来按提示配置即可
+     */
+    public static void animTool() {
+        final CommonArg commonArg = new CommonArg();
+        // 视频对齐方式 ORIN_H = 左右对齐, ORIN_V 上下对齐
+        commonArg.orin = CommonArg.ORIN_H;
+        // 素材宽高 px
+        commonArg.videoW = 672;
+        commonArg.videoH = 1504;
+        // 总帧数
+        commonArg.totalFrame = 240;
+        // fps
+        commonArg.fps = 24;
+        // 素材文件路径
+        commonArg.inputPath = "/Users/hexleo/temp/begod/portrait/god";
+        // 中间素材输出路径
+        commonArg.outputPath = commonArg.inputPath + "/output";
+
+        // 开始运行
+        AnimTool animTool = new AnimTool();
+        // needVideo true 直接生成video false 生成帧图片,由用户手动生成最终视频文件
+        animTool.create(commonArg, true);
+    }
+    /**
+     * 生成对应的box bin
+     * 执行 mp4edit --insert :vapc.bin:1 demo_origin.mp4 demo_output.mp4 插入对应box
+     */
+    private void mp4BoxTool(String inputFile, String outputPath) throws Exception {
+        Mp4BoxTool mp4BoxTool = new Mp4BoxTool();
+        mp4BoxTool.create(inputFile, outputPath);
+    }
+
+    /**
+     * 取出mp4文件中vapc部分json内容
+     */
+    public static void mp4ParseBox(String inputFile, String outputPath) throws Exception {
+        Mp4BoxTool mp4BoxTool = new Mp4BoxTool();
+        mp4BoxTool.parse(inputFile, outputPath);
+    }
+
+
+}

+ 94 - 0
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Md5Util.java

@@ -0,0 +1,94 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.animtool;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.MessageDigest;
+
+public class Md5Util {
+    private char[] hexDigits = new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+
+    public String getFileMD5(File file, String outputPath) {
+        if (!file.exists() || !file.isFile() || file.length() <= 0) {
+            return null;
+        }
+        InputStream inputStream = null;
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            inputStream = new FileInputStream(file);
+            byte[] dataBytes = new byte[4096];
+            int iRd = inputStream.read(dataBytes);
+            while (iRd != -1) {
+                md.update(dataBytes, 0, iRd);
+                iRd = inputStream.read(dataBytes);
+            }
+            inputStream.close();
+            byte[] digest = md.digest();
+            String md5txt = "";
+            if (digest != null) {
+                md5txt = bufferToHex(digest);
+            }
+            try {
+                BufferedWriter writer = new BufferedWriter(new FileWriter(outputPath + "/md5.txt"));
+                writer.write(md5txt);
+                writer.flush();
+                writer.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+                throw new RuntimeException();
+            }
+            return md5txt;
+        } catch (Throwable t) {
+            t.printStackTrace();
+        } finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (Throwable e) {
+                    e.printStackTrace();
+                }
+
+            }
+        }
+        return null;
+    }
+
+    private String bufferToHex(byte[] bytes) {
+        return bufferToHex(bytes, 0, bytes.length);
+    }
+
+    private String bufferToHex(byte[] bytes, int m, int n) {
+        StringBuffer sb = new StringBuffer(2 * n);
+        int k = m + n;
+        for (int l=m; l<k; l++) {
+            appendHexPair(bytes[l], sb);
+        }
+        return sb.toString();
+    }
+
+    private void appendHexPair(byte bt, StringBuffer sb) {
+        char c0 = hexDigits[(bt & 0xf0) >>> 4];
+        char c1 = hexDigits[bt & 0x0f];
+        sb.append(c0);
+        sb.append(c1);
+    }
+}

+ 155 - 0
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Mp4BoxTool.java

@@ -0,0 +1,155 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.animtool;
+
+import java.io.*;
+
+/**
+ * mp4 box 处理类
+ * 生成对应的box bin
+ * 执行 mp4edit --insert :vapc.bin:1 demo_origin.mp4 demo_output.mp4 插入对应个box
+ */
+public class Mp4BoxTool {
+
+    private static final String TAG = "Mp4BoxTool";
+
+    /**
+     * 输入json文件,输出vapc.bin可以直接进行mp4合成
+     */
+    public void create(String inputFile, String outputPath) throws Exception {
+        File input = new File(inputFile);
+        if (!input.exists() || !input.isFile()) {
+            TLog.i(TAG, "input file not exist");
+            return;
+        }
+        checkDir(outputPath);
+        File output = new File(outputPath + "/vapc.bin");
+        InputStream is = new FileInputStream(input);
+        OutputStream os = new FileOutputStream(output);
+        // 8字节的box头部
+        byte[] boxHead = getBoxHead(input.length());
+        os.write(boxHead, 0, boxHead.length);
+
+        // 复制文件
+        byte[] buffer = new byte[8192];
+        int length;
+        while ((length = is.read(buffer)) > 0) {
+            os.write(buffer, 0, length);
+        }
+        is.close();
+        os.close();
+        TLog.i(TAG, "success");
+    }
+
+    private void checkDir(String path) {
+        File file = new File(path);
+        if (!file.exists()) {
+            file.mkdirs();
+        }
+    }
+
+    private byte[] getBoxHead(long fileLen) {
+        // 加上头部的8字节
+        fileLen += 8;
+        byte[] boxHead = new byte[8];
+        // 只取4字节,大于2G的文件一概不处理
+        boxHead[0] = (byte) (fileLen >>> 24 & 0xff);
+        boxHead[1] = (byte) (fileLen >>> 16 & 0xff);
+        boxHead[2] = (byte) (fileLen >>>  8 & 0xff);
+        boxHead[3] = (byte) (fileLen & 0xff);
+
+        // 插入vapc
+        boxHead[4] = 0x76;
+        boxHead[5] = 0x61;
+        boxHead[6] = 0x70;
+        boxHead[7] = 0x63;
+
+        return boxHead;
+    }
+
+
+    /**
+     * 取出mp4文件中vapc部分json内容
+     */
+    public void parse(String inputFile, String outputPath) throws Exception {
+        File input = new File(inputFile);
+        if (!input.exists() || !input.isFile()) {
+            TLog.i(TAG, "input file not exist");
+            return;
+        }
+
+        // 查找vapc box
+        RandomAccessFile mp4File = new RandomAccessFile(inputFile, "r");
+
+        byte[] boxHead = new byte[8];
+        BoxHead head = null;
+        long vapcStartIndex = 0;
+        while (mp4File.read(boxHead, 0 , boxHead.length) == 8) {
+            head = parseBoxHead(boxHead);
+            if (head == null) break;
+            if ("vapc".equals(head.type)) {
+                head.startIndex = vapcStartIndex;
+                break;
+            }
+            mp4File.seek(head.length);
+            vapcStartIndex += head.length;
+        }
+
+        if (head == null) {
+            TLog.i(TAG, "vapc box head not found");
+            return;
+        }
+
+        // 读取vapc box
+        byte[] vapcBuf = new byte[(int) (head.length - 8)]; // ps: OOM exception
+        mp4File.seek(head.startIndex + 8); // 减去头部8字节
+        mp4File.read(vapcBuf);
+        mp4File.close();
+
+        checkDir(outputPath);
+        File output = new File(outputPath + "/vapc.json");
+
+        OutputStream os = new FileOutputStream(output);
+        // 8字节的box头部
+        os.write(vapcBuf, 0, vapcBuf.length);
+        os.close();
+
+        String json = new String(vapcBuf,0, vapcBuf.length, "UTF-8");
+        TLog.i(TAG, "success");
+        TLog.i(TAG, json);
+    }
+
+    private BoxHead parseBoxHead(byte[] boxHead) throws Exception {
+        if (boxHead.length != 8) return null;
+        BoxHead head = new BoxHead();
+        long length = 0;
+        length = length | ((boxHead[0] & 0xff) << 24);
+        length = length | ((boxHead[1] & 0xff) << 16);
+        length = length | ((boxHead[2] & 0xff) <<  8);
+        length = length |  (boxHead[3] & 0xff);
+        head.length = length;
+        head.type = new String(boxHead,4, 4, "US-ASCII");
+        return head;
+    }
+
+    class BoxHead {
+        long startIndex;
+        long length;
+        String type;
+    }
+
+
+}

+ 22 - 0
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/TLog.java

@@ -0,0 +1,22 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.animtool;
+
+public class TLog {
+    public static void i(String tag, String msg) {
+        System.out.println(tag + "\t" + msg);
+    }
+}

+ 1 - 0
Android/PlayerProj/app/.gitignore

@@ -0,0 +1 @@
+/build

+ 36 - 0
Android/PlayerProj/app/build.gradle

@@ -0,0 +1,36 @@
+apply plugin: 'com.android.application'
+
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+    compileSdkVersion 28
+    defaultConfig {
+        applicationId "com.tencent.qgame.playerproj"
+        minSdkVersion 16
+        targetSdkVersion 28
+        versionCode 1
+        versionName "1.0"
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+    lintOptions {
+        abortOnError false
+    }
+}
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+    implementation project(":animplayer")
+}
+
+project.afterEvaluate {
+    def assembleDebugTask = project.tasks.find { it.name == 'assembleDebug' }
+    def lintTask = project.tasks.find { it.name == 'lintDebug' }
+    assembleDebugTask.dependsOn(lintTask)
+}

+ 21 - 0
Android/PlayerProj/app/proguard-rules.pro

@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 29 - 0
Android/PlayerProj/app/src/main/AndroidManifest.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="com.tencent.qgame.playerproj">
+
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
+    <application
+            android:allowBackup="true"
+            android:icon="@drawable/icon"
+            android:label="@string/app_name"
+            android:supportsRtl="true"
+            android:theme="@style/AppTheme">
+        <activity android:name=".MainActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".player.AnimSimpleDemoActivity" android:screenOrientation="portrait"/>
+        <activity android:name=".player.AnimVapxDemoActivity" android:screenOrientation="portrait"/>
+        <activity android:name=".player.AnimActiveDemoActivity" android:screenOrientation="portrait"/>
+
+
+    </application>
+
+</manifest>

BIN
Android/PlayerProj/app/src/main/assets/demo.mp4


BIN
Android/PlayerProj/app/src/main/assets/mask_blur_demo.mp4


BIN
Android/PlayerProj/app/src/main/assets/mask_trunk_demo.mp4


BIN
Android/PlayerProj/app/src/main/assets/vapx.mp4


+ 44 - 0
Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/MainActivity.kt

@@ -0,0 +1,44 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import com.tencent.qgame.playerproj.player.AnimActiveDemoActivity
+import com.tencent.qgame.playerproj.player.AnimSimpleDemoActivity
+import com.tencent.qgame.playerproj.player.AnimVapxDemoActivity
+import kotlinx.android.synthetic.main.activity_main.*
+
+
+class MainActivity : Activity(){
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_main)
+        btn1.setOnClickListener {
+            startActivity(Intent(this, AnimSimpleDemoActivity::class.java))
+        }
+        btn2.setOnClickListener {
+            startActivity(Intent(this, AnimVapxDemoActivity::class.java))
+        }
+        btn3.setOnClickListener {
+            startActivity(Intent(this, AnimActiveDemoActivity::class.java))
+        }
+    }
+
+
+}

+ 289 - 0
Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimActiveDemoActivity.kt

@@ -0,0 +1,289 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.player
+
+import android.app.Activity
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.BitmapFactory
+import android.os.Bundle
+import android.os.Environment
+import android.os.Handler
+import android.os.Looper
+import android.util.Base64
+import android.util.Log
+import android.view.View
+import android.widget.Toast
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.AnimView
+import com.tencent.qgame.animplayer.PointRect
+import com.tencent.qgame.animplayer.RefVec2
+import com.tencent.qgame.animplayer.inter.IAnimListener
+import com.tencent.qgame.animplayer.inter.IFetchResource
+import com.tencent.qgame.animplayer.inter.OnResourceClickListener
+import com.tencent.qgame.animplayer.mask.MaskConfig
+import com.tencent.qgame.animplayer.mix.Resource
+import com.tencent.qgame.animplayer.util.ALog
+import com.tencent.qgame.animplayer.util.IALog
+import com.tencent.qgame.playerproj.R
+import kotlinx.android.synthetic.main.activity_anim_simple_demo.*
+import java.io.File
+import java.nio.ByteBuffer
+import java.util.*
+import java.util.zip.Inflater
+import kotlin.experimental.and
+import kotlin.math.sqrt
+
+
+/**
+ * VAPX demo (融合特效Demo)
+ * 必须使用组件里提供的工具才能生成VAPX动画
+ */
+class AnimActiveDemoActivity : Activity(), IAnimListener {
+
+    companion object {
+        private const val TAG = "AnimSimpleDemoActivity"
+    }
+
+    private val dir by lazy {
+        // 存放在sdcard应用缓存文件中
+        getExternalFilesDir(null)?.absolutePath ?: Environment.getExternalStorageDirectory().path
+    }
+
+    private var head1Img = true
+
+    // 视频信息
+    data class VideoInfo(val fileName: String, val md5: String)
+
+    private val videoInfo = VideoInfo("mask_trunk_demo.mp4", "74d24e6235304e3c56b12d4867ea7d30")
+
+
+    // 动画View
+    private lateinit var animView: AnimView
+    var maskBitmap: Bitmap? = null
+
+
+    private val uiHandler by lazy {
+        Handler(Looper.getMainLooper())
+    }
+
+    override fun onStop() {
+        maskBitmap?.recycle()
+        maskBitmap = null
+        super.onStop()
+    }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_anim_simple_demo)
+        // 文件加载完成后会调用init方法
+        val files = Array(1) {
+            videoInfo.fileName
+        }
+        FileUtil.copyAssetsToStorage(this, dir, files) {
+            uiHandler.post {
+                init()
+            }
+        }
+    }
+
+    private fun init() {
+        // 初始化日志
+        initLog()
+        // 初始化调试开关
+        initTestView()
+        // 获取动画view
+        animView = playerView
+
+        animView.supportMask(true, true)
+
+        // 注册动画监听
+        animView.setAnimListener(this)
+        /**
+         * 开始播放主流程
+         * ps: 主要流程都是对AnimView的操作,其它比如队列,或改变窗口大小等操作都不是必须的
+         */
+        play(videoInfo)
+    }
+
+
+    private fun play(videoInfo: VideoInfo) {
+        // 播放前强烈建议检查文件的md5是否有改变
+        // 因为下载或文件存储过程中会出现文件损坏,导致无法播放
+        Thread {
+            val file = File(dir + "/" + videoInfo.fileName)
+            val md5 = FileUtil.getFileMD5(file)
+            if (videoInfo.md5 == md5) {
+                // 开始播放动画文件
+                animView.startPlay(file)
+            } else {
+                Log.e(TAG, "md5 is not match, error md5=$md5")
+            }
+        }.start()
+    }
+
+    /**
+     * 视频信息准备好后的回调,用于检查视频准备好后是否继续播放
+     * @return true 继续播放 false 停止播放
+     */
+    override fun onVideoConfigReady(config: AnimConfig): Boolean {
+        updateTestMask()
+        uiHandler.post {
+            val w = window.decorView.width
+            val lp = animView.layoutParams
+            lp.width = if (w == 0) dp2px(this, 400f).toInt() else w
+            lp.height = (w * config.height * 1f / config.width).toInt()
+            animView.layoutParams = lp
+        }
+        return true
+    }
+
+    /**
+     * 视频开始回调
+     */
+    override fun onVideoStart() {
+        Log.i(TAG, "onVideoStart")
+    }
+
+    /**
+     * 视频渲染每一帧时的回调
+     * @param frameIndex 帧索引
+     */
+    override fun onVideoRender(frameIndex: Int, config: AnimConfig?) {
+    }
+
+    /**
+     * 视频播放结束(失败也会回调onComplete)
+     */
+    override fun onVideoComplete() {
+        Log.i(TAG, "onVideoComplete")
+    }
+
+    /**
+     * 播放器被销毁情况下会调用onVideoDestroy
+     */
+    override fun onVideoDestroy() {
+        Log.i(TAG, "onVideoDestroy")
+    }
+
+    /**
+     * 失败回调
+     * 一次播放时可能会调用多次,建议onFailed只做错误上报
+     * @param errorType 错误类型
+     * @param errorMsg 错误消息
+     */
+    override fun onFailed(errorType: Int, errorMsg: String?) {
+        Log.i(TAG, "onFailed errorType=$errorType errorMsg=$errorMsg")
+    }
+
+
+    override fun onPause() {
+        super.onPause()
+        // 页面切换是停止播放
+        animView.stopPlay()
+    }
+
+
+    private fun initLog() {
+        ALog.isDebug = false
+        ALog.log = object : IALog {
+            override fun i(tag: String, msg: String) {
+                Log.i(tag, msg)
+            }
+
+            override fun d(tag: String, msg: String) {
+                Log.d(tag, msg)
+            }
+
+            override fun e(tag: String, msg: String) {
+                Log.e(tag, msg)
+            }
+
+            override fun e(tag: String, msg: String, tr: Throwable) {
+                Log.e(tag, msg, tr)
+            }
+        }
+    }
+
+    private fun updateTestMask() {
+        val bitmap = handleDepthMaskData("eNrt1cFtxSAMBuAgDhwZIZuU0WCTjlJGyQgckYpwn57U6kGInYQQkPq4foeAHf+epvf5P+eDcDAoM1hQ5+BQlxBQVxBR1wD49XFnDzfo9QEs4VgBxA53aHlo9xU+Pzw0dPXwWOmAt7+9m/MOe9x2c/b0pbO7bs53ue/sobPHzg6juxncbS8XgAfAIO7OurzGfWcPZ32+x+NZV2M49PatgNAX+VYAAO7y1xe0vZv++/mNAeOAuyD873obAzQTrnZ7wJ9X7fGUw2UOLZzd6KaBv77PDu5LpbvG7is9VHps7IDG2zkXd7q53uURt1h8l11X+iuXBqS36yPu3o56IWBUpeuRPKDrreSccHHAvwj/LASovNEl6YC6aO8Ga1/BBeEz4Spze9A14cnfw+s8Us7WAXmpTytn6XCsAihzTbo/5jx1RXpAfSYdKDeYy7yBPA03mRd47W67Pk/3NS7yhLvZ+SphV+4JdzXOhnOdLj/al9y/U7d5vk2vro/6DEZhLlNX6/WYeGF9G1H2H2Jpic4=")
+        val maskConfig = MaskConfig()
+        maskConfig.safeSetMaskBitmapAndReleasePre(bitmap)
+        maskConfig.maskTexPair = Pair(PointRect(0, 0, 1080, 607), RefVec2(1080, 607))
+        maskConfig.maskPositionPair = Pair(PointRect(64, 64, 128, 128), RefVec2(256, 256))
+        animView.updateMaskConfig(maskConfig)
+    }
+
+
+    private fun initTestView() {
+        btnLayout.visibility = View.VISIBLE
+        /**
+         * 开始播放按钮
+         */
+        btnPlay.setOnClickListener {
+            updateTestMask()
+            play(videoInfo)
+        }
+        /**
+         * 结束视频按钮
+         */
+        btnStop.setOnClickListener {
+            animView.stopPlay()
+        }
+    }
+
+    private fun handleDepthMaskData(compressedBase64Data: String) : Bitmap? {
+        var zipInflater : Inflater?= null
+        try {
+            val base64Bytes = Base64.decode(compressedBase64Data, Base64.DEFAULT)
+            zipInflater = Inflater()
+            zipInflater.setInput(base64Bytes, 0, base64Bytes.size)
+            val zlibBytes = ByteArray(128 * 128)
+            val zlibByteLength = zipInflater.inflate(zlibBytes)
+            if(zlibByteLength > 0) {
+                val resultBytes = ByteArray(zlibByteLength * 8 * 4)
+                for (outLoop in 0 until zlibByteLength) { //位展开操作
+                    for(inLoop in 0 until 8) {
+                        if (zlibBytes[outLoop] and (1 shl inLoop).toByte() == 0.toByte()) {
+                            resultBytes[outLoop * 8 * 4 + (7- inLoop) * 4] = 255.toByte()
+                            resultBytes[outLoop * 8 * 4 + (7- inLoop) * 4 + 1] = 255.toByte()
+                            resultBytes[outLoop * 8 * 4 + (7- inLoop) * 4 + 2] = 255.toByte()
+                            resultBytes[outLoop * 8 * 4 + (7- inLoop) * 4 + 3] = 255.toByte()
+                        }
+                    }
+                }
+                val width = sqrt((zlibByteLength * 8).toDouble())
+                if(maskBitmap == null || maskBitmap?.isRecycled != false || (maskBitmap?.width ?: 0) < width) {
+                    maskBitmap = Bitmap.createBitmap(width.toInt(), width.toInt(), Bitmap.Config.ARGB_8888)
+                }
+                maskBitmap?.copyPixelsFromBuffer( ByteBuffer.wrap(resultBytes))
+
+            }
+        } catch (e: Exception) {
+            Log.e(TAG, "base64ToBitmap error:" + e.message)
+        } finally {
+            zipInflater?.end()
+        }
+        return maskBitmap
+    }
+
+
+    private fun dp2px(context: Context, dp: Float): Float {
+        val scale = context.resources.displayMetrics.density
+        return dp * scale + 0.5f
+    }
+}
+

+ 220 - 0
Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimSimpleDemoActivity.kt

@@ -0,0 +1,220 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.player
+
+import android.app.Activity
+import android.content.Context
+import android.os.Bundle
+import android.os.Environment
+import android.os.Handler
+import android.os.Looper
+import android.util.Log
+import android.view.View
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.AnimView
+import com.tencent.qgame.animplayer.inter.IAnimListener
+import com.tencent.qgame.animplayer.util.ALog
+import com.tencent.qgame.animplayer.util.IALog
+import com.tencent.qgame.playerproj.R
+import kotlinx.android.synthetic.main.activity_anim_simple_demo.*
+import java.io.File
+
+/**
+ * 简单使用demo
+ */
+class AnimSimpleDemoActivity : Activity(), IAnimListener {
+
+    companion object {
+        private const val TAG = "AnimSimpleDemoActivity"
+    }
+
+    private val dir by lazy {
+        // 存放在sdcard应用缓存文件中
+        getExternalFilesDir(null)?.absolutePath ?: Environment.getExternalStorageDirectory().path
+    }
+
+    // 视频信息
+    data class VideoInfo(val fileName: String,val md5:String)
+
+    // ps:每次修改mp4文件,但文件名不变,记得先卸载app,因为assets同名文件不会进行替换
+    private val videoInfo = VideoInfo("demo.mp4", "3132824326bb07a1143739863e1e5762")
+
+    // 动画View
+    private lateinit var animView: AnimView
+
+    private val uiHandler by lazy {
+        Handler(Looper.getMainLooper())
+    }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_anim_simple_demo)
+        // 文件加载完成后会调用init方法
+        loadFile()
+    }
+
+    private fun init() {
+        // 初始化日志
+        initLog()
+        // 初始化调试开关
+        initTestView()
+        // 获取动画view
+        animView = playerView
+        // 注册动画监听
+        animView.setAnimListener(this)
+        /**
+         * 开始播放主流程
+         * ps: 主要流程都是对AnimView的操作,其它比如队列,或改变窗口大小等操作都不是必须的
+         */
+        play(videoInfo)
+    }
+
+
+    private fun play(videoInfo: VideoInfo) {
+        // 播放前强烈建议检查文件的md5是否有改变
+        // 因为下载或文件存储过程中会出现文件损坏,导致无法播放
+        Thread {
+            val file = File(dir + "/" + videoInfo.fileName)
+            val md5 = FileUtil.getFileMD5(file)
+            if (videoInfo.md5 == md5) {
+                // 开始播放动画文件
+                animView.startPlay(file)
+            } else {
+                Log.e(TAG, "md5 is not match, error md5=$md5")
+            }
+        }.start()
+    }
+
+
+    /**
+     * 视频信息准备好后的回调,用于检查视频准备好后是否继续播放
+     * @return true 继续播放 false 停止播放
+     */
+    override fun onVideoConfigReady(config: AnimConfig): Boolean {
+
+        uiHandler.post {
+            val w = dp2px(this,400f).toInt()
+            val lp = animView.layoutParams
+            lp.width = w
+            lp.height = (w * config.height *1f / config.width).toInt()
+            animView.layoutParams = lp
+        }
+        return true
+    }
+
+    /**
+     * 视频开始回调
+     */
+    override fun onVideoStart() {
+        Log.i(TAG, "onVideoStart")
+    }
+
+    /**
+     * 视频渲染每一帧时的回调
+     * @param frameIndex 帧索引
+     */
+    override fun onVideoRender(frameIndex: Int, config: AnimConfig?) {
+    }
+
+    /**
+     * 视频播放结束(失败也会回调onComplete)
+     */
+    override fun onVideoComplete() {
+        Log.i(TAG, "onVideoComplete")
+    }
+
+    /**
+     * 播放器被销毁情况下会调用onVideoDestroy
+     */
+    override fun onVideoDestroy() {
+        Log.i(TAG, "onVideoDestroy")
+    }
+
+    /**
+     * 失败回调
+     * 一次播放时可能会调用多次,建议onFailed只做错误上报
+     * @param errorType 错误类型
+     * @param errorMsg 错误消息
+     */
+    override fun onFailed(errorType: Int, errorMsg: String?) {
+        Log.i(TAG, "onFailed errorType=$errorType errorMsg=$errorMsg")
+    }
+
+
+
+    override fun onPause() {
+        super.onPause()
+        // 页面切换是停止播放
+        animView.stopPlay()
+    }
+
+
+    private fun initLog() {
+        ALog.isDebug = false
+        ALog.log = object : IALog {
+            override fun i(tag: String, msg: String) {
+                Log.i(tag, msg)
+            }
+
+            override fun d(tag: String, msg: String) {
+                Log.d(tag, msg)
+            }
+
+            override fun e(tag: String, msg: String) {
+                Log.e(tag, msg)
+            }
+
+            override fun e(tag: String, msg: String, tr: Throwable) {
+                Log.e(tag, msg, tr)
+            }
+        }
+    }
+
+
+    private fun initTestView() {
+        btnLayout.visibility = View.VISIBLE
+        /**
+         * 开始播放按钮
+         */
+        btnPlay.setOnClickListener {
+            play(videoInfo)
+        }
+        /**
+         * 结束视频按钮
+         */
+        btnStop.setOnClickListener {
+            animView.stopPlay()
+        }
+    }
+
+    private fun loadFile() {
+        val files = Array(1) {
+            videoInfo.fileName
+        }
+        FileUtil.copyAssetsToStorage(this, dir, files) {
+            uiHandler.post {
+                init()
+            }
+        }
+    }
+
+
+    private fun dp2px(context: Context, dp: Float): Float {
+        val scale = context.resources.displayMetrics.density
+        return dp * scale + 0.5f
+    }
+}
+

+ 289 - 0
Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimVapxDemoActivity.kt

@@ -0,0 +1,289 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.player
+
+import android.app.Activity
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.BitmapFactory
+import android.os.Bundle
+import android.os.Environment
+import android.os.Handler
+import android.os.Looper
+import android.util.Log
+import android.view.View
+import android.widget.Toast
+import com.tencent.qgame.animplayer.AnimConfig
+import com.tencent.qgame.animplayer.AnimView
+import com.tencent.qgame.animplayer.inter.IAnimListener
+import com.tencent.qgame.animplayer.inter.IFetchResource
+import com.tencent.qgame.animplayer.inter.OnResourceClickListener
+import com.tencent.qgame.animplayer.mix.Resource
+import com.tencent.qgame.animplayer.util.ALog
+import com.tencent.qgame.animplayer.util.IALog
+import com.tencent.qgame.playerproj.R
+import kotlinx.android.synthetic.main.activity_anim_simple_demo.*
+import java.io.File
+import java.util.*
+
+
+/**
+ * VAPX demo (融合特效Demo)
+ * 必须使用组件里提供的工具才能生成VAPX动画
+ */
+class AnimVapxDemoActivity : Activity(), IAnimListener {
+
+    companion object {
+        private const val TAG = "AnimSimpleDemoActivity"
+    }
+
+    private val dir by lazy {
+        // 存放在sdcard应用缓存文件中
+        getExternalFilesDir(null)?.absolutePath ?: Environment.getExternalStorageDirectory().path
+    }
+
+    private var head1Img = true
+
+    // 视频信息
+    data class VideoInfo(val fileName: String, val md5: String)
+
+    private val videoInfo = VideoInfo("vapx.mp4", "f981e0f094ead842ad5ae99f1ffaa1a1")
+
+    // 动画View
+    private lateinit var animView: AnimView
+
+    private val uiHandler by lazy {
+        Handler(Looper.getMainLooper())
+    }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_anim_simple_demo)
+        // 文件加载完成后会调用init方法
+        loadFile()
+    }
+
+    private fun init() {
+        // 初始化日志
+        initLog()
+        // 初始化调试开关
+        initTestView()
+        // 获取动画view
+        animView = playerView
+        /**
+         * 注册资源获取类
+         */
+        animView.setFetchResource(object : IFetchResource {
+            /**
+             * 获取图片资源
+             * 无论图片是否获取成功都必须回调 result 否则会无限等待资源
+             */
+            override fun fetchImage(resource: Resource, result: (Bitmap?) -> Unit) {
+                /**
+                 * srcTag是素材中的一个标记,在制作素材时定义
+                 * 解析时由业务读取tag决定需要播放的内容是什么
+                 * 比如:一个素材里需要显示多个头像,则需要定义多个不同的tag,表示不同位置,需要显示不同的头像,文字类似
+                 */
+                val srcTag = resource.tag
+
+                if (srcTag == "[sImg1]") { // 此tag是已经写入到动画配置中的tag
+                    val drawableId = if (head1Img) R.drawable.head1 else R.drawable.head2
+                    head1Img = !head1Img
+                    val options = BitmapFactory.Options()
+                    options.inScaled = false
+                    result(BitmapFactory.decodeResource(resources, drawableId, options))
+                } else {
+                    result(null)
+                }
+            }
+
+            /**
+             * 获取文字资源
+             */
+            override fun fetchText(resource: Resource, result: (String?) -> Unit) {
+                val str = "恭喜 No.${1000 + Random().nextInt(8999)}用户 升神"
+                val srcTag = resource.tag
+
+                if (srcTag == "[sTxt1]") { // 此tag是已经写入到动画配置中的tag
+                    result(str)
+                } else {
+                    result(null)
+                }
+            }
+
+            /**
+             * 播放完毕后的资源回收
+             */
+            override fun releaseResource(resources: List<Resource>) {
+                resources.forEach {
+                    it.bitmap?.recycle()
+                }
+            }
+        })
+
+        // 注册点击事件监听
+        animView.setOnResourceClickListener(object : OnResourceClickListener {
+            override fun onClick(resource: Resource) {
+                Toast.makeText(
+                    this@AnimVapxDemoActivity,
+                    "srcTag=${resource.tag} onClick",
+                    Toast.LENGTH_LONG
+                ).show()
+            }
+        })
+
+        // 注册动画监听
+        animView.setAnimListener(this)
+        /**
+         * 开始播放主流程
+         * ps: 主要流程都是对AnimView的操作,其它比如队列,或改变窗口大小等操作都不是必须的
+         */
+        play(videoInfo)
+    }
+
+
+    private fun play(videoInfo: VideoInfo) {
+        // 播放前强烈建议检查文件的md5是否有改变
+        // 因为下载或文件存储过程中会出现文件损坏,导致无法播放
+        Thread {
+            val file = File(dir + "/" + videoInfo.fileName)
+            val md5 = FileUtil.getFileMD5(file)
+            if (videoInfo.md5 == md5) {
+                // 开始播放动画文件
+                animView.startPlay(file)
+            } else {
+                Log.e(TAG, "md5 is not match, error md5=$md5")
+            }
+        }.start()
+    }
+
+    /**
+     * 视频信息准备好后的回调,用于检查视频准备好后是否继续播放
+     * @return true 继续播放 false 停止播放
+     */
+    override fun onVideoConfigReady(config: AnimConfig): Boolean {
+        uiHandler.post {
+            val w = window.decorView.width
+            val lp = animView.layoutParams
+            lp.width = if (w == 0) dp2px(this, 400f).toInt() else w
+            lp.height = (w * config.height * 1f / config.width).toInt()
+            animView.layoutParams = lp
+        }
+        return true
+    }
+
+    /**
+     * 视频开始回调
+     */
+    override fun onVideoStart() {
+        Log.i(TAG, "onVideoStart")
+    }
+
+    /**
+     * 视频渲染每一帧时的回调
+     * @param frameIndex 帧索引
+     */
+    override fun onVideoRender(frameIndex: Int, config: AnimConfig?) {
+    }
+
+    /**
+     * 视频播放结束(失败也会回调onComplete)
+     */
+    override fun onVideoComplete() {
+        Log.i(TAG, "onVideoComplete")
+    }
+
+    /**
+     * 播放器被销毁情况下会调用onVideoDestroy
+     */
+    override fun onVideoDestroy() {
+        Log.i(TAG, "onVideoDestroy")
+    }
+
+    /**
+     * 失败回调
+     * 一次播放时可能会调用多次,建议onFailed只做错误上报
+     * @param errorType 错误类型
+     * @param errorMsg 错误消息
+     */
+    override fun onFailed(errorType: Int, errorMsg: String?) {
+        Log.i(TAG, "onFailed errorType=$errorType errorMsg=$errorMsg")
+    }
+
+
+    override fun onPause() {
+        super.onPause()
+        // 页面切换是停止播放
+        animView.stopPlay()
+    }
+
+
+    private fun initLog() {
+        ALog.isDebug = false
+        ALog.log = object : IALog {
+            override fun i(tag: String, msg: String) {
+                Log.i(tag, msg)
+            }
+
+            override fun d(tag: String, msg: String) {
+                Log.d(tag, msg)
+            }
+
+            override fun e(tag: String, msg: String) {
+                Log.e(tag, msg)
+            }
+
+            override fun e(tag: String, msg: String, tr: Throwable) {
+                Log.e(tag, msg, tr)
+            }
+        }
+    }
+
+
+    private fun initTestView() {
+        btnLayout.visibility = View.VISIBLE
+        /**
+         * 开始播放按钮
+         */
+        btnPlay.setOnClickListener {
+            play(videoInfo)
+        }
+        /**
+         * 结束视频按钮
+         */
+        btnStop.setOnClickListener {
+            animView.stopPlay()
+        }
+    }
+
+    private fun loadFile() {
+        val files = Array(1) {
+            videoInfo.fileName
+        }
+        FileUtil.copyAssetsToStorage(this, dir, files) {
+            uiHandler.post {
+                init()
+            }
+        }
+    }
+
+
+    private fun dp2px(context: Context, dp: Float): Float {
+        val scale = context.resources.displayMetrics.density
+        return dp * scale + 0.5f
+    }
+}
+

+ 109 - 0
Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/FileUtil.kt

@@ -0,0 +1,109 @@
+/*
+ * Tencent is pleased to support the open source community by making vap available.
+ *
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * Licensed under the MIT License (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/MIT
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.tencent.qgame.playerproj.player
+
+import android.content.Context
+import java.io.*
+import java.security.MessageDigest
+
+object FileUtil {
+
+    private val hexDigits = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f')
+
+    fun copyAssetsToStorage(context: Context, dir: String, files: Array<String>, loadSuccess:()->Unit) {
+        Thread {
+            var outputStream: OutputStream
+            var inputStream: InputStream
+            val buf = ByteArray(4096)
+            files.forEach {
+                try {
+                    if (File("$dir/$it").exists()) {
+                        return@forEach
+                    }
+                    inputStream = context.assets.open(it)
+                    outputStream = FileOutputStream("$dir/$it")
+                    var length = inputStream.read(buf)
+                    while (length > 0) {
+                        outputStream.write(buf, 0, length)
+                        length = inputStream.read(buf)
+                    }
+                    outputStream.close()
+                    inputStream.close()
+                } catch (e: IOException) {
+                    e.printStackTrace()
+                    return@Thread
+                }
+            }
+            loadSuccess.invoke()
+        }.start()
+
+    }
+
+    fun getFileMD5(file: File): String? {
+        if (!file.exists() || !file.isFile || file.length() <= 0) {
+            return null
+        }
+        var inputStream: InputStream? = null
+        try {
+            val md = MessageDigest.getInstance("MD5")
+            inputStream = FileInputStream(file)
+            val dataBytes = ByteArray(4096)
+            var iRd: Int
+            iRd = inputStream.read(dataBytes)
+            while (iRd != -1) {
+                md.update(dataBytes, 0, iRd)
+                iRd = inputStream.read(dataBytes)
+            }
+            inputStream.close()
+            val digest = md.digest()
+            if (digest != null) {
+                return bufferToHex(digest)
+            }
+        } catch (t: Throwable) {
+            t.printStackTrace()
+        } finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close()
+                } catch (e: Throwable) {
+                    e.printStackTrace()
+                }
+
+            }
+        }
+        return null
+    }
+
+    private fun bufferToHex(bytes: ByteArray): String {
+        return bufferToHex(bytes, 0, bytes.size)
+    }
+
+    private fun bufferToHex(bytes: ByteArray, m: Int, n: Int): String {
+        val sb = StringBuffer(2 * n)
+        val k = m + n
+        for (l in m until k) {
+            appendHexPair(bytes[l], sb)
+        }
+        return sb.toString()
+    }
+
+    private fun appendHexPair(bt: Byte, sb: StringBuffer) {
+        val c0 = hexDigits[bt.toInt() and 0xf0 ushr 4]
+        val c1 = hexDigits[bt.toInt() and 0x0f]
+        sb.append(c0)
+        sb.append(c1)
+    }
+}

BIN
Android/PlayerProj/app/src/main/res/drawable/bg.png


BIN
Android/PlayerProj/app/src/main/res/drawable/head1.png


BIN
Android/PlayerProj/app/src/main/res/drawable/head2.png


+ 74 - 0
Android/PlayerProj/app/src/main/res/drawable/ic_launcher_background.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:height="108dp"
+        android:width="108dp"
+        android:viewportHeight="108"
+        android:viewportWidth="108">
+    <path android:fillColor="#008577"
+          android:pathData="M0,0h108v108h-108z"/>
+    <path android:fillColor="#00000000" android:pathData="M9,0L9,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M19,0L19,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M29,0L29,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M39,0L39,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M49,0L49,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M59,0L59,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M69,0L69,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M79,0L79,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M89,0L89,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M99,0L99,108"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,9L108,9"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,19L108,19"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,29L108,29"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,39L108,39"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,49L108,49"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,59L108,59"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,69L108,69"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,79L108,79"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,89L108,89"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M0,99L108,99"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M19,29L89,29"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M19,39L89,39"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M19,49L89,49"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M19,59L89,59"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M19,69L89,69"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M19,79L89,79"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M29,19L29,89"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M39,19L39,89"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M49,19L49,89"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M59,19L59,89"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M69,19L69,89"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+    <path android:fillColor="#00000000" android:pathData="M79,19L79,89"
+          android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
+</vector>

BIN
Android/PlayerProj/app/src/main/res/drawable/icon.png


+ 37 - 0
Android/PlayerProj/app/src/main/res/layout/activity_anim_simple_demo.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/bg">
+
+
+    <LinearLayout
+        android:id="@+id/btnLayout"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="bottom|right"
+        android:orientation="horizontal"
+        android:visibility="gone">
+        <Button
+            android:id="@+id/btnPlay"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="PLAY"/>
+        <Button
+            android:id="@+id/btnStop"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="STOP"/>
+
+    </LinearLayout>
+
+    
+    <com.tencent.qgame.animplayer.AnimView
+        android:id="@+id/playerView"
+        android:layout_width="400dp"
+        android:layout_height="400dp"
+        android:layout_gravity="center"/>
+    
+</FrameLayout>

+ 39 - 0
Android/PlayerProj/app/src/main/res/layout/activity_main.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@android:color/white"
+    tools:context=".MainActivity">
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:layout_gravity="center"
+        >
+
+    <Button
+        android:id="@+id/btn1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Simple Demo" />
+
+    <Button
+        android:id="@+id/btn2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="VAPX Demo(融合动画)" />
+
+    <Button
+        android:id="@+id/btn3"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Active Demo(可变动画)" />
+    </LinearLayout>
+
+
+</FrameLayout>
+
+

+ 6 - 0
Android/PlayerProj/app/src/main/res/values/colors.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="colorPrimary">#008577</color>
+    <color name="colorPrimaryDark">#00574B</color>
+    <color name="colorAccent">#D81B60</color>
+</resources>

+ 3 - 0
Android/PlayerProj/app/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">AnimPlayer</string>
+</resources>

+ 7 - 0
Android/PlayerProj/app/src/main/res/values/styles.xml

@@ -0,0 +1,7 @@
+<resources>
+
+    <!-- Base application theme. -->
+    <style name="AppTheme" parent="@android:style/Theme.Black.NoTitleBar">
+    </style>
+
+</resources>

+ 17 - 0
Android/PlayerProj/app/src/test/java/com/tencent/qgame/playerproj/ExampleUnitTest.kt

@@ -0,0 +1,17 @@
+package com.tencent.qgame.playerproj
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+    @Test
+    fun addition_isCorrect() {
+        assertEquals(4, 2 + 2)
+    }
+}

+ 59 - 0
Android/PlayerProj/bintrayv1.gradle

@@ -0,0 +1,59 @@
+apply plugin: 'com.jfrog.bintray'
+
+version = libraryVersion
+
+if (project.hasProperty("android")) { // Android libraries
+    task sourcesJar(type: Jar) {
+        classifier = 'sources'
+        from android.sourceSets.main.java.srcDirs
+    }
+
+    task javadoc(type: Javadoc) {
+        source = android.sourceSets.main.java.srcDirs
+        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
+    }
+} else { // Java libraries
+    task sourcesJar(type: Jar, dependsOn: classes) {
+        classifier = 'sources'
+        from sourceSets.main.allSource
+    }
+}
+
+task javadocJar(type: Jar, dependsOn: javadoc) {
+    classifier = 'javadoc'
+    from javadoc.destinationDir
+}
+
+artifacts {
+    archives javadocJar
+    archives sourcesJar
+}
+
+// Bintray
+Properties properties = new Properties()
+properties.load(project.rootProject.file('local.properties').newDataInputStream())
+
+bintray {
+    user = properties.getProperty("bintray.user")
+    key = properties.getProperty("bintray.apikey")
+
+    configurations = ['archives']
+    pkg {
+        repo = bintrayRepo
+        name = bintrayName
+        desc = libraryDescription
+        websiteUrl = siteUrl
+        vcsUrl = gitUrl
+        licenses = allLicenses
+        publish = true
+        publicDownloadNumbers = true
+        version {
+            desc = libraryDescription
+            gpg {
+                sign = true //Determines whether to GPG sign the files. The default is false
+                passphrase = properties.getProperty("bintray.gpg.password")
+                //Optional. The passphrase for GPG signing'
+            }
+        }
+    }
+}

+ 29 - 0
Android/PlayerProj/build.gradle

@@ -0,0 +1,29 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+    ext.kotlin_version = '1.3.50'
+    repositories {
+        google()
+        jcenter()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:3.2.1'
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
+        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
+        // NOTE: Do not place your application dependencies here; they belong
+        // in the individual module build.gradle files
+    }
+}
+
+allprojects {
+    repositories {
+        google()
+        jcenter()
+    }
+    tasks.withType(Javadoc).all { enabled = false }
+}
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}

+ 15 - 0
Android/PlayerProj/gradle.properties

@@ -0,0 +1,15 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official

BIN
Android/PlayerProj/gradle/wrapper/gradle-wrapper.jar


+ 5 - 0
Android/PlayerProj/gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 172 - 0
Android/PlayerProj/gradlew

@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"

+ 84 - 0
Android/PlayerProj/gradlew.bat

@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 42 - 0
Android/PlayerProj/installv1.gradle

@@ -0,0 +1,42 @@
+apply plugin: 'com.github.dcendents.android-maven'
+
+group = publishedGroupId                               // Maven Group ID for the artifact
+
+install {
+    repositories.mavenInstaller {
+        // This generates POM.xml with proper parameters
+        pom {
+            project {
+                packaging 'aar'
+                groupId publishedGroupId
+                artifactId artifact
+
+                // Add your description here
+                name libraryName
+                description libraryDescription
+                url siteUrl
+
+                // Set your license
+                licenses {
+                    license {
+                        name licenseName
+                        url licenseUrl
+                    }
+                }
+                developers {
+                    developer {
+                        id developerId
+                        name developerName
+                        email developerEmail
+                    }
+                }
+                scm {
+                    connection gitUrl
+                    developerConnection gitUrl
+                    url siteUrl
+
+                }
+            }
+        }
+    }
+}

+ 37 - 0
Android/PlayerProj/maven.gradle

@@ -0,0 +1,37 @@
+apply plugin: 'maven'
+
+def GROUP = "com.tencent.qgame"
+def ARTIFACT_ID = "animplayer"
+def VERSION = "2.0.6"
+def IS_SNAPSHOTS = true
+def SNAPSHOTS_VERSION = "5"
+def USER_NAME = System.env.VAP_USER_NAME
+def KEY = System.env.VAP_KEY
+
+uploadArchives{
+    repositories.mavenDeployer{
+        // 配置本地仓库路径,项目根目录下的repository目录中
+        def repoUrl = "https://mirrors.tencent.com/repository/maven/thirdparty"
+        def version = VERSION
+        print("")
+        if (IS_SNAPSHOTS) {
+            version = VERSION + "." + SNAPSHOTS_VERSION + "-SNAPSHOT"
+            repoUrl = "https://mirrors.tencent.com/repository/maven/thirdparty-snapshots"
+        }
+
+        repository(url: repoUrl) {
+            authentication(userName: USER_NAME, password: KEY)
+            pom.groupId = GROUP
+            pom.artifactId = ARTIFACT_ID
+            pom.version = version
+        }
+
+        snapshotRepository(url: repoUrl) {
+            authentication(userName: USER_NAME, password: KEY)
+            pom.groupId = GROUP
+            pom.artifactId = ARTIFACT_ID
+            pom.version = version
+        }
+
+    }
+}

+ 1 - 0
Android/PlayerProj/settings.gradle

@@ -0,0 +1 @@
+include ':app', ':animtool', ':animplayer'

+ 113 - 0
Android/README.md

@@ -0,0 +1,113 @@
+## Android VAP
+
+使用kotlin实现,Java代码也可以直接引用,使用样例可以参考demo
+
+
+* 代码编写
+
+AnimView 视频显示使用的view
+IAnimListener 视频播放过程中的回调方法
+
+
+代码样例
+
+```kotlin
+private fun init() {
+    // 获取视频播放 AnimView
+    animView = (AnimView) findViewById(R.id.player);
+    // 开始播放动画文件
+    animView.startPlay(file)
+}
+```
+
+* IAnimListener 说明
+
+ps:所有回调都在VAP工作线程中
+
+```kotlin
+interface IAnimListener {
+    /**
+     * 配置准备好后回调
+     * @return true 继续播放 false 结束播放
+     */
+    fun onVideoConfigReady(config: AnimConfig): Boolean {
+        return true // 默认继续播放
+    }
+    
+    /**
+     * 开始播放
+     */
+    fun onVideoStart()
+
+
+    /**
+     * 视频渲染每一帧时的回调
+     * @param frameIndex 帧索引
+     */
+    fun onVideoRender(frameIndex: Int, config: AnimConfig?)
+
+    /**
+     * 视频播放结束(失败也会回调onComplete)
+     */
+    fun onVideoComplete()
+
+    /**
+     * 播放器被销毁情况下会调用onVideoDestroy
+     */
+    fun onVideoDestroy()
+
+    /**
+     * 失败回调
+     * 一次播放时可能会调用多次,建议onFailed只做错误上报
+     * @param errorType 错误类型
+     * @param errorMsg 错误消息
+     */
+    fun onFailed(errorType: Int, errorMsg: String?)
+}
+
+```
+
+### VAP融合动画
+
+实现VAP融合动画,需要实现 IFetchResource 接口,如果是图片类型需要返回对应的Bitmap,如果是文字需要返回对应的String,Demo:AnimVapxDemoActivity 里有详细实现说明
+
+```kotlin
+interface IFetchResource {
+    // 获取图片 (暂时不支持Bitmap.Config.ALPHA_8 主要是因为一些机型opengl兼容问题)
+    fun fetchImage(resource: Resource, result:(Bitmap?) -> Unit)
+
+    // 获取文字
+    fun fetchText(resource: Resource, result:(String?) -> Unit)
+
+    // 资源释放通知
+    fun releaseResource(resources: List<Resource>)
+}
+```
+
+监听Vapx动画自定义资源被点击的事件,需要注册 OnResourceClickListener 监听
+
+```kotlin
+interface OnResourceClickListener {
+    // 返回被点击的资源
+    fun onClick(resource: Resource)
+}
+```
+
+
+### 引入方式
+
+maven方式引入(jcenter目前还在上传审核中,可以先用aar方式引入)
+
+```gradle
+repositories {
+    jcenter()
+}
+
+dependencies {
+    implementation "com.egame.vap:animplayer:2.0.6"
+}
+```
+
+aar引入
+
+需要自己打包animplayer项目为aar(PlayerProj/animplayer)

+ 2 - 0
CONTRIBUTING.md

@@ -0,0 +1,2 @@
+# Contributing
+遇到任何问题或者有好的建议,欢迎提issue/pull request

+ 122 - 0
Introduction.md

@@ -0,0 +1,122 @@
+## 1. VAP
+
+VAP(Video Animation Player)是企鹅电竞开发,用于播放酷炫动画的实现方案。
+
+* 相比Webp, Apng动图方案,具有高压缩率(素材更小)、硬件解码(解码更快)的优点
+* 相比Lottie,能实现更复杂的动画效果(比如粒子特效)
+
+特效展示:
+
+![](./images/anim1.gif)
+
+而且VAP还能在动画中融入自定义的属性(比如用户名称, 头像)
+
+![](./images/anim2.gif)
+
+
+## 2. 项目背景
+
+企鹅电竞是个直播平台,需要在直播间里显示酷炫的送礼动画。
+
+
+动画越酷炫,对素材大小与解码性能要求越高,调研了很多方案,先给对比表:
+
+
+-|文件大小|解码方式|特效支持
+---|---|---|---
+Lottie|无法导出|软解|无粒子特效
+GIF|4.6M|软解|只支持8位色彩
+Apng|10.6M|软解|全支持
+Webp|9.2M|软解|全支持
+mp4|1.5M|硬解|无透明背景
+VAP|***1.5M***|***硬解***|***全支持***
+
+* 测试参数:
+	* 手机: 小米mix3
+	* 素材: 736 × 576 80帧
+	* Apng: 75质量; Webp: 75质量; VAP: 2000码率
+
+调研方案:
+
+1. 矢量动画方案(代表Lottie): Lottie矢量动画压缩率很高,但因为无法显示特殊效果(比如粒子特效),所以此方案不适合;
+2. 动图方案(代表GIF, Apng, Webp):
+	* GIF: 只支持8位颜色,颜色丢失严重,解码性能低,无法满足特效效果;
+	* Apng, Webp: 能够满足特效效果,但文件大,软解效率低(低端的手机上,比如当年的红米1,解码过程甚至能导致整个直播间卡顿),这些问题很难接受;
+3. 视频方案(代表mp4): 采用H264编码,相比动图方案,有很高的压缩率,硬件解码效率很高,缺点很明显,无法支持透明背景;
+
+调研后发现,要么特效表现无法达到要求(Lottie, GIF),要么文件太大而且还是软解(Webp, Apng),要么不支持透明度(mp4),这些方案都不能满足我们的需求,高性能动画组件VAP诞生。
+
+
+## 3. 实现原理
+
+### 方案选择
+
+mp4视频方案无论从效果、大小与解码性能上都是最优的,但H264的里存的是YUV数据,并没有带透明通道。VAP方案基于mp4,解决视频里透明度的问题,这样就能兼具更好的压缩效率,与更好的解码性能。
+
+### 视频透明度实现
+
+H264解码出来每一帧的数据是YUV,转换为RGB后是不带Alpha通道的,而我们可以在视频中额外开辟一块区域,在RGB通道里存储Alpha的值,最后利用OpenGL将这些数据合成为ARGB图像(带透明通道的图像)。
+
+举个例子,解码器解码出一帧原始图像后,合成原理如图所示:
+
+![](./images/pic1.png)
+
+
+每一帧都做相同的事情,就是得到带透明度的视频,实际视频如下:
+
+原始视频|最终效果
+---|---
+![](./images/anim3.gif)|![](./images/anim4.gif)
+
+原始视频中,黑白区域承载Alpha数据。VAP最新版本里实现了Alpha区域大小可变,通过缩小Alpha区域大小,在不影响最终显示效果的同时,能有效减少视频分辨率,提高机型兼容性,而且为VAP的融合特性空余出多余的区域。
+
+### 动画配置信息
+
+动画播放过程中,需要一些配置信息协助播放(比如Alpha区域声明,包括融合动画信息),配置是JSON格式。为了组件更方便使用,所有相关文件都合并到mp4文件里,这样播放动画只需要一个mp4文件即可。
+
+mp4的组织方式与JSON的key-value组织方式很像,被称为一个BOX,我们创建一个新的BOX(vapc VAP Config),JSON内容放到这个BOX里,播放前先读取此BOX然后播放(ps: mp4规范里定义如果无法识别的BOX自动忽略,不影响mp4正常播放流程)。
+
+![](./images/pic2.png)
+
+### VAP融合动画
+
+VAP还支持在动画中融入自定义属性,比如用户名称, 头像。我们称其为VAP融合动画。
+
+视频内容无法直接实现属性的插入,只能曲线救国,通过对属性图片进行修剪,欺骗用户的眼睛,让其看起来像是在视频内容里,实现最终的融合效果(效果如文章开头展示)。
+
+为实现属性图片处理,需要引入“遮罩”素材,利用遮罩与属性图片进行Porter-Duff操作,就能得到需要的形状
+
+![](./images/pic3.png)
+
+再将结果贴到视频对应坐标位置,就能实现最后的融合效果。
+
+“遮罩”素材保存在每一帧视频内容里,之前通过缩小Aplha区域,空出来的区域得到利用。实现原理如图所示
+
+![](./images/pic4.png)
+
+实际视频
+
+![](./images/anim5.gif)
+
+
+## 配套工具
+
+为大家更方便的使用组件,还有配套的素材制作工具
+
+![](./images/pic5.png)
+
+
+## 已接入APP
+
+
+![](./images/icons.png)
+
+## QQ交流群
+遇到任何问题或者有好的建议,欢迎提issues,或者加入QQ群交流
+
+![](./images/qq_group.png)
+
+
+## License
+
+VAP is under the MIT license. See the LICENSE file for details.

+ 1259 - 0
LICENSE.txt

@@ -0,0 +1,1259 @@
+Tencent is pleased to support the open source community by making VAP available. 
+
+Copyright (C) 2020 THL A29 Limited, a Tencent company.  All rights reserved.
+
+VAP is licensed under the the MIT except for the third-party components listed below. 
+
+Terms of the MIT: 
+--------------------------------------------------------------------
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 
+(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, 
+merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished 
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+Other dependencies and licenses:
+
+Open Source Software Licensed under the GNU General Public License version 2 or later: 
+--------------------------------------------------------------------
+1. ffmpeg
+Copyright (C) Ffmpeg Project
+Source code of this software can be obtained from: https://github.com/FFmpeg/FFmpeg/tree/n4.2
+
+Most files in FFmpeg are under the GNU Lesser General Public License version 2.1 or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to FFmpeg.
+
+Some optional parts of FFmpeg are licensed under the GNU General Public License version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of these parts are used by default, you have to explicitly pass --enable-gpl to configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
+
+Specifically, the GPL parts of FFmpeg are:
+
+libpostproc
+optional x86 optimization in the files
+libavcodec/x86/flac_dsp_gpl.asm
+libavcodec/x86/idct_mmx.c
+libavfilter/x86/vf_removegrain.asm
+the following building and testing tools
+compat/solaris/make_sunver.pl
+doc/t2h.pm
+doc/texi2pod.pl
+libswresample/swresample-test.c
+tests/checkasm/*
+tests/tiny_ssim.c
+the following filters in libavfilter:
+vf_blackframe.c
+vf_boxblur.c
+vf_colormatrix.c
+vf_cover_rect.c
+vf_cropdetect.c
+vf_delogo.c
+vf_eq.c
+vf_find_rect.c
+vf_fspp.c
+vf_geq.c
+vf_histeq.c
+vf_hqdn3d.c
+vf_interlace.c
+vf_kerndeint.c
+vf_mcdeint.c
+vf_mpdecimate.c
+vf_owdenoise.c
+vf_perspective.c
+vf_phase.c
+vf_pp.c
+vf_pp7.c
+vf_pullup.c
+vf_repeatfields.c
+vf_sab.c
+vf_smartblur.c
+vf_spp.c
+vf_stereo3d.c
+vf_super2xsai.c
+vf_tinterlace.c
+vf_uspp.c
+vsrc_mptestsrc.c
+Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then the configure parameter --enable-version3 will activate this licensing option for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts, COPYING.GPLv3 to learn the exact legal terms that apply in this case.
+
+There are a handful of files under other licensing terms, namely:
+
+The files libavcodec/jfdctfst.c, libavcodec/jfdctint_template.c and libavcodec/jrevdct.c are taken from libjpeg, see the top of the files for licensing details. Specifically note that you must credit the IJG in the documentation accompanying your program if you only distribute executables. You must also indicate any changes including additions and deletions to those three files in the documentation.
+tests/reference.pnm is under the expat license.
+External libraries
+FFmpeg can be combined with a number of external libraries, which sometimes affect the licensing of binaries resulting from the combination.
+
+Compatible libraries
+The following libraries are under GPL:
+
+frei0r
+libcdio
+librubberband
+libvidstab
+libx264
+libx265
+libxavs
+libxvid
+When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by passing --enable-gpl to configure.
+
+The OpenCORE and VisualOn libraries are under the Apache License 2.0. That license is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of those licenses. So to combine these libraries with FFmpeg, the license version needs to be upgraded by passing --enable-version3 to configure.
+
+Incompatible libraries
+
+There are certain libraries you can combine with FFmpeg whose licenses are not compatible with the GPL and/or the LGPL. If you wish to enable these libraries, even in circumstances that their license may be incompatible, pass --enable-nonfree to configure. This will cause the resulting binary to be unredistributable.
+
+The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which are incompatible with the GPLv2 and v3. To the best of our knowledge, they are compatible with the LGPL.
+
+ GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+
+ GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
+
+Open Source Software Licensed under the GNU General Public License version 2: 
+--------------------------------------------------------------------
+1. bento4
+Copyright (C) Axiomatic Systems LLC
+Source code of this software can be obtained from: http://zebulon.bok.net/Bento4/source/Bento4-SRC-1-5-1-628.zip
+
+
+Terms of the GNU General Public License version 2: 
+--------------------------------------------------------------------
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.  
+51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+Preamble
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
+c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+How to Apply These Terms to Your New Programs
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+one line to give the program's name and an idea of what it does.
+Copyright (C) yyyy  name of author
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
+type `show w'.  This is free software, and you are welcome
+to redistribute it under certain conditions; type `show c' 
+for details.
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright
+interest in the program `Gnomovision'
+(which makes passes at compilers) written 
+by James Hacker.
+
+signature of Ty Coon, 1 April 1989
+Ty Coon, President of Vice
+This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.

+ 168 - 0
QGVAPlayer.podspec

@@ -0,0 +1,168 @@
+#
+#  Be sure to run `pod spec lint QGRouter.podspec' to ensure this is a
+#  valid spec and to remove all comments including this before submitting the spec.
+#
+#  To learn more about Podspec attributes see https://docs.cocoapods.org/specification.html
+#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
+#
+
+Pod::Spec.new do |spec|
+
+  # ―――  Spec Metadata  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  These will help people to find your library, and whilst it
+  #  can feel like a chore to fill in it's definitely to your advantage. The
+  #  summary should be tweet-length, and the description more in depth.
+  #
+
+  spec.name         = "QGVAPlayer"
+  spec.version      = "2.2.1"
+  spec.summary      = "video animation player."
+  spec.platform     = :ios, "8.0"
+
+  # This description is used to generate tags and improve search results.
+  #   * Think: What does it do? Why did you write it? What is the focus?
+  #   * Try to keep it short, snappy and to the point.
+  #   * Write the description between the DESC delimiters below.
+  #   * Finally, don't worry about the indent, CocoaPods strips it!
+  spec.description  = "video animation player - 高效的特效动画播放组件."
+
+  spec.homepage     = ""
+  # spec.screenshots  = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
+
+
+  # ―――  Spec License  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  Licensing your code is important. See https://choosealicense.com for more info.
+  #  CocoaPods will detect a license file if there is a named LICENSE*
+  #  Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
+  #
+
+  spec.license      = {
+        :type => 'Copyright',
+        :text => <<-LICENSE
+              © 1998-2019 Tencent. All rights reserved.
+        LICENSE
+    }
+  # spec.license      = { :type => "MIT", :file => "FILE_LICENSE" }
+
+# 集成源码
+    puts "Pod Install #{spec.name} Source"
+
+  # ――― Author Metadata  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  Specify the authors of the library, with email addresses. Email addresses
+  #  of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
+  #  accepts just a name if you'd rather not provide an email address.
+  #
+  #  Specify a social_media_url where others can refer to, for example a twitter
+  #  profile URL.
+  #
+
+  spec.author             = { "chanceguo" => "chanceguo@tencent.com" }
+  # Or just: spec.author    = "chanceguo"
+  # spec.authors            = { "chanceguo" => "chanceguo@tencent.com" }
+  # spec.social_media_url   = "https://twitter.com/chanceguo"
+
+  # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  If this Pod runs only on iOS or OS X, then specify the platform and
+  #  the deployment target. You can optionally include the target after the platform.
+  #
+
+  # spec.platform     = :ios
+  # spec.platform     = :ios, "5.0"
+
+  #  When using multiple platforms
+  # spec.ios.deployment_target = "5.0"
+  # spec.osx.deployment_target = "10.7"
+  # spec.watchos.deployment_target = "2.0"
+  # spec.tvos.deployment_target = "9.0"
+
+
+  # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  Specify the location from where the source should be retrieved.
+  #  Supports git, hg, bzr, svn and HTTP.
+  #
+
+  spec.source       = { :git => "", :tag => "#{spec.version}"}
+
+
+  # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  CocoaPods is smart about how it includes source code. For source files
+  #  giving a folder will include any swift, h, m, mm, c & cpp files.
+  #  For header files it will include any header in the folder.
+  #  Not including the public_header_files will make all headers public.
+  #
+
+  spec.subspec 'Shaders' do |ss|
+    ss.source_files = 'iOS/QGVAPlayer/QGVAPlayer/Shaders/**/*'
+  end
+
+  spec.subspec 'Classes' do |ss|
+    ss.source_files  = 'iOS/QGVAPlayer/QGVAPlayer/Classes/*.{h,m}'
+      ss.subspec 'Models' do |sss|
+        sss.source_files = 'iOS/QGVAPlayer/QGVAPlayer/Classes/Models/**/*'
+      end
+      ss.subspec 'Views' do |sss|
+        sss.source_files = 'iOS/QGVAPlayer/QGVAPlayer/Classes/Views/**/*'
+      end
+      ss.subspec 'Controllers' do |sss|
+        sss.source_files = 'iOS/QGVAPlayer/QGVAPlayer/Classes/Controllers/**/*'
+      end
+      ss.subspec 'MP4Parser' do |sss|
+        sss.source_files = 'iOS/QGVAPlayer/QGVAPlayer/Classes/MP4Parser/**/*'
+      end
+      ss.subspec 'Utils' do |sss|
+        sss.source_files = 'iOS/QGVAPlayer/QGVAPlayer/Classes/Utils/**/*'
+      end
+  end
+
+
+  # spec.exclude_files = "Classes/Exclude"
+
+  spec.public_header_files = "iOS/QGVAPlayer/QGVAPlayer/**/*.h"
+
+
+  # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  A list of resources included with the Pod. These are copied into the
+  #  target bundle with a build phase script. Anything else will be cleaned.
+  #  You can preserve files from being cleaned, please don't preserve
+  #  non-essential files like tests, examples and documentation.
+  #
+
+  # spec.resource  = "icon.png"
+  # spec.resources = "Resources/*.png"
+
+  # spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
+
+
+  # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  Link your library with frameworks, or libraries. Libraries do not include
+  #  the lib prefix of their name.
+  #
+
+  # spec.framework  = "SomeFramework"
+  # spec.frameworks = "SomeFramework", "AnotherFramework"
+
+  # spec.library   = "iconv"
+  # spec.libraries = "iconv", "xml2"
+
+
+  # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
+  #
+  #  If your library depends on compiler flags you can set them in the xcconfig hash
+  #  where they will only apply to your library. If you depend on other Podspecs
+  #  you can include multiple dependencies to ensure it works.
+  spec.user_target_xcconfig  = { 'OTHER_LDFLAGS' => "-force_load ${BUILT_PRODUCTS_DIR}/#{spec.name}/lib#{spec.name}.a" }
+
+  spec.requires_arc = true
+
+  # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
+  # spec.dependency "JSONKit", "~> 1.4"
+
+end

+ 54 - 0
README.md

@@ -0,0 +1,54 @@
+# VAP
+
+[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT)
+
+VAP(Video Animation Player)是企鹅电竞开发,用于播放酷炫动画的实现方案。
+
+* 相比Webp, Apng动图方案,具有高压缩率(素材更小)、硬件解码(解码更快)的优点
+* 相比Lottie,能实现更复杂的动画效果(比如粒子特效)
+
+特效展示:
+
+![](./images/anim1.gif)
+
+而且VAP还能在动画中融入自定义的属性(比如用户名称, 头像)
+
+![](./images/anim2.gif)
+
+
+项目详细介绍请参考 [Introduction.md](./Introduction.md)
+
+
+## 性能简述
+
+
+-|文件大小|解码方式|特效支持
+---|---|---|---
+Lottie|无法导出|软解|无粒子特效
+GIF|4.6M|软解|只支持8位色彩
+Apng|10.6M|软解|全支持
+Webp|9.2M|软解|全支持
+mp4|1.5M|硬解|无透明背景
+VAP|***1.5M***|***硬解***|***全支持***
+
+
+实验参数参考 [Introduction.md](./Introduction.md)
+
+
+## 平台支持
+
+支持:[Android](./Android), [iOS](./iOS), [web](./web). 接入说明在对应平台目录中
+
+为大家更方便的使用组件,还有配套的素材制作工具[tool](./tool) (工具目前只支持Mac版本)
+
+
+
+## QQ交流群
+遇到任何问题或者有好的建议,欢迎提issues,或者加入QQ群交流
+
+![](./images/qq_group.png)
+
+
+## License
+
+VAP is under the MIT license. See the [LICENSE](./LICENSE.txt) file for details.

+ 865 - 0
iOS/QGVAPlayer/QGVAPlayer.xcodeproj/project.pbxproj

@@ -0,0 +1,865 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 50;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		630723B122F0409200B15629 /* QGVAPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630723A722F0409200B15629 /* QGVAPlayer.framework */; };
+		630723B622F0409200B15629 /* QGVAPlayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723B522F0409200B15629 /* QGVAPlayerTests.m */; };
+		630723B822F0409200B15629 /* QGVAPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723AA22F0409200B15629 /* QGVAPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307240722F0410600B15629 /* QGMP4Box.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723C322F0410600B15629 /* QGMP4Box.m */; };
+		6307240822F0410600B15629 /* QGMP4Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723C422F0410600B15629 /* QGMP4Parser.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307240922F0410600B15629 /* QGMP4Parser.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723C522F0410600B15629 /* QGMP4Parser.m */; };
+		6307240A22F0410600B15629 /* QGMP4Box.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723C622F0410600B15629 /* QGMP4Box.h */; };
+		6307240B22F0410600B15629 /* UIView+VAP.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723C722F0410600B15629 /* UIView+VAP.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307240C22F0410600B15629 /* QGVAPWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723C922F0410600B15629 /* QGVAPWeakProxy.m */; };
+		6307240D22F0410600B15629 /* QGVAPLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723CB22F0410600B15629 /* QGVAPLogger.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307240E22F0410600B15629 /* QGVAPLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723CC22F0410600B15629 /* QGVAPLogger.m */; };
+		6307240F22F0410600B15629 /* QGVAPSafeMutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723CD22F0410600B15629 /* QGVAPSafeMutableDictionary.h */; };
+		6307241022F0410600B15629 /* QGVAPSafeMutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723CE22F0410600B15629 /* QGVAPSafeMutableArray.h */; };
+		6307241122F0410600B15629 /* QGVAPSafeMutableArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723CF22F0410600B15629 /* QGVAPSafeMutableArray.m */; };
+		6307241222F0410600B15629 /* QGVAPSafeMutableDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723D022F0410600B15629 /* QGVAPSafeMutableDictionary.m */; };
+		6307241322F0410600B15629 /* QGVAPWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723D122F0410600B15629 /* QGVAPWeakProxy.h */; };
+		6307241422F0410600B15629 /* UIColor+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723D322F0410600B15629 /* UIColor+VAPUtil.m */; };
+		6307241522F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723D422F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.h */; };
+		6307241622F0410600B15629 /* UIColor+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723D522F0410600B15629 /* UIColor+VAPUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307241722F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723D622F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.m */; };
+		6307241822F0410600B15629 /* QGMP4AnimatedImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723D822F0410600B15629 /* QGMP4AnimatedImageFrame.m */; };
+		6307241922F0410600B15629 /* QGBaseDFileInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723D922F0410600B15629 /* QGBaseDFileInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307241A22F0410600B15629 /* QGBaseAnimatedImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723DA22F0410600B15629 /* QGBaseAnimatedImageFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307241B22F0410600B15629 /* QGMP4HWDFileInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723DB22F0410600B15629 /* QGMP4HWDFileInfo.m */; };
+		6307241C22F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723DC22F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.h */; };
+		6307241D22F0410600B15629 /* QGBaseDFileInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723DD22F0410600B15629 /* QGBaseDFileInfo.m */; };
+		6307241E22F0410600B15629 /* QGMP4AnimatedImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723DE22F0410600B15629 /* QGMP4AnimatedImageFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307241F22F0410600B15629 /* QGMP4HWDFileInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723DF22F0410600B15629 /* QGMP4HWDFileInfo.h */; };
+		6307242022F0410600B15629 /* QGBaseAnimatedImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723E022F0410600B15629 /* QGBaseAnimatedImageFrame.m */; };
+		6307242322F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723E422F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.m */; };
+		6307242422F0410600B15629 /* QGAnimatedImageDecodeConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723E622F0410600B15629 /* QGAnimatedImageDecodeConfig.m */; };
+		6307242522F0410600B15629 /* QGAnimatedImageDecodeThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723E722F0410600B15629 /* QGAnimatedImageDecodeThread.h */; };
+		6307242622F0410600B15629 /* QGAnimatedImageDecodeThreadPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723E822F0410600B15629 /* QGAnimatedImageDecodeThreadPool.h */; };
+		6307242722F0410600B15629 /* QGAnimatedImageBufferManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723E922F0410600B15629 /* QGAnimatedImageBufferManager.h */; };
+		6307242822F0410600B15629 /* QGAnimatedImageDecodeManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723EA22F0410600B15629 /* QGAnimatedImageDecodeManager.h */; };
+		6307242922F0410600B15629 /* QGAnimatedImageDecodeConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723EB22F0410600B15629 /* QGAnimatedImageDecodeConfig.h */; };
+		6307242A22F0410600B15629 /* QGAnimatedImageDecodeThreadPool.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723EC22F0410600B15629 /* QGAnimatedImageDecodeThreadPool.m */; };
+		6307242B22F0410600B15629 /* QGBaseDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723EE22F0410600B15629 /* QGBaseDecoder.m */; };
+		6307242C22F0410600B15629 /* QGMP4FrameHWDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723EF22F0410600B15629 /* QGMP4FrameHWDecoder.m */; };
+		6307242D22F0410600B15629 /* QGBaseDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723F022F0410600B15629 /* QGBaseDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307242E22F0410600B15629 /* QGMP4FrameHWDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723F122F0410600B15629 /* QGMP4FrameHWDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307242F22F0410600B15629 /* QGAnimatedImageDecodeThread.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F222F0410600B15629 /* QGAnimatedImageDecodeThread.m */; };
+		6307243022F0410600B15629 /* QGAnimatedImageBufferManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F322F0410600B15629 /* QGAnimatedImageBufferManager.m */; };
+		6307243122F0410600B15629 /* QGAnimatedImageDecodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F422F0410600B15629 /* QGAnimatedImageDecodeManager.m */; };
+		6307243222F0410600B15629 /* UIView+VAP.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F522F0410600B15629 /* UIView+VAP.m */; };
+		6307243322F0410600B15629 /* QGHWDMetalView.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F822F0410600B15629 /* QGHWDMetalView.m */; };
+		6307243522F0410600B15629 /* QGHWDShaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723FA22F0410600B15629 /* QGHWDShaderTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307243622F0410600B15629 /* QGHWDMetalRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723FB22F0410600B15629 /* QGHWDMetalRenderer.m */; };
+		6307243822F0410600B15629 /* QGHWDMetalView.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723FD22F0410600B15629 /* QGHWDMetalView.h */; };
+		6307243922F0410600B15629 /* QGHWDMetalRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723FE22F0410600B15629 /* QGHWDMetalRenderer.h */; };
+		6307243A22F0410600B15629 /* QGHWDMP4OpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6307240022F0410600B15629 /* QGHWDMP4OpenGLView.m */; };
+		6307243B22F0410600B15629 /* QGHWDMP4OpenGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6307240122F0410600B15629 /* QGHWDMP4OpenGLView.h */; };
+		6307243C22F0410600B15629 /* VAPMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 6307240222F0410600B15629 /* VAPMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6307243F22F0410600B15629 /* QGHWDShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6307240622F0410600B15629 /* QGHWDShaders.metal */; };
+		632942D9231BED7D00B511BB /* QGVAPMetalUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 632942D7231BED7D00B511BB /* QGVAPMetalUtil.h */; };
+		632942DA231BED7D00B511BB /* QGVAPMetalUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 632942D8231BED7D00B511BB /* QGVAPMetalUtil.m */; };
+		636FE34823604B570001565D /* UIView+MP4HWDecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 636FE34623604B570001565D /* UIView+MP4HWDecode.h */; };
+		636FE34923604B570001565D /* UIView+MP4HWDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 636FE34723604B570001565D /* UIView+MP4HWDecode.m */; };
+		639CA47C2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 639CA47A2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.h */; };
+		639CA47D2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 639CA47B2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.m */; };
+		63AEB398231671260069CEBB /* QGVAPConfigManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB396231671250069CEBB /* QGVAPConfigManager.h */; };
+		63AEB399231671260069CEBB /* QGVAPConfigManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB397231671250069CEBB /* QGVAPConfigManager.m */; };
+		63AEB39C23167A030069CEBB /* QGVAPConfigModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB39A23167A030069CEBB /* QGVAPConfigModel.h */; };
+		63AEB39D23167A030069CEBB /* QGVAPConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB39B23167A030069CEBB /* QGVAPConfigModel.m */; };
+		63AEB3A02316AF8A0069CEBB /* NSDictionary+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB39E2316AF8A0069CEBB /* NSDictionary+VAPUtil.h */; };
+		63AEB3A12316AF8A0069CEBB /* NSDictionary+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB39F2316AF8A0069CEBB /* NSDictionary+VAPUtil.m */; };
+		63AEB3A52317CD940069CEBB /* NSArray+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB3A32317CD940069CEBB /* NSArray+VAPUtil.h */; };
+		63AEB3A62317CD940069CEBB /* NSArray+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB3A42317CD940069CEBB /* NSArray+VAPUtil.m */; };
+		63AEB3EE231952DD0069CEBB /* QGVAPTextureLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB3EC231952DD0069CEBB /* QGVAPTextureLoader.h */; };
+		63AEB3EF231952DD0069CEBB /* QGVAPTextureLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB3ED231952DD0069CEBB /* QGVAPTextureLoader.m */; };
+		63AEB3F4231959D60069CEBB /* QGVAPMetalView.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB3F2231959D60069CEBB /* QGVAPMetalView.h */; };
+		63AEB3F5231959D60069CEBB /* QGVAPMetalView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB3F3231959D60069CEBB /* QGVAPMetalView.m */; };
+		63AEB3F923195BF80069CEBB /* QGVAPMetalRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB3F723195BF80069CEBB /* QGVAPMetalRenderer.h */; };
+		63AEB3FA23195BF80069CEBB /* QGVAPMetalRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB3F823195BF80069CEBB /* QGVAPMetalRenderer.m */; };
+		63AFC6B7231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AFC6B5231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.h */; };
+		63AFC6B8231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AFC6B6231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.m */; };
+		63BAD37822F0966300EAD4C4 /* UIDevice+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 63BAD37622F0966300EAD4C4 /* UIDevice+VAPUtil.h */; };
+		63BAD37922F0966300EAD4C4 /* UIDevice+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 63BAD37722F0966300EAD4C4 /* UIDevice+VAPUtil.m */; };
+		649EF40D24122B4D00164950 /* QGVAPMaskInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 649EF40B24122B4C00164950 /* QGVAPMaskInfo.h */; };
+		649EF40E24122B4D00164950 /* QGVAPMaskInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 649EF40C24122B4C00164950 /* QGVAPMaskInfo.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		630723B222F0409200B15629 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 6307239E22F0409200B15629 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 630723A622F0409200B15629;
+			remoteInfo = QGVAPlayer;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		630723A722F0409200B15629 /* QGVAPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = QGVAPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		630723AA22F0409200B15629 /* QGVAPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGVAPlayer.h; sourceTree = "<group>"; };
+		630723AB22F0409200B15629 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		630723B022F0409200B15629 /* QGVAPlayerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QGVAPlayerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+		630723B522F0409200B15629 /* QGVAPlayerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGVAPlayerTests.m; sourceTree = "<group>"; };
+		630723B722F0409200B15629 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		630723C322F0410600B15629 /* QGMP4Box.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGMP4Box.m; sourceTree = "<group>"; };
+		630723C422F0410600B15629 /* QGMP4Parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGMP4Parser.h; sourceTree = "<group>"; };
+		630723C522F0410600B15629 /* QGMP4Parser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGMP4Parser.m; sourceTree = "<group>"; };
+		630723C622F0410600B15629 /* QGMP4Box.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGMP4Box.h; sourceTree = "<group>"; };
+		630723C722F0410600B15629 /* UIView+VAP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+VAP.h"; sourceTree = "<group>"; };
+		630723C922F0410600B15629 /* QGVAPWeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGVAPWeakProxy.m; sourceTree = "<group>"; };
+		630723CB22F0410600B15629 /* QGVAPLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGVAPLogger.h; sourceTree = "<group>"; };
+		630723CC22F0410600B15629 /* QGVAPLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGVAPLogger.m; sourceTree = "<group>"; };
+		630723CD22F0410600B15629 /* QGVAPSafeMutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGVAPSafeMutableDictionary.h; sourceTree = "<group>"; };
+		630723CE22F0410600B15629 /* QGVAPSafeMutableArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGVAPSafeMutableArray.h; sourceTree = "<group>"; };
+		630723CF22F0410600B15629 /* QGVAPSafeMutableArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGVAPSafeMutableArray.m; sourceTree = "<group>"; };
+		630723D022F0410600B15629 /* QGVAPSafeMutableDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGVAPSafeMutableDictionary.m; sourceTree = "<group>"; };
+		630723D122F0410600B15629 /* QGVAPWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGVAPWeakProxy.h; sourceTree = "<group>"; };
+		630723D322F0410600B15629 /* UIColor+VAPUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+VAPUtil.m"; sourceTree = "<group>"; };
+		630723D422F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+VAPThreadSafe.h"; sourceTree = "<group>"; };
+		630723D522F0410600B15629 /* UIColor+VAPUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+VAPUtil.h"; sourceTree = "<group>"; };
+		630723D622F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNotificationCenter+VAPThreadSafe.m"; sourceTree = "<group>"; };
+		630723D822F0410600B15629 /* QGMP4AnimatedImageFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGMP4AnimatedImageFrame.m; sourceTree = "<group>"; };
+		630723D922F0410600B15629 /* QGBaseDFileInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGBaseDFileInfo.h; sourceTree = "<group>"; };
+		630723DA22F0410600B15629 /* QGBaseAnimatedImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGBaseAnimatedImageFrame.h; sourceTree = "<group>"; };
+		630723DB22F0410600B15629 /* QGMP4HWDFileInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGMP4HWDFileInfo.m; sourceTree = "<group>"; };
+		630723DC22F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "QGBaseAnimatedImageFrame+Displaying.h"; sourceTree = "<group>"; };
+		630723DD22F0410600B15629 /* QGBaseDFileInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGBaseDFileInfo.m; sourceTree = "<group>"; };
+		630723DE22F0410600B15629 /* QGMP4AnimatedImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGMP4AnimatedImageFrame.h; sourceTree = "<group>"; };
+		630723DF22F0410600B15629 /* QGMP4HWDFileInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGMP4HWDFileInfo.h; sourceTree = "<group>"; };
+		630723E022F0410600B15629 /* QGBaseAnimatedImageFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGBaseAnimatedImageFrame.m; sourceTree = "<group>"; };
+		630723E422F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "QGBaseAnimatedImageFrame+Displaying.m"; sourceTree = "<group>"; };
+		630723E622F0410600B15629 /* QGAnimatedImageDecodeConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGAnimatedImageDecodeConfig.m; sourceTree = "<group>"; };
+		630723E722F0410600B15629 /* QGAnimatedImageDecodeThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGAnimatedImageDecodeThread.h; sourceTree = "<group>"; };
+		630723E822F0410600B15629 /* QGAnimatedImageDecodeThreadPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGAnimatedImageDecodeThreadPool.h; sourceTree = "<group>"; };
+		630723E922F0410600B15629 /* QGAnimatedImageBufferManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGAnimatedImageBufferManager.h; sourceTree = "<group>"; };
+		630723EA22F0410600B15629 /* QGAnimatedImageDecodeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGAnimatedImageDecodeManager.h; sourceTree = "<group>"; };
+		630723EB22F0410600B15629 /* QGAnimatedImageDecodeConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGAnimatedImageDecodeConfig.h; sourceTree = "<group>"; };
+		630723EC22F0410600B15629 /* QGAnimatedImageDecodeThreadPool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGAnimatedImageDecodeThreadPool.m; sourceTree = "<group>"; };
+		630723EE22F0410600B15629 /* QGBaseDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGBaseDecoder.m; sourceTree = "<group>"; };
+		630723EF22F0410600B15629 /* QGMP4FrameHWDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGMP4FrameHWDecoder.m; sourceTree = "<group>"; };
+		630723F022F0410600B15629 /* QGBaseDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGBaseDecoder.h; sourceTree = "<group>"; };
+		630723F122F0410600B15629 /* QGMP4FrameHWDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGMP4FrameHWDecoder.h; sourceTree = "<group>"; };
+		630723F222F0410600B15629 /* QGAnimatedImageDecodeThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGAnimatedImageDecodeThread.m; sourceTree = "<group>"; };
+		630723F322F0410600B15629 /* QGAnimatedImageBufferManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGAnimatedImageBufferManager.m; sourceTree = "<group>"; };
+		630723F422F0410600B15629 /* QGAnimatedImageDecodeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGAnimatedImageDecodeManager.m; sourceTree = "<group>"; };
+		630723F522F0410600B15629 /* UIView+VAP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+VAP.m"; sourceTree = "<group>"; };
+		630723F822F0410600B15629 /* QGHWDMetalView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGHWDMetalView.m; sourceTree = "<group>"; };
+		630723FA22F0410600B15629 /* QGHWDShaderTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGHWDShaderTypes.h; sourceTree = "<group>"; };
+		630723FB22F0410600B15629 /* QGHWDMetalRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGHWDMetalRenderer.m; sourceTree = "<group>"; };
+		630723FD22F0410600B15629 /* QGHWDMetalView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGHWDMetalView.h; sourceTree = "<group>"; };
+		630723FE22F0410600B15629 /* QGHWDMetalRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGHWDMetalRenderer.h; sourceTree = "<group>"; };
+		6307240022F0410600B15629 /* QGHWDMP4OpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGHWDMP4OpenGLView.m; sourceTree = "<group>"; };
+		6307240122F0410600B15629 /* QGHWDMP4OpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGHWDMP4OpenGLView.h; sourceTree = "<group>"; };
+		6307240222F0410600B15629 /* VAPMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VAPMacros.h; sourceTree = "<group>"; };
+		6307240622F0410600B15629 /* QGHWDShaders.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = QGHWDShaders.metal; sourceTree = "<group>"; };
+		632942D7231BED7D00B511BB /* QGVAPMetalUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGVAPMetalUtil.h; sourceTree = "<group>"; };
+		632942D8231BED7D00B511BB /* QGVAPMetalUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGVAPMetalUtil.m; sourceTree = "<group>"; };
+		636FE34623604B570001565D /* UIView+MP4HWDecode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+MP4HWDecode.h"; sourceTree = "<group>"; };
+		636FE34723604B570001565D /* UIView+MP4HWDecode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+MP4HWDecode.m"; sourceTree = "<group>"; };
+		639CA47A2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIGestureRecognizer+VAPUtil.h"; sourceTree = "<group>"; };
+		639CA47B2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIGestureRecognizer+VAPUtil.m"; sourceTree = "<group>"; };
+		63AEB396231671250069CEBB /* QGVAPConfigManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGVAPConfigManager.h; sourceTree = "<group>"; };
+		63AEB397231671250069CEBB /* QGVAPConfigManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGVAPConfigManager.m; sourceTree = "<group>"; };
+		63AEB39A23167A030069CEBB /* QGVAPConfigModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGVAPConfigModel.h; sourceTree = "<group>"; };
+		63AEB39B23167A030069CEBB /* QGVAPConfigModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGVAPConfigModel.m; sourceTree = "<group>"; };
+		63AEB39E2316AF8A0069CEBB /* NSDictionary+VAPUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+VAPUtil.h"; sourceTree = "<group>"; };
+		63AEB39F2316AF8A0069CEBB /* NSDictionary+VAPUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+VAPUtil.m"; sourceTree = "<group>"; };
+		63AEB3A32317CD940069CEBB /* NSArray+VAPUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSArray+VAPUtil.h"; sourceTree = "<group>"; };
+		63AEB3A42317CD940069CEBB /* NSArray+VAPUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSArray+VAPUtil.m"; sourceTree = "<group>"; };
+		63AEB3EC231952DD0069CEBB /* QGVAPTextureLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGVAPTextureLoader.h; sourceTree = "<group>"; };
+		63AEB3ED231952DD0069CEBB /* QGVAPTextureLoader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGVAPTextureLoader.m; sourceTree = "<group>"; };
+		63AEB3F2231959D60069CEBB /* QGVAPMetalView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGVAPMetalView.h; sourceTree = "<group>"; };
+		63AEB3F3231959D60069CEBB /* QGVAPMetalView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGVAPMetalView.m; sourceTree = "<group>"; };
+		63AEB3F723195BF80069CEBB /* QGVAPMetalRenderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGVAPMetalRenderer.h; sourceTree = "<group>"; };
+		63AEB3F823195BF80069CEBB /* QGVAPMetalRenderer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGVAPMetalRenderer.m; sourceTree = "<group>"; };
+		63AFC6B5231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGVAPMetalShaderFunctionLoader.h; sourceTree = "<group>"; };
+		63AFC6B6231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGVAPMetalShaderFunctionLoader.m; sourceTree = "<group>"; };
+		63AFC6B9231E3E5B00E127F9 /* QGHWDMetalShaderSourceDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGHWDMetalShaderSourceDefine.h; sourceTree = "<group>"; };
+		63BAD37622F0966300EAD4C4 /* UIDevice+VAPUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIDevice+VAPUtil.h"; sourceTree = "<group>"; };
+		63BAD37722F0966300EAD4C4 /* UIDevice+VAPUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+VAPUtil.m"; sourceTree = "<group>"; };
+		649EF40B24122B4C00164950 /* QGVAPMaskInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QGVAPMaskInfo.h; sourceTree = "<group>"; };
+		649EF40C24122B4C00164950 /* QGVAPMaskInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QGVAPMaskInfo.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		630723A422F0409200B15629 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		630723AD22F0409200B15629 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				630723B122F0409200B15629 /* QGVAPlayer.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		6307239D22F0409200B15629 = {
+			isa = PBXGroup;
+			children = (
+				630723A922F0409200B15629 /* QGVAPlayer */,
+				630723B422F0409200B15629 /* QGVAPlayerTests */,
+				630723A822F0409200B15629 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		630723A822F0409200B15629 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				630723A722F0409200B15629 /* QGVAPlayer.framework */,
+				630723B022F0409200B15629 /* QGVAPlayerTests.xctest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		630723A922F0409200B15629 /* QGVAPlayer */ = {
+			isa = PBXGroup;
+			children = (
+				6307240422F0410600B15629 /* Shaders */,
+				630723C122F0410600B15629 /* Classes */,
+				630723AB22F0409200B15629 /* Info.plist */,
+			);
+			path = QGVAPlayer;
+			sourceTree = "<group>";
+		};
+		630723B422F0409200B15629 /* QGVAPlayerTests */ = {
+			isa = PBXGroup;
+			children = (
+				630723B522F0409200B15629 /* QGVAPlayerTests.m */,
+				630723B722F0409200B15629 /* Info.plist */,
+			);
+			path = QGVAPlayerTests;
+			sourceTree = "<group>";
+		};
+		630723C122F0410600B15629 /* Classes */ = {
+			isa = PBXGroup;
+			children = (
+				630723AA22F0409200B15629 /* QGVAPlayer.h */,
+				6307240222F0410600B15629 /* VAPMacros.h */,
+				630723C722F0410600B15629 /* UIView+VAP.h */,
+				630723F522F0410600B15629 /* UIView+VAP.m */,
+				630723D722F0410600B15629 /* Models */,
+				630723F622F0410600B15629 /* Views */,
+				630723E522F0410600B15629 /* Controllers */,
+				630723C222F0410600B15629 /* MP4Parser */,
+				630723C822F0410600B15629 /* Utils */,
+			);
+			path = Classes;
+			sourceTree = "<group>";
+		};
+		630723C222F0410600B15629 /* MP4Parser */ = {
+			isa = PBXGroup;
+			children = (
+				630723C622F0410600B15629 /* QGMP4Box.h */,
+				630723C322F0410600B15629 /* QGMP4Box.m */,
+				630723C422F0410600B15629 /* QGMP4Parser.h */,
+				630723C522F0410600B15629 /* QGMP4Parser.m */,
+			);
+			path = MP4Parser;
+			sourceTree = "<group>";
+		};
+		630723C822F0410600B15629 /* Utils */ = {
+			isa = PBXGroup;
+			children = (
+				632942D7231BED7D00B511BB /* QGVAPMetalUtil.h */,
+				632942D8231BED7D00B511BB /* QGVAPMetalUtil.m */,
+				63AFC6B5231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.h */,
+				63AFC6B6231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.m */,
+				630723C922F0410600B15629 /* QGVAPWeakProxy.m */,
+				630723D122F0410600B15629 /* QGVAPWeakProxy.h */,
+				630723CD22F0410600B15629 /* QGVAPSafeMutableDictionary.h */,
+				630723D022F0410600B15629 /* QGVAPSafeMutableDictionary.m */,
+				630723CE22F0410600B15629 /* QGVAPSafeMutableArray.h */,
+				630723CF22F0410600B15629 /* QGVAPSafeMutableArray.m */,
+				630723CA22F0410600B15629 /* Logger */,
+				630723D222F0410600B15629 /* Categorys */,
+			);
+			path = Utils;
+			sourceTree = "<group>";
+		};
+		630723CA22F0410600B15629 /* Logger */ = {
+			isa = PBXGroup;
+			children = (
+				630723CB22F0410600B15629 /* QGVAPLogger.h */,
+				630723CC22F0410600B15629 /* QGVAPLogger.m */,
+			);
+			path = Logger;
+			sourceTree = "<group>";
+		};
+		630723D222F0410600B15629 /* Categorys */ = {
+			isa = PBXGroup;
+			children = (
+				630723D522F0410600B15629 /* UIColor+VAPUtil.h */,
+				630723D322F0410600B15629 /* UIColor+VAPUtil.m */,
+				63BAD37622F0966300EAD4C4 /* UIDevice+VAPUtil.h */,
+				63BAD37722F0966300EAD4C4 /* UIDevice+VAPUtil.m */,
+				630723D422F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.h */,
+				630723D622F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.m */,
+				63AEB39E2316AF8A0069CEBB /* NSDictionary+VAPUtil.h */,
+				63AEB39F2316AF8A0069CEBB /* NSDictionary+VAPUtil.m */,
+				63AEB3A32317CD940069CEBB /* NSArray+VAPUtil.h */,
+				63AEB3A42317CD940069CEBB /* NSArray+VAPUtil.m */,
+				636FE34623604B570001565D /* UIView+MP4HWDecode.h */,
+				636FE34723604B570001565D /* UIView+MP4HWDecode.m */,
+				639CA47A2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.h */,
+				639CA47B2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.m */,
+			);
+			path = Categorys;
+			sourceTree = "<group>";
+		};
+		630723D722F0410600B15629 /* Models */ = {
+			isa = PBXGroup;
+			children = (
+				649EF40B24122B4C00164950 /* QGVAPMaskInfo.h */,
+				649EF40C24122B4C00164950 /* QGVAPMaskInfo.m */,
+				630723DA22F0410600B15629 /* QGBaseAnimatedImageFrame.h */,
+				630723E022F0410600B15629 /* QGBaseAnimatedImageFrame.m */,
+				630723DC22F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.h */,
+				630723E422F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.m */,
+				630723DE22F0410600B15629 /* QGMP4AnimatedImageFrame.h */,
+				630723D822F0410600B15629 /* QGMP4AnimatedImageFrame.m */,
+				630723D922F0410600B15629 /* QGBaseDFileInfo.h */,
+				630723DD22F0410600B15629 /* QGBaseDFileInfo.m */,
+				630723DF22F0410600B15629 /* QGMP4HWDFileInfo.h */,
+				630723DB22F0410600B15629 /* QGMP4HWDFileInfo.m */,
+				63AEB39A23167A030069CEBB /* QGVAPConfigModel.h */,
+				63AEB39B23167A030069CEBB /* QGVAPConfigModel.m */,
+				63AEB3EC231952DD0069CEBB /* QGVAPTextureLoader.h */,
+				63AEB3ED231952DD0069CEBB /* QGVAPTextureLoader.m */,
+			);
+			path = Models;
+			sourceTree = "<group>";
+		};
+		630723E522F0410600B15629 /* Controllers */ = {
+			isa = PBXGroup;
+			children = (
+				630723EB22F0410600B15629 /* QGAnimatedImageDecodeConfig.h */,
+				630723E622F0410600B15629 /* QGAnimatedImageDecodeConfig.m */,
+				630723E722F0410600B15629 /* QGAnimatedImageDecodeThread.h */,
+				630723F222F0410600B15629 /* QGAnimatedImageDecodeThread.m */,
+				630723E822F0410600B15629 /* QGAnimatedImageDecodeThreadPool.h */,
+				630723EC22F0410600B15629 /* QGAnimatedImageDecodeThreadPool.m */,
+				630723E922F0410600B15629 /* QGAnimatedImageBufferManager.h */,
+				630723F322F0410600B15629 /* QGAnimatedImageBufferManager.m */,
+				630723EA22F0410600B15629 /* QGAnimatedImageDecodeManager.h */,
+				630723F422F0410600B15629 /* QGAnimatedImageDecodeManager.m */,
+				63AEB396231671250069CEBB /* QGVAPConfigManager.h */,
+				63AEB397231671250069CEBB /* QGVAPConfigManager.m */,
+				630723ED22F0410600B15629 /* Decoders */,
+			);
+			path = Controllers;
+			sourceTree = "<group>";
+		};
+		630723ED22F0410600B15629 /* Decoders */ = {
+			isa = PBXGroup;
+			children = (
+				630723F022F0410600B15629 /* QGBaseDecoder.h */,
+				630723EE22F0410600B15629 /* QGBaseDecoder.m */,
+				630723F122F0410600B15629 /* QGMP4FrameHWDecoder.h */,
+				630723EF22F0410600B15629 /* QGMP4FrameHWDecoder.m */,
+			);
+			path = Decoders;
+			sourceTree = "<group>";
+		};
+		630723F622F0410600B15629 /* Views */ = {
+			isa = PBXGroup;
+			children = (
+				630723F722F0410600B15629 /* Metal */,
+				630723FF22F0410600B15629 /* OpenGL */,
+			);
+			path = Views;
+			sourceTree = "<group>";
+		};
+		630723F722F0410600B15629 /* Metal */ = {
+			isa = PBXGroup;
+			children = (
+				63AEB3F12319597F0069CEBB /* Vapx */,
+				630723FD22F0410600B15629 /* QGHWDMetalView.h */,
+				630723F822F0410600B15629 /* QGHWDMetalView.m */,
+				630723FE22F0410600B15629 /* QGHWDMetalRenderer.h */,
+				630723FB22F0410600B15629 /* QGHWDMetalRenderer.m */,
+			);
+			path = Metal;
+			sourceTree = "<group>";
+		};
+		630723FF22F0410600B15629 /* OpenGL */ = {
+			isa = PBXGroup;
+			children = (
+				6307240122F0410600B15629 /* QGHWDMP4OpenGLView.h */,
+				6307240022F0410600B15629 /* QGHWDMP4OpenGLView.m */,
+			);
+			path = OpenGL;
+			sourceTree = "<group>";
+		};
+		6307240422F0410600B15629 /* Shaders */ = {
+			isa = PBXGroup;
+			children = (
+				630723FA22F0410600B15629 /* QGHWDShaderTypes.h */,
+				6307240622F0410600B15629 /* QGHWDShaders.metal */,
+				63AFC6B9231E3E5B00E127F9 /* QGHWDMetalShaderSourceDefine.h */,
+			);
+			path = Shaders;
+			sourceTree = "<group>";
+		};
+		63AEB3F12319597F0069CEBB /* Vapx */ = {
+			isa = PBXGroup;
+			children = (
+				63AEB3F2231959D60069CEBB /* QGVAPMetalView.h */,
+				63AEB3F3231959D60069CEBB /* QGVAPMetalView.m */,
+				63AEB3F723195BF80069CEBB /* QGVAPMetalRenderer.h */,
+				63AEB3F823195BF80069CEBB /* QGVAPMetalRenderer.m */,
+			);
+			path = Vapx;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		630723A222F0409200B15629 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6307240B22F0410600B15629 /* UIView+VAP.h in Headers */,
+				630723B822F0409200B15629 /* QGVAPlayer.h in Headers */,
+				63AEB3A02316AF8A0069CEBB /* NSDictionary+VAPUtil.h in Headers */,
+				63AEB3A52317CD940069CEBB /* NSArray+VAPUtil.h in Headers */,
+				649EF40D24122B4D00164950 /* QGVAPMaskInfo.h in Headers */,
+				636FE34823604B570001565D /* UIView+MP4HWDecode.h in Headers */,
+				6307243C22F0410600B15629 /* VAPMacros.h in Headers */,
+				6307242D22F0410600B15629 /* QGBaseDecoder.h in Headers */,
+				6307242E22F0410600B15629 /* QGMP4FrameHWDecoder.h in Headers */,
+				63AEB398231671260069CEBB /* QGVAPConfigManager.h in Headers */,
+				6307243522F0410600B15629 /* QGHWDShaderTypes.h in Headers */,
+				6307241622F0410600B15629 /* UIColor+VAPUtil.h in Headers */,
+				6307241A22F0410600B15629 /* QGBaseAnimatedImageFrame.h in Headers */,
+				6307241E22F0410600B15629 /* QGMP4AnimatedImageFrame.h in Headers */,
+				6307241922F0410600B15629 /* QGBaseDFileInfo.h in Headers */,
+				6307240D22F0410600B15629 /* QGVAPLogger.h in Headers */,
+				63AFC6B7231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.h in Headers */,
+				6307240822F0410600B15629 /* QGMP4Parser.h in Headers */,
+				63AEB39C23167A030069CEBB /* QGVAPConfigModel.h in Headers */,
+				6307242522F0410600B15629 /* QGAnimatedImageDecodeThread.h in Headers */,
+				6307243822F0410600B15629 /* QGHWDMetalView.h in Headers */,
+				6307242722F0410600B15629 /* QGAnimatedImageBufferManager.h in Headers */,
+				63AEB3F923195BF80069CEBB /* QGVAPMetalRenderer.h in Headers */,
+				6307240A22F0410600B15629 /* QGMP4Box.h in Headers */,
+				6307240F22F0410600B15629 /* QGVAPSafeMutableDictionary.h in Headers */,
+				63AEB3EE231952DD0069CEBB /* QGVAPTextureLoader.h in Headers */,
+				6307242822F0410600B15629 /* QGAnimatedImageDecodeManager.h in Headers */,
+				6307241522F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.h in Headers */,
+				6307241322F0410600B15629 /* QGVAPWeakProxy.h in Headers */,
+				6307241022F0410600B15629 /* QGVAPSafeMutableArray.h in Headers */,
+				6307241F22F0410600B15629 /* QGMP4HWDFileInfo.h in Headers */,
+				6307243B22F0410600B15629 /* QGHWDMP4OpenGLView.h in Headers */,
+				6307242622F0410600B15629 /* QGAnimatedImageDecodeThreadPool.h in Headers */,
+				6307243922F0410600B15629 /* QGHWDMetalRenderer.h in Headers */,
+				6307241C22F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.h in Headers */,
+				63BAD37822F0966300EAD4C4 /* UIDevice+VAPUtil.h in Headers */,
+				6307242922F0410600B15629 /* QGAnimatedImageDecodeConfig.h in Headers */,
+				632942D9231BED7D00B511BB /* QGVAPMetalUtil.h in Headers */,
+				639CA47C2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.h in Headers */,
+				63AEB3F4231959D60069CEBB /* QGVAPMetalView.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		630723A622F0409200B15629 /* QGVAPlayer */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 630723BB22F0409200B15629 /* Build configuration list for PBXNativeTarget "QGVAPlayer" */;
+			buildPhases = (
+				630723A222F0409200B15629 /* Headers */,
+				630723A322F0409200B15629 /* Sources */,
+				630723A422F0409200B15629 /* Frameworks */,
+				630723A522F0409200B15629 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = QGVAPlayer;
+			productName = QGVAPlayer;
+			productReference = 630723A722F0409200B15629 /* QGVAPlayer.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		630723AF22F0409200B15629 /* QGVAPlayerTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 630723BE22F0409200B15629 /* Build configuration list for PBXNativeTarget "QGVAPlayerTests" */;
+			buildPhases = (
+				630723AC22F0409200B15629 /* Sources */,
+				630723AD22F0409200B15629 /* Frameworks */,
+				630723AE22F0409200B15629 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				630723B322F0409200B15629 /* PBXTargetDependency */,
+			);
+			name = QGVAPlayerTests;
+			productName = QGVAPlayerTests;
+			productReference = 630723B022F0409200B15629 /* QGVAPlayerTests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		6307239E22F0409200B15629 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 1030;
+				ORGANIZATIONNAME = Tencent;
+				TargetAttributes = {
+					630723A622F0409200B15629 = {
+						CreatedOnToolsVersion = 10.3;
+					};
+					630723AF22F0409200B15629 = {
+						CreatedOnToolsVersion = 10.3;
+					};
+				};
+			};
+			buildConfigurationList = 630723A122F0409200B15629 /* Build configuration list for PBXProject "QGVAPlayer" */;
+			compatibilityVersion = "Xcode 9.3";
+			developmentRegion = en;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 6307239D22F0409200B15629;
+			productRefGroup = 630723A822F0409200B15629 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				630723A622F0409200B15629 /* QGVAPlayer */,
+				630723AF22F0409200B15629 /* QGVAPlayerTests */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		630723A522F0409200B15629 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		630723AE22F0409200B15629 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		630723A322F0409200B15629 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6307243F22F0410600B15629 /* QGHWDShaders.metal in Sources */,
+				6307242A22F0410600B15629 /* QGAnimatedImageDecodeThreadPool.m in Sources */,
+				63AFC6B8231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.m in Sources */,
+				6307243A22F0410600B15629 /* QGHWDMP4OpenGLView.m in Sources */,
+				6307243322F0410600B15629 /* QGHWDMetalView.m in Sources */,
+				63AEB3A62317CD940069CEBB /* NSArray+VAPUtil.m in Sources */,
+				6307240C22F0410600B15629 /* QGVAPWeakProxy.m in Sources */,
+				6307240922F0410600B15629 /* QGMP4Parser.m in Sources */,
+				639CA47D2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.m in Sources */,
+				63AEB39D23167A030069CEBB /* QGVAPConfigModel.m in Sources */,
+				63AEB3EF231952DD0069CEBB /* QGVAPTextureLoader.m in Sources */,
+				6307242C22F0410600B15629 /* QGMP4FrameHWDecoder.m in Sources */,
+				636FE34923604B570001565D /* UIView+MP4HWDecode.m in Sources */,
+				6307243022F0410600B15629 /* QGAnimatedImageBufferManager.m in Sources */,
+				6307240722F0410600B15629 /* QGMP4Box.m in Sources */,
+				6307243122F0410600B15629 /* QGAnimatedImageDecodeManager.m in Sources */,
+				6307242B22F0410600B15629 /* QGBaseDecoder.m in Sources */,
+				6307241B22F0410600B15629 /* QGMP4HWDFileInfo.m in Sources */,
+				6307242F22F0410600B15629 /* QGAnimatedImageDecodeThread.m in Sources */,
+				6307241D22F0410600B15629 /* QGBaseDFileInfo.m in Sources */,
+				6307243222F0410600B15629 /* UIView+VAP.m in Sources */,
+				6307242422F0410600B15629 /* QGAnimatedImageDecodeConfig.m in Sources */,
+				6307241222F0410600B15629 /* QGVAPSafeMutableDictionary.m in Sources */,
+				63AEB399231671260069CEBB /* QGVAPConfigManager.m in Sources */,
+				63AEB3A12316AF8A0069CEBB /* NSDictionary+VAPUtil.m in Sources */,
+				63BAD37922F0966300EAD4C4 /* UIDevice+VAPUtil.m in Sources */,
+				6307240E22F0410600B15629 /* QGVAPLogger.m in Sources */,
+				6307241822F0410600B15629 /* QGMP4AnimatedImageFrame.m in Sources */,
+				6307241722F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.m in Sources */,
+				6307242022F0410600B15629 /* QGBaseAnimatedImageFrame.m in Sources */,
+				63AEB3F5231959D60069CEBB /* QGVAPMetalView.m in Sources */,
+				6307241422F0410600B15629 /* UIColor+VAPUtil.m in Sources */,
+				6307243622F0410600B15629 /* QGHWDMetalRenderer.m in Sources */,
+				649EF40E24122B4D00164950 /* QGVAPMaskInfo.m in Sources */,
+				63AEB3FA23195BF80069CEBB /* QGVAPMetalRenderer.m in Sources */,
+				6307242322F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.m in Sources */,
+				632942DA231BED7D00B511BB /* QGVAPMetalUtil.m in Sources */,
+				6307241122F0410600B15629 /* QGVAPSafeMutableArray.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		630723AC22F0409200B15629 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				630723B622F0409200B15629 /* QGVAPlayerTests.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		630723B322F0409200B15629 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 630723A622F0409200B15629 /* QGVAPlayer */;
+			targetProxy = 630723B222F0409200B15629 /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		630723B922F0409200B15629 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				COPY_PHASE_STRIP = NO;
+				CURRENT_PROJECT_VERSION = 1;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+				MTL_FAST_MATH = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = iphoneos;
+				VERSIONING_SYSTEM = "apple-generic";
+				VERSION_INFO_PREFIX = "";
+			};
+			name = Debug;
+		};
+		630723BA22F0409200B15629 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				COPY_PHASE_STRIP = NO;
+				CURRENT_PROJECT_VERSION = 1;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				MTL_FAST_MATH = YES;
+				SDKROOT = iphoneos;
+				VALIDATE_PRODUCT = YES;
+				VERSIONING_SYSTEM = "apple-generic";
+				VERSION_INFO_PREFIX = "";
+			};
+			name = Release;
+		};
+		630723BC22F0409200B15629 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CODE_SIGN_IDENTITY = "";
+				CODE_SIGN_STYLE = Automatic;
+				DEFINES_MODULE = YES;
+				DEVELOPMENT_TEAM = 6W55574XBS;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				DYLIB_INSTALL_NAME_BASE = "@rpath";
+				INFOPLIST_FILE = QGVAPlayer/Info.plist;
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = com.tencent.QGVAPlayer;
+				PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
+				SKIP_INSTALL = YES;
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Debug;
+		};
+		630723BD22F0409200B15629 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CODE_SIGN_IDENTITY = "";
+				CODE_SIGN_STYLE = Automatic;
+				DEFINES_MODULE = YES;
+				DEVELOPMENT_TEAM = 6W55574XBS;
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				DYLIB_INSTALL_NAME_BASE = "@rpath";
+				INFOPLIST_FILE = QGVAPlayer/Info.plist;
+				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = com.tencent.QGVAPlayer;
+				PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
+				SKIP_INSTALL = YES;
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Release;
+		};
+		630723BF22F0409200B15629 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = 6W55574XBS;
+				INFOPLIST_FILE = QGVAPlayerTests/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = com.tencent.QGVAPlayerTests;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Debug;
+		};
+		630723C022F0409200B15629 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = 6W55574XBS;
+				INFOPLIST_FILE = QGVAPlayerTests/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = com.tencent.QGVAPlayerTests;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		630723A122F0409200B15629 /* Build configuration list for PBXProject "QGVAPlayer" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				630723B922F0409200B15629 /* Debug */,
+				630723BA22F0409200B15629 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		630723BB22F0409200B15629 /* Build configuration list for PBXNativeTarget "QGVAPlayer" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				630723BC22F0409200B15629 /* Debug */,
+				630723BD22F0409200B15629 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		630723BE22F0409200B15629 /* Build configuration list for PBXNativeTarget "QGVAPlayerTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				630723BF22F0409200B15629 /* Debug */,
+				630723C022F0409200B15629 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 6307239E22F0409200B15629 /* Project object */;
+}

+ 7 - 0
iOS/QGVAPlayer/QGVAPlayer.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:QGVAPlayer.xcodeproj">
+   </FileRef>
+</Workspace>

+ 8 - 0
iOS/QGVAPlayer/QGVAPlayer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IDEDidComputeMac32BitWarning</key>
+	<true/>
+</dict>
+</plist>

BIN
iOS/QGVAPlayer/QGVAPlayer.xcodeproj/project.xcworkspace/xcuserdata/chanceguo.xcuserdatad/UserInterfaceState.xcuserstate


+ 14 - 0
iOS/QGVAPlayer/QGVAPlayer.xcodeproj/xcuserdata/chanceguo.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>SchemeUserState</key>
+	<dict>
+		<key>QGVAPlayer.xcscheme_^#shared#^_</key>
+		<dict>
+			<key>orderHint</key>
+			<integer>1</integer>
+		</dict>
+	</dict>
+</dict>
+</plist>

Some files were not shown because too many files changed in this diff