-// Intensity Shuttle USB3 capture driver, v0.6.0
+// Intensity Shuttle USB3 capture driver, v0.7.0
// Can download 8-bit and 10-bit UYVY/v210-ish frames from HDMI, quite stable
// (can do captures for hours at a time with no drops), except during startup
// 576p60/720p60/1080i60 works, 1080p60 does not work (firmware limitation)
constexpr VideoFormatEntry entries[] = {
{ 0x01f1, 720, 480, 0, 40, 5, 60000, 1001, false }, // 480p59.94 (believed).
{ 0x0131, 720, 576, 0, 44, 5, 50, 1, false }, // 576p50.
+ { 0x0151, 720, 576, 0, 44, 5, 50, 1, false }, // 576p50.
{ 0x0011, 720, 576, 0, 44, 5, 50, 1, false }, // 576p50 (5:4).
{ 0x0143, 1280, 720, 0, 25, 5, 50, 1, false }, // 720p50.
{ 0x0103, 1280, 720, 0, 25, 5, 60, 1, false }, // 720p60.
// There are seemingly no direct indicators of sample rate; you just get
// one frame's worth and have to guess from that.
-int guess_sample_rate(const VideoFormat &video_format, size_t len)
+int guess_sample_rate(const VideoFormat &video_format, size_t len, int default_rate)
{
size_t num_samples = len / 3 / 8;
size_t num_samples_per_second = num_samples * video_format.frame_rate_nom / video_format.frame_rate_den;
}
}
- fprintf(stderr, "%ld samples at %d/%d fps (%ld Hz) matches no known sample rate, assuming 48000 Hz\n",
- num_samples, video_format.frame_rate_nom, video_format.frame_rate_den, num_samples_per_second);
- return 48000;
+ fprintf(stderr, "%ld samples at %d/%d fps (%ld Hz) matches no known sample rate, keeping capture at %d Hz\n",
+ num_samples, video_format.frame_rate_nom, video_format.frame_rate_den, num_samples_per_second, default_rate);
+ return default_rate;
}
} // namespace
audio_format.id = audio_frame.format;
if (decode_video_format(video_frame.format, &video_format)) {
if (audio_frame.frame.len != 0) {
- audio_format.sample_rate = guess_sample_rate(video_format, audio_frame.frame.len);
+ audio_format.sample_rate = guess_sample_rate(video_format, audio_frame.frame.len, last_sample_rate);
last_sample_rate = audio_format.sample_rate;
}
frame_callback(video_timecode,
video_frame.frame, HEADER_SIZE, video_format,
audio_frame.frame, AUDIO_HEADER_SIZE, audio_format);
} else {
+ video_frame_allocator->release_frame(video_frame.frame);
audio_format.sample_rate = last_sample_rate;
frame_callback(video_timecode,
FrameAllocator::Frame(), 0, video_format,