输入源类型-image-source
2026-01-15
13
0
原文转自:https://www.bytezonex.com/archives/aiQ17CYF.html
这里以插件image-source.dll为例,在该插件中注册了5种源,都为OBS_SOURCE_TYPE_INPUT类型。
bool obs_module_load(void)
{
obs_register_source(&image_source_info);
obs_register_source(&color_source_info_v1);
obs_register_source(&color_source_info_v2);
obs_register_source(&color_source_info_v3);
obs_register_source(&slideshow_info);
return true;
}
关于image-source详见:https://www.pnpon.com/article/forum-63.html
回调函数
| 基本功能 | 回调函数名 | slideshow_info | color_source_info_v3 | image_source_info |
|---|---|---|---|---|
| 获取源显示名称 | get_name | ss_getname | color_source_get_name | image_source_get_name |
| 创建源实例 | create | ss_create | color_source_create | image_source_create |
| 销毁源实例 | destroy | ss_destroy | color_source_destroy | image_source_destroy |
| 更新源设置 | update | ss_update | color_source_update | image_source_update |
| 渲染视频帧 | video_render | ss_video_render | color_source_render | image_source_render |
| 设置默认参数 | get_defaults | ss_defaults | color_source_defaults_v3 | image_source_defaults |
| 获取属性列表 | get_properties | ss_properties | color_source_properties | image_source_properties |
| 获取源宽度 | get_width | ss_width | color_source_getwidth | image_source_getwidth |
| 获取源高度 | get_height | ss_height | color_source_getheight | image_source_getheight |
| 每帧调用的时间处理函数 | video_tick | ss_video_tick | ❌ | image_source_tick |
| 渲染音频数据(仅幻灯片) | audio_render | ss_audio_render | ❌ | ❌ |
| 源被激活时调用 | activate | ss_activate | ❌ | image_source_activate |
| 源被停用时调用 | deactivate | ss_deactivate | ❌ | ❌ |
| 源显示时调用 | show | ❌ | ❌ | image_source_show |
| 源隐藏时调用 | hide | ❌ | ❌ | image_source_hide |
| 枚举活动源(仅幻灯片) | enum_active_sources | ss_enum_sources | ❌ | ❌ |
| 检查缺失文件 | missing_files | ss_missingfiles | ❌ | image_source_missingfiles |
| 播放/暂停媒体控制 | media_play_pause | ss_play_pause | ❌ | ❌ |
| 重新开始媒体 | media_restart | ss_restart | ❌ | ❌ |
| 停止媒体播放 | media_stop | ss_stop | ❌ | ❌ |
| 下一张幻灯片 | media_next | ss_next_slide | ❌ | ❌ |
| 上一张幻灯片 | media_previous | ss_previous_slide | ❌ | ❌ |
| 获取媒体播放状态 | media_get_state | ss_get_state | ❌ | ❌ |
关键差异总结:
- 媒体控制功能:只有
slideshow_info有完整的媒体控制回调函数,支持播放、暂停、停止、上一张/下一张等操作 - 激活/显示控制:
- slideshow 有 activate/deactivate
- image_source 有 show/hide/activate
- color_source 都没有
- 音频处理:只有 slideshow 有
audio_render函数 - 时间处理:slideshow 和 image_source 都有
video_tick,color_source 没有 - 文件管理:slideshow 和 image_source 都有
missing_files函数用于检查缺失文件
这些差异反映了三个源的不同用途:
- 幻灯片源:完整的媒体播放器功能
- 颜色源:简单的纯色显示,功能最少
- 图像源:静态/动态图像显示,有基本的激活/隐藏控制
OBS源





