#ifndef TGCALLS_AUDIO_STREAMING_PART_PERSISTENT_DECODER_H #define TGCALLS_AUDIO_STREAMING_PART_PERSISTENT_DECODER_H #include "absl/types/optional.h" #include #include #include #include // Fix build on Windows - this should appear before FFmpeg timestamp include. #define _USE_MATH_DEFINES #include extern "C" { #include #include #include } namespace tgcalls { class AudioStreamingPartPersistentDecoderState; class WrappedCodecParameters { public: WrappedCodecParameters(AVCodecParameters const *codecParameters); ~WrappedCodecParameters(); bool isEqual(AVCodecParameters const *other); private: AVCodecParameters *_value = nullptr; }; class AudioStreamingPartPersistentDecoder { public: AudioStreamingPartPersistentDecoder(); ~AudioStreamingPartPersistentDecoder(); int decode(AVCodecParameters const *codecParameters, AVRational timeBase, AVPacket &packet, AVFrame *frame); private: void maybeReset(AVCodecParameters const *codecParameters, AVRational timeBase); private: AudioStreamingPartPersistentDecoderState *_state = nullptr; }; } #endif