6#include <libavutil/buffer.h>
7#include <libavutil/pixfmt.h>
13struct AVFormatContext;
67 bool setup(AVFormatContext* formatContext, SDL_Renderer* renderer,
int width,
int height);
130 AVCodecContext* videoCodecContext_;
131 SDL_Renderer* renderer_;
134 AVFrame* videoFrame_;
136 AVPacket* videoPacket_;
137 SwsContext* swsContext_;
138 int videoStreamIndex_;
140 SDL_Texture* texture_;
142 std::chrono::high_resolution_clock::time_point lastFrameTime_;
143 std::chrono::high_resolution_clock::time_point playbackStartTime_;
145 AVBufferRef* hwDeviceCtx_ =
nullptr;
146 AVPixelFormat expectedSwFormat_ = AV_PIX_FMT_NONE;
Implements video and audio playback using FFmpeg.
Definition ffmpeg_player.h:30
Decodes and renders video frames using FFmpeg and SDL.
Definition video_decoder.h:38
void resetPlaybackTimes()
Resets playback timing variables.
Definition video_decoder.cpp:419
void stop()
Stops video playback.
Definition video_decoder.cpp:210
void updateTexture()
Updates the SDL texture with the current RGB frame data.
Definition video_decoder.cpp:382
void play()
Starts video playback.
Definition video_decoder.cpp:205
SDL_Texture * getTexture() const
Retrieves the current video texture.
Definition video_decoder.cpp:253
void flush()
Flushes the decoder buffers.
Definition video_decoder.cpp:412
~VideoDecoder()
Destroys the VideoDecoder instance and cleans up resources.
Definition video_decoder.cpp:27
void update()
Updates the video frame based on playback timing.
Definition video_decoder.cpp:215
bool decodeVideoFrame()
Decodes the next video frame.
Definition video_decoder.cpp:257
bool setup(AVFormatContext *formatContext, SDL_Renderer *renderer, int width, int height)
Sets up the video decoder with format context and renderer.
Definition video_decoder.cpp:32