summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6fda0ac)
raw | patch | inline | side by side (parent: 6fda0ac)
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Fri, 20 Oct 2017 12:06:28 +0000 (15:06 +0300) | ||
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Fri, 20 Oct 2017 12:06:28 +0000 (15:06 +0300) |
utils/wbcap.cpp | patch | blob | history |
diff --git a/utils/wbcap.cpp b/utils/wbcap.cpp
index 4ec87eec91375492729ab4ae2b14ab8151d3d9a9..38a8cc045c5e510753b8c75e8587962e6615f6bc 100644 (file)
--- a/utils/wbcap.cpp
+++ b/utils/wbcap.cpp
WBStreamer(VideoStreamer* streamer, Crtc* crtc, PixelFormat pixfmt)
: m_capdev(*streamer)
{
+ Videomode m = crtc->mode();
+
m_capdev.set_port(crtc->idx());
- m_capdev.set_format(pixfmt, crtc->mode().hdisplay, crtc->mode().vdisplay);
+ m_capdev.set_format(pixfmt, m.hdisplay, m.vdisplay / (m.interlace() ? 2 : 1));
m_capdev.set_queue_size(s_fbs.size());
for (auto fb : s_free_fbs) {
public:
WBFlipState(Card& card, Crtc* crtc, Plane* plane)
: m_card(card), m_crtc(crtc), m_plane(plane)
- {
- }
-
- void setup(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
{
auto fb = s_ready_fbs.back();
s_ready_fbs.pop_back();
req.add(m_plane, "CRTC_ID", m_crtc->id());
req.add(m_plane, "FB_ID", fb->id());
- req.add(m_plane, "CRTC_X", x);
- req.add(m_plane, "CRTC_Y", y);
+ req.add(m_plane, "CRTC_X", 0);
+ req.add(m_plane, "CRTC_Y", 0);
req.add(m_plane, "CRTC_W", min((uint32_t)m_crtc->mode().hdisplay, fb->width()));
req.add(m_plane, "CRTC_H", min((uint32_t)m_crtc->mode().vdisplay, fb->height()));
Videomode dst_mode = dst_mode_name.empty() ? dst_conn->get_default_mode() : dst_conn->get_mode(dst_mode_name);
dst_crtc->set_mode(dst_conn, dst_mode);
- uint32_t width = src_mode.hdisplay;
- uint32_t height = src_mode.vdisplay;
+ uint32_t src_width = src_mode.hdisplay;
+ uint32_t src_height = src_mode.vdisplay;
+
+ uint32_t dst_width = src_mode.hdisplay;
+ uint32_t dst_height = src_mode.vdisplay;
+ if (src_mode.interlace())
+ dst_height /= 2;
printf("src %s, crtc %s\n", src_conn->fullname().c_str(), src_mode.to_string().c_str());
printf("dst %s, crtc %s\n", dst_conn->fullname().c_str(), dst_mode.to_string().c_str());
- printf("fb %ux%u\n", width, height);
+ printf("src_fb %ux%u, dst_fb %ux%u\n", src_width, src_height, dst_width, dst_height);
for (int i = 0; i < CAMERA_BUF_QUEUE_SIZE; ++i) {
- auto fb = new DumbFramebuffer(card, width, height, pixfmt);
+ auto fb = new DumbFramebuffer(card, dst_width, dst_height, pixfmt);
s_fbs.push_back(fb);
s_free_fbs.push_back(fb);
}
s_free_fbs.pop_back();
// This draws a moving bar to SRC display
- BarFlipState barflipper(card, src_crtc, src_plane, width, height);
+ BarFlipState barflipper(card, src_crtc, src_plane, src_width, src_height);
barflipper.start_flipping();
- // This shows the captures SRC frames on DST display
+ // This shows the captured SRC frames on DST display
WBFlipState wbflipper(card, dst_crtc, dst_plane);
- wbflipper.setup(0, 0, width, height);
WBStreamer wb(vid.get_capture_streamer(), src_crtc, pixfmt);
wb.start_streaming();