diff options
author | Fox Caminiti <fox@foxcam.net> | 2022-08-16 15:06:45 -0400 |
---|---|---|
committer | Fox Caminiti <fox@foxcam.net> | 2022-08-16 15:06:45 -0400 |
commit | e89dc91182a94e48ca9220a2fe075db680ddff04 (patch) | |
tree | a277c1e38293f92e635c981ad2f6b0d84d103e09 /ffmpeg_backend.cpp | |
parent | 04b7ccfd87d802e6b9a22b86c8d098979164b8ba (diff) |
undo functional
Diffstat (limited to 'ffmpeg_backend.cpp')
-rw-r--r-- | ffmpeg_backend.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/ffmpeg_backend.cpp b/ffmpeg_backend.cpp index f437285..6f0aeb5 100644 --- a/ffmpeg_backend.cpp +++ b/ffmpeg_backend.cpp @@ -86,10 +86,20 @@ bool32 AV_IsFileSupported(char *filename) return 1; } -void AV_Init(source *Source, layer_bitmap_info *BitmapInfo, memory *Memory) +// Note that we can't get away with not having to keep track of the AV pointer +// for undos by clearing/reallocing these contexts every frame since the state +// of the PTS value is stored inside FileFormatContext. +void AV_Dealloc(av_info *AV) +{ + Assert(AV); + avformat_free_context(AV->FileFormatContext); + avcodec_free_context(&AV->VideoCodecContext); + av_packet_free(&AV->VideoPacket); + av_frame_free(&AV->VideoFrame); +}; + +void AV_Init(source *Source, av_info *AV, memory *Memory) { - BitmapInfo->AVInfo = AllocateMemory(Memory, sizeof(av_info), P_AVInfo); - av_info *AV = (av_info *)BitmapInfo->AVInfo; *AV = {}; int32 err = 0; |