struct av_codec_info { real32 AvgPTSPerFrame; AVFormatContext *FileFormatContext; AVCodecParameters *VideoCodecParameters; const AVCodec* VideoCodec; const AVCodecHWConfig* VideoHWConfig; // AVPixelFormat HWPixFormat; AVCodecContext *VideoCodecContext; AVStream *VideoStream; }; struct av_packet_info { uint64 PreviousPTS = -1; // PTS value of the previous frame, used to check timings. AVPacket *VideoPacket; AVFrame *VideoFrame; SwsContext *RGBContext; }; static bool32 AV_TryFrame(av_codec_info *AV, av_packet_info *AVPacket, int32 *err); // Internal attempt to decode a frame. Typically run in a while loop until it returns true.