diff options
Diffstat (limited to 'src/lib/ffmpeg_decoder.h')
| -rw-r--r-- | src/lib/ffmpeg_decoder.h | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h index 022c5625b..795320280 100644 --- a/src/lib/ffmpeg_decoder.h +++ b/src/lib/ffmpeg_decoder.h @@ -27,6 +27,7 @@ #include "bitmap_text.h" #include "decoder.h" #include "ffmpeg.h" +#include "packet_queue.h" #include "video_filter_graph_set.h" extern "C" { #include <libavcodec/avcodec.h> @@ -39,6 +40,7 @@ class AudioBuffers; class FFmpegAudioStream; class Image; class Log; +class PacketQueue; class VideoFilterGraph; struct ffmpeg_pts_offset_test; @@ -49,10 +51,10 @@ struct ffmpeg_pts_offset_test; class FFmpegDecoder : public FFmpeg, public Decoder { public: - FFmpegDecoder (std::shared_ptr<const Film> film, std::shared_ptr<const FFmpegContent>, bool fast); + FFmpegDecoder(std::shared_ptr<const Film> film, std::shared_ptr<const FFmpegContent>, bool fast); - bool pass () override; - void seek (dcpomatic::ContentTime time, bool) override; + bool pass() override; + void seek(dcpomatic::ContentTime time, bool) override; dcpomatic::ContentTime position() const override; private: @@ -64,23 +66,24 @@ private: }; FlushResult flush(); + bool process_from_packet_queue(bool flushing); - AVSampleFormat audio_sample_format (std::shared_ptr<FFmpegAudioStream> stream) const; - int bytes_per_audio_sample (std::shared_ptr<FFmpegAudioStream> stream) const; + AVSampleFormat audio_sample_format(std::shared_ptr<FFmpegAudioStream> stream) const; + int bytes_per_audio_sample(std::shared_ptr<FFmpegAudioStream> stream) const; - std::shared_ptr<FFmpegAudioStream> audio_stream_from_index (int index) const; - void process_audio_frame (std::shared_ptr<FFmpegAudioStream> stream); + std::shared_ptr<FFmpegAudioStream> audio_stream_from_index(int index) const; + void process_audio_frame(std::shared_ptr<FFmpegAudioStream> stream); - void process_video_frame (); + void process_video_frame(); - bool decode_and_process_video_packet (AVPacket* packet); - void decode_and_process_audio_packet (AVPacket* packet); - void decode_and_process_subtitle_packet (AVPacket* packet); + bool decode_and_process_video_packet(AVPacket* packet); + void decode_and_process_audio_packet(AVPacket* packet); + void decode_and_process_subtitle_packet(AVPacket* packet); - BitmapText process_bitmap_subtitle (AVSubtitleRect const * rect); - void process_ass_subtitle (std::string ass, dcpomatic::ContentTime from); + BitmapText process_bitmap_subtitle(AVSubtitleRect const * rect); + void process_ass_subtitle(std::string ass, dcpomatic::ContentTime from); - void maybe_add_subtitle (); + void maybe_add_subtitle(); FlushResult flush_codecs(); FlushResult flush_fill(); @@ -97,12 +100,14 @@ private: std::map<std::shared_ptr<FFmpegAudioStream>, boost::optional<dcpomatic::ContentTime>> _next_time; enum class FlushState { + PACKET_QUEUE, CODECS, AUDIO_DECODER, FILL, }; - FlushState _flush_state = FlushState::CODECS; + FlushState _flush_state = FlushState::PACKET_QUEUE; std::vector<boost::optional<dcpomatic::ContentTime>> _dropped_time; + std::unique_ptr<PacketQueue> _packet_queue; }; |
