diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-12-19 20:42:41 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-12-19 20:42:41 +0000 |
| commit | 54a9c84e2b4d69b1e6ed669400f84b1604cc2369 (patch) | |
| tree | 18f914b82c073eef5f8f7b4c7ec86ede3072b075 /src/lib/encoder.h | |
| parent | dedac27070ac5ad65265a0db1fa316b3e436cea7 (diff) | |
Move audio into Encoder so that J2KStillEncoder can use it too. Rename J2KWAVEncoder -> J2KVideoEncoder.
Diffstat (limited to 'src/lib/encoder.h')
| -rw-r--r-- | src/lib/encoder.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/lib/encoder.h b/src/lib/encoder.h index 64f113d74..f355daff7 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -31,6 +31,12 @@ extern "C" { #include <libavutil/samplefmt.h> } +#ifdef HAVE_SWRESAMPLE +extern "C" { +#include <libswresample/swresample.h> +} +#endif +#include <sndfile.h> #include "util.h" #include "video_sink.h" #include "audio_sink.h" @@ -55,10 +61,10 @@ class Encoder : public VideoSink, public AudioSink { public: Encoder (boost::shared_ptr<const Film> f, boost::shared_ptr<const EncodeOptions> o); - virtual ~Encoder () {} + virtual ~Encoder (); /** Called to indicate that a processing run is about to begin */ - virtual void process_begin () {} + virtual void process_begin (); /** Call with a frame of video. * @param i Video frame image. @@ -70,7 +76,7 @@ public: void process_audio (boost::shared_ptr<AudioBuffers>); /** Called when a processing run has finished */ - virtual void process_end () {} + virtual void process_end (); float current_frames_per_second () const; bool skipping () const; @@ -84,9 +90,6 @@ protected: */ virtual void do_process_video (boost::shared_ptr<Image> i, boost::shared_ptr<Subtitle> s) = 0; - /** Called with some audio data */ - virtual void do_process_audio (boost::shared_ptr<AudioBuffers>) = 0; - void frame_done (); void frame_skipped (); @@ -110,6 +113,17 @@ protected: SourceFrame _video_frame; /** Number of audio frames received so far */ int64_t _audio_frame; + +private: + void close_sound_files (); + void write_audio (boost::shared_ptr<const AudioBuffers> audio); + +#if HAVE_SWRESAMPLE + SwrContext* _swr_context; +#endif + + std::vector<SNDFILE*> _sound_files; + int64_t _audio_frames_written; }; #endif |
