|
Twitch SDK (Internal)
|
#include <streamer.h>
Classes | |
| class | IListener |
| struct | StartParams |
Public Types | |
| enum | StreamerState { StreamerState::Stopped, StreamerState::Starting, StreamerState::Started, StreamerState::Stopping } |
| using | StartCallback = std::function< void(TTV_ErrorCode ec)> |
| using | StopCallback = std::function< void(TTV_ErrorCode ec)> |
| using | FrameWriterDelayStateChangedCallback = std::function< void(FrameWriter::DelayState state)> |
| enum | State { State::Uninitialized, State::Initialized, State::ShuttingDown, State::Inert } |
Public Member Functions | |
| Streamer (const std::shared_ptr< User > &user, const std::shared_ptr< StreamerContext > &context) | |
| virtual | ~Streamer () |
| void | AddListener (const std::shared_ptr< IListener > &listener) |
| void | RemoveListener (const std::shared_ptr< IListener > &listener) |
| void | AddBandwidthStatListener (const std::shared_ptr< IBandwidthStatListener > &listener) |
| void | RemoveBandwidthStatListener (const std::shared_ptr< IBandwidthStatListener > &listener) |
| TTV_ErrorCode | SetVideoEncoder (const std::shared_ptr< IVideoEncoder > &encoder) |
| TTV_ErrorCode | SetAudioEncoder (const std::shared_ptr< IAudioEncoder > &encoder) |
| TTV_ErrorCode | SetCustomMuxer (const std::shared_ptr< IMuxer > &muxer) |
| void | SetBroadcasterSoftware (const std::string &str) |
| void | SetForceArchiveBroadcast (bool forceArchive) |
| void | SetFrameWriterDelayStateChangedCallback (const FrameWriterDelayStateChangedCallback &callback) |
| virtual void | SetTaskRunner (std::shared_ptr< TaskRunner > taskRunner) override |
| virtual TTV_ErrorCode | Initialize () override |
| virtual void | Update () override |
| virtual TTV_ErrorCode | Shutdown () override |
| virtual std::string | GetLoggerName () const override |
| virtual bool | CheckShutdown () override |
| virtual void | CompleteShutdown () override |
| TTV_ErrorCode | Start (const StartParams ¶ms, StartCallback &&callback) |
| TTV_ErrorCode | Stop (const std::string &reason, StopCallback &&callback) |
| TTV_ErrorCode | GetVolume (AudioLayerId layer, float &volume) const |
| TTV_ErrorCode | SetVolume (AudioLayerId layer, float volume) |
| void | SetAudioCapturer (AudioLayerId layerId, const std::shared_ptr< IAudioCapture > &capturer) |
| void | SetAudioCapturerEnabled (AudioLayerId layer, bool enabled) |
| void | GetAudioCapturers (std::vector< std::shared_ptr< IAudioCapture >> &result) const |
| std::shared_ptr< IAudioCapture > | GetAudioCapturer (AudioLayerId layer) const |
| void | SetVideoCapturer (std::shared_ptr< IVideoCapture > capturer) |
| std::shared_ptr< IVideoCapture > | GetVideoCapturer () const |
| uint64_t | GetStreamTime () const |
| std::shared_ptr< StreamStats > | GetStreamStats () |
| std::shared_ptr< const StreamStats > | GetStreamStats () const |
| VideoParams | GetVideoParams () const |
| TTV_ErrorCode | ValidateParams (const VideoParams &videoParams, const IngestServer &ingestServer) const |
| StreamerState | GetStreamerState () const |
| std::shared_ptr< TaskRunner > | GetTaskRunner () |
| virtual State | GetState () const override |
Static Public Member Functions | |
| static std::string | GetComponentName () |
| static void | GetRequiredAuthScopes (std::vector< std::string > &scopes) |
Protected Member Functions | |
| virtual void | OnUserLogInComplete (TTV_ErrorCode ec) |
| virtual void | OnUserLogOutComplete (TTV_ErrorCode ec) |
| virtual void | OnUserInfoFetchComplete (TTV_ErrorCode ec) |
| virtual void | OnUserAuthenticationIssue (std::shared_ptr< const OAuthToken > oauthToken, TTV_ErrorCode ec) |
| void | Log (TTV_MessageLevel level, const char *format,...) |
| TTV_ErrorCode | StartTask (std::shared_ptr< Task > task) |
| void | CompleteTask (Task *task) |
| bool | IsTaskRunning (Task *task) const |
| virtual void | SetState (State state) |
| virtual void | SetClientState (State state) |
| virtual void | SetServerState (State state) |
Protected Attributes | |
| std::weak_ptr< User > | mUser |
| bool | mOAuthIssue |
| Whether or not the internal updates of the component are on hold because of an issue with the OAuth token. More... | |
| ClientServerValue< State > | mState |
| std::shared_ptr< TaskRunner > | mTaskRunner |
| std::vector< std::shared_ptr< Task > > | mRunningTasks |
| std::mutex | mTaskMutex |
| uint64_t | mShutdownTimeMilliseconds |
Private Member Functions | |
| TTV_ErrorCode | FetchChannelInfo (std::function< void(TTV_ErrorCode ec)> &&callback) |
| TTV_ErrorCode | AddVideoFrame (const std::shared_ptr< VideoFrame > &frame) |
| TTV_ErrorCode | GetStreamInfo () |
| TTV_ErrorCode | SetIngestServer (const IngestServer &ingestServer) |
| TTV_ErrorCode | SetStreamName (const std::string &streamKey, bool absEnabled) |
| TTV_ErrorCode | KickOffStart (const StartParams ¶ms, StartCallback &&callback) |
| TTV_ErrorCode | InternalStart (const StartParams ¶ms) |
| TTV_ErrorCode | InternalStop (TTV_ErrorCode ec, bool solicited, StopCallback &&callback) |
| TTV_ErrorCode | UpdateBandwidthWarningState () |
| TTV_ErrorCode | TrackStartFailure (TTV_ErrorCode ec, bool synchronous) |
| TTV_ErrorCode | TrackMinuteBroadcast () |
| void | NotifyStreamerStateChanged () |
The following must be set before initialization:
The starting and stopping of the broadcast is always asynchronous. When stopping a broadcast it is possible that the stop may not complete immediately of the network has backed up and encoded frames are still being sent to the ingest server. Wait for the stop callback.
| struct ttv::broadcast::Streamer::StartParams |
| Class Members | ||
|---|---|---|
| StreamStartFlags | flags | |
| IngestServer | ingestServer | |
| wstring | outputFile | |
| VideoParams | videoParams | |
| using ttv::broadcast::Streamer::FrameWriterDelayStateChangedCallback = std::function<void(FrameWriter::DelayState state)> |
| using ttv::broadcast::Streamer::StartCallback = std::function<void(TTV_ErrorCode ec)> |
| using ttv::broadcast::Streamer::StopCallback = std::function<void(TTV_ErrorCode ec)> |
|
stronginherited |
|
strong |
| ttv::broadcast::Streamer::Streamer | ( | const std::shared_ptr< User > & | user, |
| const std::shared_ptr< StreamerContext > & | context | ||
| ) |
|
virtual |
| void ttv::broadcast::Streamer::AddBandwidthStatListener | ( | const std::shared_ptr< IBandwidthStatListener > & | listener | ) |
| void ttv::broadcast::Streamer::AddListener | ( | const std::shared_ptr< IListener > & | listener | ) |
|
private |
|
overridevirtual |
Reimplemented from ttv::Component.
|
overridevirtual |
Reimplemented from ttv::UserComponent.
|
protectedinherited |
|
private |
| std::shared_ptr<IAudioCapture> ttv::broadcast::Streamer::GetAudioCapturer | ( | AudioLayerId | layer | ) | const |
| void ttv::broadcast::Streamer::GetAudioCapturers | ( | std::vector< std::shared_ptr< IAudioCapture >> & | result | ) | const |
|
inlinestatic |
|
overridevirtual |
Implements ttv::Component.
|
static |
|
overridevirtualinherited |
Implements ttv::IComponent.
| StreamerState ttv::broadcast::Streamer::GetStreamerState | ( | ) | const |
|
private |
|
inline |
|
inline |
| uint64_t ttv::broadcast::Streamer::GetStreamTime | ( | ) | const |
|
inlineinherited |
| std::shared_ptr<IVideoCapture> ttv::broadcast::Streamer::GetVideoCapturer | ( | ) | const |
|
inline |
| TTV_ErrorCode ttv::broadcast::Streamer::GetVolume | ( | AudioLayerId | layer, |
| float & | volume | ||
| ) | const |
|
overridevirtual |
Reimplemented from ttv::UserComponent.
|
private |
|
private |
|
protectedinherited |
|
private |
|
protectedinherited |
|
private |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
Reimplemented in ttv::social::FriendList, ttv::social::Presence, and ttv::chat::ChatUserThreads.
|
protectedvirtualinherited |
|
protectedvirtualinherited |
| void ttv::broadcast::Streamer::RemoveBandwidthStatListener | ( | const std::shared_ptr< IBandwidthStatListener > & | listener | ) |
| void ttv::broadcast::Streamer::RemoveListener | ( | const std::shared_ptr< IListener > & | listener | ) |
| void ttv::broadcast::Streamer::SetAudioCapturer | ( | AudioLayerId | layerId, |
| const std::shared_ptr< IAudioCapture > & | capturer | ||
| ) |
| void ttv::broadcast::Streamer::SetAudioCapturerEnabled | ( | AudioLayerId | layer, |
| bool | enabled | ||
| ) |
| TTV_ErrorCode ttv::broadcast::Streamer::SetAudioEncoder | ( | const std::shared_ptr< IAudioEncoder > & | encoder | ) |
|
inline |
Sets the broadcaster_software value for the stream.
|
protectedvirtualinherited |
| TTV_ErrorCode ttv::broadcast::Streamer::SetCustomMuxer | ( | const std::shared_ptr< IMuxer > & | muxer | ) |
|
inline |
Sets the force archive flag for the stream
|
inline |
|
private |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
private |
|
overridevirtual |
Reimplemented from ttv::Component.
| void ttv::broadcast::Streamer::SetVideoCapturer | ( | std::shared_ptr< IVideoCapture > | capturer | ) |
| TTV_ErrorCode ttv::broadcast::Streamer::SetVideoEncoder | ( | const std::shared_ptr< IVideoEncoder > & | encoder | ) |
These must be set before calling Initialize().
| TTV_ErrorCode ttv::broadcast::Streamer::SetVolume | ( | AudioLayerId | layer, |
| float | volume | ||
| ) |
|
overridevirtual |
Reimplemented from ttv::Component.
| TTV_ErrorCode ttv::broadcast::Streamer::Start | ( | const StartParams & | params, |
| StartCallback && | callback | ||
| ) |
Performs an asynchronous start.
|
protectedinherited |
| TTV_ErrorCode ttv::broadcast::Streamer::Stop | ( | const std::string & | reason, |
| StopCallback && | callback | ||
| ) |
Performs an asynchronous stop.
|
private |
|
private |
Sends a tracking event indicating that we failed to start the broadcast.
| [in] | ec | The error that occurred when trying to start. |
| [in] | synchronous | If this is true, the failure occurred synchronously and an error was immediately returned to the client. If this is false, the error was delivered asynchronously in the client's callback. |
|
overridevirtual |
Reimplemented from ttv::Component.
|
private |
| TTV_ErrorCode ttv::broadcast::Streamer::ValidateParams | ( | const VideoParams & | videoParams, |
| const IngestServer & | ingestServer | ||
| ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The broadcaster_software parameter to send over RTMP.
|
private |
The name of the channel to broadcast to.
|
private |
|
private |
|
private |
|
private |
|
private |
If true appends recorder=1 to the RTMP URL forcing the server to record the broadcast.
|
private |
|
private |
|
private |
The number of system ticks at the time of stream start.
|
private |
The state last reported to the client.
|
private |
|
private |
|
protectedinherited |
Whether or not the internal updates of the component are on hold because of an issue with the OAuth token.
|
private |
|
protectedinherited |
|
private |
|
protectedinherited |
|
private |
|
protectedinherited |
|
private |
The cause of the last state change.
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
The key that grants stream access to the channel.
|
private |
|
mutableprotectedinherited |
|
protectedinherited |
|
private |
|
protectedinherited |
|
private |
|
private |
|
private |
1.8.13