Skills

Gsy Render And Effects

三种渲染载体(TextureView / SurfaceView / GLSurfaceView)、显示比例(16:9/4:3/full/custom)、GL 滤镜与自定义...

Install

npx skills add CarGuo/GSYVideoPlayer --skill gsy-render-and-effects -g -a claude-code -y
Repository
CarGuo/GSYVideoPlayer21.5k
Category
Engineering
Updated
26d ago
License
Apache-2.0
Context cost
Lightabout 1,276 tokens
Runs scripts
No, instructions only

What it does

三种渲染载体(TextureView / SurfaceView / GLSurfaceView)、显示比例(16:9/4:3/full/custom)、GL 滤镜与自定义 Shader。

gsy-render-and-effects

渲染类型 GSYVideoType.setRenderType(int)

常量值说明
TEXTURE0默认,与动画/圆角/缩放兼容最好
SURFACE1性能最好,但和 View 动画冲突
GLSURFACE2必需,若要用 setEffectFilter

见 GSYVideoType#L39-L49。设置时机:setUp 之前,全局生效。

显示比例 GSYVideoType.setShowType(int)

常量值说明
SCREEN_TYPE_DEFAULT0按视频原比例居中
SCREEN_TYPE_16_91强制 16:9
SCREEN_TYPE_4_32强制 4:3
SCREEN_TYPE_18_96全面屏
SCREEN_TYPE_FULL4全屏裁减;surface_container 建议 FrameLayout
SCREEN_MATCH_FULL-4全屏拉伸;surface_container 建议 FrameLayout
SCREEN_TYPE_CUSTOM-5需先 setScreenScaleRatio(float)

见 GSYVideoType#L10-L29 与 GSYVideoType#L165-L167。

硬解码开关

静态方法说明
enableMediaCodec() / disableMediaCodec()IJK 硬解码总开关 #L71-L79
enableMediaCodecTexture() / disableMediaCodecTexture()硬解 + Texture 直渲染优化 #L100-L108
enableSmartMediaCodec() / disableSmartMediaCodec()硬解失败自动软解回退 #L86-L94
isMediaCodec() / isMediaCodecTexture() / isSmartMediaCodec()查询

设置时机:setUp 之前,且部分机型需要在 Application.onCreate 就配好。

GL 滤镜

需要满足两个条件:

  1. GSYVideoType.setRenderType(GSYVideoType.GLSURFACE)
  2. builder.setEffectFilter(new XxxEffect()) 或 player.setEffectFilter(...)
Read the whole SKILL.md on GitHub

More in Engineering