Twitch SDK (Internal)
videostreamer.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
12 #include <memory>
13 
14 namespace ttv
15 {
16  class IThread;
17 
18  namespace broadcast
19  {
20  class IVideoEncoder;
21  class VideoFrameQueue;
22  class IVideoCapture;
23  class VideoStreamer;
24  class VideoFrame;
25  class FlvMuxer;
26  }
27 }
28 
30 {
31 public:
32  VideoStreamer();
34 
35 public:
36  TTV_ErrorCode SetEncoder(const std::shared_ptr<IVideoEncoder>& encoder);
37  TTV_ErrorCode SetCapturer(const std::shared_ptr<IVideoCapture>& capturer);
38  TTV_ErrorCode Initialize(const VideoParams& videoParams);
40  TTV_ErrorCode ProcessFrame(const std::shared_ptr<VideoFrame>& videoFrame);
45 
46  TTV_ErrorCode ValidateVideoParams(const VideoParams& videoParams) const;
47 
48  void SetInitialTime(uint64_t initialTime);
49 
50  std::string GetEncoderName() const;
51 
52 private:
53  TTV_ErrorCode OpenVideo(const VideoParams* videoParams);
54  void ProcessFrameQueue();
55 
56 private:
57  uint64_t mInitialTime;
58 
59  volatile bool mDoProcessing;
60 
61  std::shared_ptr<IVideoEncoder> mVideoEncoder;
62  std::shared_ptr<IVideoCapture> mVideoCapturer;
63  std::unique_ptr<VideoFrameQueue> mFrameQueue;
64  std::shared_ptr<IThread> mFrameQueueThread;
66 };
TTV_ErrorCode Initialize(const VideoParams &videoParams)
std::shared_ptr< IThread > mFrameQueueThread
Definition: videostreamer.h:64
void SetInitialTime(uint64_t initialTime)
Definition: videostreamer.h:29
volatile bool mDoProcessing
Definition: videostreamer.h:59
std::shared_ptr< IVideoEncoder > mVideoEncoder
Definition: videostreamer.h:61
TTV_ErrorCode SetCapturer(const std::shared_ptr< IVideoCapture > &capturer)
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
TTV_ErrorCode ValidateVideoParams(const VideoParams &videoParams) const
std::string GetEncoderName() const
Definition: broadcasttypes.h:80
TTV_ErrorCode SetEncoder(const std::shared_ptr< IVideoEncoder > &encoder)
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
uint64_t mInitialTime
Definition: videostreamer.h:57
TTV_ErrorCode ProcessFrame(const std::shared_ptr< VideoFrame > &videoFrame)
VideoParams mVideoParams
Definition: videostreamer.h:65
TTV_ErrorCode OpenVideo(const VideoParams *videoParams)
std::unique_ptr< VideoFrameQueue > mFrameQueue
Definition: videostreamer.h:63
std::shared_ptr< IVideoCapture > mVideoCapturer
Definition: videostreamer.h:62