
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)
| 常量 | 值 | 说明 |
|---|---|---|
TEXTURE | 0 | 默认,与动画/圆角/缩放兼容最好 |
SURFACE | 1 | 性能最好,但和 View 动画冲突 |
GLSURFACE | 2 | 必需,若要用 setEffectFilter |
见 GSYVideoType#L39-L49。设置时机:setUp 之前,全局生效。
显示比例 GSYVideoType.setShowType(int)
| 常量 | 值 | 说明 |
|---|---|---|
SCREEN_TYPE_DEFAULT | 0 | 按视频原比例居中 |
SCREEN_TYPE_16_9 | 1 | 强制 16:9 |
SCREEN_TYPE_4_3 | 2 | 强制 4:3 |
SCREEN_TYPE_18_9 | 6 | 全面屏 |
SCREEN_TYPE_FULL | 4 | 全屏裁减;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 滤镜
需要满足两个条件:
GSYVideoType.setRenderType(GSYVideoType.GLSURFACE)builder.setEffectFilter(new XxxEffect())或player.setEffectFilter(...)
