X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mixer.h;h=9f32f2ac2d79f5c6d86156bb38f0af5ea6d17564;hb=a472dcd2c9faec3e191539fb647237195047bbd4;hp=498a2d13afd1a8e02340a455949daeb6c7cb8f9d;hpb=0323944a99ea3c0e175f0f3d004fa42fecd02ece;p=nageru diff --git a/mixer.h b/mixer.h index 498a2d1..9f32f2a 100644 --- a/mixer.h +++ b/mixer.h @@ -7,7 +7,6 @@ #undef Success #include #include -#include #include #include "bmusb/bmusb.h" @@ -19,8 +18,9 @@ #include "resampler.h" #include "timebase.h" #include "httpd.h" +#include "ebu_r128_proc.h" -#define NUM_CARDS 2 +#define MAX_CARDS 16 namespace movit { class YCbCrInput; @@ -31,7 +31,7 @@ class QSurfaceFormat; class Mixer { public: // The surface format is used for offscreen destinations for OpenGL contexts we need. - Mixer(const QSurfaceFormat &format); + Mixer(const QSurfaceFormat &format, unsigned num_cards); ~Mixer(); void start(); void quit(); @@ -93,7 +93,7 @@ public: } private: - void bm_frame(int card_index, uint16_t timecode, + void bm_frame(unsigned card_index, uint16_t timecode, FrameAllocator::Frame video_frame, size_t video_offset, uint16_t video_format, FrameAllocator::Frame audio_frame, size_t audio_offset, uint16_t audio_format); void place_rectangle(movit::Effect *resample_effect, movit::Effect *padding_effect, float x0, float y0, float x1, float y1); @@ -103,6 +103,7 @@ private: double pts() { return double(pts_int) / TIMEBASE; } HTTPD httpd; + unsigned num_cards; QSurface *mixer_surface, *h264_encoder_surface; std::unique_ptr resource_pool; @@ -137,9 +138,9 @@ private: std::unique_ptr resampler; // Under audio_mutex. int last_timecode = -1; // Unwrapped. }; - CaptureCard cards[NUM_CARDS]; // protected by + CaptureCard cards[MAX_CARDS]; // protected by - RefCountedFrame bmusb_current_rendering_frame[NUM_CARDS]; + RefCountedFrame bmusb_current_rendering_frame[MAX_CARDS]; class OutputChannel { public: @@ -164,7 +165,10 @@ private: bool should_quit = false; audio_level_callback_t audio_level_callback = nullptr; - ebur128_state *r128_state = nullptr; + Ebu_r128_proc r128; + + // TODO: Implement oversampled peak detection. + float peak = 0.0f; }; extern Mixer *global_mixer;