Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
set attributes properly and add checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MGTheTrain committed Apr 19, 2024
1 parent 710bd11 commit c7975c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/video/src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ VideoPlayer::VideoPlayer() {
window = nullptr;
renderer = nullptr;
texture = nullptr;
SwsContext* swsContext = nullptr;
swsContext = nullptr;
frame = nullptr;
videoStream = -1;
}
Expand Down Expand Up @@ -147,6 +147,12 @@ bool loadVideo(VideoPlayer& player, const char* filename) {
player.formatContext->streams[player.videoStream]->time_base;
player.frameDuration = av_q2d(player.timeBase);

player.frame = av_frame_alloc();
if (!player.frame) {
std::cerr << "Failed to allocate frame\n";
return false;
}

return true;
}

Expand Down

0 comments on commit c7975c2

Please sign in to comment.