summaryrefslogtreecommitdiff
path: root/ffmpeg_backend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ffmpeg_backend.cpp')
-rw-r--r--ffmpeg_backend.cpp16
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;