Implements video and audio playback using FFmpeg. More...
#include <ffmpeg_player.h>
Inheritance diagram for FFmpegPlayer:
Collaboration diagram for FFmpegPlayer:Public Member Functions | |
| void | seek (double time_seconds, int stream_index) |
| FFmpegPlayer () | |
| Constructs an FFmpegPlayer instance. | |
| ~FFmpegPlayer () override | |
| Destroys the FFmpegPlayer instance and cleans up resources. | |
| bool | setup (SDL_Renderer *renderer, const std::string &path, int width, int height) override |
| Sets up the player with renderer and media file. | |
| void | play () override |
| Starts playback of the media file. | |
| void | stop () override |
| Stops playback of the media file. | |
| void | update () override |
| Updates the playback state. | |
| SDL_Texture * | getTexture () const override |
| Retrieves the current video texture. | |
| bool | isPlaying () const override |
| Checks if the player is currently playing. | |
| void | setVolume (float volume) override |
| Sets the audio volume. | |
| void | setMute (bool mute) override |
| Toggles audio mute state. | |
| void | seekToBeginning (int streamIndex) |
| Seeks to the beginning of the specified stream. | |
| AVFormatContext * | getFormatContext () const |
| Gets the format context. | |
Public Member Functions inherited from IVideoPlayer | |
| virtual | ~IVideoPlayer ()=default |
| Destructor. | |
Implements video and audio playback using FFmpeg.
This class extends IVideoPlayer to handle media file playback with FFmpeg, managing format context, video, and audio decoding. It provides methods for setup, playback control, and volume management, with cleanup handled via RAII.
| FFmpegPlayer::FFmpegPlayer | ( | ) |
Constructs an FFmpegPlayer instance.
Initializes with null pointers for decoders and format context.
|
override |
Destroys the FFmpegPlayer instance and cleans up resources.
Ensures all allocated resources, including decoders and format context, are freed.
|
inline |
Gets the format context.
Provides access to the AVFormatContext for decoder use.
Here is the caller graph for this function:
|
overridevirtual |
Retrieves the current video texture.
Implements IVideoPlayer.
Here is the call graph for this function:
|
overridevirtual |
Checks if the player is currently playing.
Implements IVideoPlayer.
Here is the caller graph for this function:
|
overridevirtual |
Starts playback of the media file.
Initiates video and audio playback if not already playing.
Implements IVideoPlayer.
Here is the call graph for this function:| void FFmpegPlayer::seekToBeginning | ( | int | streamIndex | ) |
Seeks to the beginning of the specified stream.
Used by decoders to reset playback position.
| streamIndex | Index of the stream to seek (-1 for all audio/video streams). |
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Toggles audio mute state.
| mute | True to mute, false to unmute. |
Implements IVideoPlayer.
Here is the call graph for this function:
|
overridevirtual |
Sets up the player with renderer and media file.
Configures the player with the specified renderer, file path, and resolution.
| renderer | Pointer to the SDL_Renderer for texture rendering. |
| path | Path to the media file. |
| width | Desired width of the video output. |
| height | Desired height of the video output. |
Implements IVideoPlayer.
Here is the call graph for this function:
|
overridevirtual |
Sets the audio volume.
| volume | Volume level (0.0 to 1.0). |
Implements IVideoPlayer.
Here is the call graph for this function:
|
overridevirtual |
Stops playback of the media file.
Halts video and audio playback and resets stream positions if applicable.
Implements IVideoPlayer.
Here is the call graph for this function:
|
overridevirtual |
Updates the playback state.
Calls update on video and audio decoders to process the next frame or audio sample.
Implements IVideoPlayer.
Here is the call graph for this function: