From 93bc0eec06f3ca1cb6fd4b4fb2b7a719e4f71f0f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 1 Apr 2012 17:25:41 +0200 Subject: [PATCH] spark: fix getAspectRatio and getPictureInfo in MP mode --- libspark/video.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libspark/video.cpp b/libspark/video.cpp index f4936c3..09998ff 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -221,6 +221,12 @@ int cVideo::setAspectRatio(int aspect, int mode) int cVideo::getAspectRatio(void) { video_size_t s; + if (fd == -1) + { + /* in movieplayer mode, fd is not opened -> fall back to procfs */ + int n = proc_get_hex("/proc/stb/vmpeg/0/aspect"); + return n * 2 + 1; + } if (fop(ioctl, VIDEO_GET_SIZE, &s) < 0) { lt_info("%s: VIDEO_GET_SIZE %m\n", __func__); @@ -526,6 +532,15 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h) void cVideo::getPictureInfo(int &width, int &height, int &rate) { video_size_t s; + if (fd == -1) + { + /* in movieplayer mode, fd is not opened -> fall back to procfs */ + rate = proc_get_hex("/proc/stb/vmpeg/0/framerate"); + width = proc_get_hex("/proc/stb/vmpeg/0/xres"); + height = proc_get_hex("/proc/stb/vmpeg/0/yres"); + rate /= 1000; + return; + } ioctl(fd, VIDEO_GET_SIZE, &s); ioctl(fd, VIDEO_GET_FRAME_RATE, &rate); rate /= 1000;