X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_encoder.h;h=5e6dcecf75d1ee556314d9ff8cddea1f49d12752;hb=4542d9e7c510ba91e1b9b056536a2bc4a18ecf32;hp=bd5be454572b62b4ef6e77305d129398250cf31d;hpb=d8ea1796f34ff894b148a0af78c0a547e0496ee1;p=dcpomatic.git diff --git a/src/lib/ffmpeg_encoder.h b/src/lib/ffmpeg_encoder.h index bd5be4545..5e6dcecf7 100644 --- a/src/lib/ffmpeg_encoder.h +++ b/src/lib/ffmpeg_encoder.h @@ -23,10 +23,14 @@ #include "encoder.h" #include "event_history.h" +#include "audio_mapping.h" extern "C" { #include #include } +#include + +class Butler; class FFmpegEncoder : public Encoder { @@ -37,7 +41,7 @@ public: FORMAT_H264 }; - FFmpegEncoder (boost::shared_ptr film, boost::weak_ptr job, boost::filesystem::path output, Format format); + FFmpegEncoder (boost::shared_ptr film, boost::weak_ptr job, boost::filesystem::path output, Format format, bool mixdown_to_stereo); void go (); @@ -52,11 +56,24 @@ private: void audio (boost::shared_ptr, DCPTime); void subtitle (PlayerSubtitles, DCPTimePeriod); - AVCodecContext* _codec_context; + void setup_video (); + void setup_audio (); + + void audio_frame (int size); + + AVCodec* _video_codec; + AVCodecContext* _video_codec_context; + AVCodec* _audio_codec; + AVCodecContext* _audio_codec_context; AVFormatContext* _format_context; AVStream* _video_stream; + AVStream* _audio_stream; AVPixelFormat _pixel_format; - std::string _codec_name; + AVSampleFormat _sample_format; + AVDictionary* _video_options; + std::string _video_codec_name; + std::string _audio_codec_name; + int _output_audio_channels; mutable boost::mutex _mutex; DCPTime _last_time; @@ -64,6 +81,17 @@ private: EventHistory _history; boost::filesystem::path _output; + + boost::shared_ptr _pending_audio; + + mutable boost::mutex _queue_mutex; + boost::condition _queue_full; + std::list, DCPTime> > _queue; + + boost::shared_ptr _butler; + + static int _video_stream_index; + static int _audio_stream_index; }; #endif