From 4f4705397c4563a69b87c5e8424f3b0d132ef552 Mon Sep 17 00:00:00 2001 From: louis Date: Wed, 9 Jan 2013 18:49:15 +0100 Subject: Adapted video scaling to new implementation (thanks @Zoolook for the patch) --- README | 11 +- displaymenu.c | 10 +- displaymenu.h | 1 + displaymenuview.c | 6 +- displaymenuview.h | 2 +- ...-video-scaling-without-YAEPG-vdr-1.7.33_v4.diff | 153 --------------------- patches/epgsearch_menucats.patch | 126 ----------------- 7 files changed, 14 insertions(+), 295 deletions(-) delete mode 100644 patches/0003-softhddevice-video-scaling-without-YAEPG-vdr-1.7.33_v4.diff delete mode 100644 patches/epgsearch_menucats.patch diff --git a/README b/README index 73d60f4..3fb86f7 100644 --- a/README +++ b/README @@ -19,6 +19,9 @@ Requirements - Installed ImageMagick for displaying png/jpg Icons, Channel Logos and EPG Images +- for scaling the video picture to fit into the VDR menu window please use + softhddevice plugin revision 87c1c7be (2013-01-01) or newer. + - epgsearch Git since commit ba7c6277 (2013-01-03) to correctly replace the schedules menu with epgsearch @@ -99,14 +102,6 @@ Additional hint: some channels have slashes in their name (in germany nick/comed In this example, as a dirty hack just create a folder in your channel logo directory named "nick" and place an image named "comedy.png" inside this folder. -With softhddevice as output plugin, use a Version newer than Revision f640ebde -(0.5.1, 10.10.2012) to achieve a correct display of the screen resolution during channel switching. -For scaling the video picture to fit into the VDR menu window, currently you have to patch -softhddevice with the provided patch provided in -./patches/0003-softhddevice-video-scaling-without-YAEPG-vdr-1.7.33_v4.diff in the plugin sources. -This patch should soon be included in the softhddevice git. - - Setup Options ------------- diff --git a/displaymenu.c b/displaymenu.c index 7e41197..ef76d65 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -45,6 +45,7 @@ cNopacityDisplayMenu::~cNopacityDisplayMenu() { cOsdProvider::DropImage(handleButtons[i]); delete osd; + cDevice::PrimaryDevice()->ScaleVideo(cRect::Null); } void cNopacityDisplayMenu::DrawDisk(void) { @@ -209,7 +210,7 @@ void cNopacityDisplayMenu::SetTitle(const char *Title) { menuView->ShowHeaderLogo(false); left += menuView->DrawHeaderIcon(MenuCategory()); } - menuView->AdjustContentBackground(contentNarrow, contentNarrowLast); + menuView->AdjustContentBackground(contentNarrow, contentNarrowLast, videoWindowRect); menuView->DrawHeaderLabel(left, title); } } @@ -512,7 +513,7 @@ void cNopacityDisplayMenu::SetScrollbar(int Total, int Offset) { void cNopacityDisplayMenu::SetEvent(const cEvent *Event) { if (!Event) return; - menuView->AdjustContentBackground(false, contentNarrowLast); + menuView->AdjustContentBackground(false, contentNarrowLast, videoWindowRect); detailView = new cNopacityMenuDetailEventView(osd, Event); menuView->SetDetailViewSize(dvEvent, detailView); detailView->SetFonts(); @@ -531,7 +532,7 @@ void cNopacityDisplayMenu::SetEvent(const cEvent *Event) { void cNopacityDisplayMenu::SetRecording(const cRecording *Recording) { if (!Recording) return; - menuView->AdjustContentBackground(false, contentNarrowLast); + menuView->AdjustContentBackground(false, contentNarrowLast, videoWindowRect); detailView = new cNopacityMenuDetailRecordingView(osd, Recording); menuView->SetDetailViewSize(dvRecording, detailView); detailView->SetFonts(); @@ -548,7 +549,7 @@ void cNopacityDisplayMenu::SetRecording(const cRecording *Recording) { void cNopacityDisplayMenu::SetText(const char *Text, bool FixedFont) { if (!Text) return; - menuView->AdjustContentBackground(false, contentNarrowLast); + menuView->AdjustContentBackground(false, contentNarrowLast, videoWindowRect); detailView = new cNopacityMenuDetailTextView(osd); menuView->SetDetailViewSize(dvText, detailView); detailView->SetFonts(); @@ -577,6 +578,7 @@ void cNopacityDisplayMenu::Flush(void) { initMenu = false; initial = false; osd->Flush(); + cDevice::PrimaryDevice()->ScaleVideo(videoWindowRect); } void cNopacityDisplayMenu::Action(void) { diff --git a/displaymenu.h b/displaymenu.h index 716d60a..6937efe 100644 --- a/displaymenu.h +++ b/displaymenu.h @@ -23,6 +23,7 @@ private: int handleBackgrounds[8]; int handleButtons[4]; int positionButtons[4]; + cRect videoWindowRect; void DrawDisk(void); void DrawTimers(void); void SplitItem(const char *Text, cString *strItems, int *tabItems); diff --git a/displaymenuview.c b/displaymenuview.c index f71f0c0..5731beb 100644 --- a/displaymenuview.c +++ b/displaymenuview.c @@ -323,7 +323,7 @@ void cNopacityDisplayMenuView::DrawBorderDecoration() { } -void cNopacityDisplayMenuView::AdjustContentBackground(bool contentNarrow, bool contentNarrowLast) { +void cNopacityDisplayMenuView::AdjustContentBackground(bool contentNarrow, bool contentNarrowLast, cRect & vidWin) { if (contentNarrow) { pixmapContent->SetDrawPortPoint(cPoint(contentWidthNarrow - contentWidthFull, 0)); if (config.scalePicture) { @@ -333,13 +333,13 @@ void cNopacityDisplayMenuView::AdjustContentBackground(bool contentNarrow, bool osdTop + headerHeight, contentWidthFull - osdLeft - contentWidthNarrow - widthScrollbar - 4 * spaceMenu, contentHeight);// - osdTop - headerHeight); - cDevice::PrimaryDevice()->CanScaleVideo(availableRect); + vidWin = cDevice::PrimaryDevice()->CanScaleVideo(availableRect); } } else { pixmapContent->SetDrawPortPoint(cPoint(0, 0)); if (config.scalePicture) { // ask output device to restore full size - cDevice::PrimaryDevice()->CanScaleVideo(cRect::Null); + vidWin = cDevice::PrimaryDevice()->CanScaleVideo(cRect::Null); } } if (contentNarrow != contentNarrowLast) { diff --git a/displaymenuview.h b/displaymenuview.h index e0d30b7..68b6b69 100644 --- a/displaymenuview.h +++ b/displaymenuview.h @@ -85,7 +85,7 @@ class cNopacityDisplayMenuView { const cFont *GetTextAreaFont(bool FixedFont); cRect *GetDescriptionTextWindowSize(void) {return &textWindowSize;}; void CreateBackgroundImages(int *handleBackgrounds, int *handleButtons); - void AdjustContentBackground(bool contentNarrow, bool contentNarrowLast); + void AdjustContentBackground(bool contentNarrow, bool contentNarrowLast, cRect & vidWin); void DrawBorderDecoration(void); int ShowHeaderLogo(bool show); void DrawHeaderLogo(void); diff --git a/patches/0003-softhddevice-video-scaling-without-YAEPG-vdr-1.7.33_v4.diff b/patches/0003-softhddevice-video-scaling-without-YAEPG-vdr-1.7.33_v4.diff deleted file mode 100644 index 43d987e..0000000 --- a/patches/0003-softhddevice-video-scaling-without-YAEPG-vdr-1.7.33_v4.diff +++ /dev/null @@ -1,153 +0,0 @@ -From ac0430c0b4c331d9adc87b8556545875e08ed82c Mon Sep 17 00:00:00 2001 -From: Lucian Muresan -Date: Tue, 18 Dec 2012 01:05:02 +0100 -Subject: [PATCH 3/3] softhddevice-video-scaling-without-YAEPG-vdr-1.7.33_v4 - ---- - softhddevice.cpp | 90 +++++++++++++++++++++++++++++++++++++++++--------------- - video.h | 2 +- - 2 files changed, 67 insertions(+), 25 deletions(-) - -diff --git a/softhddevice.cpp b/softhddevice.cpp -index d20f2cb..113efcc 100644 ---- a/softhddevice.cpp -+++ b/softhddevice.cpp -@@ -313,17 +313,9 @@ cSoftOsd::~cSoftOsd(void) - SetActive(false); - // done by SetActive: OsdClose(); - --#ifdef USE_YAEPG -- // support yaepghd, video window -- if (vidWin.bpp) { // restore fullsized video -- int width; -- int height; -- double video_aspect; -- -- ::GetOsdSize(&width, &height, &video_aspect); -- // works osd relative -- VideoSetOutputPosition(0, 0, width, height); -- } -+#if APIVERSNUM >= 10733 -+ // rescale to full-size when Osd disappears -+ cDevice::PrimaryDevice()->ScaleVideo(); - #endif - } - -@@ -346,19 +338,9 @@ void cSoftOsd::Flush(void) - if (OsdLevel >= OSD_LEVEL_SUBTITLES && IsOpen()) { - return; - } --#ifdef USE_YAEPG -- // support yaepghd, video window -- if (vidWin.bpp) { --#ifdef OSD_DEBUG -- dsyslog("[softhddev]%s: %dx%d+%d+%d\n", __FUNCTION__, vidWin.Width(), -- vidWin.Height(), vidWin.x1, vidWin.y2); --#endif -- -- // FIXME: vidWin is OSD relative not video window. -- VideoSetOutputPosition(Left() + vidWin.x1, Top() + vidWin.y1, -- vidWin.Width(), vidWin.Height()); -- } --#endif -+ // scale to the size and position stored by the last call to cDevice::CanScaleVideo -+ // by passing a cRect(-1,-1,-1,-1) as by our convention -+ cDevice::PrimaryDevice()->ScaleVideo(cRect(-1,-1,-1,-1)); - - // - // VDR draws subtitle without clearing the old -@@ -1464,11 +1446,18 @@ class cSoftHdDevice:public cDevice - // Image Grab facilities - - virtual uchar *GrabImage(int &, bool, int, int, int); -+#if APIVERSNUM >= 10733 -+ virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter); -+ virtual void ScaleVideo(const cRect &Rect = cRect::Null); -+ private: -+ cRect vidWinRect; // default constructor initializes with cRect::Null which is interpreted as "full size" -+#endif - - #if 0 - // SPU facilities - private: - cDvbSpuDecoder * spuDecoder; -+ - public: - virtual cSpuDecoder * GetSpuDecoder(void); - #endif -@@ -1888,6 +1877,59 @@ uchar *cSoftHdDevice::GrabImage(int &size, bool jpeg, int quality, int width, - return::GrabImage(&size, jpeg, quality, width, height); - } - -+#if APIVERSNUM >= 10733 -+///< Asks the output device whether it can scale the currently shown video in -+///< such a way that it fits into the given Rect, while retaining its proper -+///< aspect ratio. If the scaled video doesn't exactly fit into Rect, Alignment -+///< is used to determine how to align the actual rectangle with the requested -+///< one. The actual rectangle can be smaller, larger or the same size as the -+///< given Rect, and its location may differ, depending on the capabilities of -+///< the output device, which may not be able to display a scaled video at -+///< arbitrary sizes and locations. The device shall, however, do its best to -+///< match the requested Rect as closely as possible, preferring a size and -+///< location that fits completely into the requested Rect if possible. -+///< Returns the rectangle that can actually be used when scaling the video. -+///< A skin plugin using this function should rearrange its content according -+///< to the rectangle returned from calling this function, and should especially -+///< be prepared for cases where the returned rectangle is way off the requested -+///< Rect, or even Null. In such cases, the skin may want to fall back to -+///< working with full screen video. -+///< If this device can't scale the video, a Null rectangle is returned (this -+///< is also the default implementation). -+cRect cSoftHdDevice::CanScaleVideo(const cRect &Rect, int Alignment/* = taCenter*/) -+{ -+ // first implementation: we can always scale, we're a soft device ;-), ignore alignment for now -+ -+ // so let's just remember what the next call to ScaleVideo should actually use as a rectangle -+ // argument if called with cRect(-1,-1,-1,-1) -+ vidWinRect = Rect; -+ return vidWinRect; -+} -+ -+///< Scales the currently shown video in such a way that it fits into the given -+///< Rect. Rect should be one retrieved through a previous call to -+///< CanScaleVideo() (otherwise results may be undefined). -+///< Even if video output is scaled, the functions GetVideoSize() and -+///< GetOsdSize() must still return the same values as if in full screen mode! -+///< If this device can't scale the video, nothing happens. -+///< To restore full screen video, call this function with a Null rectangle. -+void cSoftHdDevice::ScaleVideo(const cRect &Rect/* = cRect::Null*/) -+{ -+ const cRect * actualRect = &Rect; -+ if (Rect == cRect(-1,-1,-1,-1)) { -+ // actual rectangle was stored here by the previous call to CanScaleVideo -+ actualRect = &vidWinRect; -+ } else { -+ // remember the value, just for the case we were called explicitly with a real value -+ vidWinRect = Rect; -+ } -+ -+ // let our specialized code do the actual resizing / repositioning -+ VideoSetOutputPosition((*actualRect).X(), (*actualRect).Y(), (*actualRect).Width(), (*actualRect).Height()); -+} -+#endif -+ -+ - /** - ** Call rgb to jpeg for C Plugin. - */ -diff --git a/video.h b/video.h -index 0868169..8a49b4c 100644 ---- a/video.h -+++ b/video.h -@@ -109,7 +109,7 @@ extern void VideoSetSaturation(int); - /// Set hue adjustment. - extern void VideoSetHue(int); - -- /// Set video output position. -+ /// Set video output position (Null width or height sets to full available window or screen). - extern void VideoSetOutputPosition(int, int, int, int); - - /// Set video mode. --- -1.8.0 - diff --git a/patches/epgsearch_menucats.patch b/patches/epgsearch_menucats.patch deleted file mode 100644 index 9ca5a75..0000000 --- a/patches/epgsearch_menucats.patch +++ /dev/null @@ -1,126 +0,0 @@ -diff -upr vdr-plugin-epgsearch_orig/changrp.c vdr-plugin-epgsearch/changrp.c ---- vdr-plugin-epgsearch_orig/changrp.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/changrp.c 2012-12-27 14:46:38.000000000 +0100 -@@ -306,7 +306,7 @@ cMenuChannelGroups::cMenuChannelGroups(c - :cOsdMenu(tr("Channel groups"),20) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSetup); -+ //SetMenuCategory(mcSetup); - #endif - groupSel = -1; - groupName = GroupName; -@@ -411,7 +411,7 @@ cMenuEditChannelGroup::cMenuEditChannelG - :cOsdMenu(tr("Edit channel group"),30) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSetup); -+ //SetMenuCategory(mcSetup); - #endif - group = Group; - channelSel = group->CreateChannelSel(); -diff -upr vdr-plugin-epgsearch_orig/epgsearchsetup.c vdr-plugin-epgsearch/epgsearchsetup.c ---- vdr-plugin-epgsearch_orig/epgsearchsetup.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/epgsearchsetup.c 2012-12-27 14:46:38.000000000 +0100 -@@ -55,7 +55,7 @@ cMenuSetupSubMenu::cMenuSetupSubMenu(con - : cOsdMenu(Title, 33) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSetup); -+ //SetMenuCategory(mcSetup); - #endif - data = Data; - } -diff -upr vdr-plugin-epgsearch_orig/menu_blacklistedit.c vdr-plugin-epgsearch/menu_blacklistedit.c ---- vdr-plugin-epgsearch_orig/menu_blacklistedit.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/menu_blacklistedit.c 2012-12-27 14:46:38.000000000 +0100 -@@ -43,7 +43,7 @@ cMenuBlacklistEdit::cMenuBlacklistEdit(c - :cOsdMenu(tr("Edit blacklist"),32) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSetup); -+ //SetMenuCategory(mcSetup); - #endif - SearchModes[0] = strdup(tr("phrase")); - SearchModes[1] = strdup(tr("all words")); -diff -upr vdr-plugin-epgsearch_orig/menu_blacklists.c vdr-plugin-epgsearch/menu_blacklists.c ---- vdr-plugin-epgsearch_orig/menu_blacklists.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/menu_blacklists.c 2012-12-27 14:46:38.000000000 +0100 -@@ -100,7 +100,7 @@ cMenuBlacklists::cMenuBlacklists() - :cOsdMenu(tr("Blacklists"), 3, 20, 11, 6, 5) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSetup); -+ //SetMenuCategory(mcSetup); - #endif - cMutexLock BlacklistLock(&Blacklists); - cBlacklist *Blacklist = Blacklists.First(); -diff -upr vdr-plugin-epgsearch_orig/menu_conflictcheck.c vdr-plugin-epgsearch/menu_conflictcheck.c ---- vdr-plugin-epgsearch_orig/menu_conflictcheck.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/menu_conflictcheck.c 2012-12-27 14:46:38.000000000 +0100 -@@ -63,7 +63,7 @@ cMenuConflictCheck::cMenuConflictCheck() - :cOsdMenu("", 4, 12, 4, 5, 30) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSchedule); -+ //SetMenuCategory(mcSchedule); - #endif - showAll = false; - lastSel = -1; -@@ -198,7 +198,7 @@ cMenuConflictCheckDetails::cMenuConflict - :cOsdMenu(tr("Timer conflicts"), 2, 4, 13, 3, 2) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSchedule); -+ //SetMenuCategory(mcSchedule); - #endif - timerObj = TimerObj; - checktime = timerObj->conflCheckTime; -diff -upr vdr-plugin-epgsearch_orig/menu_deftimercheckmethod.c vdr-plugin-epgsearch/menu_deftimercheckmethod.c ---- vdr-plugin-epgsearch_orig/menu_deftimercheckmethod.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/menu_deftimercheckmethod.c 2012-12-27 14:46:39.000000000 +0100 -@@ -121,7 +121,7 @@ cMenuDefTimerCheckMethod::cMenuDefTimerC - :cOsdMenu(tr("Default timer check method"), 20) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSetup); -+ //SetMenuCategory(mcSetup); - #endif - CheckModes[0] = tr("no check"); - CheckModes[UPD_CHDUR] = tr("by channel and time"); -diff -upr vdr-plugin-epgsearch_orig/menu_main.c vdr-plugin-epgsearch/menu_main.c ---- vdr-plugin-epgsearch_orig/menu_main.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/menu_main.c 2012-12-27 14:46:38.000000000 +0100 -@@ -50,7 +50,7 @@ cMenuSearchMain::cMenuSearchMain(void) - :cOsdMenu("", GetTab(1), GetTab(2), GetTab(3), GetTab(4), GetTab(5)) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSchedule); -+ //SetMenuCategory(mcSchedule); - #endif - helpKeys = -1; - otherChannel = 0; -diff -upr vdr-plugin-epgsearch_orig/menu_searchresults.c vdr-plugin-epgsearch/menu_searchresults.c ---- vdr-plugin-epgsearch_orig/menu_searchresults.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/menu_searchresults.c 2012-12-27 14:46:38.000000000 +0100 -@@ -192,7 +192,7 @@ cMenuSearchResults::cMenuSearchResults(c - :cOsdMenu("", MenuTemplate->Tab(0), MenuTemplate->Tab(1), MenuTemplate->Tab(2), MenuTemplate->Tab(3), MenuTemplate->Tab(4)) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSchedule); -+ //SetMenuCategory(mcSchedule); - #endif - - helpKeys = -1; -diff -upr vdr-plugin-epgsearch_orig/menu_whatson.c vdr-plugin-epgsearch/menu_whatson.c ---- vdr-plugin-epgsearch_orig/menu_whatson.c 2012-12-29 08:11:25.000000000 +0100 -+++ vdr-plugin-epgsearch/menu_whatson.c 2012-12-27 14:46:38.000000000 +0100 -@@ -260,7 +260,7 @@ cMenuWhatsOnSearch::cMenuWhatsOnSearch(c - :cOsdMenu("", GetTab(1), GetTab(2), GetTab(3), GetTab(4), GetTab(5)) - { - #if VDRVERSNUM >= 10728 -- SetMenuCategory(mcSchedule); -+ //SetMenuCategory(mcSchedule); - #endif - - helpKeys = -1; -- cgit v1.2.3