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

Represents a stream that is currently in the playing state. More...

#include <StreamState.h>

Public Member Functions

virtual ~PlayingState ()
 Virtual destructor. More...
 
bool Play (StreamBase &stream, float speed, unsigned int unixTime) override
 Perform the Play action based on the stream state. More...
 
void Pause (StreamBase &stream) override
 Perform the Pause action based on the stream state. More...
 
void Stop (StreamBase &stream) override
 Perform the Stop action based on the stream state. More...
 
bool GoToLive (StreamBase &stream) override
 Perform the GoToLive action based on the stream state. More...
 
- Public Member Functions inherited from MediaController::StreamState
virtual ~StreamState ()
 Virtual destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from MediaController::StreamState
 StreamState ()
 Constructor. More...
 

Detailed Description

Represents a stream that is currently in the playing state.

Definition at line 55 of file StreamState.h.

Inherits MediaController::StreamState.

Constructor & Destructor Documentation

virtual MediaController::PlayingState::~PlayingState ( )
inlinevirtual

Virtual destructor.

Definition at line 61 of file StreamState.h.

61 {}

Member Function Documentation

bool PlayingState::GoToLive ( StreamBase stream)
overridevirtual

Perform the GoToLive action based on the stream state.

Parameters
streamThe stream instance.

Reimplemented from MediaController::StreamState.

Definition at line 38 of file StreamState.cpp.

38  {
39  // If the stream is already live then simply return.
40  if (stream.GetMode() == Controller::kLive) return true;
41 
42  // The stream needs to be stopped since it will be transitioning from playback to live.
43  return stream.Play();
44 }
The stream is playing live video.
Definition: IStream.h:21
Mode GetMode() override
Get the current playback mode.
Definition: StreamBase.cpp:40
bool Play(float speed=0, unsigned int unixTime=0) override
Call Play on the stream.
Definition: StreamBase.cpp:22
void PlayingState::Pause ( StreamBase stream)
overridevirtual

Perform the Pause action based on the stream state.

Parameters
streamThe stream instance.

Reimplemented from MediaController::StreamState.

Definition at line 30 of file StreamState.cpp.

30  {
31  stream.Pause();
32 }
void Pause() override
Call Pause on the stream.
Definition: StreamBase.cpp:24
bool PlayingState::Play ( StreamBase stream,
float  speed,
unsigned int  unixTime 
)
overridevirtual

Perform the Play action based on the stream state.

Parameters
streamThe stream instance.
speedThe playback speed.
unixTimeThe start time for playback.

Reimplemented from MediaController::StreamState.

Definition at line 14 of file StreamState.cpp.

14  {
15  // Fast forward is not allowed if the stream is currently live so return
16  // if it's attempted.
17  if (stream.GetMode() == Controller::kLive) {
18  if (speed < 0 || unixTime != 0) {
19  return stream.Play(speed, unixTime == 0 ? stream.GetLastTimestamp() : unixTime);
20  }
21  }
22  else {
23  if (speed != stream.GetGstreamer()->GetSpeed() || unixTime != 0)
24  return stream.Resume(speed, unixTime);
25  }
26 
27  return true;
28 }
The stream is playing live video.
Definition: IStream.h:21
GstWrapper * GetGstreamer() const
Get the current GStreamer wrapper instance.
Definition: StreamBase.cpp:32
unsigned int GetLastTimestamp() const
Gets the current time of the stream.
Definition: StreamBase.cpp:36
Mode GetMode() override
Get the current playback mode.
Definition: StreamBase.cpp:40
float GetSpeed() const
Get the current playback speed.
Definition: GstWrapper.h:96
bool Play(float speed=0, unsigned int unixTime=0) override
Call Play on the stream.
Definition: StreamBase.cpp:22
virtual bool Resume(float speed=0, unsigned int unixTime=0)
Send PLAY on an existing stream.
Definition: StreamBase.cpp:30
void PlayingState::Stop ( StreamBase stream)
overridevirtual

Perform the Stop action based on the stream state.

Parameters
streamThe stream instance.

Reimplemented from MediaController::StreamState.

Definition at line 34 of file StreamState.cpp.

34  {
35  stream.Stop();
36 }
void Stop() override
Call TearDown on the stream.
Definition: StreamBase.cpp:26

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