C++ Samples
Demonstrates how to create a C++ application using the VideoXpert SDK
CppSamples::LiveStreaming::MediaOperationshandler Class Reference

MediaOperationshandler wraps the IController instance and some associated properties for streaming. More...

#include <MediaOperationshandler.h>

Public Member Functions

 MediaOperationshandler (MediaController::IController *mediaControl)
 
 ~MediaOperationshandler ()
 
bool DoOperation (char keyCode)
 Do media operation for given character. More...
 

Protected Member Functions

void DecreaseSpeed ()
 Decrease speed and play with new speed. More...
 
void GoToLive () const
 Request the media control to move the stream to live. More...
 
void IncreaseSpeed ()
 Increase speed and play with new speed. More...
 
void PauseOrPlay ()
 Toggle between pause and play options. More...
 

Private Attributes

MediaController::IController_mediaControl
 
bool _isPlaying
 
float _speed
 

Detailed Description

MediaOperationshandler wraps the IController instance and some associated properties for streaming.

Definition at line 12 of file MediaOperationshandler.h.

Constructor & Destructor Documentation

CppSamples::LiveStreaming::MediaOperationshandler::MediaOperationshandler ( MediaController::IController mediaControl)
inline
CppSamples::LiveStreaming::MediaOperationshandler::~MediaOperationshandler ( )
inline

Definition at line 15 of file MediaOperationshandler.h.

15 { }

Member Function Documentation

void CppSamples::LiveStreaming::MediaOperationshandler::DecreaseSpeed ( )
protected

Decrease speed and play with new speed.

Definition at line 35 of file MediaOperationshandler.cpp.

35  {
36  // Decrease the current speed by 2
37  _speed -= 2;
38  // Play the stream with new speed
39  bool result = _mediaControl->Play(_speed);
40  // Verfify the result.
41  if (result)
42  cout << "Speed decreased to " << _speed;
43  else
44  cout << "\nFailed to decrease speed.";
45  cout << "\n";
46 }
virtual bool Play(float speed=0, unsigned int unixTime=0)=0
bool CppSamples::LiveStreaming::MediaOperationshandler::DoOperation ( char  keyCode)

Do media operation for given character.

Parameters
keyCodeCharacter code represent a command.

Definition at line 8 of file MediaOperationshandler.cpp.

8  {
9  // Map the character code with operations
10  // p => Play or Pause
11  // z => Increase Speed
12  // x => Decrease Speed
13  // l -> Go to Live
14  switch (keyCode) {
15  case 'p':
16  PauseOrPlay();
17  return true;
18  case 'z':
19  IncreaseSpeed();
20  return true;
21  case 'x':
22  DecreaseSpeed();
23  return true;
24  //case 'l':
25  // GoToLive();
26  // return true;
27  default:
28  break;
29  }
30 
31  return false;
32 }
void PauseOrPlay()
Toggle between pause and play options.
void IncreaseSpeed()
Increase speed and play with new speed.
void DecreaseSpeed()
Decrease speed and play with new speed.
void CppSamples::LiveStreaming::MediaOperationshandler::GoToLive ( ) const
protected

Request the media control to move the stream to live.

Definition at line 49 of file MediaOperationshandler.cpp.

49  {
51 }
virtual bool GoToLive()=0
void CppSamples::LiveStreaming::MediaOperationshandler::IncreaseSpeed ( )
protected

Increase speed and play with new speed.

Definition at line 54 of file MediaOperationshandler.cpp.

54  {
55  // Increase the current speed by 2
56  _speed += 2;
57  // Play the stream with new speed
58  bool result = _mediaControl->Play(_speed);
59  // Verfify the result.
60  if (result)
61  cout << "Speed increased to " << _speed;
62  else
63  cout << "\nFailed to increase speed.";
64  cout << "\n";
65 }
virtual bool Play(float speed=0, unsigned int unixTime=0)=0
void CppSamples::LiveStreaming::MediaOperationshandler::PauseOrPlay ( )
protected

Toggle between pause and play options.

Definition at line 68 of file MediaOperationshandler.cpp.

68  {
69  if (_isPlaying) {
70  // Play mode to Pause mode
71  cout << "\n" << "Pausing the stream.\n";
73  _isPlaying = false;
74  }
75  else {
76  // Pause Mode to Play mode
77  cout << "\nResuming the stream.\n";
79  _isPlaying = true;
80  }
81 }
virtual void Pause()=0
virtual bool Play(float speed=0, unsigned int unixTime=0)=0

Member Data Documentation

bool CppSamples::LiveStreaming::MediaOperationshandler::_isPlaying
private

Definition at line 46 of file MediaOperationshandler.h.

MediaController::IController* CppSamples::LiveStreaming::MediaOperationshandler::_mediaControl
private

Definition at line 45 of file MediaOperationshandler.h.

float CppSamples::LiveStreaming::MediaOperationshandler::_speed
private

Definition at line 47 of file MediaOperationshandler.h.


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