obs软件使用教程(讲解obs推流直播的好处)

 2025-10-16  阅读 917  评论 0

摘要:OBS 是一个开源的视频直播软件功能很强大,B站 快手 抖音 直播软件大都以此为基础,进行二次开发,或深度借鉴OBS进行开发。OBS开发中,会常用到很多内部定义的源,本文将各种源枚举下,以方便查找。OBS很多函数 是以源id为参数的,id,是定义在源的导出接口中的比如struct obs_sourc

OBS 是一个开源的视频直播软件

功能很强大,B站 快手 抖音 直播软件大都以此为基础,进行二次开发,或深度借鉴OBS进行开发。

OBS开发中,会常用到很多内部定义的源,本文将各种源枚举下,以方便查找。

OBS很多函数 是以源id为参数的,

id,是定义在源的导出接口中的

比如

struct obs_source_info window_capture_info = {	.id             = "window_capture",	.type           = OBS_SOURCE_TYPE_INPUT,	.output_flags   = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW,	.get_name       = wc_getname,	.create         = wc_create,	.destroy        = wc_destroy,	.update         = wc_update,	.video_render   = wc_render,	.video_tick     = wc_tick,	.get_width      = wc_width,	.get_height     = wc_height,	.get_defaults   = wc_defaults,	.get_properties = wc_properties};

obs软件使用教程(讲解obs推流直播的好处)(1)

OBS有哪些源ID呢,在此列举下:

ID name

image_source 图像

color_source 色源

slideshow 图像幻灯片放映

ffmpeg_source 媒体源

text_gdiplus 文本 (GDI+)

text_ft2_source 文本 (FreeType 2)

monitor_capture 显示器捕获

window_capture 窗口捕获

game_capture 游戏捕获

dshow_input 视频捕获设备

wasapi_input_capture 音频输入捕获

wasapi_output_capture 音频输出捕获

img_TransImg 透明图 —–自定义的

比如 右键 添加按钮,会添加各种源,所用的相关API接口如下:

/** * Enumerates all available inputs source types. * *   Inputs are general source inputs (such as capture sources, device sources, * etc). */EXPORT bool obs_enum_input_types(size_t idx, const char **id);

obs软件使用教程(讲解obs推流直播的好处)(2)
/** Returns the translated display name of a source */EXPORT const char *obs_source_get_display_name(const char *id);

obs软件使用教程(讲解obs推流直播的好处)(3)
/** Returns capability flags of a source */EXPORT uint32_t obs_source_get_output_flags(const obs_source_t *source);/** Returns capability flags of a source type */EXPORT uint32_t obs_get_source_output_flags(const char *id);

obs软件使用教程(讲解obs推流直播的好处)(4)

右键菜单代码,遍历源ID

QMenu *OBSBasic::CreateAddSourcePopupMenu()

   const char *type;   size_t idx = 0;	while (obs_enum_input_types(idx++, &type)) {		const char *name = obs_source_get_display_name(type);		uint32_t caps = obs_get_source_output_flags(type);		//...		if (strcmp(type, "image_source") == 0 || strcmp(type, "monitor_capture") == 0 || strcmp(type, "dshow_input") == 0) //...		{			if ((caps & OBS_SOURCE_DEPRECATED) == 0) {				addSource(popup, type, name);				//addSource(popup, type, name);			}			else {				addSource(deprecated, type, name);				foundDeprecated = true;			}			foundValues = true;		}			}

版权声明:xxxxxxxxx;

原文链接:http://cn.tdroid.net/ce91cCz0GAw0GUVc.html

发表评论:

管理员

  • 内容326528
  • 积分0
  • 金币0
关于我们
lecms主程序为免费提供使用,使用者不得将本系统应用于任何形式的非法用途,由此产生的一切法律风险,需由使用者自行承担,与本站和开发者无关。一旦使用lecms,表示您即承认您已阅读、理解并同意受此条款的约束,并遵守所有相应法律和法规。
联系方式
电话:
地址:广东省中山市
Email:
注册登录
注册帐号
登录帐号

Copyright © 2022 太卓开发网 Inc. 保留所有权利。 泰达科技网易库网

页面耗时0.1850秒, 内存占用1.34 MB, 访问数据库18次