]> git.sesse.net Git - nageru/blobdiff - mixer.h
Add a menu option where the user can change the input resolution.
[nageru] / mixer.h
diff --git a/mixer.h b/mixer.h
index 32e8168f64cc96a62c3cdc58a51d4773417c7e48..27ba586a7837b646e3933221d430f417d44ec157 100644 (file)
--- a/mixer.h
+++ b/mixer.h
@@ -136,6 +136,16 @@ public:
                return theme->map_signal(channel);
        }
 
+       unsigned get_audio_source() const
+       {
+               return audio_source_channel;
+       }
+
+       void set_audio_source(unsigned channel)
+       {
+               audio_source_channel = channel;
+       }
+
        void set_signal_mapping(int signal, int card)
        {
                return theme->set_signal_mapping(signal, card);
@@ -228,13 +238,29 @@ public:
 
        std::string get_card_description(unsigned card_index) const {
                assert(card_index < num_cards);
-               return cards[card_index].usb->get_description();
+               return cards[card_index].capture->get_description();
+       }
+
+       std::map<uint32_t, VideoMode> get_available_video_modes(unsigned card_index) const {
+               assert(card_index < num_cards);
+               return cards[card_index].capture->get_available_video_modes();
+       }
+
+       uint32_t get_current_video_mode(unsigned card_index) const {
+               assert(card_index < num_cards);
+               return cards[card_index].capture->get_current_video_mode();
+       }
+
+       void set_video_mode(unsigned card_index, uint32_t mode) {
+               assert(card_index < num_cards);
+               cards[card_index].capture->set_video_mode(mode);
        }
 
 private:
+       void configure_card(unsigned card_index, const QSurfaceFormat &format, CaptureInterface *capture);
        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);
+               FrameAllocator::Frame video_frame, size_t video_offset, VideoFormat video_format,
+               FrameAllocator::Frame audio_frame, size_t audio_offset, AudioFormat audio_format);
        void place_rectangle(movit::Effect *resample_effect, movit::Effect *padding_effect, float x0, float y0, float x1, float y1);
        void thread_func();
        void audio_thread_func();
@@ -249,8 +275,11 @@ private:
        QSurface *mixer_surface, *h264_encoder_surface;
        std::unique_ptr<movit::ResourcePool> resource_pool;
        std::unique_ptr<Theme> theme;
+       std::atomic<unsigned> audio_source_channel{0};
        std::unique_ptr<movit::EffectChain> display_chain;
        GLuint cbcr_program_num;  // Owned by <resource_pool>.
+       GLuint cbcr_vbo;  // Holds position and texcoord data.
+       GLuint cbcr_position_attribute_index, cbcr_texcoord_attribute_index;
        std::unique_ptr<H264Encoder> h264_encoder;
 
        // Effects part of <display_chain>. Owned by <display_chain>.
@@ -260,7 +289,7 @@ private:
 
        std::mutex bmusb_mutex;
        struct CaptureCard {
-               BMUSBCapture *usb;
+               CaptureInterface *capture;
                std::unique_ptr<PBOFrameAllocator> frame_allocator;
 
                // Stuff for the OpenGL context (for texture uploading).