]> git.sesse.net Git - nageru/commitdiff
Upgrade to newer bmusb, with namespacing.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 25 Jul 2016 11:58:01 +0000 (13:58 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 25 Jul 2016 11:58:01 +0000 (13:58 +0200)
12 files changed:
bmusb
decklink_capture.cpp
decklink_capture.h
fake_capture.cpp
fake_capture.h
glwidget.cpp
mixer.cpp
mixer.h
pbo_frame_allocator.cpp
pbo_frame_allocator.h
ref_counted_frame.cpp
ref_counted_frame.h

diff --git a/bmusb b/bmusb
index ec5eaa5e319e91f89db15dcbccdf64a056f710ae..c66728fa32fc79abd5c4fb9188750cccf9039dee 160000 (submodule)
--- a/bmusb
+++ b/bmusb
@@ -1 +1 @@
-Subproject commit ec5eaa5e319e91f89db15dcbccdf64a056f710ae
+Subproject commit c66728fa32fc79abd5c4fb9188750cccf9039dee
index e57b5d4b4886aacefb5840ba3f3dda1b71ba0bce..81566cb1a5ad20d85a3be25a8b01e2c24a62906e 100644 (file)
@@ -20,6 +20,7 @@
 
 using namespace std;
 using namespace std::placeholders;
+using namespace bmusb;
 
 namespace {
 
index bfb6d0e1774c2c4b0cfe59f7c19019ff13d08a22..0a9c37b0494539c3cc5c3bc3f8964793cefa6a77 100644 (file)
@@ -14,7 +14,7 @@ class IDeckLinkDisplayMode;
 
 // TODO: Adjust CaptureInterface to be a little less bmusb-centric.
 // There are too many member functions here that don't really do anything.
-class DeckLinkCapture : public CaptureInterface, IDeckLinkInputCallback
+class DeckLinkCapture : public bmusb::CaptureInterface, IDeckLinkInputCallback
 {
 public:
        DeckLinkCapture(IDeckLink *card, int card_index);  // Takes ownership of <card>.
@@ -33,7 +33,7 @@ public:
                IDeckLinkAudioInputPacket *audio_frame) override;
 
        // CaptureInterface.
-       void set_video_frame_allocator(FrameAllocator *allocator) override
+       void set_video_frame_allocator(bmusb::FrameAllocator *allocator) override
        {
                video_frame_allocator = allocator;
                if (owned_video_frame_allocator.get() != allocator) {
@@ -41,13 +41,13 @@ public:
                }
        }
 
-       FrameAllocator *get_video_frame_allocator() override
+       bmusb::FrameAllocator *get_video_frame_allocator() override
        {
                return video_frame_allocator;
        }
 
        // Does not take ownership.
-       void set_audio_frame_allocator(FrameAllocator *allocator) override
+       void set_audio_frame_allocator(bmusb::FrameAllocator *allocator) override
        {
                audio_frame_allocator = allocator;
                if (owned_audio_frame_allocator.get() != allocator) {
@@ -55,12 +55,12 @@ public:
                }
        }
 
-       FrameAllocator *get_audio_frame_allocator() override
+       bmusb::FrameAllocator *get_audio_frame_allocator() override
        {
                return audio_frame_allocator;
        }
 
-       void set_frame_callback(frame_callback_t callback) override
+       void set_frame_callback(bmusb::frame_callback_t callback) override
        {
                frame_callback = callback;
        }
@@ -84,7 +84,7 @@ public:
        // TODO: Can the API communicate this to us somehow, for e.g. Thunderbolt cards?
        bool get_disconnected() const override { return false; }
 
-       std::map<uint32_t, VideoMode> get_available_video_modes() const override { return video_modes; }
+       std::map<uint32_t, bmusb::VideoMode> get_available_video_modes() const override { return video_modes; }
        void set_video_mode(uint32_t video_mode_id) override;
        uint32_t get_current_video_mode() const override { return current_video_mode; }
 
@@ -109,11 +109,11 @@ private:
        std::function<void()> dequeue_init_callback = nullptr;
        std::function<void()> dequeue_cleanup_callback = nullptr;
 
-       FrameAllocator *video_frame_allocator = nullptr;
-       FrameAllocator *audio_frame_allocator = nullptr;
-       std::unique_ptr<FrameAllocator> owned_video_frame_allocator;
-       std::unique_ptr<FrameAllocator> owned_audio_frame_allocator;
-       frame_callback_t frame_callback = nullptr;
+       bmusb::FrameAllocator *video_frame_allocator = nullptr;
+       bmusb::FrameAllocator *audio_frame_allocator = nullptr;
+       std::unique_ptr<bmusb::FrameAllocator> owned_video_frame_allocator;
+       std::unique_ptr<bmusb::FrameAllocator> owned_audio_frame_allocator;
+       bmusb::frame_callback_t frame_callback = nullptr;
 
        IDeckLinkConfiguration *config = nullptr;
 
@@ -122,7 +122,7 @@ private:
        BMDTimeValue frame_duration;
        BMDTimeScale time_scale;
 
-       std::map<uint32_t, VideoMode> video_modes;
+       std::map<uint32_t, bmusb::VideoMode> video_modes;
        BMDDisplayMode current_video_mode;
 
        std::map<uint32_t, std::string> video_inputs;
index b767d8fd8fdf2770642487e82d9edea1af000778..7d23d8cafdc70df47f123f06200b9730c5897742 100644 (file)
@@ -29,6 +29,7 @@ constexpr uint8_t crs[NUM_COLORS] = { 240, 34, 110, 128 };
 
 using namespace std;
 
+namespace bmusb {
 namespace {
 
 void memset2(uint8_t *s, const uint8_t c[2], size_t n)
@@ -263,3 +264,5 @@ void FakeCapture::producer_thread_func()
                dequeue_cleanup_callback();
        }
 }
+
+}  // namespace bmusb
index c517257edc7cbf838c74a34f33c2c4a76317589b..84a8953163bb15c8c0ffc1df1ae8a71ed6c23d62 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "bmusb/bmusb.h"
 
+namespace bmusb {
+
 class FakeCapture : public CaptureInterface
 {
 public:
@@ -96,4 +98,6 @@ private:
        std::thread producer_thread;
 };
 
+}  // namespace bmusb
+
 #endif  // !defined(_FAKE_CAPTURE_H)
index 82d702fa1947c85f2ff9f742dbfa50216dc624a4..6409a1347dd869444dd039e03917373d84fae01f 100644 (file)
@@ -190,7 +190,7 @@ void GLWidget::show_context_menu(unsigned signal_num, const QPoint &pos)
        // The same for resolution.
        QMenu mode_submenu;
        QActionGroup mode_group(&mode_submenu);
-       std::map<uint32_t, VideoMode> video_modes = global_mixer->get_available_video_modes(current_card);
+       std::map<uint32_t, bmusb::VideoMode> video_modes = global_mixer->get_available_video_modes(current_card);
        uint32_t current_video_mode = global_mixer->get_current_video_mode(current_card);
        bool has_auto_mode = false;
        for (const auto &mode : video_modes) {
index e24d0bb9f0ef14acd05e738b28179d373bbd1e5f..6bc878074f2fa77e9ef9ef6da6157d54dc202eaa 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -46,6 +46,7 @@ class QOpenGLContext;
 using namespace movit;
 using namespace std;
 using namespace std::placeholders;
+using namespace bmusb;
 
 Mixer *global_mixer = nullptr;
 bool uses_mlock = false;
diff --git a/mixer.h b/mixer.h
index a09268996688918de9533c6a0e6a1ee82f15c043..05471d6d61ae550af47a8ceb03faebfbc29697ca 100644 (file)
--- a/mixer.h
+++ b/mixer.h
@@ -352,7 +352,7 @@ public:
                return cards[card_index].capture->get_description();
        }
 
-       std::map<uint32_t, VideoMode> get_available_video_modes(unsigned card_index) const {
+       std::map<uint32_t, bmusb::VideoMode> get_available_video_modes(unsigned card_index) const {
                assert(card_index < num_cards);
                return cards[card_index].capture->get_available_video_modes();
        }
@@ -404,10 +404,10 @@ public:
        }
 
 private:
-       void configure_card(unsigned card_index, CaptureInterface *capture, bool is_fake_capture);
+       void configure_card(unsigned card_index, bmusb::CaptureInterface *capture, bool is_fake_capture);
        void bm_frame(unsigned card_index, uint16_t timecode,
-               FrameAllocator::Frame video_frame, size_t video_offset, VideoFormat video_format,
-               FrameAllocator::Frame audio_frame, size_t audio_offset, AudioFormat audio_format);
+               bmusb::FrameAllocator::Frame video_frame, size_t video_offset, bmusb::VideoFormat video_format,
+               bmusb::FrameAllocator::Frame audio_frame, size_t audio_offset, bmusb::AudioFormat audio_format);
        void bm_hotplug_add(libusb_device *dev);
        void bm_hotplug_remove(unsigned card_index);
        void place_rectangle(movit::Effect *resample_effect, movit::Effect *padding_effect, float x0, float y0, float x1, float y1);
@@ -444,7 +444,7 @@ private:
        std::mutex bmusb_mutex;
        bool has_bmusb_thread = false;
        struct CaptureCard {
-               CaptureInterface *capture = nullptr;
+               bmusb::CaptureInterface *capture = nullptr;
                bool is_fake_capture;
                std::unique_ptr<PBOFrameAllocator> frame_allocator;
 
index 74f54fd11082b4b9695338381ed01761ecc6d13a..34b2c7ba04de98378e92c6b0ad2fe78043d52902 100644 (file)
@@ -104,7 +104,7 @@ PBOFrameAllocator::~PBOFrameAllocator()
 }
 //static int sumsum = 0;
 
-FrameAllocator::Frame PBOFrameAllocator::alloc_frame()
+bmusb::FrameAllocator::Frame PBOFrameAllocator::alloc_frame()
 {
         Frame vf;
 
index 891806a793826eaa08d14c8fbe917aca0adb9571..9220491669c2a194bac2b3c2833d3c3f2ffaf696 100644 (file)
@@ -12,7 +12,7 @@
 // An allocator that allocates straight into OpenGL pinned memory.
 // Meant for video frames only. We use a queue rather than a stack,
 // since we want to maximize pipelineability.
-class PBOFrameAllocator : public FrameAllocator {
+class PBOFrameAllocator : public bmusb::FrameAllocator {
 public:
        // Note: You need to have an OpenGL context when calling
        // the constructor.
index 047858115df5c55c4abbbe664f0f36f925321387..3a30eace84cbc184b2a511483d7661e92a6bfb3f 100644 (file)
@@ -1,6 +1,6 @@
 #include "ref_counted_frame.h"
 
-void release_refcounted_frame(FrameAllocator::Frame *frame)
+void release_refcounted_frame(bmusb::FrameAllocator::Frame *frame)
 {
        if (frame->owner) {
                frame->owner->release_frame(*frame);
index 67787ef3cbb7289b2929cfe33f83fa7ac7f71765..881d0d5015c8f5f0738982ba9096eb797edc6b99 100644 (file)
 
 #include "bmusb/bmusb.h"
 
-void release_refcounted_frame(FrameAllocator::Frame *frame);
+void release_refcounted_frame(bmusb::FrameAllocator::Frame *frame);
 
-typedef std::shared_ptr<FrameAllocator::Frame> RefCountedFrameBase;
+typedef std::shared_ptr<bmusb::FrameAllocator::Frame> RefCountedFrameBase;
 
 class RefCountedFrame : public RefCountedFrameBase {
 public:
        RefCountedFrame() {}
 
-       RefCountedFrame(const FrameAllocator::Frame &frame)
-               : RefCountedFrameBase(new FrameAllocator::Frame(frame), release_refcounted_frame) {}
+       RefCountedFrame(const bmusb::FrameAllocator::Frame &frame)
+               : RefCountedFrameBase(new bmusb::FrameAllocator::Frame(frame), release_refcounted_frame) {}
 };
 
 #endif  // !defined(_REF_COUNTED_FRAME_H)