Added Stream Discoverer to detect frame size from a gstreamer pipeline

Previous use of Stream are not affected (the discoverer is passively returning the given width and height). But if the Stream is created without dimensions, it will run a discoverer to try to get preroll frames and detect width and height from there.
This commit is contained in:
Bruno Herbelin
2021-12-30 00:15:43 +01:00
parent bc540044ac
commit 033d41863a
5 changed files with 153 additions and 19 deletions

View File

@@ -17,6 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
#include <string>
#include <sstream>
#include <glm/gtc/matrix_transform.hpp>
@@ -45,8 +46,11 @@ void GenericStreamSource::setDescription(const std::string &desc)
{
Log::Notify("Creating Source with Stream description '%s'", desc.c_str());
std::string pipeline = desc;
pipeline.append(" ! queue max-size-buffers=10 ! videoconvert");
// open gstreamer
stream_->open(desc);
stream_->open(pipeline);
stream_->play(true);
// will be ready after init and one frame rendered