ASAPCabinetFE
 
Loading...
Searching...
No Matches
IVideoPlayer Interface Referenceabstract

Interface for a video player. More...

#include <ivideo_player.h>

+ Inheritance diagram for IVideoPlayer:
+ Collaboration diagram for IVideoPlayer:

Public Member Functions

virtual ~IVideoPlayer ()=default
 Destructor.
 
virtual bool setup (SDL_Renderer *renderer, const std::string &path, int width, int height)=0
 Sets up the video player.
 
virtual void play ()=0
 Starts video playback.
 
virtual void stop ()=0
 Stops the video playback.
 
virtual void update ()=0
 Updates the video state.
 
virtual SDL_Texture * getTexture () const =0
 Retrieves the current video texture.
 
virtual bool isPlaying () const =0
 Checks if the video is currently playing.
 
virtual void setVolume (float volume)=0
 Sets the volume for the video's audio track.
 
virtual void setMute (bool mute)=0
 Sets the mute state for the video's audio track.
 

Detailed Description

Interface for a video player.

This abstract class defines the necessary methods for any video player implementation. It ensures that any concrete class provides functionality to load, play, stop, update, and retrieve video textures along with the playing state. It also includes methods for audio control.

Note
All implementations should handle resource management appropriately.
See also
SDL_Renderer, SDL_Texture

Constructor & Destructor Documentation

◆ ~IVideoPlayer()

virtual IVideoPlayer::~IVideoPlayer ( )
virtualdefault

Destructor.

Virtual destructor to ensure derived class destructors are called correctly.

Member Function Documentation

◆ getTexture()

virtual SDL_Texture * IVideoPlayer::getTexture ( ) const
pure virtual

Retrieves the current video texture.

Returns the SDL_Texture representing the current frame of the video.

Returns
SDL_Texture pointer if available; otherwise, may return nullptr.

Implemented in DummyVideoPlayer, FFmpegPlayer, and VlcVideoPlayer.

◆ isPlaying()

virtual bool IVideoPlayer::isPlaying ( ) const
pure virtual

Checks if the video is currently playing.

Evaluates whether the video player is actively playing the video.

Returns
true if the video is being played; false otherwise.

Implemented in DummyVideoPlayer, FFmpegPlayer, and VlcVideoPlayer.

◆ play()

virtual void IVideoPlayer::play ( )
pure virtual

Starts video playback.

Initiates the video playback. The video player should begin rendering as soon as play is called.

Implemented in DummyVideoPlayer, FFmpegPlayer, and VlcVideoPlayer.

◆ setMute()

virtual void IVideoPlayer::setMute ( bool  mute)
pure virtual

Sets the mute state for the video's audio track.

Parameters
muteTrue to mute the audio, false to unmute.

Implemented in DummyVideoPlayer, FFmpegPlayer, and VlcVideoPlayer.

◆ setup()

virtual bool IVideoPlayer::setup ( SDL_Renderer *  renderer,
const std::string &  path,
int  width,
int  height 
)
pure virtual

Sets up the video player.

Configures the video player with the given renderer, video file path, and display dimensions.

Parameters
rendererPointer to an SDL_Renderer used for rendering.
pathFile path of the video to be played.
widthDesired width of the video.
heightDesired height of the video.
Returns
true if the setup is successful; false otherwise.

Implemented in DummyVideoPlayer, FFmpegPlayer, and VlcVideoPlayer.

◆ setVolume()

virtual void IVideoPlayer::setVolume ( float  volume)
pure virtual

Sets the volume for the video's audio track.

Parameters
volumeThe desired volume, typically a float between 0.0 (silent) and 1.0 (full volume).

Implemented in DummyVideoPlayer, FFmpegPlayer, and VlcVideoPlayer.

◆ stop()

virtual void IVideoPlayer::stop ( )
pure virtual

Stops the video playback.

Halts any video activity and can reset player states if necessary.

Implemented in DummyVideoPlayer, FFmpegPlayer, and VlcVideoPlayer.

◆ update()

virtual void IVideoPlayer::update ( )
pure virtual

Updates the video state.

Handles the periodic updates for the video player, such as frame progression. Should be called in the game/render loop.

Implemented in DummyVideoPlayer, FFmpegPlayer, and VlcVideoPlayer.


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