FMediaIOCorePlayerBase

Implements a base player for hardware IO cards.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

MediaIOCore

Header

/Engine/Plugins/Media/MediaIOFramework/Source/MediaIOCore/Public/MediaIOCorePlayerBase.h

Include

#include "MediaIOCorePlayerBase.h"

Syntax

class FMediaIOCorePlayerBase :
    public IMediaPlayer,
    protected IMediaCache,
    protected IMediaControls,
    protected IMediaTracks,
    protected IMediaView,
    public ITimedDataInput

Remarks

Implements a base player for hardware IO cards.

The processing of metadata and video frames is delayed until the fetch stage (TickFetch) in order to increase the window of opportunity for receiving frames for the current render frame time code.

Depending on whether the media source enables time code synchronization, the player's current play time (CurrentTime) is derived either from the time codes embedded in frames or from the Engine's global time code.

Variables

Name Description

Protected variable

FMediaAudioTrac...

 

AudioTrackFormat

Format of the audio.

Protected variable

FMediaIOSamplin...

 

BaseSettings

Base set of settings to start from when setuping channels

Protected variable

bool

 

bUseTimeSynchronization

Whether to use the Synchronization Time module as time source.

Protected variable

bool

 

bWarnedIncompatibleFrameRate

Warn when the video frame rate is not the same as the engine's frame rate.

Protected variable

TArray< ITimedD...

 

Channels

Timed Data Input handler

Protected variable

FCriticalSectio...

 

CriticalSection

Critical section for synchronizing access to receiver and sinks.

Protected variable

EMediaState

 

CurrentState

Current state of the media player.

Protected variable

FTimespan

 

CurrentTime

Current playback time.

Protected variable

IMediaEventSink...

 

EventSink

The media event handler.

Protected variable

int32

 

FrameDelay

When using Time Synchronization (TC synchronization), how many frame back of a delay would you like.

Protected variable

FString

 

OpenUrl

Url used to open the media player.

Protected variable

FTimespan

 

PreviousFrameTimespan

Previous frame Timespan

Protected variable

FMediaIOCoreSam...

 

Samples

The media sample cache.

Protected variable

double

 

TimeDelay

When not using Time Synchronization (use computer time), how many sec back of a delay would you like.

Protected variable

FFrameRate

 

VideoFrameRate

Video frame rate in the last received sample.

Protected variable

FMediaVideoTrac...

 

VideoTrackFormat

Format of the video.

Constructors

Name Description

Public function

FMediaIOCorePlayerBase

(
    IMediaEventSink& InEventSink
)

Create and initialize a new instance.

Destructors

Name Description

Public function Virtual

~FMediaIOCorePlayerBase()

Virtual destructor.

Functions

Name Description

Protected function Static

double

 

GetApplicationSeconds()

Get the application time with a delta to represent the actual system time.

Protected function Static

double

 

GetPlatformSeconds()

Get the platform time with a delta to represent the actual system time.

Public function Const

const FMedia...

 

GetSamples()

Protected function Const

bool

 

IsHardwareReady()

Is the IO hardware/device ready to be used.

Protected function Static

bool

 

IsTimecodeLogEnabled()

Log the timecode when a frame is received.

Protected function Virtual

bool

 

ReadMediaOptions

(
    const IMediaOptions* Options
)

Return true if the options combination are valid.

Protected function

void

 

SetupSampleChannels()

Setup settings for the different kind of supported data channels.

Public function Virtual

void

 

TickTimeManagement()

Overridden from IMediaPlayer

Name Description

Public function Virtual

void

 

Close()

Close a previously opened media source.

Public function Virtual

IMediaCache ...

 

GetCache()

Get the player's cache controls.

Public function Virtual

IMediaContro...

 

GetControls()

Get the player's playback controls.

Public function Virtual Const

FString

 

GetInfo()

Get debug information about the player and currently opened media.

Public function Virtual

IMediaSample...

 

GetSamples()

Get the player's sample queue.

Public function Virtual Const

FString

 

GetStats()

Get playback statistics information.

Public function Virtual

IMediaTracks...

 

GetTracks()

Get the player's track collection.

Public function Virtual Const

FString

 

GetUrl()

Get the URL of the currently loaded media.

Public function Virtual

IMediaView &

 

GetView()

Get the player's view settings.

Public function Virtual

bool

 

Open

(
    const FString& Url,
    const IMediaOptions* Options
)

Open a media source from a URL with optional parameters.

Public function Virtual

bool

 

Open

(
    const TSharedRef< FArchive, ESPMode...,
    const FString& OriginalUrl,
    const IMediaOptions* Options
)

Open a media source from a file or memory archive with optional parameters.

Public function Virtual

void

 

TickFetch

(
    FTimespan DeltaTime,
    FTimespan Timecode
)

Tick the player in the Fetch phase.

Overridden from IMediaCache

Name Description

Public function Virtual Const

int32

 

GetSampleCount

(
    EMediaCacheState State
)

Query the number of samples for the specified caching state.

Public function Virtual Const

bool

 

QueryCacheState

(
    EMediaCacheState State,
    TRangeSet< FTimespan >& OutTimeRan...
)

Query the time ranges of cached media samples for the specified caching state.

Overridden from IMediaControls

Name Description

Protected function Virtual Const

bool

 

CanControl

(
    EMediaControl Control
)

Whether the specified control is currently available.

Protected function Virtual Const

FTimespan

 

GetDuration()

Get the media's duration.

Protected function Virtual Const

float

 

GetRate()

Get the nominal playback rate, i.e. 1.0 for real time.

Protected function Virtual Const

EMediaState

 

GetState()

Get the state of the media.

Protected function Virtual Const

EMediaStatus

 

GetStatus()

Get media player status flags.

Protected function Virtual Const

TRangeSet< f...

 

GetSupportedRates

(
    EMediaRateThinning Thinning
)

Get the supported playback rates.

Protected function Virtual Const

FTimespan

 

GetTime()

Get the player's current playback time.

Protected function Virtual Const

bool

 

IsLooping()

Check whether playback is currently looping.

Protected function Virtual

bool

 

Seek

(
    const FTimespan& Time
)

Change the media's playback time.

Protected function Virtual

bool

 

SetLooping

(
    bool Looping
)

Set whether playback should be looping.

Protected function Virtual

bool

 

SetRate

(
    float Rate
)

Set the current playback rate.

Overridden from IMediaTracks

Name Description

Protected function Virtual Const

bool

 

GetAudioTrackFormat

(
    int32 TrackIndex,
    int32 FormatIndex,
    FMediaAudioTrackFormat& OutFormat
)

Get details about the specified audio track format.

Protected function Virtual Const

int32

 

GetNumTrackFormats

(
    EMediaTrackType TrackType,
    int32 TrackIndex
)

Get the number of formats of the specified track.

Protected function Virtual Const

int32

 

GetNumTracks

(
    EMediaTrackType TrackType
)

Get the number of media tracks of the given type.

Protected function Virtual Const

int32

 

GetSelectedTrack

(
    EMediaTrackType TrackType
)

Get the index of the currently selected track of the given type.

Protected function Virtual Const

FText

 

GetTrackDisplayName

(
    EMediaTrackType TrackType,
    int32 TrackIndex
)

Get the human readable name of the specified track.

Protected function Virtual Const

int32

 

GetTrackFormat

(
    EMediaTrackType TrackType,
    int32 TrackIndex
)

Get the index of the currently selected format of the given track type.

Protected function Virtual Const

FString

 

GetTrackLanguage

(
    EMediaTrackType TrackType,
    int32 TrackIndex
)

Get the language tag of the specified track.

Protected function Virtual Const

FString

 

GetTrackName

(
    EMediaTrackType TrackType,
    int32 TrackIndex
)

Get the internal name of the specified track.

Protected function Virtual Const

bool

 

GetVideoTrackFormat

(
    int32 TrackIndex,
    int32 FormatIndex,
    FMediaVideoTrackFormat& OutFormat
)

Get details about the specified video track format.

Protected function Virtual

bool

 

SelectTrack

(
    EMediaTrackType TrackType,
    int32 TrackIndex
)

Select the active track of the given type.

Protected function Virtual

bool

 

SetTrackFormat

(
    EMediaTrackType TrackType,
    int32 TrackIndex,
    int32 FormatIndex
)

Select the active format on the specified track.

Overridden from ITimedDataInput

Name Description

Public function Virtual

void

 

AddChannel

(
    ITimedDataInputChannel* Channe...
)

Add a channel belonging to this input

Public function Virtual Const

TArray< ITim...

 

GetChannels()

Get a list of the channel this input has.

Public function Virtual Const

FText

 

GetDisplayName()

Get the name used when displayed.

Public function Virtual Const

double

 

GetEvaluationOffsetInSeconds()

Get the offset in seconds used at evaluation.

Public function Virtual Const

ETimedDataIn...

 

GetEvaluationType()

Get how the input is evaluated.

Public function Virtual Const

FFrameRate

 

GetFrameRate()

Get the frame rate at which the samples is produce.

Public function Virtual Const

bool

 

IsDataBufferSizeControlledByInput()

Does channel from this input support a different buffer size than it's input.

Public function Virtual

void

 

RemoveChannel

(
    ITimedDataInputChannel* Channe...
)

Remove channel from the input

Public function Virtual

void

 

SetEvaluationOffsetInSeconds

(
    double Offset
)

Set the offset in seconds used at evaluation.

Public function Virtual

void

 

SetEvaluationType

(
    ETimedDataInputEvaluationType Evalu...
)

Set how the input is evaluated.