summaryrefslogtreecommitdiff
path: root/dvbspu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de>2010-01-06 13:34:00 +0100
committerKlaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de>2010-01-06 13:34:00 +0100
commit939081e274d0a9868e5ba9a7951666ad508afb96 (patch)
treee79853c0ab397e609897a8f9dfc731231ce0aee4 /dvbspu.c
parentea01358b3bca9d55402ba632c95cdd6458abfdb3 (diff)
downloadvdr-patch-lnbsharing-939081e274d0a9868e5ba9a7951666ad508afb96.tar.gz
vdr-patch-lnbsharing-939081e274d0a9868e5ba9a7951666ad508afb96.tar.bz2
Version 1.7.11vdr-1.7.11
- Fixed resetting the file size when regenerating the index file. - The new function cDevice::PatPmtParser() can be used in derived devices to access the PAT/PMT of the currently replayed material. - Updated the Italian OSD texts (thanks to Diego Pierotto). - The PCR pid in generated PMTs is now set to 0x1FFF ("no PCR pid") in cPatPmtGenerator::GeneratePmt(), because VDR doesn't record the PCR pid. - Updated the Estonian OSD texts (thanks to Arthur Konovalov). - The 'sky' plugin is no longer part of the VDR source. - Improved SPU handling on devices with limited OSD capabilities (thanks to Matthieu Castet). - Several code modifications to avoid compiler warnings (thanks to Winfried Köhler). - Added stream type 11172 AUDIO to cPatPmtParser::ParsePmt() (thanks to Johann Friedrichs). - Removed debug output of '-' from cTransfer::Receive(). - Added defines for large files to the 'newplugin' script (reported by Udo Richter). - Removed the workaround for short channel names of "Kabel Deutschland", because apparently they now have their data according to the DVB standard (thanks to Johann Friedrichs). - Some fixes to dvbspu.[hc] (thanks to Johann Friedrichs). - Fixed a busy loop when moving editing marks (thanks to Johann Friedrichs). - Updated sources.conf (thanks to Derek Kelly). - Modified cCharSetConv so that it can be used to convert from "whatever VDR uses" to a given code (thanks to Joachim Wilke). - Channel names containing commas are now handled correctly in channels.conf. If a channel's short name contains a comma, it is replaced with a '.'. - cDevice now logs the device number when a new device is created. - Fixed handling STREAMTYPE_11172_AUDIO in cPatPmtParser::ParsePmt(). - cParsePatPmt now has functions to retrieve the audio, dolby and subtitle pids. - cPatFilter::Process() now only stores CA descriptors for video and audio pids (thanks to Francesco Saverio Schiavarelli for reporting a problem with channels that have some encrypted components that VDR doesn't use). - cDevice::AddPid() now stores the stream type of the given pid (thanks to Andreas Regel). - Added cFont::FontName() and cFont::Size() (thanks to Andreas Regel). - cPatPmtParser now also stores the audio stream types. - The support for full featured DVB cards of the TT/FuSi design has been moved into the new plugin 'dvbsddevice'. On systems that use such a card as their primary device, this plugin now needs to be loaded when running VDR in order to view live or recorded video. If the plugin is not loaded, the card will be treated like a budget DVB card, and there will be no OSD or viewing capability. - Fixed handling the "CA PMT" generation (revised a change not mentioned in version 1.7.9's changes, which caused a malfunction with Conax and Viaccess CAMs). - Fixed stopping subtitle display when switching the primary device (thanks to Anssi Hannula). IMPORTANT NOTE TO PLUGIN AUTHORS: a plugin that implements a derived cDevice class that can replay video must now call the MakePrimaryDevice() function of its base class. - Fixed compiler warnings "format not a string literal and no format arguments" in some syslog calls (thanks to Rolf Ahrenberg). - The new command line options --edit and --genindex can be used to edit a recording or generate its index without actually starting the entire VDR (based on a patch from Helmut Auer). - Improved the description of the transponder parameters in vdr.5 (thanks to Winfried Köhler). - Avoiding setting the video stream type to 2 if the vpid is 0 (problem reported by Arthur Konovalov). - Implemented handling the "Content Descriptor" (based on a patch from Rolf Ahrenberg). The 'classic', 'sttng' and 'curses' skins display the textual representation of the content descriptors as "genre". The epg.data file stores the genre using the tag character 'G'. - Implemented handling the "Parental Rating Descriptor" (based on a patch from Rolf Ahrenberg). The 'classic', 'sttng' and 'curses' skins display the parental rating (if given) in their event displays. The epg.data file stores the parental rating using the tag character 'R'. IMPORTANT NOTE: if VDR doesn't display a parental rating, this does not necessarily mean that the given programme is suitable for all audiences! - Rearranged cEvent members to minimize memory waste. - After a CLRE command, no further EPG processing is now done for 10 seconds, so that data sent with subsequent PUTE commands doesn't interfere with data from the broadcasters (suggested by Helmut Auer). - Added support for DVB cards with multiple fontends. Note that this only works for DVB cards where each frontend can be used independently of all the others on the same adapter. - Fixed plugin arguments corruption with glibc 2.11 on x86_64 (thanks to Anssi Hannula).
Diffstat (limited to 'dvbspu.c')
-rw-r--r--dvbspu.c128
1 files changed, 103 insertions, 25 deletions
diff --git a/dvbspu.c b/dvbspu.c
index 76ed405..488bd89 100644
--- a/dvbspu.c
+++ b/dvbspu.c
@@ -8,7 +8,7 @@
*
* parts of this file are derived from the OMS program.
*
- * $Id: dvbspu.c 2.2 2009/11/22 14:17:59 kls Exp $
+ * $Id: dvbspu.c 2.7 2009/12/26 15:51:15 kls Exp $
*/
#include "dvbspu.h"
@@ -16,7 +16,6 @@
#include <string.h>
#include <inttypes.h>
#include <math.h>
-#include "device.h"
/*
* cDvbSpubitmap:
@@ -147,7 +146,7 @@ bool cDvbSpuBitmap::getMinSize(const aDvbSpuPalDescr paldescr,
DEBUG("MinSize: (%d, %d) x (%d, %d)\n",
size.x1, size.y1, size.x2, size.y2);
if (size.x1 > size.x2 || size.y1 > size.y2)
- return false;
+ return false;
return ret;
}
@@ -340,6 +339,35 @@ sDvbSpuRect cDvbSpuDecoder::CalcAreaSize(sDvbSpuRect fgsize, cBitmap *fgbmp, sDv
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 ? 4 : 2;
+}
+
+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);
@@ -347,43 +375,92 @@ void cDvbSpuDecoder::Draw(void)
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 (!fg || !bg || !osd)
+ Hide();
- if (!fg || !bg || !osd) {
- Hide();
- }
+ if (osd == NULL) {
+ restricted_osd = false;
+ osd = cOsdProvider::NewOsd(0, 0);
- 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)
+ 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);
+
+#define DIV(a, b) (a/b)?:1
+ for (int d = 1; !setarea && d <= 2; d++) {
+
+ /* first try old behaviour */
+ tArea Area = { areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, DIV(CalcAreaBpp(fg, bg), d) };
+
+ if ((Area.Width() & 7) != 0)
+ Area.x2 += 8 - (Area.Width() & 7);
+
+ if (osd->CanHandleAreas(&Area, 1) == oeOk &&
+ osd->SetAreas(&Area, 1) == oeOk)
+ setarea = true;
+
+ /* second try to split area if there is both area */
+ if (!setarea && fg && bg) {
+ tArea Area_Both [2] = {
+ {bgsize.x1, bgsize.y1, bgsize.x2, bgsize.y2, DIV(CalcAreaBpp(0, bg), d)},
+ {hlpsize.x1, hlpsize.y1, hlpsize.x2, hlpsize.y2, DIV(CalcAreaBpp(fg, 0), d)}
+ };
+ if (!Area_Both[0].Intersects(Area_Both[1])) {
+ /* there is no intersection. We can reduce hl */
+ Area_Both[1].x1 = hlsize.x1;
+ Area_Both[1].y1 = hlsize.y1;
+ Area_Both[1].x2 = hlsize.x2;
+ Area_Both[1].y2 = hlsize.y2;
+
+ if ((Area_Both[0].Width() & 7) != 0)
+ Area_Both[0].x2 += 8 - (Area_Both[0].Width() & 7);
+ if ((Area_Both[1].Width() & 7) != 0)
+ Area_Both[1].x2 += 8 - (Area_Both[1].Width() & 7);
+ if (osd->CanHandleAreas(Area_Both, 2) == oeOk &&
+ osd->SetAreas(Area_Both, 2) == oeOk)
+ setarea = true;
+ }
+ }
+ }
+ if (!setarea)
dsyslog("dvbspu: AreaSize (%d, %d) (%d, %d) Bpp %d", areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, (fg && bg) ? 4 : 2 );
- }
+ }
+ /* we could draw use DrawPixel on osd */
+ if (bg || fg) {
if (bg)
osd->DrawBitmap(bgsize.x1, bgsize.y1, *bg);
if (fg)
- osd->DrawBitmap(hlsize.x1, hlsize.y1, *fg);
+ osd->DrawBitmap(hlpsize.x1, hlpsize.y1, *fg);
delete fg;
delete bg;
@@ -514,6 +591,7 @@ int cDvbSpuDecoder::setTime(uint32_t pts)
}
}
if (fodd != 0 && feven != 0) {
+ Hide();
delete spubmp;
spubmp = new cDvbSpuBitmap(size, spu + fodd, spu + feven,
spu + feven, spu + cmdOffs());