c++ - Gstreamer:向正在运行的管道添加一个 bin
问题描述
我有一个正在运行的视频管道。现在我想动态添加一个录音箱......(有时主管道已经运行了一段时间......)
我的管道的图像架构如附件。上面的管道是我的工作管道,而底部是我要连接到上面的独立录音箱
安装bin的步骤如下(我所知道的)
- 获取 bin 的 pad(即在这种情况下为记录 bin)
- 用探针挡住这个焊盘(bin)
- 将 bin 的状态设置为正在运行
- 获取要连接的管道或组件的焊盘
- 用探针挡住这个焊盘(管道)
- 将它们连接在一起'
- 取下探头
//get sink pad to recording bin and block it
// https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html?gi-language=c#dynamically-changing-the-pipeline
GstElement *temp = gst_bin_get_by_name(GST_BIN(recording), "queuer" );
pad = gst_element_get_static_pad(temp,"sink");
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, &GstProbeCallback, NULL, NULL);
gst_bin_add(GST_BIN(pipeline),recording);
// when the bin has been attached, now set it to play
gst_element_set_state(recording,GST_STATE_PLAYING);
g_print(" Starting to play \n");
t_sink_pad = gst_element_get_request_pad (tee,"src_2");
gst_pad_add_probe (tee_sink_pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, &GstProbeCallback, NULL, NULL);
if(gst_pad_link (tee_sink_pad,pad) != GST_PAD_LINK_OK)
{
g_printerr ("Tee(Record) could not be linked.\n");
gst_object_unref (pipeline);
return -1;
}
g_print("Linking Done for recording \n\n");
GST_DEBUG_OBJECT (pipeline, "Linking Done for recording");
但是我好像遇到了无法建立链接的问题
Tee(Record) could not be linked.
我想知道我错过了哪一步......据说这是从一个更简单的情况下添加到管道并删除它们
谢谢你的帮助
解决方案
推荐阅读
- powerbi - 如何设置 Power BI 许可证
- javascript - 访问复杂 javascript 对象的元素
- python - 是否有更有效的方法来迭代矩阵并在特定列上执行计算?
- html - 向下滚动时,如何使它与我的视频重叠?
- sql - 为什么在 Postgres 中查询 LTREE 时字符串连接不起作用?
- grails - grails 4 sessionRegistry为空
- java - 从实现 Queue 接口的 ListQueue 类调用受保护的方法“Front”
- java - 如何修复“找不到引用的类 com.google.protobuf”?
- r - R使用绘图功能时如何增加网格之间的距离?
- java - 将 Firestore 数据提取到自定义对象中