-Subproject commit ec5eaa5e319e91f89db15dcbccdf64a056f710ae
+Subproject commit c66728fa32fc79abd5c4fb9188750cccf9039dee
using namespace std;
using namespace std::placeholders;
+using namespace bmusb;
namespace {
// 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>.
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) {
}
}
- 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) {
}
}
- 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;
}
// 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; }
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;
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;
using namespace std;
+namespace bmusb {
namespace {
void memset2(uint8_t *s, const uint8_t c[2], size_t n)
dequeue_cleanup_callback();
}
}
+
+} // namespace bmusb
#include "bmusb/bmusb.h"
+namespace bmusb {
+
class FakeCapture : public CaptureInterface
{
public:
std::thread producer_thread;
};
+} // namespace bmusb
+
#endif // !defined(_FAKE_CAPTURE_H)
// 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) {
using namespace movit;
using namespace std;
using namespace std::placeholders;
+using namespace bmusb;
Mixer *global_mixer = nullptr;
bool uses_mlock = false;
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();
}
}
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);
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;
}
//static int sumsum = 0;
-FrameAllocator::Frame PBOFrameAllocator::alloc_frame()
+bmusb::FrameAllocator::Frame PBOFrameAllocator::alloc_frame()
{
Frame vf;
// 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.
#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);
#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)