Bug#563084: vdr: Fix some dvd menu

2010-01-15 Thread matthieu castet

Hi,

Tobias Grimm a écrit :

Hello!

matthieu castet wrote:


This patch try to use less memory for dvd menu.
PS : this patch has been integrated in vdr 1.7 :
http://thread.gmane.org/gmane.linux.vdr/41532


I would prefer to wait for VDR 1.8, but I'm afraid it won't make it into
Squeeze. I consider adding your patch with the next upload. But it breaks
the ABI so all plugins must be updated as well.



The abi is broken because I add a member in dvdspu class ?
But dvdspu is only used by dvd plugin. Do you need to rebuild others ?
If you want I can rework the patch to avoid that.

Matthieu

PS : I have done some debug with an other vdr user and :
- this patch should be applied with 
http://article.gmane.org/gmane.linux.vdr/41531/match= patch
- there is a missing Hide in Draw.
I will resend you a patch. Tell me if you want that I avoid breaking plugin API.



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#563084: vdr: Fix some dvd menu

2010-01-15 Thread Tobias Grimm
Hello!

matthieu castet wrote:

 The abi is broken because I add a member in dvdspu class ?

Yes.

 But dvdspu is only used by dvd plugin. Do you need to rebuild others ?

Technically not, but by the inofficial VDR Packaging Policy every ABI
change requires all plugins to be rebuilt. That's why VDR provides a
virtual package for each new ABI and plugins depend on it.

 If you want I can rework the patch to avoid that.

If that's possible without any drawbacks, this would be great.

 PS : I have done some debug with an other vdr user and :
 - this patch should be applied with
 http://article.gmane.org/gmane.linux.vdr/41531/match= patch

Does this work? Klaus seemed to be sceptical.

 - there is a missing Hide in Draw.

I think, I've seen this in the vdr 1.7.11. diff too.

 I will resend you a patch. Tell me if you want that I avoid breaking
 plugin API.

If it's possible to not break the ABI, please do so.

The KDE guys have put together a nice list of do's and don'ts:

http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++

bye,

Tobias



signature.asc
Description: OpenPGP digital signature


Bug#563084: vdr: Fix some dvd menu

2010-01-14 Thread Tobias Grimm
Hello!

matthieu castet wrote:

 This patch try to use less memory for dvd menu.
 PS : this patch has been integrated in vdr 1.7 :
 http://thread.gmane.org/gmane.linux.vdr/41532

I would prefer to wait for VDR 1.8, but I'm afraid it won't make it into
Squeeze. I consider adding your patch with the next upload. But it breaks
the ABI so all plugins must be updated as well.

bye,

Tobias



signature.asc
Description: OpenPGP digital signature


Bug#563084: vdr: Fix some dvd menu

2009-12-30 Thread matthieu castet
Package: vdr
Version: 1.6.0-13
Severity: normal
Tags: patch

Hi,

on FF card osd memory are limited and the dvd menu sometime failed to be
displayed with oeOutOfMemory error.

This patch try to use less memory for dvd menu.

Matthieu

PS : this patch has been integrated in vdr 1.7 :
http://thread.gmane.org/gmane.linux.vdr/41532

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.31-1-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to fr_FR)
Shell: /bin/sh linked to /bin/dash

Versions of packages vdr depends on:
ii  adduser   3.112  add and remove users and groups
ii  debconf [debconf-2.0] 1.5.28 Debian configuration management sy
ii  libc6 2.10.2-2   GNU C Library: Shared libraries
ii  libcap2   1:2.17-2   support for getting/setting POSIX.
ii  libfontconfig12.6.0-4.2  generic font configuration library
ii  libfreetype6  2.3.11-1   FreeType 2 font engine, shared lib
ii  libgcc1   1:4.4.2-7  GCC support library
ii  libjpeg62 6b-15  The Independent JPEG Group's JPEG 
ii  libstdc++64.4.2-7The GNU Standard C++ Library v3
ii  psmisc22.9-1 utilities that use the proc file s

Versions of packages vdr recommends:
pn  lirc  none (no description available)
ii  ttf-bitstream-vera1.10-7 The Bitstream Vera family of free 
ii  ttf-freefont  20090104-5 Freefont Serif, Sans and Mono True

vdr suggests no packages.

-- debconf information excluded
--- vdr-1.6.0/dvbspu.c	2007-02-03 11:13:18.0 +0100
+++ vdr-1.6.0p/dvbspu.c	2009-11-21 21:48:54.0 +0100
@@ -335,6 +335,35 @@
 return size;
 }
 
+int cDvbSpuBitmap::getMinBpp(const aDvbSpuPalDescr paldescr)
+{
+int col = 1;
+for (int i = 0; i  4; i++) {
+if (paldescr[i].trans != 0) {
+col++;
+}
+}
+return col  2 ? 2 : 1;
+}
+
+int cDvbSpuDecoder::CalcAreaBpp(cBitmap *fgbmp, cBitmap *bgbmp)
+{
+int fgbpp = 0;
+int bgbpp = 0;
+int ret;
+if (fgbmp) {
+fgbpp = spubmp-getMinBpp(hlpDescr);
+}
+if (bgbmp) {
+bgbpp = spubmp-getMinBpp(palDescr);
+}
+ret = fgbpp + bgbpp;
+if (ret  2)
+ret = 4;
+return ret;
+}
+
+
 void cDvbSpuDecoder::Draw(void)
 {
 cMutexLock MutexLock(mutex);
@@ -342,43 +371,89 @@
 Hide();
 return;
 }
-
+sDvbSpuRect bgsize;
 cBitmap *fg = NULL;
 cBitmap *bg = NULL;
-sDvbSpuRect bgsize;
-sDvbSpuRect hlsize;
-
-hlsize.x1 = hlpsize.x1;
-hlsize.y1 = hlpsize.y1;
-hlsize.x2 = hlpsize.x2;
-hlsize.y2 = hlpsize.y2;
 
 if (highlight)
-fg = spubmp-getBitmap(hlpDescr, palette, hlsize);
+fg = spubmp-getBitmap(hlpDescr, palette, hlpsize);
 
 if (spubmp-getMinSize(palDescr, bgsize))
 bg = spubmp-getBitmap(palDescr, palette, bgsize);
 
-sDvbSpuRect areaSize = CalcAreaSize(hlsize, fg, bgsize, bg);
+if (osd == NULL) {
+restricted_osd = false;
+osd = cOsdProvider::NewOsd(0, 0);
+
+tArea Area = { size.x1, size.y1, size.x2, size.y2, 4};
+if (osd-CanHandleAreas(Area, 1) != oeOk)
+restricted_osd = true;
+else
+osd-SetAreas(Area, 1);
+}
+if (restricted_osd) {
+sDvbSpuRect hlsize;
+bool setarea = false;
+/* reduce fg area (only valid if there is no bg below) */
+if (fg) {
+spubmp-getMinSize(hlpDescr,hlsize);
+/* clip to the highligh area */
+setMax(hlsize.x1, hlpsize.x1);
+setMax(hlsize.y1, hlpsize.y1);
+setMin(hlsize.x2, hlpsize.x2);
+setMin(hlsize.y2, hlpsize.y2);
+if (hlsize.x1  hlsize.x2 || hlsize.y1  hlsize.y2) {
+hlsize.x1 = hlsize.x2 = hlsize.y1 = hlsize.y2 = 0;
+}
+}
+sDvbSpuRect areaSize = CalcAreaSize((fg  bg) ? hlpsize : hlsize, fg, bgsize, bg);
 
-if (!fg || !bg || !osd) {
-   Hide();
-   }
+#define DIV(a, b) (a/b)?:1
+for (int d = 1; !setarea  d = 2; d++) {
 
-if (bg || fg) {
-if (osd == NULL) {
-   osd = cOsdProvider::NewOsd(0, 0);
-   if ((areaSize.width()  3) != 0)
-  areaSize.x2 += 4 - (areaSize.width()  3);
-   tArea Area = { areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, (fg  bg) ? 4 : 2 };
-   if (osd-SetAreas(Area, 1) != oeOk)
+/* first try old behaviour */
+tArea Area = { areaSize.x1, areaSize.y1,