]> git.sesse.net Git - nageru/commitdiff
Interact with BMUSBCapture through CaptureInterface.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 27 Feb 2016 01:27:39 +0000 (02:27 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 27 Feb 2016 01:27:39 +0000 (02:27 +0100)
mixer.cpp
mixer.h

index 21c3f696100eec8407bd8b19ff22becdd7be4882..9c5c853ded7961896adbaced16eff6886d6e5a6d 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -138,12 +138,12 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
        for (unsigned card_index = 0; card_index < num_cards; ++card_index) {
                printf("Configuring card %d...\n", card_index);
                CaptureCard *card = &cards[card_index];
-               card->usb = new BMUSBCapture(card_index);
-               card->usb->set_frame_callback(bind(&Mixer::bm_frame, this, card_index, _1, _2, _3, _4, _5, _6, _7));
+               card->capture = new BMUSBCapture(card_index);
+               card->capture->set_frame_callback(bind(&Mixer::bm_frame, this, card_index, _1, _2, _3, _4, _5, _6, _7));
                card->frame_allocator.reset(new PBOFrameAllocator(8 << 20, WIDTH, HEIGHT));  // 8 MB.
-               card->usb->set_video_frame_allocator(card->frame_allocator.get());
+               card->capture->set_video_frame_allocator(card->frame_allocator.get());
                card->surface = create_surface(format);
-               card->usb->set_dequeue_thread_callbacks(
+               card->capture->set_dequeue_thread_callbacks(
                        [card]{
                                eglBindAPI(EGL_OPENGL_API);
                                card->context = create_context(card->surface);
@@ -156,13 +156,13 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
                                resource_pool->clean_context();
                        });
                card->resampling_queue.reset(new ResamplingQueue(OUTPUT_FREQUENCY, OUTPUT_FREQUENCY, 2));
-               card->usb->configure_card();
+               card->capture->configure_card();
        }
 
        BMUSBCapture::start_bm_thread();
 
        for (unsigned card_index = 0; card_index < num_cards; ++card_index) {
-               cards[card_index].usb->start_bm_capture();
+               cards[card_index].capture->start_bm_capture();
        }
 
        // Set up stuff for NV12 conversion.
@@ -232,7 +232,7 @@ Mixer::~Mixer()
                        cards[card_index].should_quit = true;  // Unblock thread.
                        cards[card_index].new_data_ready_changed.notify_all();
                }
-               cards[card_index].usb->stop_dequeue_thread();
+               cards[card_index].capture->stop_dequeue_thread();
        }
 
        h264_encoder.reset(nullptr);
diff --git a/mixer.h b/mixer.h
index 821ceb2f5f606ad48133f7d8475f1fe7d40af12a..d59b6a3221a2d0e45221301fa8c85b40c6a35e99 100644 (file)
--- a/mixer.h
+++ b/mixer.h
@@ -238,7 +238,7 @@ 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();
        }
 
 private:
@@ -273,7 +273,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).