Browse Source

[-] 移除非 iOS 相关文件

陈文艺 2 weeks ago
parent
commit
10981d3e5d
100 changed files with 63 additions and 10550 deletions
  1. 63 11
      .gitignore
  2. 0 13
      Android/PlayerProj/.gitignore
  3. 0 1259
      Android/PlayerProj/LICENSE.txt
  4. 0 1
      Android/PlayerProj/animplayer/.gitignore
  5. 0 39
      Android/PlayerProj/animplayer/build.gradle
  6. 0 21
      Android/PlayerProj/animplayer/proguard-rules.pro
  7. 0 33
      Android/PlayerProj/animplayer/publish.gradle
  8. 0 2
      Android/PlayerProj/animplayer/src/main/AndroidManifest.xml
  9. 0 92
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimConfig.kt
  10. 0 188
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimConfigManager.kt
  11. 0 157
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimPlayer.kt
  12. 0 311
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimView.kt
  13. 0 211
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AudioPlayer.kt
  14. 0 70
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Constant.kt
  15. 0 171
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Decoder.kt
  16. 0 115
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/EGLUtil.kt
  17. 0 397
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/HardDecoder.kt
  18. 0 66
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/IAnimView.kt
  19. 0 54
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/IRenderListener.kt
  20. 0 153
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/Render.kt
  21. 0 43
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/RenderConstant.kt
  22. 0 207
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/YUVRender.kt
  23. 0 60
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/YUVShader.kt
  24. 0 65
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/file/AssetsFileContainer.kt
  25. 0 60
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/file/FileContainer.kt
  26. 0 34
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/file/IFileContainer.kt
  27. 0 50
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/file/StreamContainer.kt
  28. 0 49
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/file/StreamMediaDataSource.kt
  29. 0 74
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/IAnimListener.kt
  30. 0 33
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/IFetchResource.kt
  31. 0 24
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/inter/OnResourceClickListener.kt
  32. 0 66
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskAnimPlugin.kt
  33. 0 74
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskConfig.kt
  34. 0 130
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskRender.kt
  35. 0 114
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mask/MaskShader.kt
  36. 0 83
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Frame.kt
  37. 0 229
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixAnimPlugin.kt
  38. 0 151
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixRender.kt
  39. 0 94
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixShader.kt
  40. 0 56
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixTouch.kt
  41. 0 39
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Resource.kt
  42. 0 152
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Src.kt
  43. 0 127
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/plugin/AnimPluginManager.kt
  44. 0 48
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/plugin/IAnimPlugin.kt
  45. 0 21
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/textureview/InnerTextureView.kt
  46. 0 54
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/ALog.kt
  47. 0 68
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/BitmapUtil.kt
  48. 0 50
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/GlFloatArray.kt
  49. 0 107
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/MediaUtil.kt
  50. 0 252
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/ScaleTypeUtil.kt
  51. 0 74
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/ShaderUtil.kt
  52. 0 81
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/SpeedControlUtil.kt
  53. 0 84
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/TexCoordsUtil.kt
  54. 0 58
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/TextureLoadUtil.kt
  55. 0 64
      Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/util/VertexUtil.kt
  56. 0 3
      Android/PlayerProj/animplayer/src/main/res/values/strings.xml
  57. 0 17
      Android/PlayerProj/animplayer/src/test/java/com/tencent/qgame/animplayer/ExampleUnitTest.java
  58. 0 1
      Android/PlayerProj/animtool/.gitignore
  59. 0 26
      Android/PlayerProj/animtool/build.gradle
  60. 0 425
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/AnimTool.java
  61. 0 94
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/CommonArg.java
  62. 0 204
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/CommonArgTool.java
  63. 0 126
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/GetAlphaFrame.java
  64. 0 168
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Main.java
  65. 0 95
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Md5Util.java
  66. 0 156
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/Mp4BoxTool.java
  67. 0 52
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/ProcessUtil.java
  68. 0 52
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/TLog.java
  69. 0 24
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/data/PointRect.java
  70. 0 72
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/ui/OpenSourceUI.java
  71. 0 587
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/ui/ToolUI.java
  72. 0 295
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/ui/VapxUI.java
  73. 0 79
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/vapx/FrameSet.java
  74. 0 208
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/vapx/GetMaskFrame.java
  75. 0 90
      Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/vapx/SrcSet.java
  76. 0 1
      Android/PlayerProj/app/.gitignore
  77. 0 30
      Android/PlayerProj/app/build.gradle
  78. 0 21
      Android/PlayerProj/app/proguard-rules.pro
  79. 0 29
      Android/PlayerProj/app/src/main/AndroidManifest.xml
  80. BIN
      Android/PlayerProj/app/src/main/assets/mask_blur_demo.mp4
  81. BIN
      Android/PlayerProj/app/src/main/assets/mask_trunk_demo.mp4
  82. BIN
      Android/PlayerProj/app/src/main/assets/special_size_750.mp4
  83. BIN
      Android/PlayerProj/app/src/main/assets/vapx.mp4
  84. 0 48
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/MainActivity.kt
  85. 0 281
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimActiveDemoActivity.kt
  86. 0 215
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimSimpleDemoActivity.kt
  87. 0 228
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimSpecialSizeDemoActivity.kt
  88. 0 287
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimVapxDemoActivity.kt
  89. 0 109
      Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/FileUtil.kt
  90. BIN
      Android/PlayerProj/app/src/main/res/drawable/bg.png
  91. BIN
      Android/PlayerProj/app/src/main/res/drawable/head1.png
  92. BIN
      Android/PlayerProj/app/src/main/res/drawable/head2.png
  93. 0 74
      Android/PlayerProj/app/src/main/res/drawable/ic_launcher_background.xml
  94. BIN
      Android/PlayerProj/app/src/main/res/drawable/icon.png
  95. 0 37
      Android/PlayerProj/app/src/main/res/layout/activity_anim_simple_demo.xml
  96. 0 44
      Android/PlayerProj/app/src/main/res/layout/activity_main.xml
  97. 0 6
      Android/PlayerProj/app/src/main/res/values/colors.xml
  98. 0 3
      Android/PlayerProj/app/src/main/res/values/strings.xml
  99. 0 7
      Android/PlayerProj/app/src/main/res/values/styles.xml
  100. 0 17
      Android/PlayerProj/app/src/test/java/com/tencent/qgame/playerproj/ExampleUnitTest.kt

+ 63 - 11
.gitignore

@@ -1,16 +1,68 @@
-# dependencies
-node_modules
-# logs
-npm-debug.log
+# Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
 
-# Nuxt generate
-.vscode
+## User settings
+xcuserdata/
 
-.idea
+## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
+*.xcscmblueprint
+*.xccheckout
 
-# sw.*
+## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
+build/
+DerivedData/
+*.moved-aside
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
 
-.cache
+## Obj-C/Swift specific
+*.hmap
 
-#mac cache 
-.DS_Store
+## App packaging
+*.ipa
+*.dSYM.zip
+*.dSYM
+
+# CocoaPods
+#
+# We recommend against adding the Pods directory to your .gitignore. However
+# you should judge for yourself, the pros and cons are mentioned at:
+# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
+#
+# Pods/
+#
+# Add this line if you want to avoid checking in source code from the Xcode workspace
+# *.xcworkspace
+
+# Carthage
+#
+# Add this line if you want to avoid checking in source code from Carthage dependencies.
+# Carthage/Checkouts
+
+Carthage/Build/
+
+# fastlane
+#
+# It is recommended to not store the screenshots in the git repo.
+# Instead, use fastlane to re-generate the screenshots whenever they are needed.
+# For more information about the recommended setup visit:
+# https://docs.fastlane.tools/best-practices/source-control/#source-control
+
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots/**/*.png
+fastlane/test_output
+
+# Code Injection
+#
+# After new code Injection tools there's a generated folder /iOSInjectionProject
+# https://github.com/johnno1962/injectionforxcode
+
+iOSInjectionProject/

+ 0 - 13
Android/PlayerProj/.gitignore

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

+ 0 - 1259
Android/PlayerProj/LICENSE.txt

@@ -1,1259 +0,0 @@
-Tencent is pleased to support the open source community by making VAP available. 
-
-Copyright (C) 2020 Tencent.  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.

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

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

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

@@ -1,39 +0,0 @@
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-
-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 上传(这个要在底部)
-// 上传需要执行此任务 IDE -> gradle-> Tasks/publishing/bintrayUpload
-// apply from: file("publish.gradle")
-
-
-// maven central
-// 上传指令./gradlew uploadArchives
-// https://s01.oss.sonatype.org/
-// Staging Repositories -> close -> release
-// apply from: "../publish-mavencentral.gradle"

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

@@ -1,21 +0,0 @@
-# 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

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

@@ -1,33 +0,0 @@
-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'
-
-    // 开源许可证
-    licenseName = 'MIT'
-    licenseUrl = 'http://opensource.org/licenses/MIT'
-    allLicenses = ["MIT"]
-
-    // library artifact(单个module一般就填写library name)
-    artifact = 'animplayer'
-    libraryName = 'animplayer'
-    libraryVersion = '2.0.15'
-    libraryDescription = ''
-    // bintrayName 是你在网页Repository页面能看到的名称
-    bintrayName = 'vap'
-}
-
-apply from: '../installv1.gradle'
-apply from: '../bintrayv1.gradle'

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

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

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

@@ -1,92 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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) //参考宽&高

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

@@ -1,188 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file.IFileContainer
-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: IFileContainer, enableVersion1: Boolean, 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 enableVersion1=$enableVersion1 result=$result")
-            if (!result) {
-                isParsingConfig = false
-                return Constant.REPORT_ERROR_TYPE_PARSE_CONFIG
-            }
-            if (config?.isDefaultConfig == true && !enableVersion1) {
-                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
-            when (defaultVideoMode) {
-                Constant.VIDEO_MODE_SPLIT_HORIZONTAL -> {
-                    // 视频左右对齐(alpha左\rgb右)
-                    width = _videoWidth / 2
-                    height = _videoHeight
-                    alphaPointRect = PointRect(0, 0, width, height)
-                    rgbPointRect = PointRect(width, 0, width, height)
-                }
-                Constant.VIDEO_MODE_SPLIT_VERTICAL -> {
-                    // 视频上下对齐(alpha上\rgb下)
-                    width = _videoWidth
-                    height = _videoHeight / 2
-                    alphaPointRect = PointRect(0, 0, width, height)
-                    rgbPointRect = PointRect(0, height, width, height)
-                }
-                Constant.VIDEO_MODE_SPLIT_HORIZONTAL_REVERSE -> {
-                    // 视频左右对齐(rgb左\alpha右)
-                    width = _videoWidth / 2
-                    height = _videoHeight
-                    rgbPointRect = PointRect(0, 0, width, height)
-                    alphaPointRect = PointRect(width, 0, width, height)
-                }
-                Constant.VIDEO_MODE_SPLIT_VERTICAL_REVERSE -> {
-                    // 视频上下对齐(rgb上\alpha下)
-                    width = _videoWidth
-                    height = _videoHeight / 2
-                    rgbPointRect = PointRect(0, 0, width, height)
-                    alphaPointRect = PointRect(0, height, width, height)
-                }
-                else -> {
-                    // 默认视频左右对齐(alpha左\rgb右)
-                    width = _videoWidth / 2
-                    height = _videoHeight
-                    alphaPointRect = PointRect(0, 0, width, height)
-                    rgbPointRect = PointRect(width, 0, width, height)
-                }
-            }
-        }
-    }
-
-
-    private fun parse(fileContainer: IFileContainer, 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
-            }
-            player.fps = config.fps
-            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
-    }
-
-
-
-}

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

@@ -1,157 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file.IFileContainer
-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: IAnimView) {
-
-    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
-        }
-    // 设置默认的fps <= 0 表示以vapc配置为准 > 0  表示以此设置为准
-    var defaultFps: Int = 0
-    var playLoop: Int = 0
-        set(value) {
-            decoder?.playLoop = value
-            audioPlayer?.playLoop = value
-            field = value
-        }
-    var supportMaskBoolean : Boolean = false
-    var maskEdgeBlurBoolean : Boolean = false
-    // 是否兼容老版本 默认不兼容
-    var enableVersion1 : Boolean = false
-    // 视频模式
-    var videoMode: Int = Constant.VIDEO_MODE_SPLIT_HORIZONTAL
-    var isDetachedFromWindow = false
-    var isSurfaceAvailable = false
-    var startRunnable: Runnable? = null
-    var isStartRunning = false // 启动时运行状态
-    var isMute = false // 是否静音
-
-    val configManager = AnimConfigManager(this)
-    val pluginManager = AnimPluginManager(this)
-
-    fun onSurfaceTextureDestroyed() {
-        isSurfaceAvailable = false
-        isStartRunning = 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: IFileContainer) {
-        isStartRunning = true
-        prepareDecoder()
-        if (decoder?.prepareThread() == false) {
-            isStartRunning = false
-            decoder?.onFailed(Constant.REPORT_ERROR_TYPE_CREATE_THREAD, Constant.ERROR_MSG_CREATE_THREAD)
-            decoder?.onVideoComplete()
-            return
-        }
-        // 在线程中解析配置
-        decoder?.renderThread?.handler?.post {
-            val result = configManager.parseConfig(fileContainer, enableVersion1, videoMode, defaultFps)
-            if (result != Constant.OK) {
-                isStartRunning = false
-                decoder?.onFailed(result, Constant.getErrorMsg(result))
-                decoder?.onVideoComplete()
-                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: IFileContainer) {
-        synchronized(AnimPlayer::class.java) {
-            if (isSurfaceAvailable) {
-                isStartRunning = false
-                decoder?.start(fileContainer)
-                if (!isMute) {
-                    audioPlayer?.start(fileContainer)
-                }
-            } else {
-                 startRunnable = Runnable {
-                    innerStartPlay(fileContainer)
-                 }
-                animView.prepareTextureView()
-            }
-        }
-    }
-
-    fun stopPlay() {
-        decoder?.stop()
-        audioPlayer?.stop()
-    }
-
-    fun isRunning(): Boolean {
-        return isStartRunning // 启动过程运行状态
-                || (decoder?.isRunning ?: false) // 解码过程运行状态
-
-    }
-
-    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
-    }
-
-}

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

@@ -1,311 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.TextureView
-import android.view.View
-import android.widget.FrameLayout
-import com.tencent.qgame.animplayer.file.AssetsFileContainer
-import com.tencent.qgame.animplayer.file.FileContainer
-import com.tencent.qgame.animplayer.file.IFileContainer
-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.textureview.InnerTextureView
-import com.tencent.qgame.animplayer.util.ALog
-import com.tencent.qgame.animplayer.util.IScaleType
-import com.tencent.qgame.animplayer.util.ScaleType
-import com.tencent.qgame.animplayer.util.ScaleTypeUtil
-import java.io.File
-
-open class AnimView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0):
-    IAnimView,
-    FrameLayout(context, attrs, defStyleAttr),
-    TextureView.SurfaceTextureListener {
-
-    companion object {
-        private const val TAG = "${Constant.TAG}.AnimView"
-    }
-    private lateinit var player: AnimPlayer
-
-    private val uiHandler by lazy { Handler(Looper.getMainLooper()) }
-    private var surface: SurfaceTexture? = null
-    private var animListener: IAnimListener? = null
-    private var innerTextureView: InnerTextureView? = null
-    private var lastFile: IFileContainer? = null
-    private val scaleTypeUtil = ScaleTypeUtil()
-
-    // 代理监听
-    private val animProxyListener by lazy {
-        object : IAnimListener {
-
-            override fun onVideoConfigReady(config: AnimConfig): Boolean {
-                scaleTypeUtil.setVideoSize(config.width, config.height)
-                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)
-            }
-
-        }
-    }
-
-    // 保证AnimView已经布局完成才加入TextureView
-    private var onSizeChangedCalled = false
-    private var needPrepareTextureView = false
-    private val prepareTextureViewRunnable = Runnable {
-        removeAllViews()
-        innerTextureView = InnerTextureView(context).apply {
-            player = this@AnimView.player
-            isOpaque = false
-            surfaceTextureListener = this@AnimView
-            layoutParams = scaleTypeUtil.getLayoutParam(this)
-        }
-        addView(innerTextureView)
-    }
-
-
-    init {
-        hide()
-        player = AnimPlayer(this)
-        player.animListener = animProxyListener
-    }
-
-
-    override fun prepareTextureView() {
-        if (onSizeChangedCalled) {
-            uiHandler.post(prepareTextureViewRunnable)
-        } else {
-            ALog.e(TAG, "onSizeChanged not called")
-            needPrepareTextureView = true
-        }
-    }
-
-    override 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")
-        this.surface = null
-        player.onSurfaceTextureDestroyed()
-        uiHandler.post {
-            innerTextureView?.surfaceTextureListener = null
-            innerTextureView = null
-            removeAllViews()
-        }
-        return true
-    }
-
-    override fun onSurfaceTextureAvailable(surface: SurfaceTexture, width: Int, height: Int) {
-        ALog.i(TAG, "onSurfaceTextureAvailable width=$width height=$height")
-        this.surface = surface
-        player.onSurfaceTextureAvailable(width, height)
-    }
-
-    override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
-        super.onSizeChanged(w, h, oldw, oldh)
-        ALog.i(TAG, "onSizeChanged w=$w, h=$h")
-        scaleTypeUtil.setLayoutSize(w, h)
-        onSizeChangedCalled = true
-        // 需要保证onSizeChanged被调用
-        if (needPrepareTextureView) {
-            needPrepareTextureView = false
-            prepareTextureView()
-        }
-    }
-
-    override fun onAttachedToWindow() {
-        ALog.i(TAG, "onAttachedToWindow")
-        super.onAttachedToWindow()
-        player.isDetachedFromWindow = false
-        // 自动恢复播放
-        if (player.playLoop > 0) {
-            lastFile?.apply {
-                startPlay(this)
-            }
-        }
-    }
-
-    override fun onDetachedFromWindow() {
-        ALog.i(TAG, "onDetachedFromWindow")
-        super.onDetachedFromWindow()
-        player.isDetachedFromWindow = true
-        player.onSurfaceTextureDestroyed()
-    }
-
-
-    override fun setAnimListener(animListener: IAnimListener?) {
-        this.animListener = animListener
-    }
-
-    override fun setFetchResource(fetchResource: IFetchResource?) {
-        player.pluginManager.getMixAnimPlugin()?.resourceRequest = fetchResource
-    }
-
-    override fun setOnResourceClickListener(resourceClickListener: OnResourceClickListener?) {
-        player.pluginManager.getMixAnimPlugin()?.resourceClickListener = resourceClickListener
-    }
-
-    /**
-     * 兼容方案,优先保证表情显示
-     */
-    open fun enableAutoTxtColorFill(enable: Boolean) {
-        player.pluginManager.getMixAnimPlugin()?.autoTxtColorFill = enable
-    }
-
-    override fun setLoop(playLoop: Int) {
-        player.playLoop = playLoop
-    }
-
-    override fun supportMask(isSupport : Boolean, isEdgeBlur : Boolean) {
-        player.supportMaskBoolean = isSupport
-        player.maskEdgeBlurBoolean = isEdgeBlur
-    }
-
-    override fun updateMaskConfig(maskConfig: MaskConfig?) {
-        player.updateMaskConfig(maskConfig)
-    }
-
-
-    @Deprecated("Compatible older version mp4, default false")
-    fun enableVersion1(enable: Boolean) {
-        player.enableVersion1 = enable
-    }
-
-    // 兼容老版本视频模式
-    @Deprecated("Compatible older version mp4")
-    fun setVideoMode(mode: Int) {
-        player.videoMode = mode
-    }
-
-    override fun setFps(fps: Int) {
-        ALog.i(TAG, "setFps=$fps")
-        player.defaultFps = fps
-    }
-
-    override fun setScaleType(type : ScaleType) {
-        scaleTypeUtil.currentScaleType = type
-    }
-
-    override fun setScaleType(scaleType: IScaleType) {
-        scaleTypeUtil.scaleTypeImpl = scaleType
-    }
-
-    /**
-     * @param isMute true 静音
-     */
-    override fun setMute(isMute: Boolean) {
-        ALog.e(TAG, "set mute=$isMute")
-        player.isMute = isMute
-    }
-
-    override 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)
-            animProxyListener.onVideoComplete()
-        }
-    }
-
-    override fun startPlay(assetManager: AssetManager, assetsPath: String) {
-        try {
-            val fileContainer = AssetsFileContainer(assetManager, assetsPath)
-            startPlay(fileContainer)
-        } catch (e: Throwable) {
-            animProxyListener.onFailed(Constant.REPORT_ERROR_TYPE_FILE_ERROR, Constant.ERROR_MSG_FILE_ERROR)
-            animProxyListener.onVideoComplete()
-        }
-    }
-
-
-    override fun startPlay(fileContainer: IFileContainer) {
-        ui {
-            if (visibility != View.VISIBLE) {
-                ALog.e(TAG, "AnimView is GONE, can't play")
-                return@ui
-            }
-            if (!player.isRunning()) {
-                lastFile = fileContainer
-                player.startPlay(fileContainer)
-            } else {
-                ALog.e(TAG, "is running can not start")
-            }
-        }
-    }
-
-
-    override fun stopPlay() {
-        player.stopPlay()
-    }
-
-    override fun isRunning(): Boolean {
-        return player.isRunning()
-    }
-
-    override fun getRealSize(): Pair<Int, Int> {
-        return scaleTypeUtil.getRealSize()
-    }
-
-    private fun hide() {
-        lastFile?.close()
-        ui {
-            removeAllViews()
-        }
-    }
-
-    private fun ui(f:()->Unit) {
-        if (Looper.myLooper() == Looper.getMainLooper()) f() else uiHandler.post { f() }
-    }
-
-}

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

@@ -1,211 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file.IFileContainer
-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: IFileContainer) {
-        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: IFileContainer) {
-        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) ?: ""
-        ALog.i(TAG, "audio mime=$mime")
-        if (!MediaUtil.checkSupportCodec(mime)) {
-            ALog.e(TAG, "mime=$mime not support")
-            release()
-            return
-        }
-
-        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.state
-        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() {
-        if (isRunning) {
-            needDestroy = true
-            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")
-        }
-    }
-}

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

@@ -1,70 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 // 视频左右对齐(alpha左\rgb右)
-    @Deprecated("Compatible older version mp4")
-    const val VIDEO_MODE_SPLIT_VERTICAL = 2 // 视频上下对齐(alpha上\rgb下)
-    @Deprecated("Compatible older version mp4")
-    const val VIDEO_MODE_SPLIT_HORIZONTAL_REVERSE = 3 // 视频左右对齐(rgb左\alpha右)
-    @Deprecated("Compatible older version mp4")
-    const val VIDEO_MODE_SPLIT_VERTICAL_REVERSE = 4 // 视频上下对齐(rgb上\alpha下)
-
-
-    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 REPORT_ERROR_TYPE_HEVC_NOT_SUPPORT = 10008 // 不支持h265
-
-    const val ERROR_MSG_EXTRACTOR_EXC = "0x1 MediaExtractor exception" // MediaExtractor exception
-    const val ERROR_MSG_DECODE_EXC = "0x2 MediaCodec exception" // MediaCodec exception
-    const val ERROR_MSG_CREATE_THREAD = "0x3 thread create fail" // 线程创建失败
-    const val ERROR_MSG_CREATE_RENDER = "0x4 render create fail" // 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" // 文件无法读取
-    const val ERROR_MSG_HEVC_NOT_SUPPORT = "0x8 hevc not support" // 不支持h265
-
-
-    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 ?: ""}"
-    }
-
-}

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

@@ -1,171 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file.IFileContainer
-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: IRenderListener? = 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: IFileContainer)
-
-    fun stop() {
-        isStopReq = true
-    }
-
-    abstract fun destroy()
-
-    fun prepareThread(): Boolean {
-        return createThread(renderThread, "anim_render_thread") && createThread(decodeThread, "anim_decode_thread")
-    }
-
-    fun prepareRender(needYUV: Boolean): Boolean {
-        if (render == null) {
-            ALog.i(TAG, "prepareRender")
-            player.animView.getSurfaceTexture()?.apply {
-                if (needYUV) {
-                    ALog.i(TAG, "use yuv render")
-                    render = YUVRender(this)
-                } else {
-                    render = Render(this).apply {
-                        updateViewPort(surfaceWidth, surfaceHeight)
-                    }
-                }
-            }
-        }
-        return render != null
-    }
-
-    fun preparePlay(videoWidth: Int, videoHeight: Int) {
-        player.configManager.defaultConfig(videoWidth, videoHeight)
-        player.configManager.config?.apply {
-            render?.setAnimConfig(this)
-        }
-        player.pluginManager.onRenderCreate()
-    }
-
-    /**
-     * decode过程中视频尺寸变化
-     * 主要是没有16进制对齐的老视频
-     */
-    fun videoSizeChange(newWidth: Int, newHeight: Int) {
-        if (newWidth <= 0 || newHeight <= 0) return
-        val config = player.configManager.config ?: return
-        if (config.videoWidth != newWidth || config.videoHeight != newHeight) {
-            ALog.i(TAG, "videoSizeChange old=(${config.videoWidth},${config.videoHeight}), new=($newWidth,$newHeight)")
-            config.videoWidth = newWidth
-            config.videoHeight = newHeight
-            render?.setAnimConfig(config)
-        }
-    }
-
-
-    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?)

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

@@ -1,115 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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
-    private var surface: Surface? = 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()
-            surface = Surface(surfaceTexture)
-            eglSurface = egl?.eglCreateWindowSurface(eglDisplay, eglConfig, surface, 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)
-            surface?.release()
-            surface = null
-        }
-    }
-
-}

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

@@ -1,397 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.MediaCodecInfo
-import android.media.MediaExtractor
-import android.media.MediaFormat
-import android.os.Build
-import android.view.Surface
-import com.tencent.qgame.animplayer.file.IFileContainer
-import com.tencent.qgame.animplayer.util.ALog
-import com.tencent.qgame.animplayer.util.MediaUtil
-
-class HardDecoder(player: AnimPlayer) : Decoder(player), SurfaceTexture.OnFrameAvailableListener {
-
-
-    companion object {
-        private const val TAG = "${Constant.TAG}.HardDecoder"
-    }
-
-    private var surface: Surface? = null
-    private var glTexture: SurfaceTexture? = null
-    private val bufferInfo by lazy { MediaCodec.BufferInfo() }
-    private var needDestroy = false
-
-    // 动画的原始尺寸
-    private var videoWidth = 0
-    private var videoHeight = 0
-
-    // 动画对齐后的尺寸
-    private var alignWidth = 0
-    private var alignHeight = 0
-
-    // 动画是否需要走YUV渲染逻辑的标志位
-    private var needYUV = false
-    private var outputFormat: MediaFormat? = null
-
-    override fun start(fileContainer: IFileContainer) {
-        isStopReq = false
-        needDestroy = false
-        isRunning = true
-        renderThread.handler?.post {
-            startPlay(fileContainer)
-        }
-    }
-
-    override fun onFrameAvailable(surfaceTexture: SurfaceTexture?) {
-        if (isStopReq) return
-        ALog.d(TAG, "onFrameAvailable")
-        renderData()
-    }
-
-    private fun renderData() {
-        renderThread.handler?.post {
-            try {
-                glTexture?.apply {
-                    updateTexImage()
-                    render?.renderFrame()
-                    player.pluginManager.onRendering()
-                    render?.swapBuffers()
-                }
-            } catch (e: Throwable) {
-                ALog.e(TAG, "render exception=$e", e)
-            }
-        }
-    }
-
-    private fun startPlay(fileContainer: IFileContainer) {
-
-        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")
-
-            // 是否支持h265
-            if (MediaUtil.checkIsHevc(format)) {
-                if (Build.VERSION.SDK_INT  < Build.VERSION_CODES.LOLLIPOP
-                    || !MediaUtil.checkSupportCodec(MediaUtil.MIME_HEVC)) {
-
-                    onFailed(Constant.REPORT_ERROR_TYPE_HEVC_NOT_SUPPORT,
-                        "${Constant.ERROR_MSG_HEVC_NOT_SUPPORT} " +
-                                "sdk:${Build.VERSION.SDK_INT}" +
-                                ",support hevc:" + MediaUtil.checkSupportCodec(MediaUtil.MIME_HEVC))
-                    release(null, null)
-                    return
-                }
-            }
-
-            videoWidth = format.getInteger(MediaFormat.KEY_WIDTH)
-            videoHeight = format.getInteger(MediaFormat.KEY_HEIGHT)
-            // 防止没有INFO_OUTPUT_FORMAT_CHANGED时导致alignWidth和alignHeight不会被赋值一直是0
-            alignWidth = videoWidth
-            alignHeight = videoHeight
-            ALog.i(TAG, "Video size is $videoWidth x $videoHeight")
-
-            // 由于使用mediacodec解码老版本素材时对宽度1500尺寸的视频进行数据对齐,解码后的宽度变成1504,导致采样点出现偏差播放异常
-            // 所以当开启兼容老版本视频模式并且老版本视频的宽度不能被16整除时要走YUV渲染逻辑
-            // 但是这样直接判断有风险,后期想办法改
-            needYUV = videoWidth % 16 != 0 && player.enableVersion1
-
-            try {
-                if (!prepareRender(needYUV)) {
-                    throw RuntimeException("render create fail")
-                }
-            } catch (t: Throwable) {
-                onFailed(Constant.REPORT_ERROR_TYPE_CREATE_RENDER, "${Constant.ERROR_MSG_CREATE_RENDER} e=$t")
-                release(null, null)
-                return
-            }
-
-            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 {
-                if (needYUV) {
-                    format.setInteger(
-                            MediaFormat.KEY_COLOR_FORMAT,
-                            MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar
-                    )
-                    configure(format, null, null, 0)
-                } else {
-                    surface = Surface(glTexture)
-                    configure(format, surface, null, 0)
-                }
-
-                start()
-                decodeThread.handler?.post {
-                    try {
-                        startDecode(extractor, this)
-                    } 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)
-                    }
-                }
-            }
-        } catch (e: Throwable) {
-            ALog.e(TAG, "MediaCodec configure 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) {
-        val TIMEOUT_USEC = 10000L
-        var inputChunk = 0
-        var outputDone = false
-        var inputDone = false
-        var frameIndex = 0
-        var isLoop = false
-
-        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 -> {
-                        outputFormat = decoder.outputFormat
-                        outputFormat?.apply {
-                            try {
-                                // 有可能取到空值,做一层保护
-                                val stride = getInteger("stride")
-                                val sliceHeight = getInteger("slice-height")
-                                if (stride > 0 && sliceHeight > 0) {
-                                    alignWidth = stride
-                                    alignHeight = sliceHeight
-                                }
-                            } catch (t: Throwable) {
-                                ALog.e(TAG, "$t", t)
-                            }
-                        }
-                        ALog.i(TAG, "decoder output format changed: $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
-                            player.playLoop = playLoop // 消耗loop次数 自动恢复后能有正确的loop次数
-                            outputDone = playLoop <= 0
-                        }
-                        val doRender = !outputDone
-                        if (doRender) {
-                            speedControlUtil.preRender(bufferInfo.presentationTimeUs)
-                        }
-
-                        if (needYUV && doRender) {
-                            yuvProcess(decoder, decoderStatus)
-                        }
-
-                        // release & render
-                        decoder.releaseOutputBuffer(decoderStatus, doRender && !needYUV)
-
-                        if (frameIndex == 0 && !isLoop) {
-                            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")
-                            player.pluginManager.onLoopStart()
-                            extractor.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC)
-                            inputDone = false
-                            decoder.flush()
-                            speedControlUtil.reset()
-                            frameIndex = 0
-                            isLoop = true
-                        }
-                        if (outputDone) {
-                            release(decoder, extractor)
-                        }
-                    }
-                }
-            }
-        }
-
-    }
-
-    /**
-     * 获取到解码后每一帧的YUV数据,裁剪出正确的尺寸
-     */
-    private fun yuvProcess(decoder: MediaCodec, outputIndex: Int) {
-        val outputBuffer = decoder.outputBuffers[outputIndex]
-        outputBuffer?.let {
-            it.position(0)
-            it.limit(bufferInfo.offset + bufferInfo.size)
-            var yuvData = ByteArray(outputBuffer.remaining())
-            outputBuffer.get(yuvData)
-
-            if (yuvData.isNotEmpty()) {
-                var yData = ByteArray(videoWidth * videoHeight)
-                var uData = ByteArray(videoWidth * videoHeight / 4)
-                var vData = ByteArray(videoWidth * videoHeight / 4)
-
-                if (outputFormat?.getInteger(MediaFormat.KEY_COLOR_FORMAT) == MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar) {
-                    yuvData = yuv420spTop(yuvData)
-                }
-
-                yuvCopy(yuvData, 0, alignWidth, alignHeight, yData, videoWidth, videoHeight)
-                yuvCopy(yuvData, alignWidth * alignHeight, alignWidth / 2, alignHeight / 2, uData, videoWidth / 2, videoHeight / 2)
-                yuvCopy(yuvData, alignWidth * alignHeight * 5 / 4, alignWidth / 2, alignHeight / 2, vData, videoWidth / 2, videoHeight / 2)
-
-                render?.setYUVData(videoWidth, videoHeight, yData, uData, vData)
-                renderData()
-            }
-        }
-    }
-
-    private fun yuv420spTop(yuv420sp: ByteArray): ByteArray {
-        val yuv420p = ByteArray(yuv420sp.size)
-        val ySize = alignWidth * alignHeight
-        System.arraycopy(yuv420sp, 0, yuv420p, 0, alignWidth * alignHeight)
-        var i = ySize
-        var j = ySize
-        while (i < ySize * 3 / 2) {
-            yuv420p[j] = yuv420sp[i]
-            yuv420p[j + ySize / 4] = yuv420sp[i + 1]
-            i += 2
-            j++
-        }
-        return yuv420p
-    }
-
-    private fun yuvCopy(src: ByteArray, srcOffset: Int, inWidth: Int, inHeight: Int, dest: ByteArray, outWidth: Int, outHeight: Int) {
-        for (h in 0 until inHeight) {
-            if (h < outHeight) {
-                System.arraycopy(src, srcOffset + h * inWidth, dest, h * outWidth, outWidth)
-            }
-        }
-    }
-
-    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()
-                surface?.release()
-                surface = null
-            } catch (e: Throwable) {
-                ALog.e(TAG, "release e=$e", e)
-            }
-            isRunning = false
-            onVideoComplete()
-            if (needDestroy) {
-                destroyInner()
-            }
-        }
-    }
-
-    override fun destroy() {
-        if (isRunning) {
-            needDestroy = true
-            stop()
-        } else {
-            destroyInner()
-        }
-    }
-
-    private fun destroyInner() {
-        ALog.i(TAG, "destroyInner")
-        renderThread.handler?.post {
-            player.pluginManager.onDestroy()
-            render?.destroyRender()
-            render = null
-            onVideoDestroy()
-            destroyThread()
-        }
-    }
-}

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

@@ -1,66 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.AssetManager
-import android.graphics.SurfaceTexture
-import com.tencent.qgame.animplayer.file.IFileContainer
-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.IScaleType
-import com.tencent.qgame.animplayer.util.ScaleType
-import java.io.File
-
-interface IAnimView {
-
-    fun prepareTextureView()
-
-    fun getSurfaceTexture(): SurfaceTexture?
-
-    fun setAnimListener(animListener: IAnimListener?)
-
-    fun setFetchResource(fetchResource: IFetchResource?)
-
-    fun setOnResourceClickListener(resourceClickListener: OnResourceClickListener?)
-
-    fun setLoop(playLoop: Int)
-
-    fun supportMask(isSupport: Boolean, isEdgeBlur: Boolean)
-
-    fun updateMaskConfig(maskConfig: MaskConfig?)
-
-    fun setFps(fps: Int)
-
-    fun setScaleType(type: ScaleType)
-
-    fun setScaleType(scaleType: IScaleType)
-
-    fun setMute(isMute: Boolean)
-
-    fun startPlay(file: File)
-
-    fun startPlay(assetManager: AssetManager, assetsPath: String)
-
-    fun startPlay(fileContainer: IFileContainer)
-
-    fun stopPlay()
-
-    fun isRunning(): Boolean
-
-    fun getRealSize(): Pair<Int, Int>
-}

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

@@ -1,54 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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
-
-interface IRenderListener {
-
-    /**
-     * 初始化渲染环境,获取shader字段,创建绑定纹理
-     */
-    fun initRender()
-
-    /**
-     * 渲染上屏
-     */
-    fun renderFrame()
-
-    fun clearFrame()
-
-    /**
-     * 释放纹理
-     */
-    fun destroyRender()
-
-    /**
-     * 设置视频配置
-     */
-    fun setAnimConfig(config: AnimConfig)
-
-    /**
-     * 显示区域大小变化
-     */
-    fun updateViewPort(width: Int, height: Int) {}
-
-    fun getExternalTexture(): Int
-
-    fun releaseTexture()
-
-    fun swapBuffers()
-
-    fun setYUVData(width: Int, height: Int, y: ByteArray?, u: ByteArray?, v: ByteArray?) {}
-}

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

@@ -1,153 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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): IRenderListener {
-
-    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)
-        initRender()
-    }
-
-    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)
-    }
-
-    override fun initRender() {
-        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")
-
-        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)
-    }
-
-    override fun renderFrame() {
-        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()
-    }
-
-    override fun clearFrame() {
-        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f)
-        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
-        eglUtil.swapBuffers()
-    }
-
-    override fun destroyRender() {
-        releaseTexture()
-        eglUtil.release()
-    }
-
-    override fun releaseTexture() {
-        GLES20.glDeleteTextures(genTexture.size, genTexture, 0)
-    }
-
-    /**
-     * 设置视频配置
-     */
-    override fun setAnimConfig(config: AnimConfig) {
-        setVertexBuf(config)
-        setTexCoords(config)
-    }
-
-    /**
-     * 显示区域大小变化
-     */
-    override fun updateViewPort(width: Int, height: Int) {
-        if (width <=0 || height <=0) return
-        surfaceSizeChanged = true
-        surfaceWidth = width
-        surfaceHeight = height
-    }
-
-    override fun swapBuffers() {
-        eglUtil.swapBuffers()
-    }
-
-    /**
-     * mediaCodec渲染使用的
-     */
-    override 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)
-    }
-
-}

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

@@ -1,43 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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" +
-            "}"
-}

+ 0 - 207
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/YUVRender.kt

@@ -1,207 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.GLES20
-import com.tencent.qgame.animplayer.util.GlFloatArray
-import com.tencent.qgame.animplayer.util.ShaderUtil.createProgram
-import com.tencent.qgame.animplayer.util.TexCoordsUtil
-import com.tencent.qgame.animplayer.util.VertexUtil
-import java.nio.ByteBuffer
-import java.nio.FloatBuffer
-
-class YUVRender (surfaceTexture: SurfaceTexture): IRenderListener {
-
-    companion object {
-        private const val TAG = "${Constant.TAG}.YUVRender"
-    }
-
-    private val vertexArray = GlFloatArray()
-    private val alphaArray = GlFloatArray()
-    private val rgbArray = GlFloatArray()
-
-    private var shaderProgram = 0
-
-    //顶点位置
-    private var avPosition = 0
-
-    //rgb纹理位置
-    private var rgbPosition = 0
-
-    //alpha纹理位置
-    private var alphaPosition = 0
-
-    //shader  yuv变量
-    private var samplerY = 0
-    private var samplerU = 0
-    private var samplerV = 0
-    private var textureId = IntArray(3)
-    private var convertMatrixUniform = 0
-    private var convertOffsetUniform = 0
-
-    //YUV数据
-    private var widthYUV = 0
-    private var heightYUV = 0
-    private var y: ByteBuffer? = null
-    private var u: ByteBuffer? = null
-    private var v: ByteBuffer? = null
-
-    private val eglUtil: EGLUtil = EGLUtil()
-
-    // 像素数据向GPU传输时默认以4字节对齐
-    private var unpackAlign = 4
-
-    // YUV offset
-    private val YUV_OFFSET = floatArrayOf(
-            0f, -0.501960814f, -0.501960814f
-    )
-
-    // RGB coefficients
-    private val YUV_MATRIX = floatArrayOf(
-            1f, 1f, 1f,
-            0f, -0.3441f, 1.772f,
-            1.402f, -0.7141f, 0f
-    )
-
-    init {
-        eglUtil.start(surfaceTexture)
-        initRender()
-    }
-
-    override fun initRender() {
-        shaderProgram = createProgram(YUVShader.VERTEX_SHADER, YUVShader.FRAGMENT_SHADER)
-        //获取顶点坐标字段
-        avPosition = GLES20.glGetAttribLocation(shaderProgram, "v_Position")
-        //获取纹理坐标字段
-        rgbPosition = GLES20.glGetAttribLocation(shaderProgram, "vTexCoordinateRgb")
-        alphaPosition = GLES20.glGetAttribLocation(shaderProgram, "vTexCoordinateAlpha")
-
-        //获取yuv字段
-        samplerY = GLES20.glGetUniformLocation(shaderProgram, "sampler_y")
-        samplerU = GLES20.glGetUniformLocation(shaderProgram, "sampler_u")
-        samplerV = GLES20.glGetUniformLocation(shaderProgram, "sampler_v")
-        convertMatrixUniform = GLES20.glGetUniformLocation(shaderProgram, "convertMatrix")
-        convertOffsetUniform = GLES20.glGetUniformLocation(shaderProgram, "offset")
-        //创建3个纹理
-        GLES20.glGenTextures(textureId.size, textureId, 0)
-
-        //绑定纹理
-        for (id in textureId) {
-            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, id)
-            GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT)
-            GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT)
-            GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR)
-            GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR)
-        }
-    }
-
-    override fun renderFrame() {
-        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f)
-        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
-        draw()
-    }
-
-    override fun clearFrame() {
-        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f)
-        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)
-        eglUtil.swapBuffers()
-    }
-
-    override fun destroyRender() {
-        releaseTexture()
-        eglUtil.release()
-    }
-
-    override fun setAnimConfig(config: AnimConfig) {
-        vertexArray.setArray(VertexUtil.create(config.width, config.height, PointRect(0, 0, config.width, config.height), vertexArray.array))
-        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)
-    }
-
-    override fun getExternalTexture(): Int {
-        return textureId[0]
-    }
-
-    override fun releaseTexture() {
-        GLES20.glDeleteTextures(textureId.size, textureId, 0)
-    }
-
-    override fun swapBuffers() {
-        eglUtil.swapBuffers()
-    }
-
-    override fun setYUVData(width: Int, height: Int, y: ByteArray?, u: ByteArray?, v: ByteArray?) {
-        widthYUV = width
-        heightYUV = height
-        this.y = ByteBuffer.wrap(y)
-        this.u = ByteBuffer.wrap(u)
-        this.v = ByteBuffer.wrap(v)
-
-        // 当视频帧的u或者v分量的宽度不能被4整除时,用默认的4字节对齐会导致存取最后一行时越界,所以在向GPU传输数据前指定对齐方式
-        if ((widthYUV / 2) % 4 != 0) {
-            this.unpackAlign = if ((widthYUV / 2) % 2 == 0) 2 else 1
-        }
-    }
-
-    private fun draw() {
-        if (widthYUV > 0 && heightYUV > 0 && y != null && u != null && v != null) {
-            GLES20.glUseProgram(shaderProgram)
-            vertexArray.setVertexAttribPointer(avPosition)
-            alphaArray.setVertexAttribPointer(alphaPosition)
-            rgbArray.setVertexAttribPointer(rgbPosition)
-
-            GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, unpackAlign)
-
-            //激活纹理0来绑定y数据
-            GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
-            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId[0])
-            GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_LUMINANCE, widthYUV, heightYUV, 0, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE, y)
-
-            //激活纹理1来绑定u数据
-            GLES20.glActiveTexture(GLES20.GL_TEXTURE1)
-            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId[1])
-            GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_LUMINANCE, widthYUV / 2, heightYUV / 2, 0, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE, u)
-
-            //激活纹理2来绑定v数据
-            GLES20.glActiveTexture(GLES20.GL_TEXTURE2)
-            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId[2])
-            GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_LUMINANCE, widthYUV / 2, heightYUV / 2, 0, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE, v)
-
-            //给fragment_shader里面yuv变量设置值   0 1 标识纹理x
-            GLES20.glUniform1i(samplerY, 0)
-            GLES20.glUniform1i(samplerU, 1)
-            GLES20.glUniform1i(samplerV, 2)
-
-            GLES20.glUniform3fv(convertOffsetUniform, 1, FloatBuffer.wrap(YUV_OFFSET))
-            GLES20.glUniformMatrix3fv(convertMatrixUniform, 1, false, YUV_MATRIX, 0)
-
-            //绘制
-            GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4)
-            y?.clear()
-            u?.clear()
-            v?.clear()
-            y = null
-            u = null
-            v = null
-            GLES20.glDisableVertexAttribArray(avPosition)
-            GLES20.glDisableVertexAttribArray(rgbPosition)
-            GLES20.glDisableVertexAttribArray(alphaPosition)
-        }
-    }
-}

+ 0 - 60
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/YUVShader.kt

@@ -1,60 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 YUVShader {
-
-    const val VERTEX_SHADER = "attribute vec4 v_Position;\n" +
-            "attribute vec2 vTexCoordinateAlpha;\n" +
-            "attribute vec2 vTexCoordinateRgb;\n" +
-            "varying vec2 v_TexCoordinateAlpha;\n" +
-            "varying vec2 v_TexCoordinateRgb;\n" +
-            "\n" +
-            "void main() {\n" +
-            "    v_TexCoordinateAlpha = vTexCoordinateAlpha;\n" +
-            "    v_TexCoordinateRgb = vTexCoordinateRgb;\n" +
-            "    gl_Position = v_Position;\n" +
-            "}"
-
-    const val FRAGMENT_SHADER = "precision mediump float;\n" +
-            "uniform sampler2D sampler_y;\n" +
-            "uniform sampler2D sampler_u;\n" +
-            "uniform sampler2D sampler_v;\n" +
-            "varying vec2 v_TexCoordinateAlpha;\n" +
-            "varying vec2 v_TexCoordinateRgb;\n" +
-            "uniform mat3 convertMatrix;\n" +
-            "uniform vec3 offset;\n" +
-            "\n" +
-            "void main() {\n" +
-            "   highp vec3 yuvColorAlpha;\n" +
-            "   highp vec3 yuvColorRGB;\n" +
-            "   highp vec3 rgbColorAlpha;\n" +
-            "   highp vec3 rgbColorRGB;\n" +
-            "   yuvColorAlpha.x = texture2D(sampler_y,v_TexCoordinateAlpha).r;\n" +
-            "   yuvColorRGB.x = texture2D(sampler_y,v_TexCoordinateRgb).r;\n" +
-            "   yuvColorAlpha.y = texture2D(sampler_u,v_TexCoordinateAlpha).r;\n" +
-            "   yuvColorAlpha.z = texture2D(sampler_v,v_TexCoordinateAlpha).r;\n" +
-            "   yuvColorRGB.y = texture2D(sampler_u,v_TexCoordinateRgb).r;\n" +
-            "   yuvColorRGB.z = texture2D(sampler_v,v_TexCoordinateRgb).r;\n" +
-            "   yuvColorAlpha += offset;\n" +
-            "   yuvColorRGB += offset;\n" +
-            "   rgbColorAlpha = convertMatrix * yuvColorAlpha; \n" +
-            "   rgbColorRGB = convertMatrix * yuvColorRGB; \n" +
-            "   gl_FragColor=vec4(rgbColorRGB, rgbColorAlpha.r);\n" +
-            "}"
-
-    // RGB2*Alpha+RGB1*(1-Alpha)
-}

+ 0 - 65
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/file/AssetsFileContainer.kt

@@ -1,65 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file
-
-import android.content.res.AssetFileDescriptor
-import android.content.res.AssetManager
-import android.media.MediaExtractor
-import com.tencent.qgame.animplayer.Constant
-import com.tencent.qgame.animplayer.util.ALog
-
-class AssetsFileContainer(assetManager: AssetManager, assetsPath: String): IFileContainer {
-
-    companion object {
-        private const val TAG = "${Constant.TAG}.FileContainer"
-    }
-
-    private val assetFd: AssetFileDescriptor = assetManager.openFd(assetsPath)
-    private val assetsInputStream: AssetManager.AssetInputStream =
-        assetManager.open(assetsPath, AssetManager.ACCESS_STREAMING) as AssetManager.AssetInputStream
-
-    init {
-        ALog.i(TAG, "AssetsFileContainer init")
-    }
-
-    override fun setDataSource(extractor: MediaExtractor) {
-        if (assetFd.declaredLength < 0) {
-            extractor.setDataSource(assetFd.fileDescriptor)
-        } else {
-            extractor.setDataSource(assetFd.fileDescriptor, assetFd.startOffset, assetFd.declaredLength)
-        }
-    }
-
-    override fun startRandomRead() {
-    }
-
-    override fun read(b: ByteArray, off: Int, len: Int): Int {
-        return assetsInputStream.read(b, off, len)
-    }
-
-    override fun skip(pos: Long) {
-        assetsInputStream.skip(pos)
-    }
-
-    override fun closeRandomRead() {
-        assetsInputStream.close()
-    }
-
-    override fun close() {
-        assetFd.close()
-        assetsInputStream.close()
-    }
-}

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

@@ -1,60 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file
-
-import android.media.MediaExtractor
-import com.tencent.qgame.animplayer.Constant
-import com.tencent.qgame.animplayer.util.ALog
-import java.io.File
-import java.io.FileNotFoundException
-import java.io.RandomAccessFile
-
-class FileContainer(private val file: File) : IFileContainer {
-
-    companion object {
-        private const val TAG = "${Constant.TAG}.FileContainer"
-    }
-
-    private var randomAccessFile: RandomAccessFile? = null
-
-    init {
-        ALog.i(TAG, "FileContainer init")
-        if (!(file.exists() && file.isFile && file.canRead())) throw FileNotFoundException("Unable to read $file")
-    }
-
-    override fun setDataSource(extractor: MediaExtractor) {
-        extractor.setDataSource(file.toString())
-    }
-
-    override fun startRandomRead() {
-        randomAccessFile = RandomAccessFile(file, "r")
-    }
-
-    override fun read(b: ByteArray, off: Int, len: Int): Int {
-        return randomAccessFile?.read(b, off, len) ?: -1
-    }
-
-    override fun skip(pos: Long) {
-        randomAccessFile?.skipBytes(pos.toInt())
-    }
-
-    override fun closeRandomRead() {
-        randomAccessFile?.close()
-    }
-
-    override fun close() {
-    }
-}

+ 0 - 34
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/file/IFileContainer.kt

@@ -1,34 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file
-
-import android.media.MediaExtractor
-
-interface IFileContainer {
-
-    fun setDataSource(extractor: MediaExtractor)
-
-    fun startRandomRead()
-
-    fun read(b: ByteArray, off: Int, len: Int): Int
-
-    fun skip(pos: Long)
-
-    fun closeRandomRead()
-
-    fun close()
-
-}

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

@@ -1,50 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file
-
-import android.annotation.TargetApi
-import android.media.MediaExtractor
-import android.os.Build
-import java.io.ByteArrayInputStream
-
-@TargetApi(Build.VERSION_CODES.M)
-class StreamContainer(private val bytes: ByteArray) : IFileContainer {
-
-    private var stream: ByteArrayInputStream = ByteArrayInputStream(bytes)
-
-    override fun setDataSource(extractor: MediaExtractor) {
-        val dataSource = StreamMediaDataSource(bytes)
-        extractor.setDataSource(dataSource)
-    }
-
-    override fun startRandomRead() {
-    }
-
-    override fun read(b: ByteArray, off: Int, len: Int): Int {
-        return stream.read(b, off, len)
-    }
-
-    override fun skip(pos: Long) {
-        stream.skip(pos)
-    }
-
-    override fun closeRandomRead() {
-    }
-
-    override fun close() {
-        stream.close()
-    }
-}

+ 0 - 49
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/file/StreamMediaDataSource.kt

@@ -1,49 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.file
-
-import android.annotation.TargetApi
-import android.media.MediaDataSource
-import android.os.Build
-
-@TargetApi(Build.VERSION_CODES.M)
-class StreamMediaDataSource(val bytes: ByteArray) : MediaDataSource() {
-
-    override fun close() {
-    }
-
-    override fun readAt(position: Long, buffer: ByteArray, offset: Int, size: Int): Int {
-        var newSize = size
-        synchronized(StreamMediaDataSource::class) {
-            val length = bytes.size
-            if (position >= length) {
-                return -1
-            }
-            if (position + newSize > length) {
-                newSize -= (position + newSize).toInt() - length
-            }
-            System.arraycopy(bytes, position.toInt(), buffer, offset, newSize)
-            return newSize
-        }
-
-    }
-
-    override fun getSize(): Long {
-        synchronized(StreamMediaDataSource::class) {
-            return bytes.size.toLong()
-        }
-    }
-}

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

@@ -1,74 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 Tencent.  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?)
-}

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

@@ -1,33 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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>)
-}

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

@@ -1,24 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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)
-}

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

@@ -1,66 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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()
-    }
-    
-}

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

@@ -1,74 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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
-    }
-}

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

@@ -1,130 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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)
-        }
-
-    }
-
-}

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

@@ -1,114 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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)
-    }
-
-}

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

@@ -1,83 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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)
-        }
-    }
-}

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

@@ -1,229 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.e(TAG, "IFetchResource is empty")
-            // 没有设置IFetchResource 当成普通视频播放
-            return Constant.OK
-        }
-        // 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 = if (it == null) {
-                        ALog.e(TAG, "fetch image ${src.srcId} bitmap return null")
-                        BitmapUtil.createEmptyBitmap()
-                    } else 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
-        }
-    }
-}

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

@@ -1,151 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.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.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.drawWidth, src.drawHeight, 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)
-        }
-    }
-
-    /**
-     * CENTER_FULL 并不是严格的centerCrop(centerCrop已经前置处理),此处主要是为防抖动做处理,复杂遮罩情况下需要固定src大小进行绘制防止抖动
-     */
-    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
-    }
-
-
-}

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

@@ -1,94 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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)
-    }
-
-}

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

@@ -1,56 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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, viewHeight) = mixAnimPlugin.player.animView.getRealSize()
-        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.x * videoWith / viewWith.toFloat()
-                val y = ev.y * videoHeight / viewHeight.toFloat()
-                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).apply {
-                            curPoint = frame.frame
-                        }
-                    }
-                }
-            }
-        }
-        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)
-    }
-}

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

@@ -1,39 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 com.tencent.qgame.animplayer.PointRect
-
-/**
- * 资源描述
- */
-class Resource(src: Src) {
-    var id = ""
-    var type = Src.SrcType.UNKNOWN
-    var loadType = Src.LoadType.UNKNOWN
-    var tag = ""
-    var bitmap: Bitmap? = null
-    var curPoint: PointRect? = null  // src在当前帧的位置信息
-
-    init {
-        id = src.srcId
-        type = src.srcType
-        loadType = src.loadType
-        tag = src.srcTag
-        bitmap = src.bitmap
-    }
-}

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

@@ -1,152 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 drawWidth = 0
-    var drawHeight = 0
-    var srcType = SrcType.UNKNOWN
-    var loadType = LoadType.UNKNOWN
-    var srcTag = ""
-    var txt = ""
-    var style = Style.DEFAULT
-    var color: Int = 0
-    var fitType = FitType.FIT_XY
-    var srcTextureId = 0
-    var bitmap: Bitmap? = null
-        set(value) {
-            field = value
-            genDrawSize(value)
-        }
-
-    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")
-    }
-
-
-    private fun genDrawSize(bitmap: Bitmap?) {
-        val bw = bitmap?.width?: w
-        val bh = bitmap?.height?: h
-        drawWidth = bw
-        drawHeight = bh
-        if (fitType == FitType.CENTER_FULL) {
-            if (w == 0 || h == 0) {
-                return
-            }
-            // 按src w h进行centerCrop处理
-            val srcRate = w.toFloat() / h.toFloat()
-            val bitmapRate = bw.toFloat() / bh.toFloat()
-
-            if (bitmapRate >= srcRate) {
-                drawHeight = h
-                drawWidth = (h * bitmapRate).toInt()
-            } else {
-                drawWidth = w
-                drawHeight = (w / bitmapRate).toInt()
-            }
-        }
-    }
-
-
-    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
-            }
-        }
-    }
-}

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

@@ -1,127 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 = 0
-    // 帧不相同的次数, 连续多次不同则直接使用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
-        decodeIndex = 0
-        plugins.forEach {
-            it.onRenderCreate()
-        }
-    }
-
-    fun onDecoding(decodeIndex: Int) {
-        ALog.d(TAG, "onDecoding decodeIndex=$decodeIndex")
-        this.decodeIndex = decodeIndex
-        plugins.forEach {
-            it.onDecoding(decodeIndex)
-        }
-    }
-
-    // 开始循环调用
-    fun onLoopStart() {
-        ALog.i(TAG, "onLoopStart")
-        frameIndex = 0
-        decodeIndex = 0
-    }
-
-    fun onRendering() {
-        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) // 第一帧 0
-        }
-        frameIndex++
-    }
-
-    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
-    }
-}

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

@@ -1,48 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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}
-}

+ 0 - 21
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/textureview/InnerTextureView.kt

@@ -1,21 +0,0 @@
-package com.tencent.qgame.animplayer.textureview
-
-import android.content.Context
-import android.util.AttributeSet
-import android.view.MotionEvent
-import android.view.TextureView
-import com.tencent.qgame.animplayer.AnimPlayer
-
-class InnerTextureView @JvmOverloads constructor(
-    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
-) : TextureView(context, attrs, defStyleAttr) {
-
-    var player: AnimPlayer? = null
-
-    override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
-        val res = player?.isRunning() == true
-                && ev != null
-                && player?.pluginManager?.onDispatchTouchEvent(ev) == true
-        return if (!res) super.dispatchTouchEvent(ev) else true
-    }
-}

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

@@ -1,54 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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) {}
-}
-
-

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

@@ -1,68 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 createEmptyBitmap() : Bitmap {
-        return Bitmap.createBitmap(16, 16, Bitmap.Config.ARGB_8888).apply {
-            eraseColor(Color.TRANSPARENT)
-        }
-    }
-
-    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
-    }
-
-}

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

@@ -1,50 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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)
-    }
-}

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

@@ -1,107 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.MediaCodecList
-import android.media.MediaExtractor
-import android.media.MediaFormat
-import com.tencent.qgame.animplayer.Constant
-import com.tencent.qgame.animplayer.file.IFileContainer
-import kotlin.collections.HashMap
-
-
-object MediaUtil {
-
-    private const val TAG = "${Constant.TAG}.MediaUtil"
-
-    private var isTypeMapInit = false
-    private val supportTypeMap = HashMap<String, Boolean>()
-
-    const val MIME_HEVC = "video/hevc"
-
-    fun getExtractor(file: IFileContainer): MediaExtractor {
-        val extractor = MediaExtractor()
-        file.setDataSource(extractor)
-        return extractor
-    }
-
-    /**
-     * 是否为h265的视频
-     */
-    fun checkIsHevc(videoFormat: MediaFormat):Boolean {
-        val mime = videoFormat.getString(MediaFormat.KEY_MIME) ?: ""
-        return mime.contains("hevc")
-    }
-
-    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.i(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.i(TAG, "Extractor selected track $i ($mime): $format")
-                return i
-            }
-        }
-        return -1
-    }
-
-    /**
-     * 检查设备解码支持类型
-     */
-    @Synchronized
-    fun checkSupportCodec(mimeType: String): Boolean {
-        if (!isTypeMapInit) {
-            isTypeMapInit = true
-            getSupportType()
-        }
-        return supportTypeMap.containsKey(mimeType.toLowerCase())
-    }
-
-
-    private fun getSupportType() {
-        try {
-            val numCodecs = MediaCodecList.getCodecCount()
-            for (i in 0 until numCodecs) {
-                val codecInfo = MediaCodecList.getCodecInfoAt(i)
-                if (codecInfo.isEncoder) {
-                    continue
-                }
-                val types = codecInfo.supportedTypes
-                for (j in types.indices) {
-                    supportTypeMap[types[j].toLowerCase()] = true
-                }
-            }
-            ALog.i(TAG, "supportType=${supportTypeMap.keys}")
-        } catch (t: Throwable) {
-            ALog.e(TAG, "getSupportType $t")
-        }
-    }
-
-}

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

@@ -1,252 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.view.Gravity
-import android.view.View
-import android.view.ViewGroup
-import android.widget.FrameLayout
-import com.tencent.qgame.animplayer.Constant
-
-
-enum class ScaleType {
-    FIT_XY, // 完整填充整个布局 default
-    FIT_CENTER, // 按视频比例在布局中间完整显示
-    CENTER_CROP, // 按视频比例完整填充布局(多余部分不显示)
-}
-
-interface IScaleType {
-
-    fun getLayoutParam(
-        layoutWidth: Int,
-        layoutHeight: Int,
-        videoWidth: Int,
-        videoHeight: Int,
-        layoutParams: FrameLayout.LayoutParams
-    ): FrameLayout.LayoutParams
-
-    fun getRealSize(): Pair<Int, Int>
-}
-
-class ScaleTypeFitXY : IScaleType {
-
-    private var realWidth = 0
-    private var realHeight = 0
-
-    override fun getLayoutParam(
-        layoutWidth: Int,
-        layoutHeight: Int,
-        videoWidth: Int,
-        videoHeight: Int,
-        layoutParams: FrameLayout.LayoutParams
-    ): FrameLayout.LayoutParams {
-        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT
-        layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
-        realWidth = layoutWidth
-        realHeight = layoutHeight
-        return layoutParams
-    }
-
-    override fun getRealSize(): Pair<Int, Int> {
-        return Pair(realWidth, realHeight)
-    }
-}
-
-class ScaleTypeFitCenter : IScaleType {
-
-    private var realWidth = 0
-    private var realHeight = 0
-
-    override fun getLayoutParam(
-        layoutWidth: Int,
-        layoutHeight: Int,
-        videoWidth: Int,
-        videoHeight: Int,
-        layoutParams: FrameLayout.LayoutParams
-    ): FrameLayout.LayoutParams {
-        val (w, h) = getFitCenterSize(layoutWidth, layoutHeight, videoWidth, videoHeight)
-        if (w <= 0 && h <= 0) return layoutParams
-        realWidth = w
-        realHeight = h
-        layoutParams.width = w
-        layoutParams.height = h
-        layoutParams.gravity = Gravity.CENTER
-        return layoutParams
-    }
-
-    override fun getRealSize(): Pair<Int, Int> {
-        return Pair(realWidth, realHeight)
-    }
-
-    private fun getFitCenterSize(
-        layoutWidth: Int,
-        layoutHeight: Int,
-        videoWidth: Int,
-        videoHeight: Int
-    ): Pair<Int, Int> {
-
-        val layoutRatio = layoutWidth.toFloat() / layoutHeight
-        val videoRatio = videoWidth.toFloat() / videoHeight
-
-        val realWidth: Int
-        val realHeight: Int
-        if (layoutRatio > videoRatio) {
-            realHeight = layoutHeight
-            realWidth = (videoRatio * realHeight).toInt()
-        } else {
-            realWidth = layoutWidth
-            realHeight = (realWidth / videoRatio).toInt()
-        }
-
-        return Pair(realWidth, realHeight)
-    }
-}
-
-class ScaleTypeCenterCrop : IScaleType {
-
-    private var realWidth = 0
-    private var realHeight = 0
-
-    override fun getLayoutParam(
-        layoutWidth: Int,
-        layoutHeight: Int,
-        videoWidth: Int,
-        videoHeight: Int,
-        layoutParams: FrameLayout.LayoutParams
-    ): FrameLayout.LayoutParams {
-        val (w, h) = getCenterCropSize(layoutWidth, layoutHeight, videoWidth, videoHeight)
-        if (w <= 0 && h <= 0) return layoutParams
-        realWidth = w
-        realHeight = h
-        layoutParams.width = w
-        layoutParams.height = h
-        layoutParams.gravity = Gravity.CENTER
-        return layoutParams
-    }
-
-    override fun getRealSize(): Pair<Int, Int> {
-        return Pair(realWidth, realHeight)
-    }
-
-    private fun getCenterCropSize(
-        layoutWidth: Int,
-        layoutHeight: Int,
-        videoWidth: Int,
-        videoHeight: Int
-    ): Pair<Int, Int> {
-
-        val layoutRatio = layoutWidth.toFloat() / layoutHeight
-        val videoRatio = videoWidth.toFloat() / videoHeight
-
-        val realWidth: Int
-        val realHeight: Int
-        if (layoutRatio > videoRatio) {
-            realWidth = layoutWidth
-            realHeight = (realWidth / videoRatio).toInt()
-        } else {
-            realHeight = layoutHeight
-            realWidth = (videoRatio * realHeight).toInt()
-        }
-
-        return Pair(realWidth, realHeight)
-    }
-}
-
-
-class ScaleTypeUtil {
-
-    companion object {
-        private const val TAG = "${Constant.TAG}.ScaleTypeUtil"
-    }
-
-    private val scaleTypeFitXY by lazy { ScaleTypeFitXY() }
-    private val scaleTypeFitCenter by lazy { ScaleTypeFitCenter() }
-    private val scaleTypeCenterCrop by lazy { ScaleTypeCenterCrop() }
-    private var layoutWidth = 0
-    private var layoutHeight = 0
-    private var videoWidth = 0
-    private var videoHeight = 0
-
-    var currentScaleType = ScaleType.FIT_XY
-    var scaleTypeImpl: IScaleType? = null
-
-    fun setLayoutSize(w: Int, h: Int) {
-        layoutWidth = w
-        layoutHeight = h
-    }
-
-    fun setVideoSize(w: Int, h: Int) {
-        videoWidth = w
-        videoHeight = h
-    }
-
-    /**
-     * 获取实际视频容器宽高
-     * @return w h
-     */
-    fun getRealSize(): Pair<Int, Int> {
-        val size = getCurrentScaleType().getRealSize()
-        ALog.i(TAG, "get real size (${size.first}, ${size.second})")
-        return size
-    }
-
-    fun getLayoutParam(view: View?): FrameLayout.LayoutParams {
-        val layoutParams = (view?.layoutParams as? FrameLayout.LayoutParams)
-            ?: FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT,
-                ViewGroup.LayoutParams.MATCH_PARENT
-            )
-        if (!checkParams()) {
-            ALog.e(
-                TAG,
-                "params error: layoutWidth=$layoutWidth, layoutHeight=$layoutHeight, videoWidth=$videoWidth, videoHeight=$videoHeight"
-            )
-            return layoutParams
-        }
-
-        return getCurrentScaleType().getLayoutParam(
-            layoutWidth,
-            layoutHeight,
-            videoWidth,
-            videoHeight,
-            layoutParams
-        )
-    }
-
-    private fun getCurrentScaleType(): IScaleType {
-        val tmpScaleType = scaleTypeImpl
-        return if (tmpScaleType != null) {
-            ALog.i(TAG, "custom scaleType")
-            tmpScaleType
-        } else {
-            ALog.i(TAG, "scaleType=$currentScaleType")
-            when (currentScaleType) {
-                ScaleType.FIT_XY -> scaleTypeFitXY
-                ScaleType.FIT_CENTER -> scaleTypeFitCenter
-                ScaleType.CENTER_CROP -> scaleTypeCenterCrop
-            }
-        }
-    }
-
-
-    private fun checkParams(): Boolean {
-        return layoutWidth > 0
-                && layoutHeight > 0
-                && videoWidth > 0
-                && videoHeight > 0
-    }
-
-}

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

@@ -1,74 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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
-    }
-
-}

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

@@ -1,81 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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
-    }
-}

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

@@ -1,84 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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
-    }
-
-}

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

@@ -1,58 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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)
-        }
-    }
-}

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

@@ -1,64 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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
-    }
-
-}

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

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

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

@@ -1,17 +0,0 @@
-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);
-    }
-}

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

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

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

@@ -1,26 +0,0 @@
-apply plugin: 'java-library'
-
-dependencies {
-    implementation fileTree(dir: 'libs', include: ['*.jar'])
-}
-
-sourceCompatibility = "7"
-targetCompatibility = "7"
-buildscript {
-    repositories {
-        mavenCentral()
-    }
-    dependencies {
-    }
-}
-repositories {
-    mavenCentral()
-}
-
-jar {
-    manifest {
-        attributes(
-            'Main-Class': 'com.tencent.qgame.playerproj.animtool.Main'
-        )
-    }
-}

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

@@ -1,425 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 com.tencent.qgame.playerproj.animtool.vapx.FrameSet;
-import com.tencent.qgame.playerproj.animtool.vapx.GetMaskFrame;
-import com.tencent.qgame.playerproj.animtool.vapx.SrcSet;
-
-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";
-
-    public static final String OUTPUT_DIR = "output"+ File.separator;
-    public static final String FRAME_IMAGE_DIR = "frames"+ File.separator;
-    public static final String VIDEO_FILE = "video.mp4";
-    public static final String TEMP_VIDEO_FILE = "tmp_video.mp4";
-    public static final String TEMP_VIDEO_AUDIO_FILE = "tmp_video_audio.mp4";
-    public static final String VAPC_BIN_FILE = "vapc.bin";
-    public static final String VAPC_JSON_FILE = "vapc.json";
-
-
-
-    private volatile int totalP = 0;
-    private volatile int finishThreadCount = 0;
-    private long time;
-    private GetAlphaFrame getAlphaFrame = new GetAlphaFrame();
-    private GetMaskFrame getMaskFrame = new GetMaskFrame();
-    private IToolListener toolListener;
-
-    public void setToolListener(IToolListener toolListener) {
-        this.toolListener = toolListener;
-    }
-
-    /**
-     * @param commonArg
-     * @param needVideo true 生成完整视频 false 只合成帧图片
-     */
-    public void create(final CommonArg commonArg, final boolean needVideo) throws Exception{
-        TLog.i(TAG, "start create");
-        createAllFrameImage(commonArg, new IRunResult() {
-            @Override
-            public boolean run() {
-                if (finalCheck(commonArg) && needVideo) {
-                    // 最终生成视频文件
-                    return createVideo(commonArg);
-                }
-                return false;
-            }
-        });
-    }
-
-    /**
-     * 参数校验
-     * @param commonArg
-     * @return
-     */
-    private boolean checkCommonArg(CommonArg commonArg) throws Exception {
-        return CommonArgTool.autoFillAndCheck(commonArg, toolListener);
-    }
-
-    private boolean finalCheck(CommonArg commonArg) {
-        if (commonArg.isVapx) {
-            if (commonArg.srcSet.srcs.isEmpty()) {
-                TLog.i(TAG, "vapx error: src is empty");
-                return false;
-            }
-            for (SrcSet.Src src : commonArg.srcSet.srcs) {
-                if (src.w <=0 || src.h <= 0) {
-                    TLog.i(TAG, "vapx error: src.id=" + src.srcId + ",src.w=" + src.w + ",src.h=" + src.h);
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    private void createAllFrameImage(final CommonArg commonArg, final IRunResult finishRunnable) throws Exception{
-        if (!checkCommonArg(commonArg)) {
-            if (toolListener != null) toolListener.onError();
-            return;
-        }
-
-        TLog.i(TAG, "createAllFrameImage");
-        time = System.currentTimeMillis();
-
-        // 检测output文件是否存在,不存在则生成
-        checkDir(commonArg.outputPath);
-        checkDir(commonArg.frameOutputPath);
-
-        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;
-
-        if (toolListener != null) {
-            toolListener.onProgress(0f);
-        }
-        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++) {
-                        try {
-                            createFrame(commonArg, i);
-                        } catch (Exception e) {
-                            TLog.e(TAG, "createFrame error:" + e.getMessage());
-                        }
-                        synchronized (AnimTool.class) {
-                            totalP++;
-                            float progress = totalP * 1.0f / commonArg.totalFrame;
-                            if (toolListener != null) {
-                                toolListener.onProgress(progress);
-                            } else {
-                                TLog.i(TAG, "progress " + progress);
-                            }
-                        }
-                    }
-                    synchronized (AnimTool.class) {
-                        finishThreadCount++;
-                        if (finishThreadCount == threadNum) {
-                            boolean result = false;
-                            if (finishRunnable != null) {
-                                result = finishRunnable.run();
-                            }
-                            long cost = System.currentTimeMillis() - time;
-                            TLog.i(TAG,"Finish cost=" + cost);
-                            if (toolListener != null) {
-                                if (result) {
-                                    toolListener.onComplete();
-                                } else {
-                                    toolListener.onError();
-                                }
-                            }
-                        }
-                    }
-                }
-            }).start();
-        }
-    }
-
-    private void createFrame(CommonArg commonArg, int frameIndex) throws Exception {
-        File inputFile = new File(commonArg.inputPath + String.format("%03d", frameIndex)+".png");
-        GetAlphaFrame.AlphaFrameOut videoFrame = getAlphaFrame.createFrame(commonArg, inputFile);
-        if (commonArg.isVapx) {
-            FrameSet.FrameObj frameObj = getMaskFrame.getFrameObj(frameIndex, commonArg, videoFrame.argb);
-            if (frameObj != null) {
-                commonArg.frameSet.frameObjs.add(frameObj);
-            }
-        }
-        if (videoFrame == null) {
-            TLog.i(TAG, "frameIndex="+frameIndex +" is empty");
-            return;
-        }
-        // 最后保存图片
-        BufferedImage outBuf = new BufferedImage(commonArg.outputW, commonArg.outputH, BufferedImage.TYPE_INT_ARGB);
-        outBuf.setRGB(0,0, commonArg.outputW, commonArg.outputH, videoFrame.argb, 0, commonArg.outputW);
-
-        File outputFile = new File(commonArg.frameOutputPath + 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 boolean createVideo(CommonArg commonArg) {
-        try {
-            // 创建配置json文件
-            createVapcJson(commonArg);
-            // 创建mp4文件
-            boolean result = createMp4(commonArg, commonArg.outputPath, commonArg.frameOutputPath);
-            if (!result) {
-                TLog.i(TAG, "createMp4 fail");
-                deleteFile(commonArg);
-                return false;
-            }
-            String tempVideoName = TEMP_VIDEO_FILE;
-            if (commonArg.needAudio) {
-                result = mergeAudio2Mp4(commonArg, tempVideoName);
-                if (!result) {
-                    TLog.i(TAG, "mergeAudio2Mp4 fail");
-                    deleteFile(commonArg);
-                    return false;
-                }
-                tempVideoName = TEMP_VIDEO_AUDIO_FILE;
-            }
-
-            String input = commonArg.outputPath + VAPC_JSON_FILE;
-            // 由json变为bin文件
-            String vapcBinPath = mp4BoxTool(input, commonArg.outputPath);
-            // 将bin文件合并到mp4里
-            result = mergeBin2Mp4(commonArg, vapcBinPath, tempVideoName, commonArg.outputPath);
-            if (!result) {
-                TLog.i(TAG, "mergeBin2Mp4 fail");
-                deleteFile(commonArg);
-                return false;
-            }
-            deleteFile(commonArg);
-            // 计算文件md5
-            String md5 = new Md5Util().getFileMD5(new File(commonArg.outputPath + VIDEO_FILE), commonArg.outputPath);
-            TLog.i(TAG, "md5="+md5);
-        } catch (Exception e) {
-            TLog.e(TAG, "createVideo error:" + e.getMessage());
-            return false;
-        }
-        return true;
-    }
-
-    private void deleteFile(CommonArg commonArg) {
-        // 删除临时视频文件
-        File file;
-        file = new File(commonArg.outputPath + TEMP_VIDEO_FILE);
-        if (file.exists()) file.delete();
-        if (commonArg.needAudio) {
-            file = new File(commonArg.outputPath + TEMP_VIDEO_AUDIO_FILE);
-            if (file.exists()) file.delete();
-        }
-        file = new File(commonArg.outputPath + VAPC_BIN_FILE);
-        if (file.exists()) file.delete();
-    }
-
-    /**
-     * 创建对应的配置json
-     * @param commonArg
-     */
-    private void createVapcJson(CommonArg commonArg) {
-
-        String json = "\"info\":{" +
-                "\"v\":" + commonArg.version + "," +
-                "\"f\":" + commonArg.totalFrame + "," +
-                "\"w\":" + commonArg.rgbPoint.w + "," +
-                "\"h\":" + commonArg.rgbPoint.h + "," +
-                "\"fps\":" + commonArg.fps + "," +
-                "\"videoW\":" + commonArg.outputW + "," +
-                "\"videoH\":" + commonArg.outputH + "," +
-                "\"aFrame\":" + commonArg.alphaPoint.toString() + "," +
-                "\"rgbFrame\":" + commonArg.rgbPoint.toString() + "," +
-                "\"isVapx\":" + (commonArg.isVapx ? 1 : 0) + "," +
-                "\"orien\":" + 0 +
-                "}";
-        TLog.i(TAG, "{" + json + "}");
-
-        StringBuilder sb = new StringBuilder();
-        sb.append("{");
-        sb.append(json);
-        if (commonArg.isVapx) {
-            sb.append(",");
-            sb.append(commonArg.srcSet.toString());
-            sb.append(",");
-            sb.append(commonArg.frameSet.toString());
-        }
-        sb.append("}");
-        json = sb.toString();
-
-        try {
-            BufferedWriter writer = new BufferedWriter(new FileWriter(commonArg.outputPath + VAPC_JSON_FILE));
-            writer.write(json);
-            writer.flush();
-            writer.close();
-        } catch (IOException e) {
-            TLog.e(TAG, "createVapcJson error:" + e.getMessage());
-            throw new RuntimeException();
-        }
-    }
-
-
-
-
-
-    /**
-     * 创建mp4
-     */
-    private boolean createMp4(CommonArg commonArg, String videoPath, String frameImagePath) throws Exception {
-
-        TLog.i(TAG, "run createMp4");
-        int result = ProcessUtil.run(getFFmpegCmd(commonArg, videoPath, frameImagePath));
-        TLog.i(TAG, "createMp4 result=" + (result == 0? "success" : "fail"));
-        return result == 0;
-    }
-
-    private String[] getFFmpegCmd(CommonArg commonArg, String videoPath, String frameImagePath) {
-        String[] cmd;
-        if (commonArg.enableH265) {
-            if (commonArg.enableCrf) {
-                cmd = new String[] {commonArg.ffmpegCmd, "-framerate", String.valueOf(commonArg.fps),
-                        "-i", frameImagePath + "%03d.png",
-                        "-pix_fmt", "yuv420p",
-                        "-vcodec", "libx265",
-                        "-crf", Integer.toString(commonArg.crf),
-                        "-profile:v", "main",
-                        "-level", "4.0",
-                        "-tag:v", "hvc1",
-                        "-bufsize", "2000k",
-                        "-y", videoPath + TEMP_VIDEO_FILE};
-            } else {
-                cmd = new String[] {commonArg.ffmpegCmd, "-framerate", String.valueOf(commonArg.fps),
-                        "-i", frameImagePath + "%03d.png",
-                        "-pix_fmt", "yuv420p",
-                        "-vcodec", "libx265",
-                        "-b:v", commonArg.bitrate + "k",
-                        "-profile:v", "main",
-                        "-level", "4.0",
-                        "-tag:v", "hvc1",
-                        "-bufsize", "2000k",
-                        "-y", videoPath + TEMP_VIDEO_FILE};
-            }
-
-        } else {
-            if (commonArg.enableCrf) {
-                cmd = new String[]{commonArg.ffmpegCmd, "-framerate", String.valueOf(commonArg.fps),
-                        "-i", frameImagePath + "%03d.png",
-                        "-pix_fmt", "yuv420p",
-                        "-vcodec", "libx264",
-                        "-crf", Integer.toString(commonArg.crf),
-                        "-profile:v", "main",
-                        "-level", "4.0",
-                        "-bf", "0",
-                        "-bufsize", "2000k",
-                        "-y", videoPath + TEMP_VIDEO_FILE};
-            } else {
-                cmd = new String[]{commonArg.ffmpegCmd, "-framerate", String.valueOf(commonArg.fps),
-                        "-i", frameImagePath + "%03d.png",
-                        "-pix_fmt", "yuv420p",
-                        "-vcodec", "libx264",
-                        "-b:v", commonArg.bitrate + "k",
-                        "-profile:v", "main",
-                        "-level", "4.0",
-                        "-bf", "0",
-                        "-bufsize", "2000k",
-                        "-y", videoPath + TEMP_VIDEO_FILE};
-            }
-
-        }
-
-        return cmd;
-    }
-
-    /**
-     * 合并音频文件
-     */
-    private boolean mergeAudio2Mp4(CommonArg commonArg, String tempVideoFile) throws Exception {
-        String[] cmd = new String[] {commonArg.ffmpegCmd,
-                "-i", commonArg.audioPath,
-                "-i", commonArg.outputPath + tempVideoFile,
-                "-c:v", "copy",
-                "-c:a", "aac",
-                "-y", commonArg.outputPath + TEMP_VIDEO_AUDIO_FILE};
-        TLog.i(TAG, "run mergeAudio2Mp4");
-        int result = ProcessUtil.run(cmd);
-        TLog.i(TAG, "mergeAudio2Mp4 result=" + (result == 0? "success" : "fail"));
-        return result == 0;
-    }
-
-
-    /**
-     * 合并vapc.bin到mp4里
-     */
-    private boolean mergeBin2Mp4(CommonArg commonArg, String inputFile, String tempVideoFile, String videoPath) throws Exception {
-        String[] cmd = new String[]{commonArg.mp4editCmd, "--insert", ":" + inputFile + ":3", videoPath + tempVideoFile, videoPath + VIDEO_FILE};
-        TLog.i(TAG, "run mergeBin2Mp4");
-        int result = ProcessUtil.run(cmd);
-        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 String mp4BoxTool(String inputFile, String outputPath) throws Exception {
-        Mp4BoxTool mp4BoxTool = new Mp4BoxTool();
-        return mp4BoxTool.create(inputFile, outputPath);
-    }
-
-
-    public interface IToolListener {
-        void onProgress(float progress);
-        void onWarning(String msg);
-        void onError();
-        void onComplete();
-    }
-
-    private interface IRunResult {
-        boolean run();
-    }
-
-}

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

@@ -1,94 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 com.tencent.qgame.playerproj.animtool.data.PointRect;
-import com.tencent.qgame.playerproj.animtool.vapx.FrameSet;
-import com.tencent.qgame.playerproj.animtool.vapx.SrcSet;
-
-public class CommonArg {
-
-    public String ffmpegCmd = "ffmpeg"; // ffmpeg 命令地址
-
-    public String mp4editCmd = "mp4edit"; // bento4 mp4edit 命令地址
-
-    public boolean enableH265 = false; // 是否开启h265
-
-    public int fps = 25;
-
-    public String inputPath; // 输入帧文件地址
-
-    public float scale = 0.5f; // alpha 区域缩放大小
-
-    public boolean enableCrf = false; // 是否开启可变码率
-
-    public int bitrate = 2000; // 码率
-
-    public int crf = 29; // 0(无损) - 50(最大压缩)
-
-    /**
-     * 自动填充参数配置
-     */
-    public String outputPath; // 输出地址
-
-    public String frameOutputPath; // 帧图片输出路径
-
-    public int version = 2;
-
-    public int gap; // rgb 与 alpha 之间间隔距离
-
-    public int totalFrame;
-
-    public PointRect rgbPoint = new PointRect(); // rgb 区域 原始图像区域
-
-    public PointRect alphaPoint = new PointRect();  // alpha 区域
-
-    public boolean isVLayout = false; // 是否为垂直布局
-
-    public int outputW = 0; // 输出最终视频的宽高
-
-    public int outputH = 0;
-
-    public boolean needAudio = false;
-
-    public String audioPath; // 音频地址
-
-    /**
-     * 融合动画相关参数
-     */
-
-    public boolean isVapx = false;
-
-    public SrcSet srcSet = new SrcSet();
-    public FrameSet frameSet = new FrameSet();
-
-    @Override
-    public String toString() {
-        return "CommonArg{" +
-                "ffmpegCmd='" + ffmpegCmd + '\'' +
-                ", mp4editCmd='" + mp4editCmd + '\'' +
-                ", enableH265=" + enableH265 +
-                ", fps=" + fps +
-                ", enableCrf=" + enableCrf +
-                ", bitrate=" + bitrate +
-                ", crf=" + crf +
-                ", scale=" + scale +
-                ", inputPath='" + inputPath + '\'' +
-                ", needAudio=" + needAudio + '\'' +
-                ", audioPath='" + audioPath + '\'' +
-                '}';
-    }
-}

+ 0 - 204
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/CommonArgTool.java

@@ -1,204 +0,0 @@
-package com.tencent.qgame.playerproj.animtool;
-
-import com.tencent.qgame.playerproj.animtool.vapx.SrcSet;
-
-import java.awt.image.BufferedImage;
-import java.io.File;
-
-import javax.imageio.ImageIO;
-
-/**
- * 构造参数
- */
-class CommonArgTool {
-
-    private static final String TAG = "CommonArgTool";
-    private static final int MIN_GAP = 4; // 元素最小间隙 防止编码与光栅化导致边界模糊问题
-
-    /**
-     * 参数自动填充
-     * @param commonArg
-     */
-    static boolean autoFillAndCheck(CommonArg commonArg, AnimTool.IToolListener toolListener) throws Exception {
-
-        String os = System.getProperty("os.name");
-        TLog.i(TAG, os);
-
-        if (commonArg.inputPath == null && "".equals(commonArg.inputPath)) {
-            TLog.e(TAG, "input path invalid");
-            return false;
-        }
-
-        //  路径检查
-        File input = new File(commonArg.inputPath);
-        if (!input.exists()) {
-            TLog.e(TAG, "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 (commonArg.needAudio) {
-            File audio = new File(commonArg.audioPath);
-            if (!audio.exists() || commonArg.audioPath == null || commonArg.audioPath.length() < 3) {
-                TLog.e(TAG , "audio file not exists " + commonArg.audioPath);
-                return false;
-            }
-            String type = commonArg.audioPath.substring(commonArg.audioPath.length() - 3).toLowerCase();
-            if (!"mp3".equals(type)) {
-                TLog.e(TAG , "audio file must be mp3 file " + commonArg.audioPath);
-                return false;
-            }
-        }
-
-        // output path
-        commonArg.outputPath = commonArg.inputPath + AnimTool.OUTPUT_DIR;
-
-        // 帧图片生成路径
-        commonArg.frameOutputPath = commonArg.outputPath + AnimTool.FRAME_IMAGE_DIR;
-
-        // srcId自动生成 & 融合动画路径检查 & z序
-        if (commonArg.isVapx) {
-            // vapx 强制缩小
-            commonArg.scale = 0.5f;
-            int size = commonArg.srcSet.srcs.size();
-            SrcSet.Src src;
-            for (int i=0; i<size; i++) {
-                src = commonArg.srcSet.srcs.get(i);
-                src.srcId = String.valueOf(i);
-                src.z = i;
-                File srcPath = new File(src.srcPath);
-                if (!srcPath.exists()) {
-                    TLog.e(TAG, "src="+ src.srcId+",path invalid " + src.srcPath);
-                    continue;
-                }
-                if (!File.separator.equals(src.srcPath.substring(src.srcPath.length() - 1))) {
-                    src.srcPath = src.srcPath + File.separator;
-                }
-            }
-        }
-
-        // 限定scale的值
-        if (commonArg.scale < 0.5f) {
-            commonArg.scale = 0.5f;
-        }
-
-        if (commonArg.scale > 1f) {
-            commonArg.scale = 1f;
-        }
-
-        // 检查第一帧
-        File firstFrame = new File(commonArg.inputPath + "000.png");
-        if (!firstFrame.exists()) {
-            TLog.e(TAG, "first frame 000.png does not exist");
-            return false;
-        }
-        // 获取视频高度
-        BufferedImage inputBuf = ImageIO.read(firstFrame);
-        commonArg.rgbPoint.w = inputBuf.getWidth();
-        commonArg.rgbPoint.h = inputBuf.getHeight();
-        if (commonArg.rgbPoint.w <= 0 || commonArg.rgbPoint.h <= 0) {
-            TLog.e(TAG, "video size " + commonArg.rgbPoint.w + "x" + commonArg.rgbPoint.h);
-            return false;
-        }
-
-        // 设置元素之间宽度
-        commonArg.gap = MIN_GAP;
-
-        // 计算alpha区域大小
-        commonArg.alphaPoint.w = (int) (commonArg.rgbPoint.w * commonArg.scale);
-        commonArg.alphaPoint.h = (int) (commonArg.rgbPoint.h * commonArg.scale);
-
-        // 计算视频最佳方向 (最长边最小原则)
-        int hW = commonArg.rgbPoint.w + commonArg.gap + commonArg.alphaPoint.w;
-        int hH = commonArg.rgbPoint.h;
-        int hMaxLen = Math.max(hW, hH);
-
-        int vW = commonArg.rgbPoint.w;
-        int vH = commonArg.rgbPoint.h + commonArg.gap + commonArg.alphaPoint.h;
-        int vMaxLen = Math.max(vW, vH);
-
-        if (hMaxLen > vMaxLen) { // 竖直布局
-            commonArg.isVLayout = true;
-            commonArg.alphaPoint.x = 0;
-            commonArg.alphaPoint.y = commonArg.rgbPoint.h + commonArg.gap;
-
-            commonArg.outputW = commonArg.rgbPoint.w;
-            commonArg.outputH = commonArg.rgbPoint.h + commonArg.gap + commonArg.alphaPoint.h;
-        } else { // 水平布局
-            commonArg.isVLayout = false;
-            commonArg.alphaPoint.x = commonArg.rgbPoint.w + commonArg.gap;
-            commonArg.alphaPoint.y = 0;
-
-            commonArg.outputW = commonArg.rgbPoint.w + commonArg.gap + commonArg.alphaPoint.w;
-            commonArg.outputH = commonArg.rgbPoint.h;
-        }
-
-        // 计算出 16倍数的视频
-        int[] size = calSizeFill(commonArg.outputW, commonArg.outputH);
-        // 得到最终视频宽高
-        commonArg.outputW += size[0];
-        commonArg.outputH += size[1];
-
-        if (commonArg.outputW > 1504 || commonArg.outputH > 1504) {
-            String msg = "[Warning] Output video width:" + commonArg.outputW + " or height:" + commonArg.outputH
-                    + " is over 1504. Some devices will display exception. For example green screen!";
-            TLog.w(TAG, msg);
-            if (toolListener != null) {
-                toolListener.onWarning(msg);
-            }
-        }
-
-        // 获取总帧数
-        commonArg.totalFrame = 0;
-        for (int i=0; i<=999; i++) {
-            File frameFile = new File(commonArg.inputPath + String.format("%03d", i) + ".png");
-            // 顺序检查
-            if (!frameFile.exists()) {
-                break;
-            }
-            commonArg.totalFrame++;
-        }
-
-
-        if (commonArg.totalFrame <= 0) {
-            TLog.e(TAG, "totalFrame=" + commonArg.totalFrame);
-            return false;
-        }
-
-        // 码率检查
-        if (!commonArg.enableCrf && commonArg.bitrate <= 0) {
-            TLog.e(TAG, "bitrate=" + commonArg.bitrate);
-            return false;
-        }
-
-        // crf检查
-        if (commonArg.enableCrf && (commonArg.crf < 0 || commonArg.crf > 51)) {
-            TLog.e(TAG, "crf=" + commonArg.crf + ", no in [0, 51]");
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * 寻找最小wFill & hFill情况下 整个视频宽高能被16整除
-     */
-    private static int[] calSizeFill(int outW, int outH) {
-        int wFill = 0;
-        if (outW % 16 != 0) {
-            wFill = ((outW / 16) + 1) * 16 - outW;
-        }
-
-        int hFill = 0;
-        if (outH % 16 != 0) {
-            hFill = ((outH / 16) + 1) * 16 - outH;
-        }
-        return new int[]{wFill, hFill};
-    }
-
-
-}

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

@@ -1,126 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 com.tencent.qgame.playerproj.animtool.data.PointRect;
-
-import javax.imageio.ImageIO;
-
-import java.awt.geom.AffineTransform;
-import java.awt.image.AffineTransformOp;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
-public class GetAlphaFrame {
-
-    public static class AlphaFrameOut {
-
-        public int[] argb;
-
-        public AlphaFrameOut(int[] argb) {
-            this.argb = argb;
-        }
-
-    }
-
-    public AlphaFrameOut createFrame(CommonArg commonArg, File inputFile) throws IOException {
-
-        if (!inputFile.exists()) {
-            return null;
-        }
-
-        int w = commonArg.rgbPoint.w;
-        int h = commonArg.rgbPoint.h;
-        int outW = commonArg.outputW;
-        int outH = commonArg.outputH;
-
-        BufferedImage inputBuf = ImageIO.read(inputFile);
-        int[] inputArgb = inputBuf.getRGB(0, 0, w, h, null, 0, w);
-
-        int[] outputArgb = new int[outW * outH];
-        Arrays.fill(outputArgb, 0xff000000);
-
-        BufferedImage alphaBuf = inputBuf;
-        int[] alphaArgb = inputArgb;
-
-        if (commonArg.scale < 1f) {
-            AffineTransform at = new AffineTransform();
-            at.scale(commonArg.scale, commonArg.scale);
-
-            alphaBuf = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
-            AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
-            alphaBuf = scaleOp.filter(inputBuf, alphaBuf);
-
-            alphaArgb = alphaBuf.getRGB(0, 0, w, h, null, 0, w);
-        }
-
-        // rgb 区域
-        fillColor(outputArgb, outW, commonArg.rgbPoint, false, inputArgb, w);
-
-        // alpha 区域
-        fillColor(outputArgb, outW, commonArg.alphaPoint, true, alphaArgb, w);
-
-        return new AlphaFrameOut(outputArgb);
-
-    }
-
-
-    private void fillColor(int[] outputArgb, int outputW, PointRect point, boolean isAlpha, int[] inputArgb, int inputW) {
-        int outX = 0;
-        int outY = 0;
-        for (int y = 0; y < point.h ; y++) {
-            outY = point.y + y;
-            for (int x = 0; x < point.w ; x++) {
-                outX = point.x + x;
-                int color = inputArgb[x + y * inputW];
-                outputArgb[outX + outY * outputW] = isAlpha ? getAlpha(color) : getColor(color);
-            }
-        }
-    }
-
-    private int getColor(int color) {
-        return blendBg(color, 0xff000000);
-    }
-
-    private int getAlpha(int color) {
-        int alpha = color >>> 24;
-        // r = g = b
-        return 0xff000000 + (alpha << 16) + (alpha << 8) + alpha;
-    }
-
-    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);
-
-    }
-
-}
-

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

@@ -1,168 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 com.tencent.qgame.playerproj.animtool.ui.ToolUI;
-import com.tencent.qgame.playerproj.animtool.vapx.SrcSet;
-
-public class Main {
-
-
-    public static void main(String[] args) throws Exception {
-        // 启动UI界面
-        new ToolUI().run();
-
-        // java工具普通动画
-        // animTool();
-
-        // java工具融合动画
-        // animVapxTool();
-    }
-
-
-    /**
-     *
-     * 运行前请先安装ffmpeg与bento4这两个工具
-     *
-     * 生成图片的工具
-     * step 1 填写如下参数,运行后生成中间图片
-     * step 2 进入outputPath目录,运行如下ffmpeg命令(需要预先安装ffmpeng)
-     *
-     * h264
-     * ffmpeg -r 24 -i "%03d.png" -pix_fmt yuv420p -vcodec libx264 -b:v 3000k -profile:v main -level 4.0 -bf 0 -bufsize 3000k -y demo.mp4
-     *
-     * h265
-     * ffmpeg -r 24 -i "%03d.png" -pix_fmt yuv420p -vcodec libx265 -b:v 2000k -profile:v main -level 4.0 -bf 0 -bufsize 2000k -tag:v hvc1 -y demo.mp4
-     *
-     * 使用固定码率能使文件更小,但会损失清晰度
-     * 使用-crf 参数可以提高清晰度但文件大小不可控(会变大),推荐值 29(0 最好 51 最差)
-     *
-     *
-     * ps: 项目是普通的java程序,需要在Run Configuration 里加入Application运行项目,并选择animtool项目,接下来按提示配置即可
-     */
-    public static void animTool() throws Exception {
-        final CommonArg commonArg = new CommonArg();
-        // ffmpeg 命令路径
-        commonArg.ffmpegCmd = "ffmpeg";
-        // bento4 mp4edit 命令路径
-        commonArg.mp4editCmd = "mp4edit";
-
-        /*
-         * 是否开启h265
-         * 优点:压缩率更高,视频更清晰
-         * 缺点:Android 4.x系统 & 极少部分低端机 无法播放265视频
-         */
-        commonArg.enableH265 = false;
-        // fps
-        commonArg.fps = 24;
-        // 素材文件路径
-        commonArg.inputPath = "/path/to/your/demo";
-        // alpha 区域缩放大小  (0.5 - 1)
-        commonArg.scale = 0.5f;
-
-        // 开始运行
-        AnimTool animTool = new AnimTool();
-        // needVideo true 直接生成video false 生成帧图片,由用户手动生成最终视频文件
-        animTool.create(commonArg, true);
-    }
-
-
-    /**
-     * 融合动画 demo
-     */
-    public static void animVapxTool() throws Exception {
-        final CommonArg commonArg = new CommonArg();
-        // ffmpeg 命令路径
-        commonArg.ffmpegCmd = "ffmpeg";
-        // bento4 mp4edit 命令路径
-        commonArg.mp4editCmd = "mp4edit";
-
-        String path = "/path/to/your/demo";
-
-        commonArg.enableH265 = false;
-        // fps
-        commonArg.fps = 24;
-        // 素材文件路径
-        commonArg.inputPath = path + "video";
-        // 启动融合动画
-        commonArg.isVapx = true;
-        if (commonArg.isVapx) {
-            // 融合动画默认需要缩放0.5f 空出区域
-            commonArg.scale = 0.5f;
-        }
-        // src 设置
-        commonArg.srcSet = getSrcSet(path);
-
-
-        // 开始运行
-        AnimTool animTool = new AnimTool();
-        // needVideo true 直接生成video false 生成帧图片,由用户手动生成最终视频文件
-        animTool.create(commonArg, true);
-    }
-
-
-    private static SrcSet getSrcSet(String path) {
-        SrcSet srcSet = new SrcSet();
-
-        {
-            SrcSet.Src src = new SrcSet.Src();
-            src.srcPath = path + "mask1";
-            src.srcId = "1";
-            src.srcType = SrcSet.Src.SRC_TYPE_IMG;
-            src.srcTag = "head1";
-            src.fitType = SrcSet.Src.FIT_TYPE_CF;
-            srcSet.srcs.add(src);
-        }
-
-
-        {
-            SrcSet.Src src = new SrcSet.Src();
-            src.srcPath = path + "mask2";
-            src.srcId = "2";
-            src.srcType = SrcSet.Src.SRC_TYPE_TXT;
-            src.srcTag = "text1";
-            src.fitType = SrcSet.Src.FIT_TYPE_FITXY;
-            src.color = "#0000ff";
-            src.style = SrcSet.Src.TEXT_STYLE_BOLD;
-            srcSet.srcs.add(src);
-        }
-
-
-
-
-        return srcSet;
-    }
-
-    /**
-     * 生成对应的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);
-    }
-
-
-}

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

@@ -1,95 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 {
-    public static final String MD5_FILE = "md5.txt";
-    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_FILE));
-                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);
-    }
-}

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

@@ -1,156 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 String 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 null;
-        }
-        checkDir(outputPath);
-        File output = new File(outputPath + AnimTool.VAPC_BIN_FILE);
-        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");
-        return output.getAbsolutePath();
-    }
-
-    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 + AnimTool.VAPC_JSON_FILE);
-
-        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;
-    }
-
-
-}

+ 0 - 52
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/ProcessUtil.java

@@ -1,52 +0,0 @@
-package com.tencent.qgame.playerproj.animtool;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-
-/**
- * porcess.waitFor() 必须读取执行结果
- * https://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
- */
-class ProcessUtil {
-
-    public static int run(String[] cmd) throws Exception {
-        Process proc = Runtime.getRuntime().exec(cmd);
-
-        StreamReader errorReader = new StreamReader(proc.getErrorStream(), "ERROR");
-        StreamReader outputReader = new StreamReader(proc.getInputStream(), "OUTPUT");
-        errorReader.start();
-        outputReader.start();
-
-        int result = proc.waitFor();
-        if (result != 0) TLog.i(errorReader.type, errorReader.sb.toString());
-        return result;
-    }
-
-    private static class StreamReader extends Thread {
-        InputStream is;
-        String type;
-        StringBuilder sb = new StringBuilder();
-
-        StreamReader(InputStream is, String type) {
-            this.is = is;
-            this.type = type;
-        }
-
-        public void run() {
-            try {
-                InputStreamReader isr = new InputStreamReader(is);
-                BufferedReader br = new BufferedReader(isr);
-                String line = null;
-                while ((line = br.readLine()) != null) {
-                    sb.append(line);
-                    sb.append("\n");
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-}

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

@@ -1,52 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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 ITLog logger;
-
-    public static void i(String tag, String msg) {
-        if (logger != null) {
-            logger.i(tag, msg);
-        } else {
-            System.out.println(tag + "\t" + msg);
-        }
-    }
-
-    public static void e(String tag, String msg) {
-        if (logger != null) {
-            logger.e(tag, msg);
-        } else {
-            System.out.println(tag + "\tError:" + msg);
-        }
-    }
-
-    public static void w(String tag, String msg) {
-        if (logger != null) {
-            logger.w(tag, msg);
-        } else {
-            System.out.println(tag + "\tWarning:" + msg);
-        }
-    }
-
-
-    public interface ITLog {
-        void i(String tag, String  msg);
-        void e(String tag, String  msg);
-        void w(String tag, String  msg);
-    }
-}

+ 0 - 24
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/data/PointRect.java

@@ -1,24 +0,0 @@
-package com.tencent.qgame.playerproj.animtool.data;
-
-public class PointRect {
-
-    public int x = 0;
-    public int y = 0;
-    public int w = 0;
-    public int h = 0;
-
-    public PointRect() {
-    }
-
-    public PointRect(int x, int y, int w, int h) {
-        this.x = x;
-        this.y = y;
-        this.w = w;
-        this.h = h;
-    }
-
-    @Override
-    public String toString() {
-        return "["+ x +","+ y +","+ w +","+ h +"]";
-    }
-}

+ 0 - 72
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/ui/OpenSourceUI.java

@@ -1,72 +0,0 @@
-package com.tencent.qgame.playerproj.animtool.ui;
-
-import com.tencent.qgame.playerproj.animtool.TLog;
-
-import java.awt.Toolkit;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
-import javax.swing.BoxLayout;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-class OpenSourceUI {
-
-    private final int WIDTH = 600;
-    private final int HEIGHT = 800;
-
-    public void createUI() {
-        JFrame frame = new JFrame("open source software");
-        frame.setSize(WIDTH, HEIGHT);
-        frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
-
-        int w = (Toolkit.getDefaultToolkit().getScreenSize().width - WIDTH) / 2;
-        int h = (Toolkit.getDefaultToolkit().getScreenSize().height - HEIGHT) / 2;
-        frame.setLocation(w, h);
-
-        JPanel panel = new JPanel();
-        panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
-        final JTextArea txtArea = new JTextArea();
-        txtArea.setEditable(false);
-        txtArea.setLineWrap(true);
-        txtArea.setWrapStyleWord(true);
-        JScrollPane areaScrollPane = new JScrollPane(txtArea);
-        areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
-
-        panel.add(areaScrollPane);
-
-        frame.add(panel);
-        frame.setVisible(true);
-
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                readLicense(txtArea);
-            }
-        }).start();
-    }
-
-    private void readLicense(JTextArea txtArea) {
-        StringBuilder sb = new StringBuilder();
-        try {
-            File file = new File("LICENSE.txt");
-            BufferedReader reader = new BufferedReader(new FileReader(file));
-
-            String line = reader.readLine();
-            while (line != null) {
-                if (line.length() != 0) {
-                    sb.append(line);
-                }
-                sb.append("\n");
-                line = reader.readLine();
-            }
-        } catch (Exception e) {
-            TLog.i("OpenSourceUI", "ERROR -> " + e.getMessage());
-        }
-        txtArea.setText(sb.toString());
-    }
-
-}

+ 0 - 587
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/ui/ToolUI.java

@@ -1,587 +0,0 @@
-package com.tencent.qgame.playerproj.animtool.ui;
-
-import com.tencent.qgame.playerproj.animtool.AnimTool;
-import com.tencent.qgame.playerproj.animtool.CommonArg;
-import com.tencent.qgame.playerproj.animtool.TLog;
-
-import java.awt.Desktop;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.GridLayout;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.nio.charset.StandardCharsets;
-import java.util.Properties;
-
-import javax.swing.BoxLayout;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JSpinner;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.SpinnerModel;
-import javax.swing.SpinnerNumberModel;
-
-public class ToolUI {
-
-    private static final String TAG = "ToolUI";
-    private static final String TOOL_VERSION = "VAP tool 2.0.6";
-    private static final String PROPERTIES_FILE = "setting.properties";
-    public static final int WIDTH = 900;
-    public static final int HEIGHT = 750;
-
-    private final JFrame frame = new JFrame(TOOL_VERSION);
-    private final ButtonGroup group = new ButtonGroup();
-    private final JRadioButton btnH264 = new JRadioButton("h264");
-    private final JRadioButton btnH265 = new JRadioButton("h265");
-    private final SpinnerModel modelFps = new SpinnerNumberModel(24, 1, 60, 1);
-    private final Float[] scaleArray = new Float[]{0.5f, 1f};
-    private final JComboBox<Float> boxScale = new JComboBox<>(scaleArray);
-    private final JTextField textInputPath = new JTextField();
-    private final JButton btnCreate = new JButton("create VAP");
-    private final JTextArea txtAreaLog = new JTextArea();
-    private final JTextField textAudioPath = new JTextField();
-    private final JPanel panelAudioPath = new JPanel();
-
-    private final JPanel panelBitrate = new JPanel();
-    private final JTextField textBitrate = new JTextField();
-    private final JPanel panelCrf = new JPanel();
-    private final JTextField textCrf = new JTextField();
-
-    private final ButtonGroup groupQuality = new ButtonGroup();
-    private final JRadioButton btnBitrate = new JRadioButton("bitrate");
-    private final JRadioButton btnCrf = new JRadioButton("crf");
-
-    private final JLabel labelOutInfo = new JLabel();
-    private final Dimension labelSize = new Dimension(100, 20);
-    private final Properties props = new Properties();
-    private final VapxUI vapxUI = new VapxUI(this);
-
-    private boolean needAudio = false;
-
-    private final ItemListener qualityGroupListener = new ItemListener() {
-        @Override
-        public void itemStateChanged(ItemEvent itemEvent) {
-            if (itemEvent.getSource() == btnBitrate) {
-                panelBitrate.setVisible(true);
-                panelCrf.setVisible(false);
-            } else if (itemEvent.getSource() == btnCrf) {
-                panelBitrate.setVisible(false);
-                panelCrf.setVisible(true);
-            }
-        }
-    };
-
-    public ToolUI() {
-        TLog.logger = new TLog.ITLog() {
-            @Override
-            public void i(String tag, String msg) {
-                log(tag, msg);
-            }
-
-            @Override
-            public void e(String tag, String msg) {
-                log(tag, "Error:" + msg);
-            }
-
-            @Override
-            public void w(String tag, String msg) {
-                log(tag, "Warning:" + msg);
-            }
-        };
-    }
-
-
-    public void run() {
-        createUI();
-        loadProperties();
-    }
-
-    private void loadProperties() {
-        try {
-            File file = new File(PROPERTIES_FILE);
-            if (!file.exists()) {
-                file.createNewFile();
-            }
-            props.load(new InputStreamReader(new FileInputStream(PROPERTIES_FILE), StandardCharsets.UTF_8));
-            CommonArg commonArg = getProperties();
-            group.setSelected(commonArg.enableH265 ? btnH265.getModel() : btnH264.getModel(), true);
-            modelFps.setValue(commonArg.fps);
-            textInputPath.setText(commonArg.inputPath);
-            textAudioPath.setText(commonArg.audioPath);
-            textBitrate.setText(String.valueOf(commonArg.bitrate));
-            textCrf.setText(String.valueOf(commonArg.crf));
-            groupQuality.setSelected(commonArg.enableCrf ? btnCrf.getModel() : btnBitrate.getModel(), true);
-            if (commonArg.enableCrf) {
-                panelBitrate.setVisible(false);
-                panelCrf.setVisible(true);
-            } else {
-                panelBitrate.setVisible(true);
-                panelCrf.setVisible(false);
-            }
-
-            float scale = commonArg.scale;
-            for (int i = 0; i < scaleArray.length ; i++) {
-                if (scaleArray[i] == scale) {
-                    boxScale.setSelectedIndex(i);
-                    break;
-                }
-            }
-        } catch (Exception e) {
-            TLog.e(TAG, e.getMessage());
-        }
-    }
-
-    private void runTool() {
-        txtAreaLog.setText("");
-        TLog.i(TAG, TOOL_VERSION);
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    runAnimTool();
-                } catch (Exception e) {
-                    TLog.e(TAG, e.getMessage());
-                    setOutput(false, "");
-                }
-            }
-        }).start();
-    }
-
-    private void runAnimTool() throws Exception {
-        final CommonArg commonArg = new CommonArg();
-        String os = System.getProperty("os.name").toLowerCase();
-
-        commonArg.ffmpegCmd = "ffmpeg";
-        commonArg.mp4editCmd = "mp4edit";
-
-        if (os != null && !"".equals(os)) {
-            if (os.contains("mac") && new File("mac").exists()) {
-                commonArg.ffmpegCmd = "mac/ffmpeg";
-                commonArg.mp4editCmd = "mac/mp4edit";
-            } else if (os.contains("windows") && new File("win").exists()) {
-                commonArg.ffmpegCmd = "win/ffmpeg";
-                commonArg.mp4editCmd = "win/mp4edit";
-            }
-        }
-        commonArg.enableH265 = group.isSelected(btnH265.getModel());
-        commonArg.fps = (Integer)modelFps.getValue();
-        commonArg.inputPath = textInputPath.getText();
-        commonArg.scale = scaleArray[boxScale.getSelectedIndex()];
-        if (needAudio) {
-            commonArg.needAudio = true;
-            commonArg.audioPath = textAudioPath.getText();
-        }
-
-        if (vapxUI.isVapxEnable()) {
-            commonArg.isVapx = true;
-            commonArg.srcSet = vapxUI.getSrcSet();
-            if (commonArg.srcSet == null) {
-                return;
-            }
-        }
-        try {
-            commonArg.enableCrf = groupQuality.isSelected(btnCrf.getModel());
-            commonArg.bitrate = Integer.parseInt(textBitrate.getText());
-            commonArg.crf = Integer.parseInt(textCrf.getText());
-        } catch (NumberFormatException e) {
-            TLog.e(TAG, "bitrate format error " + textBitrate.getText() + e.getMessage());
-        }
-
-        TLog.i(TAG, commonArg.toString());
-
-        AnimTool animTool = new AnimTool();
-        animTool.setToolListener(new AnimTool.IToolListener() {
-            @Override
-            public void onProgress(float progress) {
-                int p = (int)(progress * 100f);
-                labelOutInfo.setText((Math.min(p, 99)) + "%");
-            }
-
-            @Override
-            public void onWarning(String msg) {
-                JOptionPane.showMessageDialog(frame, msg, "Warning", JOptionPane.WARNING_MESSAGE);
-            }
-
-            @Override
-            public void onError() {
-                setOutput(false, "");
-            }
-
-            @Override
-            public void onComplete() {
-                setOutput(true, commonArg.outputPath);
-                try {
-                    setProperties(commonArg);
-                    Desktop.getDesktop().open(new File(commonArg.outputPath));
-                } catch (IOException e) {
-                    TLog.e(TAG, e.getMessage());
-                }
-            }
-        });
-        btnCreate.setEnabled(false);
-        animTool.create(commonArg, true);
-
-    }
-
-    private void createUI() {
-        frame.setSize(WIDTH, HEIGHT);
-        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
-        int w = (Toolkit.getDefaultToolkit().getScreenSize().width - WIDTH) / 2;
-        int h = (Toolkit.getDefaultToolkit().getScreenSize().height - HEIGHT) / 2;
-        frame.setLocation(w, h);
-
-        JPanel panel = new JPanel();
-        frame.add(panel);
-        layout(panel);
-        frame.setVisible(true);
-    }
-
-    public String getInputPath() {
-        return textInputPath.getText();
-    }
-
-    private void layout(JPanel panel) {
-        BoxLayout layout = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
-        panel.setLayout(layout);
-        // codec
-        panel.add(getCodecLayout());
-        // fps
-        panel.add(getFpsLayout());
-        // bitrate/crf switch
-        panel.add(getQualityLayout());
-        // bitrate
-        panel.add(getBitrateLayout());
-        // crf
-        panel.add(getCrfLayout());
-        // scale
-        panel.add(getScaleLayout());
-        // path
-        panel.add(getPathLayout());
-        // audio path
-        panel.add(getAudioPathLayout());
-        // vapx
-        panel.add(vapxUI.createUI());
-        // create
-        panel.add(getCreateLayout());
-        // log
-        panel.add(getLogLayout());
-        // open source
-        panel.add(getOpenSourceLayout());
-
-    }
-
-    private JPanel getCodecLayout() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-
-        JLabel label = new JLabel("codec");
-        label.setPreferredSize(labelSize);
-        panel.add(label);
-
-        JPanel panelRadio = new JPanel();
-        panelRadio.setLayout(new GridLayout(1, 2));
-        panelRadio.add(btnH264);
-        panelRadio.add(btnH265);
-        group.add(btnH264);
-        group.add(btnH265);
-        group.setSelected(btnH264.getModel(), true);
-        panel.add(panelRadio);
-
-        return panel;
-    }
-
-    private JPanel getFpsLayout() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-        JLabel label = new JLabel("fps");
-        label.setPreferredSize(labelSize);
-        panel.add(label);
-        JSpinner spinner = new JSpinner(modelFps);
-        spinner.setPreferredSize(new Dimension(60, 20));
-        panel.add(spinner);
-        return panel;
-    }
-
-    private JPanel getQualityLayout() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-
-        JLabel label = new JLabel("quality");
-        label.setPreferredSize(labelSize);
-        panel.add(label);
-
-        JPanel panelRadio = new JPanel();
-        panelRadio.setLayout(new GridLayout(1, 2));
-        panelRadio.add(btnBitrate);
-        panelRadio.add(btnCrf);
-        groupQuality.add(btnBitrate);
-        groupQuality.add(btnCrf);
-        groupQuality.setSelected(btnBitrate.getModel(), true);
-        btnBitrate.addItemListener(qualityGroupListener);
-        btnCrf.addItemListener(qualityGroupListener);
-        panel.add(panelRadio);
-
-        return panel;
-    }
-
-    private JPanel getBitrateLayout() {
-        panelBitrate.setLayout(new FlowLayout(FlowLayout.LEFT));
-        JLabel label = new JLabel("bitrate");
-        label.setPreferredSize(labelSize);
-        panelBitrate.add(label);
-        textBitrate.setPreferredSize(new Dimension(60, 20));
-        panelBitrate.add(textBitrate);
-        panelBitrate.add(new JLabel("k (default 2000k)"));
-        return panelBitrate;
-    }
-
-    private JPanel getCrfLayout() {
-        panelCrf.setLayout(new FlowLayout(FlowLayout.LEFT));
-        JLabel label = new JLabel("crf");
-        label.setPreferredSize(labelSize);
-        panelCrf.add(label);
-        textCrf.setPreferredSize(new Dimension(60, 20));
-        panelCrf.add(textCrf);
-        panelCrf.add(new JLabel("[0, 51] (default 29)"));
-        return panelCrf;
-    }
-
-    private JPanel getScaleLayout() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-        JLabel label = new JLabel("alpha scale");
-        label.setPreferredSize(labelSize);
-        panel.add(label);
-        panel.add(boxScale);
-        panel.add(new JLabel("(default 0.5)"));
-        return panel;
-    }
-
-    private JPanel getPathLayout() {
-        JPanel panel = new JPanel();
-
-        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-        JLabel label = new JLabel("frames path");
-        label.setPreferredSize(labelSize);
-        panel.add(label);
-        JPanel gPanel = new JPanel();
-        panel.add(gPanel);
-
-        BoxLayout layout = new BoxLayout(gPanel, BoxLayout.LINE_AXIS);
-        gPanel.setLayout(layout);
-
-        textInputPath.setPreferredSize(new Dimension(400,20));
-        gPanel.add(textInputPath);
-
-        JButton btnInputPath = new JButton("choose");
-        gPanel.add(btnInputPath);
-        btnInputPath.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent) {
-                JFileChooser fileChooser = new JFileChooser(new File(getInputPath()));
-                fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-                int returnVal = fileChooser.showOpenDialog(fileChooser);
-                if(returnVal == JFileChooser.APPROVE_OPTION) {
-                    // 文件夹路径
-                    String filePath = fileChooser.getSelectedFile().getAbsolutePath();
-                    textInputPath.setText(filePath);
-                }
-            }
-        });
-
-        return panel;
-    }
-
-
-    private JPanel getAudioPathLayout() {
-        JPanel panel = new JPanel();
-
-        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-        JLabel label = new JLabel("audio(mp3)");
-        label.setPreferredSize(labelSize);
-        panel.add(label);
-        panel.add(panelAudioPath);
-        final JLabel labelAudioAction = new JLabel("+");
-        panel.add(labelAudioAction);
-        labelAudioAction.addMouseListener(new MouseAdapter() {
-            @Override
-            public void mouseClicked(MouseEvent mouseEvent) {
-                needAudio = !needAudio;
-                panelAudioPath.setVisible(needAudio);
-                labelAudioAction.setText(needAudio ? "x" : "+");
-            }
-        });
-
-        BoxLayout layout = new BoxLayout(panelAudioPath, BoxLayout.LINE_AXIS);
-        panelAudioPath.setLayout(layout);
-
-        textAudioPath.setPreferredSize(new Dimension(400,20));
-        panelAudioPath.add(textAudioPath);
-
-        JButton btnInputPath = new JButton("choose");
-        panelAudioPath.add(btnInputPath);
-        btnInputPath.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent) {
-                JFileChooser fileChooser = new JFileChooser(new File(getInputPath()));
-                fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
-                int returnVal = fileChooser.showOpenDialog(fileChooser);
-                if(returnVal == JFileChooser.APPROVE_OPTION) {
-                    // 文件夹路径
-                    String filePath = fileChooser.getSelectedFile().getAbsolutePath();
-                    textAudioPath.setText(filePath);
-                }
-            }
-        });
-
-        if (!needAudio) {
-            panelAudioPath.setVisible(false);
-        }
-
-        return panel;
-    }
-
-    private void setOutput(boolean success, final String path) {
-        btnCreate.setEnabled(true);
-        if (success) {
-            labelOutInfo.setText("<html><font color='blue'>open output</font></html>");
-            labelOutInfo.addMouseListener(new MouseAdapter() {
-                @Override
-                public void mouseClicked(MouseEvent mouseEvent) {
-                    try {
-                        Desktop.getDesktop().open(new File(path));
-                    } catch (IOException e) {
-                        TLog.e(TAG, e.getMessage());
-                    }
-                }
-            });
-        } else {
-            labelOutInfo.setText("<html><font color='red'>create error!</font></html>");
-        }
-    }
-
-
-    private JPanel getCreateLayout() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-        panel.add(btnCreate);
-        btnCreate.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent) {
-                runTool();
-            }
-        });
-
-        panel.add(labelOutInfo);
-
-        return panel;
-    }
-
-
-    private JPanel getLogLayout() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
-
-        txtAreaLog.setEditable(false);
-        txtAreaLog.setLineWrap(true);
-        txtAreaLog.setWrapStyleWord(true);
-        JScrollPane areaScrollPane = new JScrollPane(txtAreaLog);
-        areaScrollPane.setVerticalScrollBarPolicy(
-                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
-        areaScrollPane.setPreferredSize(new Dimension(WIDTH, 100));
-        areaScrollPane.setMinimumSize(new Dimension(WIDTH, 100));
-
-        panel.add(areaScrollPane);
-        panel.setPreferredSize(new Dimension(WIDTH, HEIGHT));
-
-        return panel;
-    }
-
-    private JPanel getOpenSourceLayout() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new FlowLayout(FlowLayout.RIGHT));
-
-        JLabel label = new JLabel("open source software");
-        label.addMouseListener(new MouseAdapter() {
-            @Override
-            public void mouseClicked(MouseEvent mouseEvent) {
-                new OpenSourceUI().createUI();
-            }
-        });
-        panel.add(label);
-        return panel;
-    }
-
-    private void log(String tag, String msg) {
-        txtAreaLog.append("[" + tag + "]:" + msg + "\n");
-        txtAreaLog.setCaretPosition(txtAreaLog.getText().length());
-    }
-
-
-    private CommonArg getProperties() {
-        CommonArg commonArg = new CommonArg();
-        try {
-            String version = props.getProperty("version", "0");
-            String enableH265 = props.getProperty("enableH265", Boolean.toString(commonArg.enableH265));
-            String fps = props.getProperty("fps", String.valueOf(commonArg.fps));
-            String inputPath = props.getProperty("inputPath", "");
-            String scale = props.getProperty("scale", String.valueOf(scaleArray[0]));
-            String audioPath = props.getProperty("audioPath", "");
-            String bitrate = props.getProperty("bitrate", String.valueOf(commonArg.bitrate));
-            String enableCrf = props.getProperty("enableCrf", String.valueOf(commonArg.enableCrf));
-            String crf = props.getProperty("crf", String.valueOf(commonArg.crf));
-
-            int v = Integer.parseInt(version);
-            // 版本不符直接返回默认值
-            if (v != commonArg.version) return commonArg;
-            commonArg.fps = Integer.parseInt(fps);
-            commonArg.scale = Float.parseFloat(scale);
-            commonArg.enableH265 = Boolean.TRUE.toString().equals(enableH265);
-            commonArg.inputPath = inputPath;
-            commonArg.audioPath = audioPath;
-            commonArg.bitrate = Integer.parseInt(bitrate);
-            commonArg.enableCrf = Boolean.TRUE.toString().equals(enableCrf);
-            commonArg.crf = Integer.parseInt(crf);
-        } catch (Exception e) {
-            TLog.e(TAG, "getProperties error:" + e.getMessage());
-        }
-        return commonArg;
-    }
-
-
-    private void setProperties(CommonArg commonArg) throws IOException {
-        props.setProperty("version", String.valueOf(commonArg.version));
-        props.setProperty("enableH265", commonArg.enableH265? Boolean.TRUE.toString() : Boolean.FALSE.toString());
-        props.setProperty("fps", String.valueOf(commonArg.fps));
-        props.setProperty("inputPath", commonArg.inputPath == null ? "" : commonArg.inputPath);
-        props.setProperty("audioPath", commonArg.audioPath == null ? "" : commonArg.audioPath);
-        props.setProperty("scale", String.valueOf(commonArg.scale));
-        props.setProperty("bitrate", String.valueOf(commonArg.bitrate));
-        props.setProperty("crf", String.valueOf(commonArg.crf));
-        props.setProperty("enableCrf", String.valueOf(commonArg.enableCrf));
-        props.store(new OutputStreamWriter(new FileOutputStream(PROPERTIES_FILE), StandardCharsets.UTF_8), "");
-    }
-
-
-}

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

@@ -1,295 +0,0 @@
-package com.tencent.qgame.playerproj.animtool.ui;
-
-import com.tencent.qgame.playerproj.animtool.TLog;
-import com.tencent.qgame.playerproj.animtool.vapx.SrcSet;
-
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JTextField;
-
-public class VapxUI {
-
-    private static final String TAG = "VapxUI";
-
-    private final Dimension labelSize = new Dimension(100, 20);
-    private final JPanel controlPanel = new JPanel();
-    private final List<MaskUI> maskUiList = new ArrayList<>();
-    private int index = 0;
-    private ToolUI toolUI;
-    private final IMaskUIListener listener = new IMaskUIListener() {
-        @Override
-        public void onDelete(MaskUI maskUI) {
-            controlPanel.remove(maskUI.getPanel());
-            maskUiList.remove(maskUI);
-            controlPanel.revalidate();
-        }
-    };
-
-    public VapxUI(ToolUI toolUI) {
-        this.toolUI = toolUI;
-    }
-
-    public JPanel createUI() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
-        panel.setPreferredSize(new Dimension(ToolUI.WIDTH, 300));
-        panel.setMinimumSize(new Dimension(ToolUI.WIDTH, 300));
-        controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.PAGE_AXIS));
-        controlPanel.add(getAddLayout());
-        JScrollPane areaScrollPane = new JScrollPane(controlPanel);
-        panel.add(areaScrollPane);
-        return panel;
-    }
-
-    public boolean isVapxEnable() {
-        return !maskUiList.isEmpty();
-    }
-
-    public SrcSet getSrcSet() {
-        if (maskUiList.isEmpty()) return null;
-        SrcSet srcSet = new SrcSet();
-
-        SrcSet.Src src;
-        for (MaskUI maskUI : maskUiList) {
-            src = maskUI.getSrc();
-            if (src == null) return null;
-            srcSet.srcs.add(src);
-        }
-
-        return srcSet;
-    }
-
-
-    private JPanel getAddLayout() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-        JLabel label = new JLabel("add source");
-        label.setPreferredSize(labelSize);
-
-        JButton btnAdd = new JButton("add");
-        btnAdd.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent) {
-                createMaskUI();
-            }
-        });
-
-        panel.add(label);
-        panel.add(btnAdd);
-        panel.add(new JLabel("(simple video don't need add source)"));
-        return panel;
-    }
-
-    private void createMaskUI() {
-        MaskUI maskUI = new MaskUI(toolUI, ++index, listener);
-        controlPanel.add(maskUI.getPanel());
-        maskUiList.add(maskUI);
-        controlPanel.revalidate();
-    }
-
-    private static class MaskUI {
-        private ToolUI toolUI;
-        public IMaskUIListener listener;
-        public int index;
-        public String maskPath;
-        public JPanel panel = new JPanel();
-
-        private final JLabel labelIndex = new JLabel();
-        private final JTextField textSrcTag = new JTextField();
-        // image -> SrcSet.Src.SRC_TYPE_IMG text -> SrcSet.Src.SRC_TYPE_TXT
-        private final String[] srcTypeArray = new String[]{"image", "text"};
-        private final JComboBox<String> boxSrcType = new JComboBox<>(srcTypeArray);
-
-        // centerCrop -> SrcSet.Src.FIT_TYPE_CF
-        private final String[] fitTypeArray = new String[]{"fitXY", "centerCrop"};
-        private final JComboBox<String> boxFitType = new JComboBox<>(fitTypeArray);
-
-        private final JPanel txtPanel = new JPanel();
-        private final JTextField textTxtColor = new JTextField();
-        private final JCheckBox checkTxtBold = new JCheckBox("text Bold");
-
-        final JLabel labelMaskPathState = new JLabel();
-
-
-        public MaskUI(ToolUI toolUI, int index, IMaskUIListener listener) {
-            this.toolUI = toolUI;
-            this.index = index;
-            this.listener = listener;
-            createUI();
-        }
-
-        public JPanel getPanel() {
-            return panel;
-        }
-
-        public SrcSet.Src getSrc() {
-            SrcSet.Src src = new SrcSet.Src();
-            src.srcId = String.valueOf(index);
-            src.srcTag = textSrcTag.getText().trim();
-
-            src.srcType = SrcSet.Src.SRC_TYPE_IMG;
-            if (boxSrcType.getSelectedIndex() == 1) {
-                src.srcType = SrcSet.Src.SRC_TYPE_TXT;
-            }
-
-            src.fitType = SrcSet.Src.FIT_TYPE_FITXY;
-            if (boxFitType.getSelectedIndex() == 1) {
-                src.fitType = SrcSet.Src.FIT_TYPE_CF;
-            }
-
-            src.srcPath = maskPath;
-
-            if (SrcSet.Src.SRC_TYPE_TXT.equals(src.srcType)) {
-                src.color = textTxtColor.getText().trim();
-                if (checkTxtBold.isSelected()) {
-                    src.style = SrcSet.Src.TEXT_STYLE_BOLD;
-                }
-            }
-
-            if (src.srcTag == null || "".equals(src.srcTag)) {
-                String msg = "id:" + index + " source tag is empty";
-                TLog.e(TAG, msg);
-                JOptionPane.showMessageDialog(panel, msg, "Error", JOptionPane.ERROR_MESSAGE);
-                return null;
-            }
-
-            if (src.srcPath == null || "".equals(src.srcPath)) {
-                String msg = "id:" + index + " mask path is empty";
-                TLog.e(TAG, msg);
-                JOptionPane.showMessageDialog(panel, msg, "Error", JOptionPane.ERROR_MESSAGE);
-                return null;
-            }
-            return src;
-        }
-
-        private void createUI() {
-            panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
-            setMaskPath();
-            panel.add(new JSeparator());
-            panel.add(part1Layout());
-            panel.add(part2Layout());
-            panel.add(part3Layout());
-
-        }
-
-        private void setMaskPath() {
-            String text = maskPath == null? "<html><font color='red'>empty</font></html>" : maskPath;
-            labelMaskPathState.setText(text);
-        }
-
-        public JPanel part1Layout() {
-            JPanel panel = new JPanel();
-            panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-
-            // index
-            labelIndex.setText("id:" + index);
-            panel.add(labelIndex);
-
-            // srcTag
-            panel.add(new JLabel(" source tag:"));
-            textSrcTag.setPreferredSize(new Dimension(50, 20));
-            textSrcTag.setText("tag" + index);
-            panel.add(textSrcTag);
-
-            // srcType
-            panel.add(new JLabel(" source type:"));
-            boxSrcType.setSelectedIndex(0);
-            panel.add(boxSrcType);
-            boxSrcType.addItemListener(new ItemListener() {
-                @Override
-                public void itemStateChanged(ItemEvent itemEvent) {
-                    txtPanel.setVisible(srcTypeArray[1].equals(itemEvent.getItem()));
-                }
-            });
-            // fitType
-            panel.add(new JLabel(" fit type:"));
-            boxFitType.setSelectedIndex(0);
-            panel.add(boxFitType);
-
-
-
-
-            // delete
-            JLabel labelDelete = new JLabel("<html><font color='red'>delete</font></html>");
-            panel.add(labelDelete);
-            labelDelete.addMouseListener(new MouseAdapter() {
-                @Override
-                public void mouseClicked(MouseEvent mouseEvent) {
-                    if (listener != null) {
-                        listener.onDelete(MaskUI.this);
-                    }
-                }
-            });
-
-            return panel;
-        }
-
-
-        private JPanel part2Layout() {
-            JPanel panel = txtPanel;
-            panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-
-            panel.add(new JLabel(" text color:"));
-            textTxtColor.setPreferredSize(new Dimension(100, 20));
-            textTxtColor.setText("#000000");
-            panel.add(textTxtColor);
-
-            panel.add(checkTxtBold);
-            panel.setVisible(false);
-            return panel;
-        }
-
-
-        private JPanel part3Layout() {
-            JPanel panel = new JPanel();
-            panel.setLayout(new FlowLayout(FlowLayout.LEFT));
-            // mask path
-            panel.add(new JLabel(" mask path:"));
-            JButton btnMaskPath = new JButton("choose");
-            panel.add(btnMaskPath);
-            btnMaskPath.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent actionEvent) {
-                    JFileChooser fileChooser = new JFileChooser(new File(toolUI.getInputPath()));
-                    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-                    int returnVal = fileChooser.showOpenDialog(fileChooser);
-                    if(returnVal == JFileChooser.APPROVE_OPTION) {
-                        // 文件夹路径
-                        maskPath = fileChooser.getSelectedFile().getAbsolutePath();
-                        setMaskPath();
-                    }
-                }
-            });
-
-
-            panel.add(labelMaskPathState);
-
-            return panel;
-        }
-    }
-
-    private interface IMaskUIListener {
-        void onDelete(MaskUI maskUI);
-    }
-
-}

+ 0 - 79
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/vapx/FrameSet.java

@@ -1,79 +0,0 @@
-package com.tencent.qgame.playerproj.animtool.vapx;
-
-import com.tencent.qgame.playerproj.animtool.data.PointRect;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-public class FrameSet {
-
-    // for sync
-    public Vector<FrameObj> frameObjs = new Vector<>();
-
-    @Override
-    public String toString() {
-        StringBuilder json = new StringBuilder();
-
-        json.append("\"frame\":[");
-        FrameSet.FrameObj frameObj;
-        for (int i=0; i<frameObjs.size(); i++) {
-            frameObj = frameObjs.get(i);
-            json.append(frameObj.toString());
-            if (i != frameObjs.size() - 1) {
-                json.append(",");
-            }
-        }
-
-        json.append("]");
-
-        return json.toString();
-    }
-
-    public static class FrameObj {
-        public List<Frame> frames = new ArrayList<>();
-        public int frameIndex = 0;
-
-        @Override
-        public String toString() {
-            StringBuilder json = new StringBuilder();
-
-            json.append("{");
-            json.append("\"i\":").append(frameIndex).append(",");
-            json.append("\"obj\":[");
-            FrameSet.Frame frame;
-            for (int i=0; i<frames.size(); i++) {
-                frame = frames.get(i);
-                json.append(frame.toString());
-                if (i != frames.size() - 1) {
-                    json.append(",");
-                }
-            }
-            json.append("]");
-            json.append("}");
-
-            return json.toString();
-        }
-    }
-
-    public static class Frame {
-        public String srcId = "";
-        public int z = 0;
-        public int mt = 0; // 旋转角度 目前只支持0
-        public PointRect frame = new PointRect(); // src位置
-        public PointRect mFrame = new PointRect(); // 遮罩区域
-
-
-        @Override
-        public String toString() {
-
-            return "{" +
-                    "\"srcId\":" + "\"" + srcId + "\"," +
-                    "\"z\":" + z + "," +
-                    "\"frame\":" + frame.toString() + "," +
-                    "\"mFrame\":" + mFrame.toString() + "," +
-                    "\"mt\":" + mt +
-                    "}";
-        }
-    }
-}

+ 0 - 208
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/vapx/GetMaskFrame.java

@@ -1,208 +0,0 @@
-package com.tencent.qgame.playerproj.animtool.vapx;
-
-import com.tencent.qgame.playerproj.animtool.CommonArg;
-import com.tencent.qgame.playerproj.animtool.TLog;
-import com.tencent.qgame.playerproj.animtool.data.PointRect;
-
-import java.awt.geom.AffineTransform;
-import java.awt.image.AffineTransformOp;
-import java.awt.image.BufferedImage;
-import java.io.File;
-
-import javax.imageio.ImageIO;
-
-/**
- * 获取融合动画遮罩
- */
-public class GetMaskFrame {
-
-    private static final String TAG = "GetMaskFrame";
-
-    public FrameSet.FrameObj getFrameObj(int frameIndex, CommonArg commonArg, int[] outputArgb) throws Exception {
-
-        FrameSet.FrameObj frameObj = new FrameSet.FrameObj();
-        frameObj.frameIndex = frameIndex;
-
-        FrameSet.Frame frame;
-        // 需要放置的位置
-        int x;
-        int y;
-        int gap = commonArg.gap;
-        if (commonArg.isVLayout) {
-            x = commonArg.alphaPoint.w + gap;
-            y = commonArg.alphaPoint.y;
-        } else {
-            x = commonArg.alphaPoint.x;
-            y = commonArg.alphaPoint.h + gap;
-        }
-        int startX = x;
-        int lastMaxY = y;
-        for (int i=0; i<commonArg.srcSet.srcs.size(); i++) {
-            frame = getFrame(frameIndex, commonArg.srcSet.srcs.get(i), outputArgb, commonArg.outputW, commonArg.outputH, x, y, startX, lastMaxY);
-            if (frame == null) continue;
-            // 计算下一个遮罩起点
-            x = frame.mFrame.x + frame.mFrame.w + gap;
-            y = frame.mFrame.y;
-            int newY = frame.mFrame.y + frame.mFrame.h + gap;
-            if (newY > lastMaxY) {
-                lastMaxY = newY;
-            }
-
-            frameObj.frames.add(frame);
-        }
-
-        if (frameObj.frames.isEmpty()) {
-            return null;
-        }
-        return frameObj;
-    }
-
-
-    private FrameSet.Frame getFrame(int frameIndex, SrcSet.Src src, int[] outputArgb, int outW, int outH, int x, int y, int startX, int lastMaxY) throws Exception {
-        File inputFile = new File(src.srcPath  + String.format("%03d", frameIndex)+".png");
-        if (!inputFile.exists()) {
-            return null;
-        }
-
-        BufferedImage inputBuf = ImageIO.read(inputFile);
-        int maskW = inputBuf.getWidth();
-        int maskH = inputBuf.getHeight();
-        int[] maskArgb = inputBuf.getRGB(0, 0, maskW, maskH, null, 0, maskW);
-
-        FrameSet.Frame frame = new FrameSet.Frame();
-        frame.srcId = src.srcId;
-        frame.z = src.z;
-
-        frame.frame = getSrcFramePoint(maskArgb, maskW, maskH);
-        if (frame.frame == null) {
-            // 有文件,但内容是空
-            return null;
-        }
-
-        PointRect maskPoint = new PointRect(
-            frame.frame.x,
-            frame.frame.y,
-            frame.frame.w,
-            frame.frame.h
-        );
-
-        PointRect mFrame = new PointRect(x, y, frame.frame.w, frame.frame.h);
-        // 计算是否能放下遮罩
-        if (mFrame.x + mFrame.w > outW) { // 超宽换行
-            mFrame.x = startX;
-            mFrame.y = lastMaxY;
-            if (mFrame.x + mFrame.w > outW) {
-                // 超长后缩放mask
-                float scale = (outW - mFrame.x) * 1f / mFrame.w;
-
-                mFrame.w = outW - mFrame.x;
-                mFrame.h = (int) (mFrame.h * scale);
-
-                // 设置缩放区域
-                maskPoint.x = (int) (maskPoint.x * scale);
-                maskPoint.y = (int) (maskPoint.y * scale);
-                maskPoint.h = mFrame.h;
-                maskPoint.w = mFrame.w;
-
-                maskArgb = scaleMask(scale, inputBuf);
-
-                TLog.w(TAG, "frameIndex=" + frameIndex + ",src=" + src.srcId + ", no more space for(w)" + mFrame + ",scale=" + scale);
-            }
-        }
-        if (mFrame.y + mFrame.h > outH) { // 高度不够直接错误
-            TLog.e(TAG, "frameIndex=" + frameIndex + ",src=" + src.srcId + ", no more space(h)" + mFrame);
-            return null;
-        }
-        frame.mFrame = mFrame;
-
-        fillMaskToOutput(outputArgb, outW, maskArgb, maskW, maskPoint, frame.mFrame);
-
-        // 设置src的w,h 取所有遮罩里最大值
-        synchronized (GetMaskFrame.class) {
-            // 只按宽度进行判断防止横跳
-            if (frame.frame.w > src.w) {
-                src.w = frame.frame.w;
-                src.h = frame.frame.h;
-            }
-        }
-        return frame;
-    }
-
-    /**
-     * 缩放遮罩
-     */
-    private int[] scaleMask(float scale, BufferedImage inputBuf) {
-        AffineTransform at = new AffineTransform();
-        at.scale(scale, scale);
-
-        int w = inputBuf.getWidth();
-        int h = inputBuf.getHeight();
-        BufferedImage alphaBuf = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
-        AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
-        alphaBuf = scaleOp.filter(inputBuf, alphaBuf);
-
-        return alphaBuf.getRGB(0, 0, w, h, null, 0, w);
-    }
-
-    /**
-     * 获取遮罩位置信息 并转换为黑白
-     */
-    private PointRect getSrcFramePoint(int[] maskArgb, int w, int h) {
-
-        PointRect point = new PointRect();
-
-        int minX = Integer.MAX_VALUE;
-        int minY = Integer.MAX_VALUE;
-        int maxX = 0;
-        int maxY = 0;
-        for (int y=0; y<h; y++) {
-            for (int x = 0; x < w; x++) {
-                int alpha = maskArgb[x + y*w] >>> 24;
-                if (alpha > 0) {
-                    if (x < minX) minX = x;
-                    if (y < minY) minY = y;
-                    if (x > maxX) maxX = x;
-                    if (y > maxY) maxY = y;
-                }
-            }
-        }
-
-        point.x = minX;
-        point.y = minY;
-        point.w = maxX - minX + 1;
-        point.h = maxY - minY + 1;
-        if (point.w <=0 || point.h <= 0) return null;
-
-        return point;
-
-    }
-
-
-    private void fillMaskToOutput(int[] outputArgb, int outW,
-                                  int[] maskArgb, int maskW,
-                                  PointRect frame,
-                                  PointRect mFrame) {
-        for (int y=0; y < frame.h; y++) {
-            for (int x=0; x < frame.w; x++) {
-                int maskXOffset = frame.x;
-                int maskYOffset = frame.y;
-                // 先从遮罩 maskArgb 取色
-                int maskColor = maskArgb[x + maskXOffset + (y + maskYOffset) * maskW];
-                // 黑色部分不遮挡,红色部分被遮挡
-                int alpha = maskColor >>> 24;
-                int maskRed = (maskColor & 0x00ff0000) >>> 16;
-                int redAlpha = 255 - maskRed; // 红色部分算遮挡
-                alpha = (int) ((redAlpha / 255f) * (alpha / 255f) * 255f);
-                // 最终color
-                int color = 0xff000000 + (alpha << 16) + (alpha << 8) + alpha;
-
-                // 将遮罩颜色放置到视频中对应区域
-                int outputXOffset = mFrame.x;
-                int outputYOffset = mFrame.y;
-                outputArgb[x + outputXOffset + (y + outputYOffset) * outW] = color;
-
-            }
-        }
-    }
-
-}

+ 0 - 90
Android/PlayerProj/animtool/src/main/java/com/tencent/qgame/playerproj/animtool/vapx/SrcSet.java

@@ -1,90 +0,0 @@
-package com.tencent.qgame.playerproj.animtool.vapx;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SrcSet {
-
-
-    public List<Src> srcs = new ArrayList<>();
-
-
-    public static class Src {
-
-        public static final String SRC_TYPE_IMG = "img";
-        public static final String SRC_TYPE_TXT = "txt";
-
-        public static final String LOAD_TYPE_NET = "net";
-        public static final String LOAD_TYPE_LOC = "local";
-
-        public static final String TEXT_STYLE_DEFAULT = "";
-        public static final String TEXT_STYLE_BOLD = "b";
-
-        public static final String FIT_TYPE_FITXY = "fitXY";
-        public static final String FIT_TYPE_CF = "centerFull"; // 同centerCrop
-
-        /**
-         * src 配置
-         */
-        public String srcId = "";
-        public String srcType = SRC_TYPE_IMG;
-        public String loadType = LOAD_TYPE_NET;
-        public String srcTag = "";
-        public String color = "#000000";
-        public String style = TEXT_STYLE_DEFAULT;
-        public int w = 0;
-        public int h = 0;
-        public String fitType = FIT_TYPE_FITXY;
-
-        /**
-         * src 辅助信息
-         */
-        public String srcPath = "";
-        public int z = 0; // 渲染层级 与输入顺序相关
-
-        @Override
-        public String toString() {
-            StringBuilder json = new StringBuilder();
-            json.append("{");
-            json.append("\"srcId\":").append("\"").append(srcId).append("\",");
-            json.append("\"srcType\":").append("\"").append(srcType).append("\",");
-            json.append("\"srcTag\":").append("\"").append(srcTag.trim()).append("\",");
-            if (SRC_TYPE_TXT.equals(srcType)) {
-                if (color != null && color != null) {
-                    json.append("\"color\":").append("\"").append(color.trim()).append("\",");
-                }
-                json.append("\"style\":").append("\"").append(style).append("\",");
-                json.append("\"loadType\":").append("\"").append(LOAD_TYPE_LOC).append("\",");
-            } else {
-                json.append("\"loadType\":").append("\"").append(loadType).append("\",");
-            }
-
-
-            json.append("\"fitType\":").append("\"").append(fitType).append("\",");
-            json.append("\"w\":").append(w).append(",");
-            json.append("\"h\":").append(h);
-            json.append("}");
-
-            return json.toString();
-        }
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder json = new StringBuilder();
-
-        json.append("\"src\":[");
-        Src src;
-        for (int i=0; i<srcs.size(); i++) {
-            src = srcs.get(i);
-            json.append(src.toString());
-            if (i != srcs.size() - 1) {
-                json.append(",");
-            }
-        }
-
-        json.append("]");
-
-        return json.toString();
-    }
-}

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

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

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

@@ -1,30 +0,0 @@
-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")
-}

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

@@ -1,21 +0,0 @@
-# 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

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

@@ -1,29 +0,0 @@
-<?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"/>
-        <activity android:name=".player.AnimSpecialSizeDemoActivity" android:screenOrientation="portrait"/>
-
-    </application>
-
-</manifest>

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/special_size_750.mp4


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


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

@@ -1,48 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.AnimSpecialSizeDemoActivity
-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))
-        }
-        btn4.setOnClickListener {
-            startActivity(Intent(this, AnimSpecialSizeDemoActivity::class.java))
-        }
-    }
-
-
-}

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

@@ -1,281 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.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 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.mask.MaskConfig
-import com.tencent.qgame.animplayer.util.ALog
-import com.tencent.qgame.animplayer.util.IALog
-import com.tencent.qgame.animplayer.util.ScaleType
-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.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
-        // 居中(根据父布局按比例居中并全部显示s)
-        animView.setScaleType(ScaleType.FIT_CENTER)
-        // 启动过滤遮罩s
-        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()
-        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()
-        }
-    }
-
-    /**
-     * 将Base64的bitmap转换为真正的bitmap
-     */
-    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
-    }
-}
-

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

@@ -1,215 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.animplayer.util.ScaleType
-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
-        // 居中(根据父布局按比例居中并全部显示,默认fitXY)
-        animView.setScaleType(ScaleType.FIT_CENTER)
-        // 注册动画监听
-        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 {
-        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
-    }
-}
-

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

@@ -1,228 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.Constant
-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.animplayer.util.ScaleType
-import com.tencent.qgame.playerproj.R
-import kotlinx.android.synthetic.main.activity_anim_simple_demo.*
-import java.io.File
-
-/**
- * 播放宽高不是16的倍数的特殊尺寸的动画demo,这里以special_size_750.mp4为例,size = 750 x 814
- */
-class AnimSpecialSizeDemoActivity : Activity(), IAnimListener {
-
-    companion object {
-        private const val TAG = "AnimSpecialSizeActivity"
-    }
-
-    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("special_size_750.mp4", "2acde1639ad74b8bd843083246902e23")
-
-    // 动画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
-        // 视频左右对齐(rgb左\alpha右)
-        animView.setVideoMode(Constant.VIDEO_MODE_SPLIT_HORIZONTAL_REVERSE)
-        // 兼容老版本视频资源
-        animView.enableVersion1(true)
-        // 居中(根据父布局按比例居中并全部显示,默认fitXY)
-        animView.setScaleType(ScaleType.FIT_CENTER)
-        // 注册动画监听
-        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
-    }
-}
-

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

@@ -1,287 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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.animplayer.util.ScaleType
-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())
-    }
-
-    private var lastToast: Toast? = null
-
-    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.setScaleType(ScaleType.CENTER_CROP)
-        /**
-         * 注册资源获取类
-         */
-        animView.setFetchResource(object : IFetchResource {
-            /**
-             * 获取图片资源
-             * 无论图片是否获取成功都必须回调 result 否则会无限等待资源
-             */
-            override fun fetchImage(resource: Resource, result: (Bitmap?) -> Unit) {
-                /**
-                 * srcTag是素材中的一个标记,在制作素材时定义
-                 * 解析时由业务读取tag决定需要播放的内容是什么
-                 * 比如:一个素材里需要显示多个头像,则需要定义多个不同的tag,表示不同位置,需要显示不同的头像,文字类似
-                 */
-                val srcTag = resource.tag
-                if (srcTag.isNotEmpty()) {
-                    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.isNotEmpty()) { // 此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) {
-                lastToast?.cancel()
-                lastToast = Toast.makeText(
-                    this@AnimVapxDemoActivity,
-                    "srcTag=${resource.tag} onClick ${resource.curPoint}",
-                    Toast.LENGTH_LONG
-                )
-                lastToast?.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 {
-        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
-    }
-}
-

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

@@ -1,109 +0,0 @@
-/*
- * Tencent is pleased to support the open source community by making vap available.
- *
- * Copyright (C) 2020 Tencent.  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


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

@@ -1,74 +0,0 @@
-<?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


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

@@ -1,37 +0,0 @@
-<?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="match_parent"
-        android:layout_height="match_parent"
-        android:layout_gravity="center"/>
-    
-</FrameLayout>

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

@@ -1,44 +0,0 @@
-<?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:layout_gravity="center"
-        android:orientation="vertical">
-
-        <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(可变动画)" />
-
-        <Button
-            android:id="@+id/btn4"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="Special Size Demo" />
-
-    </LinearLayout>
-
-</FrameLayout>
-
-

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

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

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

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

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

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

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

@@ -1,17 +0,0 @@
-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)
-    }
-}

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