#include <deque>
#include <functional>
#include <mutex>
+#include <string>
#include <thread>
#include <vector>
virtual void release_frame(Frame frame) = 0;
};
+struct VideoFormat {
+ uint16_t id = 0; // For debugging/logging only.
+ unsigned width = 0, height = 0, second_field_start = 0;
+ unsigned extra_lines_top = 0, extra_lines_bottom = 0;
+ unsigned frame_rate_nom = 0, frame_rate_den = 0;
+ bool interlaced = false;
+};
+
typedef std::function<void(uint16_t timecode,
- FrameAllocator::Frame video_frame, size_t video_offset, uint16_t video_format,
+ FrameAllocator::Frame video_frame, size_t video_offset, VideoFormat video_format,
FrameAllocator::Frame audio_frame, size_t audio_offset, uint16_t audio_format)>
frame_callback_t;
has_dequeue_callbacks = true;
}
+ // Only valid after configure_card().
+ std::string get_description() const {
+ return description;
+ }
+
void configure_card();
void start_bm_capture();
void stop_dequeue_thread();
static void usb_thread_func();
static void cb_xfr(struct libusb_transfer *xfr);
+ std::string description;
+
FrameAllocator::Frame current_video_frame;
FrameAllocator::Frame current_audio_frame;
// Get details for the given video format; returns false if detection was incomplete.
// Note: Frame rate is _frame_ rate, not field rate. So 1080i60 gets 30/1, _not_ 60/1.
-bool decode_video_format(uint16_t video_format, int *width, int *height, int *extra_lines_top, int *extra_lines_bottom,
- int *frame_rate_nom, int *frame_rate_den, bool *interlaced);
+// "second_field_start" is only valid for interlaced modes; it signifies
+// how many lines from the very top of the frame there are before the second field
+// starts (so it will always be >= height/2 + extra_lines_top).
+bool decode_video_format(uint16_t video_format, VideoFormat *decoded_video_format);
#endif