From 54a9c84e2b4d69b1e6ed669400f84b1604cc2369 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 19 Dec 2012 20:42:41 +0000 Subject: Move audio into Encoder so that J2KStillEncoder can use it too. Rename J2KWAVEncoder -> J2KVideoEncoder. --- src/lib/encoder.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/lib/encoder.h') 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 } +#ifdef HAVE_SWRESAMPLE +extern "C" { +#include +} +#endif +#include #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 f, boost::shared_ptr 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); /** 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 i, boost::shared_ptr s) = 0; - /** Called with some audio data */ - virtual void do_process_audio (boost::shared_ptr) = 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 audio); + +#if HAVE_SWRESAMPLE + SwrContext* _swr_context; +#endif + + std::vector _sound_files; + int64_t _audio_frames_written; }; #endif -- cgit v1.2.3