FILE *audiofp;
+thread usb_thread;
+atomic<bool> should_quit;
+
FrameAllocator::~FrameAllocator() {}
#define NUM_QUEUED_FRAMES 8
}
}
-void BMUSBCapture::start_bm_capture()
+void BMUSBCapture::configure_card()
{
if (video_frame_allocator == nullptr) {
set_video_frame_allocator(new MallocFrameAllocator(FRAME_SIZE)); // FIXME: leak.
int rc;
struct libusb_transfer *xfr;
- vector<libusb_transfer *> iso_xfrs;
rc = libusb_init(nullptr);
if (rc < 0) {
exit(1);
}
- struct libusb_device_handle *devh = libusb_open_device_with_vid_pid(nullptr, 0x1edb, 0xbd3b);
+ //struct libusb_device_handle *devh = libusb_open_device_with_vid_pid(nullptr, 0x1edb, 0xbd3b);
+ //struct libusb_device_handle *devh = libusb_open_device_with_vid_pid(nullptr, 0x1edb, 0xbd4f);
+ struct libusb_device_handle *devh = libusb_open_device_with_vid_pid(nullptr, vid, pid);
if (!devh) {
fprintf(stderr, "Error finding USB device\n");
exit(1);
iso_xfrs.push_back(xfr);
}
}
+}
- {
- int i = 0;
- for (libusb_transfer *xfr : iso_xfrs) {
- rc = libusb_submit_transfer(xfr);
- ++i;
- if (rc < 0) {
- //printf("num_bytes=%d\n", num_bytes);
- fprintf(stderr, "Error submitting iso to endpoint 0x%02x, number %d: %s\n",
- xfr->endpoint, i, libusb_error_name(rc));
- exit(1);
- }
+void BMUSBCapture::start_bm_capture()
+{
+ printf("starting capture\n");
+ int i = 0;
+ for (libusb_transfer *xfr : iso_xfrs) {
+ printf("submitting transfer...\n");
+ int rc = libusb_submit_transfer(xfr);
+ ++i;
+ if (rc < 0) {
+ //printf("num_bytes=%d\n", num_bytes);
+ fprintf(stderr, "Error submitting iso to endpoint 0x%02x, number %d: %s\n",
+ xfr->endpoint, i, libusb_error_name(rc));
+ exit(1);
}
}
- should_quit = false;
- usb_thread = thread(&BMUSBCapture::usb_thread_func, this);
-
#if 0
libusb_release_interface(devh, 0);
#endif
}
-void BMUSBCapture::stop_bm_capture()
+void BMUSBCapture::start_bm_thread()
+{
+ should_quit = false;
+ usb_thread = thread(&BMUSBCapture::usb_thread_func);
+}
+
+void BMUSBCapture::stop_bm_thread()
{
should_quit = true;
usb_thread.join();