]> git.sesse.net Git - bmusb/blobdiff - bmusb.cpp
Send the audio format explicitly down, not just the ID.
[bmusb] / bmusb.cpp
index 4db8541eb1286e8578f778bad53656181ed8c326..85b92a6186c2e90debb70b4cc3fa85a0598d5eb7 100644 (file)
--- a/bmusb.cpp
+++ b/bmusb.cpp
@@ -191,6 +191,9 @@ void BMUSBCapture::dequeue_thread_func()
 
                uint16_t video_timecode = pending_video_frames.front().timecode;
                uint16_t audio_timecode = pending_audio_frames.front().timecode;
+               AudioFormat audio_format;
+               audio_format.bits_per_sample = 24;
+               audio_format.num_channels = 8;
                if (uint16_less_than_with_wraparound(video_timecode, audio_timecode)) {
                        printf("Video block 0x%04x without corresponding audio block, dropping.\n",
                                video_timecode);
@@ -204,9 +207,10 @@ void BMUSBCapture::dequeue_thread_func()
                        QueuedFrame audio_frame = pending_audio_frames.front();
                        pending_audio_frames.pop_front();
                        lock.unlock();
+                       audio_format.id = audio_frame.format;
                        frame_callback(audio_timecode,
                                       FrameAllocator::Frame(), 0, VideoFormat(),
-                                      audio_frame.frame, AUDIO_HEADER_SIZE, audio_frame.format);
+                                      audio_frame.frame, AUDIO_HEADER_SIZE, audio_format);
                } else {
                        QueuedFrame video_frame = pending_video_frames.front();
                        QueuedFrame audio_frame = pending_audio_frames.front();
@@ -222,14 +226,15 @@ void BMUSBCapture::dequeue_thread_func()
 #endif
 
                        VideoFormat video_format;
+                       audio_format.id = audio_frame.format;
                        if (decode_video_format(video_frame.format, &video_format)) {
                                frame_callback(video_timecode,
                                               video_frame.frame, HEADER_SIZE, video_format,
-                                              audio_frame.frame, AUDIO_HEADER_SIZE, audio_frame.format);
+                                              audio_frame.frame, AUDIO_HEADER_SIZE, audio_format);
                        } else {
                                frame_callback(video_timecode,
                                               FrameAllocator::Frame(), 0, video_format,
-                                              audio_frame.frame, AUDIO_HEADER_SIZE, audio_frame.format);
+                                              audio_frame.frame, AUDIO_HEADER_SIZE, audio_format);
                        }
                }
        }