current_audio_frame = audio_frame_allocator->alloc_frame();
}
+#if 0
static void dump_pack(const libusb_transfer *xfr, int offset, const libusb_iso_packet_descriptor *pack)
{
// printf("ISO pack%u length:%u, actual_length:%u, offset:%u\n", i, pack->length, pack->actual_length, offset);
- for (int j = 0; j < pack->actual_length; j++) {
+ for (unsigned j = 0; j < pack->actual_length; j++) {
//for (int j = 0; j < min(pack->actual_length, 16u); j++) {
printf("%02x", xfr->buffer[j + offset]);
if ((j % 16) == 15)
printf(" ");
}
}
+#endif
void add_to_frame(FrameAllocator::Frame *current_frame, const char *frame_type_name, const uint8_t *start, const uint8_t *end)
{
int bytes = end - start;
if (current_frame->len + bytes > current_frame->size) {
- printf("%d bytes overflow after last %s frame\n", current_frame->len + bytes - current_frame->size, frame_type_name);
+ printf("%d bytes overflow after last %s frame\n",
+ int(current_frame->len + bytes - current_frame->size), frame_type_name);
//dump_frame();
} else {
memcpy(current_frame->data + current_frame->len, start, bytes);
function<void(const uint8_t *start)> start_callback)
{
int offset = 0;
- for (unsigned i = 0; i < xfr->num_iso_packets; i++) {
+ for (int i = 0; i < xfr->num_iso_packets; i++) {
const libusb_iso_packet_descriptor *pack = &xfr->iso_packet_desc[i];
if (pack->status != LIBUSB_TRANSFER_COMPLETED) {
}
const unsigned char *iso_start = xfr->buffer + offset;
- for (int iso_offset = 0; iso_offset < pack->actual_length; ) { // Usually runs only one iteration.
+ for (unsigned iso_offset = 0; iso_offset < pack->actual_length; ) { // Usually runs only one iteration.
const unsigned char* start_next_frame = (const unsigned char *)memmem(iso_start + iso_offset, pack->actual_length - iso_offset, sync_pattern, sync_length);
if (start_next_frame == nullptr) {
// add the rest of the buffer
}
}
if (xfr->type == LIBUSB_TRANSFER_TYPE_CONTROL) {
- const libusb_control_setup *setup = libusb_control_transfer_get_setup(xfr);
+ //const libusb_control_setup *setup = libusb_control_transfer_get_setup(xfr);
uint8_t *buf = libusb_control_transfer_get_data(xfr);
#if 0
if (setup->wIndex == 44) {
}
#endif
-end:
if (libusb_submit_transfer(xfr) < 0) {
fprintf(stderr, "error re-submitting URB\n");
exit(1);
#endif
};
- for (int req = 0; req < sizeof(ctrls) / sizeof(ctrls[0]); ++req) {
+ for (unsigned req = 0; req < sizeof(ctrls) / sizeof(ctrls[0]); ++req) {
uint32_t flipped = htonl(ctrls[req].data);
static uint8_t value[4];
memcpy(value, &flipped, sizeof(flipped));