Media Controller
A GStreamer implementation using the VideoXpert SDK
MediaController::StreamFactory Class Reference

Handles the creation of new stream objects. More...

#include <StreamFactory.h>

Static Public Member Functions

static StreamBaseCreateStream (MediaRequest &request)
 Create a new stream object. More...
 
static StreamBaseCreateAudioStream (MediaRequest &request)
 Create a new audio stream object. More...
 
static MediaRequestCreateMediaRequest (MediaRequest &request)
 Create a new audio MediaRequest object. More...
 

Detailed Description

Handles the creation of new stream objects.

Definition at line 12 of file StreamFactory.h.

Member Function Documentation

StreamBase * StreamFactory::CreateAudioStream ( MediaRequest request)
static

Create a new audio stream object.

Parameters
requestThe requested media.
Returns
A new StreamBase object.

Definition at line 30 of file StreamFactory.cpp.

30  {
31  if (!request.audioDataSource)
32  return nullptr;
33 
34  MediaRequest* audioRequest = CreateMediaRequest(request);
35 
36  StreamBase* stream = new Rtsp::Stream(*audioRequest, false);
37  stream->protocol = audioRequest->dataInterface.protocol;
38  stream->state = new StoppedState();
39  return stream;
40 }
VxSdk::VxStreamProtocol::Value protocol
The protocol of the stream.
Definition: StreamBase.h:56
Represents a stream that is currently in the stopped state.
Definition: StreamState.h:86
The base class for the different stream types.
Definition: StreamBase.h:14
VxSdk::IVxDataInterface dataInterface
The protocol to use for the new video stream.
Definition: MediaRequest.h:26
Represents an RTSP stream.
Definition: RtspStream.h:18
Contains the information needed to start a new media stream.
Definition: MediaRequest.h:11
static MediaRequest * CreateMediaRequest(MediaRequest &request)
Create a new audio MediaRequest object.
VxSdk::IVxDataSource * audioDataSource
The data source to use to create the new audio stream.
Definition: MediaRequest.h:31
VxStreamProtocol::Value protocol
StreamState * state
The current state of the stream.
Definition: StreamBase.h:49
MediaRequest * StreamFactory::CreateMediaRequest ( MediaRequest request)
static

Create a new audio MediaRequest object.

Parameters
requestThe requested media.
Returns
A new MediaRequest object.

Definition at line 42 of file StreamFactory.cpp.

42  {
43  MediaRequest* audioRequest = new MediaRequest();
44  audioRequest->dataSource = request.audioDataSource;
45  audioRequest->dataInterface = request.audioDataInterface;
46  audioRequest->audioDataSource = nullptr;
47  return audioRequest;
48 }
VxSdk::IVxDataSource * dataSource
The data source to use to create the new video stream.
Definition: MediaRequest.h:21
VxSdk::IVxDataInterface dataInterface
The protocol to use for the new video stream.
Definition: MediaRequest.h:26
VxSdk::IVxDataInterface audioDataInterface
The protocol to use for the new audio stream.
Definition: MediaRequest.h:36
Contains the information needed to start a new media stream.
Definition: MediaRequest.h:11
VxSdk::IVxDataSource * audioDataSource
The data source to use to create the new audio stream.
Definition: MediaRequest.h:31
StreamBase * StreamFactory::CreateStream ( MediaRequest request)
static

Create a new stream object.

Parameters
requestThe requested media.
Returns
A new StreamBase object.

Definition at line 13 of file StreamFactory.cpp.

13  {
14  StreamBase* stream = nullptr;
15  if (!request.dataSource) return stream;
16 
17  if (request.dataInterface.protocol == VxStreamProtocol::kRtspRtp) {
18  stream = new Rtsp::Stream(request, true);
19  stream->protocol = request.dataInterface.protocol;
20  stream->state = new StoppedState();
21  }
22  else if (request.dataInterface.protocol == VxStreamProtocol::kMjpegPull) {
23  stream = new MjpegPull::Stream(request);
24  stream->protocol = request.dataInterface.protocol;
25  stream->state = new StoppedState();
26  }
27  return stream;
28 }
VxSdk::VxStreamProtocol::Value protocol
The protocol of the stream.
Definition: StreamBase.h:56
VxSdk::IVxDataSource * dataSource
The data source to use to create the new video stream.
Definition: MediaRequest.h:21
Represents a stream that is currently in the stopped state.
Definition: StreamState.h:86
The base class for the different stream types.
Definition: StreamBase.h:14
Represents an MJPEG pull stream.
VxSdk::IVxDataInterface dataInterface
The protocol to use for the new video stream.
Definition: MediaRequest.h:26
Represents an RTSP stream.
Definition: RtspStream.h:18
VxStreamProtocol::Value protocol
StreamState * state
The current state of the stream.
Definition: StreamBase.h:49

The documentation for this class was generated from the following files: