简体   繁体   English

Gstreamer在PLAYING状态下更改源

[英]Gstreamer change source on PLAYING state

Hello guys I wanna know how can I switch between different sources in my pipeline without changing state for example if I have : 大家好,我想知道如何在不更改状态的情况下在管道中的不同源之间进行切换,例如,如果我有:

Source 1 来源1

 filesrc location=file1 ! decodebin ! autovideosink

Source 2 来源2

 filesrc location=file2 ! decodebin ! autovideosink

Source 3 来源3

 filesrc location=file3 ! decodebin ! autovideosink

I want to accomplish something like switching between channels on TV. 我想要完成类似在电视频道之间切换的操作。 Is it possible to change location property dynamically ? 是否可以动态更改位置属性? I searched over and over and didn't found anything specific.If you could point me to some code examples C or python I would be grateful. 我一遍又一遍地搜索,没有发现任何具体的东西。如果您能指出一些Cpython代码示例,我将不胜感激。

You cannot change filesrc location dynamically, alternatively you can change your logic a bit, Instead of filesrc use a fdsrc and write a separate application which reads data from your file1 and pumps to fdsrc's fd. 您不能动态地更改filerc的位置,或者可以稍微更改逻辑,而不是使用fdsrc代替filesrc并编写一个单独的应用程序,该应用程序将从file1中读取数据并将其泵送到fdsrc的fd中。 so when you want to switch from file1 to file2/file3 you just need to tell your application to start pumping data from file2/file3 instead. 因此,当您想从文件1切换到文件2 /文件3时,只需告诉您的应用程序开始从文件2 /文件3抽取数据。

Hope that helps! 希望有帮助!

IMO your best bet is just to kill the old process and start a new one. 海事组织,您最好的选择就是取消旧进程并开始一个新进程。

In a long running scenario on a diverse file set you'd be counting on a wide variety of GStreamer elements to reliably clean themselves up. 在长期运行的各种文件集上,您将依靠各种各样的GStreamer元素来可靠地清理自己。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM