coastline 0.0.4
Loading...
Searching...
No Matches
coastline::VideoPlayer Class Reference

A decoded video and its audio, with bounded frame buffering. More...

#include <videoplayer.h>

Public Member Functions

 ~VideoPlayer ()
 Release decoder, texture, and audio resources.
 VideoPlayer (const VideoPlayer &)=delete
 Prevent copying decoder resources.
VideoPlayer & operator= (const VideoPlayer &)=delete
 Prevent assigning decoder resources.
bool Update (double seconds, float volume)
 Decode through elapsed movie time and update audio gain.
std::optional< double > Seek (double seconds)
 Seek to a movie position and discard buffered video and audio.
void SetPaused (bool paused)
 Pause or resume audio and change the current frame to dim greyscale while paused.
double Duration () const
const RenderTexture * Texture () const

Static Public Member Functions

static std::unique_ptr< VideoPlayer > Open (SceneRenderer &renderer, const std::filesystem::path &path)
 Open a local movie without starting its clock.

Detailed Description

A decoded video and its audio, with bounded frame buffering.

Constructor & Destructor Documentation

◆ ~VideoPlayer()

coastline::VideoPlayer::~VideoPlayer ( )

Release decoder, texture, and audio resources.

◆ VideoPlayer()

coastline::VideoPlayer::VideoPlayer ( const VideoPlayer & )
delete

Prevent copying decoder resources.

Member Function Documentation

◆ Open()

std::unique_ptr< VideoPlayer > coastline::VideoPlayer::Open ( SceneRenderer & renderer,
const std::filesystem::path & path )
static

Open a local movie without starting its clock.

Parameters
rendererThe renderer used for video textures.
pathThe movie file.
Returns
The player, or null if decoding is unavailable or opening fails.

◆ operator=()

VideoPlayer & coastline::VideoPlayer::operator= ( const VideoPlayer & )
delete

Prevent assigning decoder resources.

◆ Update()

bool coastline::VideoPlayer::Update ( double seconds,
float volume )

Decode through elapsed movie time and update audio gain.

Parameters
secondsNonnegative elapsed seconds since opening.
volumeAudio gain from zero through one.
Returns
Whether playback should continue; false on completion or a decoding error.

◆ Seek()

std::optional< double > coastline::VideoPlayer::Seek ( double seconds)

Seek to a movie position and discard buffered video and audio.

Parameters
secondsRequested movie time, clamped to [0, 86400]. A known duration caps the result at max(0, duration - 0.05) seconds.
Returns
The selected time in seconds, or an empty optional on failure or non-finite input.

◆ SetPaused()

void coastline::VideoPlayer::SetPaused ( bool paused)

Pause or resume audio and change the current frame to dim greyscale while paused.

Parameters
pausedWhether playback is paused. The caller must also stop its playback clock.

◆ Duration()

double coastline::VideoPlayer::Duration ( ) const
Returns
Movie duration in seconds, or zero when unavailable.

◆ Texture()

const RenderTexture * coastline::VideoPlayer::Texture ( ) const
Returns
The borrowed video texture, initially blank and valid until player destruction.

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