51
51
#include < QQuickRenderControl>
52
52
#include < QQuickWindow>
53
53
54
+ namespace
55
+ {
56
+ const std::string DEFAULT_STREAM_NAME ( " QmlStreamer" );
57
+ }
54
58
55
59
class RenderControl : public QQuickRenderControl
56
60
{
@@ -75,7 +79,8 @@ namespace deflect
75
79
namespace qt
76
80
{
77
81
78
- QmlStreamer::Impl::Impl ( const QString& qmlFile, const std::string& streamHost )
82
+ QmlStreamer::Impl::Impl ( const QString& qmlFile, const std::string& streamHost,
83
+ const std::string& streamName )
79
84
: QWindow()
80
85
, _context( new QOpenGLContext )
81
86
, _offscreenSurface( new QOffscreenSurface )
@@ -92,6 +97,7 @@ QmlStreamer::Impl::Impl( const QString& qmlFile, const std::string& streamHost )
92
97
, _eventHandler( nullptr )
93
98
, _streaming( false )
94
99
, _streamHost( streamHost )
100
+ , _streamName( streamName )
95
101
{
96
102
setSurfaceType ( QSurface::OpenGLSurface );
97
103
@@ -321,14 +327,19 @@ bool QmlStreamer::Impl::_setupRootItem()
321
327
return true ;
322
328
}
323
329
330
+ std::string QmlStreamer::Impl::_getDeflectStreamName () const
331
+ {
332
+ if ( !_streamName.empty ( ))
333
+ return _streamName;
334
+
335
+ const std::string streamName = _rootItem->objectName ().toStdString ();
336
+ return streamName.empty () ? DEFAULT_STREAM_NAME : streamName;
337
+ }
338
+
324
339
bool QmlStreamer::Impl::_setupDeflectStream ()
325
340
{
326
341
if ( !_stream )
327
- {
328
- const std::string streamName = _rootItem->objectName ().toStdString ();
329
- _stream = new Stream ( streamName.empty () ? " QmlStreamer" : streamName,
330
- _streamHost );
331
- }
342
+ _stream = new Stream ( _getDeflectStreamName (), _streamHost );
332
343
333
344
if ( !_stream->isConnected ( ))
334
345
return false ;
0 commit comments