From 94e8fca27b11079940f14bb58552dcd29e86754a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 25 Dec 2010 14:54:37 +0100 Subject: [PATCH] libtriple: add cVideo::VideoParamWatchdog() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5ae19e4e4971005222eec433bda2847b475da03e Author: Stefan Seyfried Date: 2010-12-25 (Sat, 25 Dec 2010) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtriple/video_td.cpp | 22 ++++++++++++++++++++-- lib/libtriple/video_td.h | 1 + 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/libtriple/video_td.cpp b/lib/libtriple/video_td.cpp index 1e2b30b0e..845ea3ffa 100644 --- a/lib/libtriple/video_td.cpp +++ b/lib/libtriple/video_td.cpp @@ -492,8 +492,9 @@ int cVideo::setZoom(int zoom) memset(&s, 0, sizeof(s)); if (zoom > 100) { - vidDispSize_t x = (vidDispSize_t)getAspectRatio(); - if (x == VID_DISPSIZE_4x3 && croppingMode == VID_DISPMODE_NORM) + /* 1 = 4:3, 3 = 16:9, 4 = 2.21:1, 0 = unknown */ + int x = getAspectRatio(); + if (x < 3 && croppingMode == VID_DISPMODE_NORM) { s.src.hori_size = 720; s.des.hori_size = 720 * 3/4 * zoom / 100; @@ -550,6 +551,23 @@ void cVideo::setZoomAspect(int index) } #endif +/* this function is regularly called, checks if video parameters + changed and triggers appropriate actions */ +void cVideo::VideoParamWatchdog(void) +{ + static unsigned int _v_info = (unsigned int) -1; + unsigned int v_info; + if (fd == -1) + return; + fop(ioctl, MPEG_VID_GET_V_INFO_RAW, &v_info); + if (_v_info != v_info) + { + lt_debug("cVideo::VPWdog: params changed. old: %08x new: %08x\n", _v_info, v_info); + setAspectRatio(-1, -1); + } + _v_info = v_info; +} + void cVideo::Pig(int x, int y, int w, int h, int /*osd_w*/, int /*osd_h*/) { /* x = y = w = h = -1 -> reset / "hide" PIG */ diff --git a/lib/libtriple/video_td.h b/lib/libtriple/video_td.h index 8a9f4f03b..fb88c6290 100644 --- a/lib/libtriple/video_td.h +++ b/lib/libtriple/video_td.h @@ -175,6 +175,7 @@ class cVideo void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600); void SetControl(int, int) { return; }; int setZoom(int); + void VideoParamWatchdog(void); void setContrast(int val); void SetVideoMode(analog_mode_t mode); void SetDBDR(int) { return; };