From e89dc91182a94e48ca9220a2fe075db680ddff04 Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Tue, 16 Aug 2022 15:06:45 -0400 Subject: undo functional --- ffmpeg_backend.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'ffmpeg_backend.cpp') 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; -- cgit v1.2.3