]> git.sesse.net Git - nageru/commitdiff
Move the allocators into CaptureCard.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 4 Oct 2015 22:33:07 +0000 (00:33 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 4 Oct 2015 22:33:07 +0000 (00:33 +0200)
mixer.cpp
mixer.h

index cfe53f7ff5ad200f11e40f5aa904de37df42c2ea..a600bf933b08bf0d70b12eca68609a14a28bcbbc 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -103,18 +103,17 @@ Mixer::Mixer(QSurface *surface1, QSurface *surface2, QSurface *surface3, QSurfac
 
        printf("Configuring first card...\n");
        cards[0].usb = new BMUSBCapture(0x1edb, 0xbd3b);  // 0xbd4f
-       //cards[0].usb = new BMUSBCapture(0x1edb, 0xbd4f);
        cards[0].usb->set_frame_callback(std::bind(&Mixer::bm_frame, this, 0, _1, _2, _3, _4, _5, _6, _7));
-       pbo_allocator1.reset(new PBOFrameAllocator(1280 * 750 * 2 + 44));
-       cards[0].usb->set_video_frame_allocator(pbo_allocator1.get());
+       cards[0].frame_allocator.reset(new PBOFrameAllocator(1280 * 750 * 2 + 44));
+       cards[0].usb->set_video_frame_allocator(cards[0].frame_allocator.get());
        cards[0].usb->configure_card();
 
-       pbo_allocator2.reset(new PBOFrameAllocator(1280 * 750 * 2 + 44));
        if (NUM_CARDS == 2) {
                printf("Configuring second card...\n");
                cards[1].usb = new BMUSBCapture(0x1edb, 0xbd4f);
                cards[1].usb->set_frame_callback(std::bind(&Mixer::bm_frame, this, 1, _1, _2, _3, _4, _5, _6, _7));
-               cards[1].usb->set_video_frame_allocator(pbo_allocator2.get());
+               cards[1].frame_allocator.reset(new PBOFrameAllocator(1280 * 750 * 2 + 44));
+               cards[1].usb->set_video_frame_allocator(cards[1].frame_allocator.get());
                cards[1].usb->configure_card();
        }
 
diff --git a/mixer.h b/mixer.h
index 74d5cd7edd48412562b09c28136f632799477a73..9a9ee585752754c180c79caa0fc907bf7e622892 100644 (file)
--- a/mixer.h
+++ b/mixer.h
@@ -54,8 +54,6 @@ private:
        void place_rectangle(movit::Effect *resample_effect, movit::Effect *padding_effect, float x0, float y0, float x1, float y1);
        void thread_func();
 
-       std::unique_ptr<PBOFrameAllocator> pbo_allocator1, pbo_allocator2;
-
        QSurface *surface1, *surface2, *surface3, *surface4;
        std::unique_ptr<movit::EffectChain> chain;
        movit::ResourcePool *resource_pool;  // Owned by <chain>.
@@ -77,6 +75,7 @@ private:
        std::mutex bmusb_mutex;
        struct CaptureCard {
                BMUSBCapture *usb;
+               std::unique_ptr<PBOFrameAllocator> frame_allocator;
 
                // Threading stuff
                bool thread_initialized = false;