diff options
author | Andreas Regel <andreas.regel@powarman.de> | 2005-05-15 12:48:00 +0200 |
---|---|---|
committer | Andreas Regel <andreas.regel@powarman.de> | 2005-05-15 12:48:00 +0200 |
commit | 4df61fcc16983f71ca5ab1d539840f7d04b9d48f (patch) | |
tree | 9768dc226dc0205f9f833e9ce6c6bf5eff4600cc | |
parent | f4460a2d3b0123c25b398b3c0168604bae2d15ba (diff) | |
download | vdr-plugin-osdpip-4df61fcc16983f71ca5ab1d539840f7d04b9d48f.tar.gz vdr-plugin-osdpip-4df61fcc16983f71ca5ab1d539840f7d04b9d48f.tar.bz2 |
Release version 0.0.8v0.0.8
- Added Navigation through channel in a way like with ordinary VDR. Use
the Left/Right keys to select channel groups, OK to choose one or the
number keys to directly enter a channel number. All this only works
with enabled info window.
- Extended the info window to contain more information. The amount of
information shown can be chosen through the setup menu. This directly
affects the height of the info window.
- Using the info window to show vdr messages if they occur.
- Changed the manner the moving of the PiP window works. Now move mode
is enabled or disabled by pressing the green button. In move mode,
the cursor keys can be used to move the PiP window.
- Added some more predefined PiP window sizes. You have to reset your
size in setup menu.
- Added support for ffmpeg 0.4.9 (should work with 0.4.8, too)
- Updated finnish translations (thanks to Rolf Ahrenberg)
- Cleaned up, dropped support for vdr versions older than 1.3.8
-rw-r--r-- | 00-DEVELOPMENT | 0 | ||||
-rw-r--r-- | HISTORY | 33 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README | 115 | ||||
-rw-r--r-- | decoder.c | 13 | ||||
-rw-r--r-- | i18n.c | 218 | ||||
-rw-r--r-- | osd.c | 491 | ||||
-rw-r--r-- | osd.h | 22 | ||||
-rw-r--r-- | osd_info.c | 335 | ||||
-rw-r--r-- | osd_info.h | 45 | ||||
-rw-r--r-- | osdpip.c | 2 | ||||
-rw-r--r-- | patches/vdr-1.2.6-256-indexes.diff | 76 | ||||
-rw-r--r-- | patches/vdr-1.2.6-256-palette.diff | 137 | ||||
-rw-r--r-- | patches/vdr-1.2.6-indexes.diff | 85 | ||||
-rw-r--r-- | patches/vdr-1.2.6-palette.diff | 139 | ||||
-rw-r--r-- | patches/vdr-osd.diff | 51 | ||||
-rw-r--r-- | pes.h | 3 | ||||
-rw-r--r-- | quantize.c | 15 | ||||
-rw-r--r-- | receiver.c | 31 | ||||
-rw-r--r-- | setup.c | 41 |
20 files changed, 787 insertions, 1067 deletions
diff --git a/00-DEVELOPMENT b/00-DEVELOPMENT deleted file mode 100644 index e69de29..0000000 --- a/00-DEVELOPMENT +++ /dev/null @@ -1,14 +1,41 @@ VDR Plugin 'osdpip' Revision History ------------------------------------ -2004-10-26: Version 0.0.7 +2005-05-15: Version 0.0.8 (written by Andreas Regel) +- Added Navigation through channel in a way like with ordinary VDR. Use + the Left/Right keys to select channel groups, OK to choose one or the + number keys to directly enter a channel number. All this only works + with enabled info window. +- Extended the info window to contain more information. The amount of + information shown can be chosen through the setup menu. This directly + affects the height of the info window. +- Using the info window to show vdr messages if they occur. +- Changed the manner the moving of the PiP window works. Now move mode + is enabled or disabled by pressing the green button. In move mode, + the cursor keys can be used to move the PiP window. +- Added some more predefined PiP window sizes. You have to reset your + size in setup menu. +- Added support for ffmpeg 0.4.9 (should work with 0.4.8, too) +- Updated finnish translations (thanks to Rolf Ahrenberg) +- Cleaned up, dropped support for vdr versions older than 1.3.8 + + +2005-02-03: Version 0.0.7.2 +- adapted to VDR 1.3.19+ (should work with older versions, too) + +2005-01-09: Version 0.0.7.1 +- adapted to VDR 1.3.18+ (should work with older versions, too) + + +2004-10-26: Version 0.0.7 - adapted to VDR 1.3.13+ (should work with older versions, too) -2004-08-01: Version 0.0.6 +2004-08-01: Version 0.0.6 (written by Andreas Regel) - added channel swapping. It is now possible to swap the currently viewed - channel with the pip channel by pressing the red key. + channel with the pip channel by pressing the red key. (thanks to Sascha + Volkenandt) - added support for other aspect ratios than 4:3. Image is now correctly scaled and black border is added when necessary. - added automatic frame dropping that always takes the last frame from @@ -48,7 +48,7 @@ DEFINES += -D_GNU_SOURCE ### The object files (add further files here): -OBJS = $(PLUGIN).o osd.o receiver.o setup.o i18n.o pes.o quantize.o decoder.o +OBJS = $(PLUGIN).o osd_info.o osd.o receiver.o setup.o i18n.o pes.o quantize.o decoder.o ifdef FFMPEG_STATIC DEFINES += -DHAVE_FFMPEG_STATIC @@ -11,10 +11,15 @@ See the file COPYING for license information. Requirements: +------------- + +- vdr 1.3.8 or higher +- libavcodec from ffmpeg (http://ffmpeg.sourceforge.net) version 0.4.8 or + higher -- libavcodec from ffmpeg (http://ffmpeg.sourceforge.net) version 0.4.8 Description: +------------ OSD Picture-in-Picture is a PlugIn that displays the current channel in a small box on the screen (default upper right corner). You can switch up and @@ -25,92 +30,64 @@ The plugin supports four modes: - greyscaled (256 shades of grey) - 256 colors with fixed palette - 128 colors with variable palette -The first mode works with an ordinary vdr installation. If you want to use the -other modes, you'll need to upgrade your VDR to support a 256 color OSD -with the provided patching instruction. The variable palette mode needs more -extensive changes to VDR's source code using the provided patch that gives the -plugin more control over the OSD's palette. You can choose the color depth in -the setup menu. If you didn't patch VDR appropriately, you'll only be able to -choose greyscaled mode. +They all work with an ordinary vdr installation. The plugin has the possibility to choose the PiP size (in the setup menu from -predefined sizes) and position (by moving it around using number keys) as well -as crop dimensions. +predefined sizes) and position (by moving it around using the cursor keys) as +well as crop dimensions. + +ATTENTION: To have the position saved, you have to enter the plugin's setup +menu and hit the ok button. -ATTENTION: To have the position saved, you have to enter the plugin's setup menu -and hit the ok button. +The plugin lets you choose the MPEG frames to decode and display (in the setup +menu). For slower machines it is further possible to set an additional frame +dropping. -From 0.0.3 on the plugin lets you choose the MPEG frames to decode and display -(in the setup menu). For slower machines it is further possible to set an -additional frame dropping. +The plugin is able to show some channel and schedule info in a second window +when switching channels. In setup menu you can change it's position, size and +the amount of information shown. -From 0.0.4 the plugins shows some channel and schedule info in a second window -when switching channels. In setup menu you can change it's position and size. -This works flawlessly in 16 color greyscale mode. If you want to use it in one -of the other provided modes you have to use one of the already mentioned -patches. Otherwise you have to live with wrong colors in this modes. Installation: +------------- -Let's say osdpip's version is 0.0.1 and vdr's version is 1.2.6. If you +Let's say osdpip's version is 0.0.1 and vdr's version is 1.3.8. If you use anything else please exchange the version numbers appropriately (this way I don't have to update this section all the times;) ). -cd vdr-1.2.6/PLUGINS/src +cd vdr-1.3.8/PLUGINS/src tar xvfz vdr-osdpip-0.0.1.tgz ln -s osdpip-0.0.1 osdpip cd ../.. -If you have ffmpeg installed, make plugins should do just fine now, but if you -have it next to your vdr folder (e.g. as the DXR3 plugin needs it), you have -to compile with make FFMPEG_STATIC=1 plugins. Ffmpeg must then be present in a -folder (or symlink) called "ffmpeg". - -NOTE: Patching VDR is not needed if you are using a VDR version greater than -1.3.7. - -Patching VDR: - -NOTE: The next step is not needed if you use the variable color patch provided -below that! - -Now, you have to call your favourite editor to open osdbase.h and jump to line -number 16. I don't provide a patch here because some patches already touch that -area. Well this one's easy, though. Just increase the number of colors in this -line to 256. If you don't want 256 color support, you can skip this part. +If you have a VDR version lower than 1.2.25, you will have to patch it using +the file vdr-osd.diff. This patch fixes a bug in VDR regardings osd usage. -#define MAXNUMCOLORS 256 +patch -p1 < PLUGINS/src/osdpip/patches/vdr-osd.diff -If you want an error free 256 color mode you will have to further modify VDR's -source code using a patch from patches subdirectory. It fixes a bug of all VDR -versions up to 1.3.3. I provide two versions of the patch: -vdr-1.2.6-indexes.diff for a plain VDR installation and -vdr-1.2.6-256-indexes.diff for a version that already has 256 color support. +After applying it you have to recompile your VDR. -To apply this patch call - patch -p1 < PLUGINS/src/osdpip/patches/vdr-1.2.6-indexes.diff -from VDR's source code directory. - -If you want variable palette color mode you will have to further modify VDR's -source code using a patch from patches subdirectory. I provide two versions of -the patch: vdr-1.2.6-palette.diff for a plain VDR installation and -vdr-1.2.6-256-palette.diff for a version that already has 256 color support. - -To apply this patch call - patch -p1 < PLUGINS/src/osdpip/patches/vdr-1.2.6-palette.diff -from VDR's source code directory. - -Now, you have to re-build VDR and Plugins. - -make [options, if necessary] vdr -make [options, if necessary] plugins +If you have ffmpeg installed, "make plugins" should do just fine now, but if +you have it next to your vdr folder (e.g. as the DXR3 plugin needs it), you +have to compile with "make FFMPEG_STATIC=1 plugins". Ffmpeg must then be +present in a folder (or symlink) called "ffmpeg". Controls: - -Up/Down Switch Channel up/down -1-4,6-9 Move box around like with cursor keys -0 Switch back to PiP channel and exit PiP -Red Swap PiP channel with currently viewed channel -Back Exit PiP without switching back -Ok Show/hide channel info window +--------- + +Normal Mode: +Up/Down Switch channel up/down +Left/Right Select channel group (only when info window enabled) +1-9 Select channel (only when info window enabled) +Red Swap PiP channel with currently viewed channel +Green Switch to move mode +Ok Show/hide channel info window +0 Switch back to PiP channel and exit PiP +Back Exit PiP without switching back + +Move Mode: +Cursor keys Move PiP window around +Green Switch to normal mode +0 Switch back to PiP channel and exit PiP +Back Exit PiP without switching back @@ -71,10 +71,18 @@ int cDecoder::Resample(int width, int height) m_Width = width; m_Height = height; +#if LIBAVCODEC_BUILD < 4708 contextResample = img_resample_full_init(m_Width, m_Height, m_Context->width, m_Context->height, OsdPipSetup.CropTop, OsdPipSetup.CropBottom, OsdPipSetup.CropLeft, OsdPipSetup.CropRight); +#else + contextResample = img_resample_full_init(m_Width, m_Height, + m_Context->width, m_Context->height, + OsdPipSetup.CropTop, OsdPipSetup.CropBottom, + OsdPipSetup.CropLeft, OsdPipSetup.CropRight, + 0, 0, 0, 0); +#endif if (!contextResample) { printf("Error initializing resample context.\n"); return -1; @@ -100,7 +108,10 @@ int cDecoder::ConvertToRGB() double cDecoder::AspectRatio() { - //printf("%d %d %f\n", m_Context->width, m_Context->height, m_Context->aspect_ratio); +#if LIBAVCODEC_BUILD < 4687 return m_Context->aspect_ratio; +#else + return av_q2d(m_Context->sample_aspect_ratio) * (double) m_Context->width / (double) m_Context->height; +#endif } @@ -24,12 +24,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Picture-in-Picture", // English @@ -48,12 +44,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Crop left", // English @@ -72,12 +64,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Crop right", // English @@ -96,12 +84,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Crop at top", // English @@ -120,12 +104,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Crop at bottom", // English @@ -144,12 +124,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Color depth", // English @@ -168,12 +144,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Size", // English @@ -192,12 +164,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Frames to display", // English @@ -216,12 +184,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Drop frames", // English @@ -240,12 +204,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Swap FFMPEG output", // English @@ -264,12 +224,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Show info window", // English @@ -280,7 +236,7 @@ const tI18nPhrase Phrases[] = { "", // Português "", // Français "", // Norsk - "Näytä kuvatieto", // Suomi + "Näytä kanavatieto", // Suomi "", // Polski "", // Español "", // Ellinika @@ -288,12 +244,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Info window width", // English @@ -304,7 +256,7 @@ const tI18nPhrase Phrases[] = { "", // Português "", // Français "", // Norsk - "Kuvatiedon leveys", // Suomi + "Kanavatiedon leveys", // Suomi "", // Polski "", // Español "", // Ellinika @@ -312,12 +264,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Info window position", // English @@ -328,7 +276,7 @@ const tI18nPhrase Phrases[] = { "", // Português "", // Français "", // Norsk - "Kuvatiedon sijainti", // Suomi + "Kanavatiedon sijainti", // Suomi "", // Polski "", // Español "", // Ellinika @@ -336,12 +284,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "top left", // English @@ -360,12 +304,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "top right", // English @@ -384,12 +324,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "bottom left", // English @@ -408,12 +344,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "bottom right", // English @@ -432,12 +364,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Greyscale (16)", // English @@ -456,12 +384,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Greyscale (256)", // English @@ -480,12 +404,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Color (256, fixed)", // English @@ -504,12 +424,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Color (128, variable)", // English @@ -528,12 +444,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "X Position", // English @@ -552,12 +464,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "Y Position", // English @@ -576,12 +484,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "automatic", // English @@ -600,12 +504,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "none", // English @@ -624,12 +524,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "1 frame", // English @@ -648,12 +544,8 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif }, { "2 frames", // English @@ -672,12 +564,108 @@ const tI18nPhrase Phrases[] = { "", // Romaneste "", // Magyar "", // Catala -#if VDRVERSNUM > 10302 "", // Russian -# if VDRVERSNUM > 10307 "", // Croatian -# endif -#endif + }, + { + "channel only", // English + "nur Kanal", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "kanava", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala + "", // Russian + "", // Croatian + }, + { + "simple", // English + "einfach", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "lyhyt", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala + "", // Russian + "", // Croatian + }, + { + "complete", // English + "komplett", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "pitkä", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala + "", // Russian + "", // Croatian + }, + { + "Normal mode", // English + "Normaler Modus", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "Normaalitoiminto", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala + "", // Russian + "", // Croatian + }, + { + "Move mode", // English + "Bewegungsmodus", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "Siirtotoiminto", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala + "", // Russian + "", // Croatian }, { NULL } }; @@ -12,6 +12,9 @@ #include <vdr/ringbuffer.h> #include <vdr/remux.h> +#include <vdr/thread.h> + +cMutex Mutex; cOsdPipObject::cOsdPipObject(cDevice *Device, const cChannel *Channel) : cOsdObject(true) @@ -22,14 +25,11 @@ cOsdPipObject::cOsdPipObject(cDevice *Device, const cChannel *Channel) m_Active = false; m_Ready = false; -#if VDRVERSNUM >= 10307 m_Reset = true; -#endif + m_MoveMode = false; m_Width = m_Height = -1; m_Bitmap = NULL; - m_BitmapInfo = NULL; - m_ShowTime = 0; - m_ShowInfo = false; + m_InfoWindow = NULL; m_AlphaBase = 0xFF000000; for (int i = 0; i < 256; i++) @@ -49,8 +49,7 @@ cOsdPipObject::~cOsdPipObject() delete m_ESBuffer; if (m_Bitmap != NULL) delete m_Bitmap; - if (m_BitmapInfo != NULL) - delete m_BitmapInfo; + delete m_InfoWindow; if (m_Osd != NULL) delete m_Osd; } @@ -129,54 +128,62 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) if (!m_Ready) { -#if VDRVERSNUM >= 10307 if (m_Bitmap != NULL) delete m_Bitmap; - if (m_BitmapInfo != NULL) - delete m_BitmapInfo; -#endif + m_Bitmap = NULL; + if (m_InfoWindow != NULL) + delete m_InfoWindow; + m_InfoWindow = NULL; switch (OsdPipSetup.Size) { - case 0: m_Width = 120; m_Height = 96; break; - case 1: m_Width = 160; m_Height = 128; break; - case 2: m_Width = 200; m_Height = 160; break; - case 3: m_Width = 240; m_Height = 192; break; - case 4: m_Width = 280; m_Height = 224; break; - case 5: m_Width = 320; m_Height = 256; break; + case 0: m_Width = 100; m_Height = 80; break; + case 1: m_Width = 120; m_Height = 96; break; + case 2: m_Width = 140; m_Height = 112; break; + case 3: m_Width = 160; m_Height = 128; break; + case 4: m_Width = 180; m_Height = 144; break; + case 5: m_Width = 200; m_Height = 160; break; + case 6: m_Width = 220; m_Height = 176; break; + case 7: m_Width = 240; m_Height = 192; break; + case 8: m_Width = 260; m_Height = 208; break; + case 9: m_Width = 280; m_Height = 224; break; + case 10: m_Width = 300; m_Height = 240; break; } -#if VDRVERSNUM >= 10307 - if (OsdPipSetup.ShowInfo) + if (OsdPipSetup.ShowInfo > 0) { + int infoX = 0; + int infoY = 0; + int infoH = OsdPipSetup.ShowInfo * 30; + switch (OsdPipSetup.InfoPosition) { case kInfoTopLeft: - m_InfoX = Setup.OSDLeft; - m_InfoY = Setup.OSDTop; + infoX = Setup.OSDLeft; + infoY = Setup.OSDTop; break; case kInfoTopRight: - m_InfoX = Setup.OSDLeft + Setup.OSDWidth - OsdPipSetup.InfoWidth; - m_InfoY = Setup.OSDTop; + infoX = Setup.OSDLeft + Setup.OSDWidth - OsdPipSetup.InfoWidth; + infoY = Setup.OSDTop; break; case kInfoBottomLeft: - m_InfoX = Setup.OSDLeft; - m_InfoY = Setup.OSDTop + Setup.OSDHeight - 60; + infoX = Setup.OSDLeft; + infoY = Setup.OSDTop + Setup.OSDHeight - infoH; break; case kInfoBottomRight: - m_InfoX = Setup.OSDLeft + Setup.OSDWidth - OsdPipSetup.InfoWidth; - m_InfoY = Setup.OSDTop + Setup.OSDHeight - 60; + infoX = Setup.OSDLeft + Setup.OSDWidth - OsdPipSetup.InfoWidth; + infoY = Setup.OSDTop + Setup.OSDHeight - infoH; break; } tArea areas[] = { { OsdPipSetup.XPosition, OsdPipSetup.YPosition, OsdPipSetup.XPosition + m_Width - 1, OsdPipSetup.YPosition + m_Height - 1, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8 }, - { m_InfoX, m_InfoY, m_InfoX + OsdPipSetup.InfoWidth - 1, m_InfoY + 60 - 1, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8 } + { infoX, infoY, infoX + OsdPipSetup.InfoWidth - 1, infoY + infoH - 1, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8 } }; if (m_Osd->CanHandleAreas(areas, 2) == oeOk) m_Osd->SetAreas(areas, 2); else m_Osd->SetAreas(areas, 1); m_Bitmap = new cBitmap(m_Width, m_Height, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8); - m_BitmapInfo = new cBitmap(OsdPipSetup.InfoWidth, 60, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8); + m_InfoWindow = new cOsdInfoWindow(m_Osd, m_Palette, infoX, infoY); } else { @@ -188,6 +195,7 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) m_Bitmap = new cBitmap(m_Width, m_Height, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8); } + Mutex.Lock(); if (OsdPipSetup.ColorDepth == kDepthGrey256) { for (int i = 0; i < 256; i++) @@ -207,59 +215,7 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) m_Palette[0] = 0xFD000000; m_Palette[255] = 0xFDFFFFFF; } -#else - if (OsdPipSetup.ShowInfo) - { - int x = 0; - int y = 0; - switch (OsdPipSetup.InfoPosition) - { - case kInfoTopLeft: - x = (720 - (Setup.OSDwidth * cOsd::CellWidth())) / 2; - y = (576 - (Setup.OSDheight * cOsd::LineHeight())) / 2; - break; - case kInfoTopRight: - x = (720 + (Setup.OSDwidth * cOsd::CellWidth())) / 2 - OsdPipSetup.InfoWidth; - y = (576 - (Setup.OSDheight * cOsd::LineHeight())) / 2; - break; - case kInfoBottomLeft: - x = (720 - (Setup.OSDwidth * cOsd::CellWidth())) / 2; - y = (576 + (Setup.OSDheight * cOsd::LineHeight())) / 2 - 60; - break; - case kInfoBottomRight: - x = (720 + (Setup.OSDwidth * cOsd::CellWidth())) / 2 - OsdPipSetup.InfoWidth; - y = (576 + (Setup.OSDheight * cOsd::LineHeight())) / 2 - 60; - break; - } - m_WindowInfo = m_Osd->Create(x, y, OsdPipSetup.InfoWidth, 60, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8, false, false); - m_BitmapInfo = new cBitmap(OsdPipSetup.InfoWidth, 60, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8, false); - } - m_Window = m_Osd->Create(OsdPipSetup.XPosition, OsdPipSetup.YPosition, - m_Width, m_Height, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8, false); - m_Bitmap = new cBitmap(m_Width, m_Height, - OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8, false); - if (OsdPipSetup.ColorDepth == kDepthGrey256 || - OsdPipSetup.ColorDepth == kDepthColor256fix) - { - for (int i = 0; i < 256; i++) - { - if (OsdPipSetup.ColorDepth == kDepthGrey256) - m_Palette[i] = m_AlphaBase | (i << 16) | (i << 8) | i; - else - m_Palette[i] = m_AlphaBase | quantizer->OutputPalette()[i]; - } - for (int i = 0; i < 256; i++) - { - m_Bitmap->SetColor(i, (eDvbColor) m_Palette[i]); - m_BitmapInfo->SetColor(i, (eDvbColor) m_Palette[i]); - } - } - if (OsdPipSetup.ColorDepth == kDepthColor128var) - { - m_Palette[0] = 0xFF000000; - m_Palette[255] = 0xFFFFFFFF; - } -#endif + Mutex.Unlock(); } if (decoder.AspectRatio() > 0.1) @@ -274,14 +230,8 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) if (OsdPipSetup.ColorDepth == kDepthGrey16) { -#if VDRVERSNUM >= 10307 m_Bitmap->DrawRectangle(0, 0, m_Width - 1, (m_Height - height) / 2 - 1, m_Palette[0]); m_Bitmap->DrawRectangle(0, (m_Height + height) / 2, m_Width - 1, m_Height - 1, m_Palette[0]); -#else - m_Bitmap->Clear(); - m_Bitmap->Fill(0, 0, m_Width - 1, (m_Height - height) / 2 - 1, clrBlack); - m_Bitmap->Fill(0, (m_Height + height) / 2, m_Width - 1, m_Height - 1, clrBlack); -#endif outputImage = decoder.PicResample()->data[0]; for (int y = 0; y < height; y++) { @@ -289,36 +239,22 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) { value = outputImage[y * m_Width + x]; value = value & 0xF0; - //value = value / 16; - //value = value * 16; value = m_AlphaBase | (value << 16) | (value << 8) | value; -#if VDRVERSNUM >= 10307 m_Bitmap->DrawPixel(x, y + (m_Height - height) / 2, value); -#else - m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) value); -#endif } } } if (OsdPipSetup.ColorDepth == kDepthGrey256) { outputImage = decoder.PicResample()->data[0]; -#if VDRVERSNUM >= 10307 m_Bitmap->DrawRectangle(0, 0, m_Width - 1, m_Height - 1, m_Palette[0]); for (int i = 0; i < 256; i++) m_Bitmap->SetColor(i, m_Palette[i]); -#else - m_Bitmap->Fill(0, 0, m_Width - 1, m_Height - 1, (eDvbColor) m_Palette[0]); -#endif for (int y = 0; y < height; y++) { for (int x = 0; x < m_Width; x++) { -#if VDRVERSNUM >= 10307 m_Bitmap->SetIndex(x, y + (m_Height - height) / 2, outputImage[y * m_Width + x]); -#else - m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) m_Palette[outputImage[y * m_Width + x]]); -#endif } } } @@ -351,42 +287,30 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) outputImage = quantizer->OutputImage(); if (OsdPipSetup.ColorDepth == kDepthColor256fix) { -#if VDRVERSNUM >= 10307 m_Bitmap->DrawRectangle(0, 0, m_Width - 1, m_Height - 1, m_Palette[0]); for (int i = 0; i < 256; i++) m_Bitmap->SetColor(i, m_Palette[i]); -#else - m_Bitmap->Fill(0, 0, m_Width - 1, m_Height - 1, (eDvbColor) m_Palette[0]); -#endif for (int y = 0; y < height; y++) { for (int x = 0; x < m_Width; x++) { -#if VDRVERSNUM >= 10307 m_Bitmap->SetIndex(x, y + (m_Height - height) / 2, outputImage[y * m_Width + x] + 1); -#else - m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) m_Palette[outputImage[y * m_Width + x]]); -#endif } } } else { + Mutex.Lock(); for (int i = 0; i < 127; i++) { m_Palette[m_PaletteStart + i] = outputPalette[i]; m_Palette[m_PaletteStart + i] |= m_AlphaBase; } + Mutex.Unlock(); -#if VDRVERSNUM >= 10307 m_Bitmap->DrawRectangle(0, 0, m_Width - 1, m_Height - 1, m_Palette[0]); for (int i = 0; i < 256; i++) m_Bitmap->SetColor(i, m_Palette[i]); -#else - for (int i = 0; i < 256; i++) - m_Bitmap->SetColor(i, (eDvbColor) m_Palette[i]); - m_Bitmap->Fill(0, 0, m_Width - 1, m_Height - 1, (eDvbColor) m_Palette[0]); -#endif for (int y = 0; y < height; y++) { for (int x = 0; x < m_Width; x++) @@ -398,33 +322,28 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) if (m_PaletteStart == 1) { m_PaletteStart = 128; -#if VDRVERSNUM >= 10307 m_AlphaBase = 0xFE000000; -#endif } else { m_PaletteStart = 1; -#if VDRVERSNUM >= 10307 m_AlphaBase = 0xFF000000; -#endif } } } if (!m_Ready) { if (OsdPipSetup.ShowInfo) - ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel())); + { + m_InfoWindow->SetChannel(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel())); + m_InfoWindow->Show(); + } m_Ready = true; } -#if VDRVERSNUM >= 10307 + Mutex.Lock(); m_Osd->DrawBitmap(OsdPipSetup.XPosition, OsdPipSetup.YPosition, *m_Bitmap); -#else - m_Osd->Clear(); - m_Osd->SetBitmap(OsdPipSetup.XPosition, OsdPipSetup.YPosition, - *m_Bitmap); -#endif m_Osd->Flush(); + Mutex.Unlock(); } void cOsdPipObject::Action(void) @@ -446,7 +365,6 @@ void cOsdPipObject::Action(void) while (m_Active) { -#if VDRVERSNUM >= 10307 if (m_Reset) { if (m_Osd) @@ -457,7 +375,6 @@ void cOsdPipObject::Action(void) m_Ready = false; m_Reset = false; } -#endif if (m_FrameDrop == -1) { while ((frame = m_ESBuffer->Get()) != NULL) @@ -499,34 +416,6 @@ void cOsdPipObject::Action(void) } } } - if (m_ShowTime != 0) - { - if (m_ShowInfo) - { -#if VDRVERSNUM >= 10307 - ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel())); - m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_BitmapInfo); -#else - ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel())); - m_Osd->SetBitmap(0, 0, *m_BitmapInfo, m_WindowInfo); - m_Osd->Show(m_WindowInfo); -#endif - m_Osd->Flush(); - m_ShowInfo = false; - } - time_t currentTime; - time(¤tTime); - if (currentTime - m_ShowTime > 2) { -#if VDRVERSNUM >= 10307 - ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel()), false); - m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_BitmapInfo); - m_Osd->Flush(); -#else - m_Osd->Hide(m_WindowInfo); -#endif - m_ShowTime = 0; - } - } } if (OsdPipSetup.ColorDepth == kDepthColor128var || @@ -539,120 +428,86 @@ void cOsdPipObject::Action(void) void cOsdPipObject::Show(void) { -#if VDRVERSNUM >= 10307 Start(); -#else - m_Osd = cOsd::OpenRaw(0, 0); - if (m_Osd) - Start(); -#endif } eOSState cOsdPipObject::ProcessKey(eKeys Key) { eOSState state = cOsdObject::ProcessKey(Key); - if (state == osUnknown) { - switch (Key & ~k_Repeat) { - case k0: Channels.SwitchTo(m_Channel->Number()); - case kBack: return osEnd; - - case kRed: SwapChannels(); + if (state == osUnknown) + { + if (m_MoveMode) + { + switch (Key & ~k_Repeat) + { + case k0: + Channels.SwitchTo(m_Channel->Number()); + case kBack: + return osEnd; + case kGreen: + m_MoveMode = false; + if (m_Ready && m_InfoWindow) + { + m_InfoWindow->SetMessage(tr("Normal mode")); + m_InfoWindow->Show(); + } + break; + case kUp: + if (OsdPipSetup.YPosition >= 10) + OsdPipSetup.YPosition -= 10; + m_Reset = true; + break; + case kLeft: + if (OsdPipSetup.XPosition >= 10) + OsdPipSetup.XPosition -= 10; + m_Reset = true; + break; + case kRight: + if (OsdPipSetup.XPosition + m_Width <= 720 - 10) + OsdPipSetup.XPosition += 10; + m_Reset = true; + break; + case kDown: + if (OsdPipSetup.YPosition + m_Height <= 576 - 10) + OsdPipSetup.YPosition += 10; + m_Reset = true; + break; + } + state = osContinue; + } + else + { + if (m_Ready && m_InfoWindow) + state = m_InfoWindow->ProcessKey(Key); + } + } + if (state == osUnknown) + { + switch (Key & ~k_Repeat) + { + case k0: + Channels.SwitchTo(m_Channel->Number()); + case kBack: + return osEnd; + case kRed: + SwapChannels(); break; - - case k1...k9: -#if VDRVERSNUM >= 10307 - switch (Key & ~k_Repeat) { - case k1: - if (OsdPipSetup.XPosition >= Setup.OSDLeft + 10) OsdPipSetup.XPosition -= 10; - if (OsdPipSetup.YPosition >= Setup.OSDTop + 10) OsdPipSetup.YPosition -= 10; - break; - case k2: - if (OsdPipSetup.YPosition >= Setup.OSDTop + 10) OsdPipSetup.YPosition -= 10; - break; - case k3: - if (OsdPipSetup.XPosition + m_Width <= Setup.OSDLeft + Setup.OSDWidth - 10) - OsdPipSetup.XPosition += 10; - if (OsdPipSetup.YPosition >= Setup.OSDTop + 10) OsdPipSetup.YPosition -= 10; - break; - case k4: - if (OsdPipSetup.XPosition >= Setup.OSDLeft + 10) OsdPipSetup.XPosition -= 10; - break; - case k6: - if (OsdPipSetup.XPosition + m_Width <= Setup.OSDLeft + Setup.OSDWidth - 10) - OsdPipSetup.XPosition += 10; - break; - case k7: - if (OsdPipSetup.XPosition >= Setup.OSDLeft + 10) OsdPipSetup.XPosition -= 10; - if (OsdPipSetup.YPosition + m_Height <= Setup.OSDTop + Setup.OSDHeight - 10) - OsdPipSetup.YPosition += 10; - break; - case k8: - if (OsdPipSetup.YPosition + m_Height <= Setup.OSDTop + Setup.OSDHeight - 10) - OsdPipSetup.YPosition += 10; - break; - case k9: - if (OsdPipSetup.XPosition + m_Width <= Setup.OSDLeft + Setup.OSDWidth - 10) - OsdPipSetup.XPosition += 10; - if (OsdPipSetup.YPosition + m_Height <= Setup.OSDTop + Setup.OSDHeight - 10) - OsdPipSetup.YPosition += 10; - break; - } - m_Reset = true; -#else - switch (Key & ~k_Repeat) { - case k1: - if (OsdPipSetup.XPosition > 9) OsdPipSetup.XPosition -= 10; - if (OsdPipSetup.YPosition > 9) OsdPipSetup.YPosition -= 10; - break; - case k2: - if (OsdPipSetup.YPosition > 9) OsdPipSetup.YPosition -= 10; - break; - case k3: - if (OsdPipSetup.XPosition < Setup.OSDwidth * cOsd::CellWidth()) - OsdPipSetup.XPosition += 10; - if (OsdPipSetup.YPosition > 9) OsdPipSetup.YPosition -= 10; - break; - case k4: - if (OsdPipSetup.XPosition > 9) OsdPipSetup.XPosition -= 10; - break; - case k6: - if (OsdPipSetup.XPosition < Setup.OSDwidth * cOsd::CellWidth()) - OsdPipSetup.XPosition += 10; - break; - case k7: - if (OsdPipSetup.XPosition > 9) OsdPipSetup.XPosition -= 10; - if (OsdPipSetup.YPosition < Setup.OSDheight * cOsd::LineHeight()) - OsdPipSetup.YPosition += 10; - break; - case k8: - if (OsdPipSetup.YPosition < Setup.OSDheight * cOsd::LineHeight()) - OsdPipSetup.YPosition += 10; - break; - case k9: - if (OsdPipSetup.XPosition < Setup.OSDwidth * cOsd::CellWidth()) - OsdPipSetup.XPosition += 10; - if (OsdPipSetup.YPosition < Setup.OSDheight * cOsd::LineHeight()) - OsdPipSetup.YPosition += 10; - break; + case kGreen: + m_MoveMode = true; + if (m_Ready && m_InfoWindow) + { + m_InfoWindow->SetMessage(tr("Move mode")); + m_InfoWindow->Show(); } - m_Osd->Relocate(m_Window, OsdPipSetup.XPosition, OsdPipSetup.YPosition); -#endif break; - case kUp: case kDown: cDevice::SwitchChannel(NORMALKEY(Key) == kUp ? 1 : -1); break; - case kOk: - if (OsdPipSetup.ShowInfo) { - if (m_ShowTime != 0) { - m_ShowTime -= 2; - } else { - //ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel())); - time(&m_ShowTime); - m_ShowInfo = true; - } + if (OsdPipSetup.ShowInfo) + { + m_InfoWindow->Show(); } break; default: @@ -669,122 +524,30 @@ void cOsdPipObject::ChannelSwitch(const cDevice * device, int channelNumber) return; if (channelNumber == 0) return; + if (channelNumber != cDevice::CurrentChannel()) + return; if (!m_Ready) return; if (OsdPipSetup.ShowInfo) { - //ShowChannelInfo(Channels.GetByNumber(device->CurrentChannel())); - time(&m_ShowTime); - m_ShowInfo = true; + m_InfoWindow->SetChannel(Channels.GetByNumber(channelNumber)); + m_InfoWindow->Show(); } } -void cOsdPipObject::ShowChannelInfo(const cChannel * channel, bool show) +void cOsdPipObject::OsdClear(void) { - char line1[100] = ""; - char line2[100] = ""; - - sprintf(line1, "%d %s", channel->Number(), channel->Name()); - -#if VDRVERSNUM >= 10300 - const cEvent * present = NULL; - cSchedulesLock schedulesLock; - const cSchedules * schedules = cSchedules::Schedules(schedulesLock); - if (schedules) { - const cSchedule * schedule = schedules->GetSchedule(channel->GetChannelID()); - if (schedule) { - const char * presentTitle = NULL; - if ((present = schedule->GetPresentEvent()) != NULL) { - presentTitle = present->Title(); - if (!isempty(presentTitle)) { - sprintf(line2, "%s %s", (const char*)present->GetTimeString(), presentTitle); -#if VDRVERSNUM < 10307 - while (m_Osd->Width(line2) > OsdPipSetup.InfoWidth - 10) { - line2[strlen(line2) - 1] = 0; - } -#endif - } - } - } - } -#else - const cEventInfo * present = NULL; - cMutexLock mutexLock; - const cSchedules * schedules = cSIProcessor::Schedules(mutexLock); - if (schedules) { - const cSchedule * schedule = schedules->GetSchedule(channel->GetChannelID()); - if (schedule) { - const char * presentTitle = NULL; - if ((present = schedule->GetPresentEvent()) != NULL) { - presentTitle = present->GetTitle(); - if (!isempty(presentTitle)) { - sprintf(line2, "%s %s", present->GetTimeString(), presentTitle); - while (m_Osd->Width(line2) > OsdPipSetup.InfoWidth - 10) { - line2[strlen(line2) - 1] = 0; - } - } - } - } - } -#endif -#if VDRVERSNUM >= 10307 - if (OsdPipSetup.ColorDepth == kDepthGrey16) - { - if (show) - { - m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, clrBlack); - const cFont *font = cFont::GetFont(fontOsd); - m_BitmapInfo->DrawText(0, 0, line1, clrWhite, clrBlack, font, OsdPipSetup.InfoWidth, 30); - m_BitmapInfo->DrawText(0, 30, line2, clrWhite, clrBlack, font, OsdPipSetup.InfoWidth, 30); - time(&m_ShowTime); - m_ShowInfo = true; - } - else - { - m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, clrTransparent); - } - } - else + //printf("OsdClear\n"); +} + +void cOsdPipObject::OsdStatusMessage(const char * message) +{ + if (!m_Ready) + return; + if (OsdPipSetup.ShowInfo) { - if (show) - { - m_Palette[0] = 0xFD000000; - m_Palette[255] = 0x00FFFFFF; - m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, m_Palette[0]); - for (int i = 0; i < 256; i++) - m_BitmapInfo->SetColor(i, m_Palette[i]); - m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_BitmapInfo); - m_Osd->Flush(); - m_Palette[255] = 0xFDFFFFFF; - m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, m_Palette[0]); - for (int i = 0; i < 256; i++) - m_BitmapInfo->SetColor(i, m_Palette[i]); - const cFont *font = cFont::GetFont(fontOsd); - m_BitmapInfo->DrawText(0, 0, line1, m_Palette[255], m_Palette[0], font, OsdPipSetup.InfoWidth, 30); - m_BitmapInfo->DrawText(0, 30, line2, m_Palette[255], m_Palette[0], font, OsdPipSetup.InfoWidth, 30); - time(&m_ShowTime); - m_ShowInfo = true; - } - else - { - m_Palette[0] = 0xFD000000; - m_Palette[255] = 0x00FFFFFF; - m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, m_Palette[0]); - for (int i = 0; i < 256; i++) - m_BitmapInfo->SetColor(i, m_Palette[i]); - m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 30 - 1, m_Palette[255]); - m_BitmapInfo->DrawRectangle(0, 30, OsdPipSetup.InfoWidth - 1, 60 - 1, m_Palette[255]); - } + m_InfoWindow->SetMessage(message); + m_InfoWindow->Show(); } -#else - if (OsdPipSetup.ColorDepth != kDepthGrey16) - for (int i = 0; i < 256; i++) - m_BitmapInfo->SetColor(i, (eDvbColor) m_Palette[i]); - m_BitmapInfo->Fill(0, 0, OsdPipSetup.InfoWidth, 60, (eDvbColor) 0xFF000000); - m_BitmapInfo->Text(0, 0, line1, (eDvbColor) 0xFFFFFFFF, (eDvbColor) 0xFF000000); - m_BitmapInfo->Text(0, 30, line2, (eDvbColor) 0xFFFFFFFF, (eDvbColor) 0xFF000000); - time(&m_ShowTime); - m_ShowInfo = true; -#endif } @@ -15,6 +15,7 @@ #include <vdr/receiver.h> #include "decoder.h" +#include "osd_info.h" class cRingBufferFrame; class cOsdPipReceiver; @@ -22,31 +23,17 @@ class cQuantize; class cOsdPipObject: public cOsdObject, public cThread, public cStatus { private: -#if VDRVERSNUM >= 10307 cOsd *m_Osd; -#else - cOsdBase *m_Osd; - tWindowHandle m_Window; - tWindowHandle m_WindowInfo; -#endif cRingBufferFrame *m_ESBuffer; cOsdPipReceiver *m_Receiver; const cChannel *m_Channel; cBitmap * m_Bitmap; - cBitmap * m_BitmapInfo; -#if VDRVERSNUM >= 10307 - int m_InfoX; - int m_InfoY; -#endif - - time_t m_ShowTime; - bool m_ShowInfo; + cOsdInfoWindow * m_InfoWindow; bool m_Active; bool m_Ready; -#if VDRVERSNUM >= 10307 bool m_Reset; -#endif + bool m_MoveMode; int m_Width, m_Height; int m_FrameDrop; @@ -59,12 +46,13 @@ private: void ProcessImage(unsigned char * data, int length); - void ShowChannelInfo(const cChannel * channel, bool show = true); void Stop(void); void SwapChannels(void); protected: virtual void Action(void); virtual void ChannelSwitch(const cDevice * device, int channelNumber); + virtual void OsdClear(void); + virtual void OsdStatusMessage(const char * message); public: cOsdPipObject(cDevice *Device, const cChannel *Channel); diff --git a/osd_info.c b/osd_info.c new file mode 100644 index 0000000..b0c8e31 --- /dev/null +++ b/osd_info.c @@ -0,0 +1,335 @@ +#include "osd_info.h" +#include "setup.h" + +#include <vdr/thread.h> + +#define DIRECTCHANNELTIMEOUT 1 +#define INFOTIMEOUT 5 + +extern cMutex Mutex; + +cOsdInfoWindow::cOsdInfoWindow(cOsd * osd, unsigned int * palette, int x, int y) +: m_Osd(osd), + m_Palette(palette), + m_InfoX(x), + m_InfoY(y), + m_Shown(false), + m_LastTime(0), + m_Number(0), + m_Group(-1), + m_WithInfo(false), + m_Message(NULL), + m_Channel(NULL) +{ + m_Bitmap = new cBitmap(OsdPipSetup.InfoWidth, OsdPipSetup.ShowInfo * 30, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8); +} + +cOsdInfoWindow::~cOsdInfoWindow() +{ + delete m_Bitmap; +} + +void cOsdInfoWindow::SetMessage(const char * message) +{ + m_Message = message; +} + +void cOsdInfoWindow::SetChannel(const cChannel * channel) +{ + m_Channel = channel; + m_WithInfo = true; + m_Number = 0; + m_Group = -1; +} + +void cOsdInfoWindow::Show() +{ + char channel[101] = ""; + char presentName[101] = ""; + char presentTime[10] = ""; + char followingName[101] = ""; + char followingTime[10] = ""; + + if (m_Message) + { + snprintf(channel, 100, "%s", m_Message); + m_Message = NULL; + } + else if (m_Channel) + { + if (m_Channel->GroupSep()) + snprintf(channel, 100, "%s", m_Channel->Name()); + else + snprintf(channel, 100, "%d%s %s", m_Channel->Number(), m_Number ? "-" : "", m_Channel->Name()); + if (m_WithInfo) + { + const cEvent * present = NULL; + const cEvent * following = NULL; + cSchedulesLock schedulesLock; + const cSchedules * schedules = cSchedules::Schedules(schedulesLock); + if (schedules) + { + const cSchedule * schedule = schedules->GetSchedule(m_Channel->GetChannelID()); + if (schedule) + { + if ((present = schedule->GetPresentEvent()) != NULL) + { + const char * presentTitle = present->Title(); + if (!isempty(presentTitle)) + { + sprintf(presentTime, "%s", (const char *) present->GetTimeString()); + sprintf(presentName, "%s", (const char *) presentTitle); + } + } + if ((following = schedule->GetFollowingEvent()) != NULL) + { + const char * followingTitle = following->Title(); + if (!isempty(followingTitle)) + { + sprintf(followingTime, "%s", (const char *) following->GetTimeString()); + sprintf(followingName, "%s", (const char *) followingTitle); + } + } + } + } + } + } + else if (m_Number) + snprintf(channel, 100, "%d-", m_Number); + else + snprintf(channel, 100, "%s", tr("*** Invalid Channel ***")); + + Mutex.Lock(); + if (OsdPipSetup.ColorDepth == kDepthGrey16) + { + m_Bitmap->DrawRectangle(0, 0, m_Bitmap->Width() - 1, m_Bitmap->Height() - 1, clrBlack); + const cFont * font = cFont::GetFont(fontOsd); + + m_Bitmap->DrawText(0, 0, channel, clrWhite, clrBlack, font, m_Bitmap->Width(), 29); + if (m_Bitmap->Height() > 30) + { + m_Bitmap->DrawText(0, 30, presentTime, clrWhite, clrBlack, font, 80, 29); + m_Bitmap->DrawText(80, 30, presentName, clrWhite, clrBlack, font, m_Bitmap->Width() - 80, 29); + } + if (m_Bitmap->Height() > 2*30) + { + m_Bitmap->DrawText(0, 2*30, followingTime, clrWhite, clrBlack, font, 80, 29); + m_Bitmap->DrawText(80, 2*30, followingName, clrWhite, clrBlack, font, m_Bitmap->Width() - 80, 29); + } + } + else + { + m_Palette[0] = 0xFD000000; + m_Palette[255] = 0x00FFFFFF; + m_Bitmap->DrawRectangle(0, 0, m_Bitmap->Width() - 1, m_Bitmap->Height() - 1, m_Palette[0]); + for (int i = 0; i < 256; i++) + m_Bitmap->SetColor(i, m_Palette[i]); + m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_Bitmap); + m_Osd->Flush(); + m_Palette[255] = 0xFDFFFFFF; + m_Bitmap->DrawRectangle(0, 0, m_Bitmap->Width() - 1, m_Bitmap->Height() - 1, m_Palette[0]); + for (int i = 0; i < 256; i++) + m_Bitmap->SetColor(i, m_Palette[i]); + const cFont *font = cFont::GetFont(fontOsd); + m_Bitmap->DrawText(0, 0, channel, m_Palette[255], m_Palette[0], font, m_Bitmap->Width(), 29); + if (m_Bitmap->Height() > 30) + { + m_Bitmap->DrawText(0, 30, presentTime, m_Palette[255], m_Palette[0], font, 80, 29); + m_Bitmap->DrawText(80, 30, presentName, m_Palette[255], m_Palette[0], font, m_Bitmap->Width() - 80, 29); + } + if (m_Bitmap->Height() > 2*30) + { + m_Bitmap->DrawText(0, 2*30, followingTime, m_Palette[255], m_Palette[0], font, 80, 29); + m_Bitmap->DrawText(80, 2*30, followingName, m_Palette[255], m_Palette[0], font, m_Bitmap->Width() - 80, 29); + } + } + m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_Bitmap); + m_Osd->Flush(); + m_Shown = true; + time(&m_LastTime); + Mutex.Unlock(); +} + +void cOsdInfoWindow::Hide() +{ + Mutex.Lock(); + if (OsdPipSetup.ColorDepth == kDepthGrey16) + { + m_Bitmap->DrawRectangle(0, 0, m_Bitmap->Width() - 1, m_Bitmap->Height() - 1, clrTransparent); + } + else + { + m_Palette[0] = 0xFD000000; + m_Palette[255] = 0x00FFFFFF; + m_Bitmap->DrawRectangle(0, 0, m_Bitmap->Width() - 1, m_Bitmap->Height() - 1, m_Palette[0]); + for (int i = 0; i < 256; i++) + m_Bitmap->SetColor(i, m_Palette[i]); + m_Bitmap->DrawRectangle(0, 0, m_Bitmap->Width()/2 - 1, m_Bitmap->Height() - 1, m_Palette[255]); + m_Bitmap->DrawRectangle(m_Bitmap->Width()/2, 0, m_Bitmap->Width() - 1, m_Bitmap->Height() - 1, m_Palette[255]); + } + m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_Bitmap); + m_Osd->Flush(); + m_Shown = false; + Mutex.Unlock(); +} + +eOSState cOsdInfoWindow::ProcessKey(eKeys key) +{ + time_t curTime; + + switch (key) + { + case k0: + if (m_Number == 0) + { + m_Group = -1; + Hide(); + return osUnknown; + } + case k1 ... k9: + if (m_Number >= 0) + { + m_Number = m_Number * 10 + key - k0; + if (m_Number > 0) + { + cChannel * channel = Channels.GetByNumber(m_Number); + m_Channel = channel; + m_WithInfo = false; + Show(); + // Lets see if there can be any useful further input: + int n = channel ? m_Number * 10 : 0; + while (channel && (channel = Channels.Next(channel)) != NULL) + { + if (!channel->GroupSep()) + { + if (n <= channel->Number() && channel->Number() <= n + 9) + { + n = 0; + break; + } + if (channel->Number() > n) + n *= 10; + } + } + if (n > 0) + { + // This channel is the only one that fits the input, so let's take it right away: + int number = m_Number; + m_Number = 0; + m_Group = -1; + m_WithInfo = true; + Channels.SwitchTo(number); + } + } + } + return osContinue; + case kLeft|k_Repeat: + case kLeft: + case kRight|k_Repeat: + case kRight: + m_WithInfo = false; + if (m_Group < 0) + { + cChannel * channel = Channels.GetByNumber(cDevice::CurrentChannel()); + if (channel) + m_Group = channel->Index(); + } + if (m_Group >= 0) + { + int SaveGroup = m_Group; + if (NORMALKEY(key) == kRight) + m_Group = Channels.GetNextGroup(m_Group); + else + m_Group = Channels.GetPrevGroup(m_Group < 1 ? 1 : m_Group); + if (m_Group < 0) + m_Group = SaveGroup; + cChannel * channel = Channels.Get(m_Group); + if (channel) + { + m_Channel = channel; + Show(); + if (!channel->GroupSep()) + m_Group = -1; + } + } + return osContinue; + case kUp|k_Repeat: + case kUp: + case kDown|k_Repeat: + case kDown: + cDevice::SwitchChannel(NORMALKEY(key) == kUp ? 1 : -1); + // no break here + case kChanUp|k_Repeat: + case kChanUp: + case kChanDn|k_Repeat: + case kChanDn: + m_WithInfo = true; + m_Number = 0; + m_Group = -1; + //Show(); + return osContinue; + case kNone: + if (Shown()) + { + time(&curTime); + if (m_Number && curTime - m_LastTime > DIRECTCHANNELTIMEOUT) + { + if (Channels.GetByNumber(m_Number)) + { + int number = m_Number; + m_Number = 0; + m_Group = -1; + Channels.SwitchTo(number); + } + else + { + m_Number = 0; + m_Group = -1; + m_Channel = NULL; + Show(); + m_Channel = Channels.Get(cDevice::CurrentChannel()); + m_WithInfo = true; + return osContinue; + } + return osContinue; + } + } + break; + case kOk: + if (Shown()) + { + if (m_Group >= 0) + { + int group = m_Group; + m_Group = -1; + m_Number = 0; + Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(group))->Number()); + } + else + { + m_Group = -1; + m_Number = 0; + m_Channel = Channels.Get(cDevice::CurrentChannel()); + m_WithInfo = true; + Hide(); + } + return osContinue; + } + break; + default: + return osUnknown; + } + if (Shown()) + { + time(&curTime); + if (curTime - m_LastTime >= INFOTIMEOUT) + { + m_Group = -1; + m_Number = 0; + Hide(); + } + return osContinue; + } + return osUnknown; +} + diff --git a/osd_info.h b/osd_info.h new file mode 100644 index 0000000..e315ce1 --- /dev/null +++ b/osd_info.h @@ -0,0 +1,45 @@ +/* + * OSD Picture in Picture plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + */ + +#ifndef VDR_OSDPIP_OSD_INFO_H +#define VDR_OSDPIP_OSD_INFO_H + +#include <sys/time.h> + +#include <vdr/channels.h> +#include <vdr/osd.h> +#include <vdr/osdbase.h> + + +class cOsdInfoWindow +{ +private: + cOsd * m_Osd; + unsigned int * m_Palette; + cBitmap * m_Bitmap; + int m_InfoX; + int m_InfoY; + bool m_Shown; + time_t m_LastTime; + + int m_Number; + int m_Group; + bool m_WithInfo; + const char * m_Message; + const cChannel * m_Channel; +public: + cOsdInfoWindow(cOsd * osd, unsigned int * palette, int x, int y); + ~cOsdInfoWindow(); + void SetMessage(const char * message); + void SetChannel(const cChannel * channel); + void Show(); + void Hide(); + eOSState ProcessKey(eKeys key); + + bool Shown() const { return m_Shown; } +}; + +#endif @@ -19,7 +19,7 @@ extern "C" #include <vdr/plugin.h> -static const char *VERSION = "0.0.7.2"; +static const char *VERSION = "0.0.8"; static const char *DESCRIPTION = "OSD Picture-in-Picture"; static const char *MAINMENUENTRY = "Picture-in-Picture"; diff --git a/patches/vdr-1.2.6-256-indexes.diff b/patches/vdr-1.2.6-256-indexes.diff deleted file mode 100644 index 5b5b5fa..0000000 --- a/patches/vdr-1.2.6-256-indexes.diff +++ /dev/null @@ -1,76 +0,0 @@ ---- vdrold/osdbase.c 2004-06-13 13:52:47.000000000 +0200 -+++ vdr-1.2.6/osdbase.c 2004-06-13 13:49:23.000000000 +0200 -@@ -116,7 +116,7 @@ - fontType = fontOsd; - font = NULL; - if (width > 0 && height > 0) { -- bitmap = MALLOC(char, width * height); -+ bitmap = MALLOC(unsigned char, width * height); - if (bitmap) { - Clean(); - memset(bitmap, 0x00, width * height); -@@ -188,7 +188,7 @@ - dirtyY2 = -1; - } - --void cBitmap::SetIndex(int x, int y, char Index) -+void cBitmap::SetIndex(int x, int y, unsigned char Index) - { - if (bitmap) { - if (0 <= x && x < width && 0 <= y && y < height) { -@@ -269,7 +269,7 @@ - Fill(0, 0, width - 1, height - 1, clrBackground); - } - --const char *cBitmap::Data(int x, int y) -+const unsigned char *cBitmap::Data(int x, int y) - { - return &bitmap[y * width + x]; - } -@@ -329,7 +329,7 @@ - cBitmap::Text(x, y, s, ColorFg, ColorBg); - } - --const char *cWindow::Data(int x, int y) -+const unsigned char *cWindow::Data(int x, int y) - { - return cBitmap::Data(x, y); - } ---- vdrold/osdbase.h 2004-06-13 13:52:47.000000000 +0200 -+++ vdr-1.2.6/osdbase.h 2004-06-13 13:48:49.000000000 +0200 -@@ -75,7 +75,7 @@ - private: - cFont *font; - eDvbFont fontType; -- char *bitmap; -+ unsigned char *bitmap; - bool clearWithBackground; - protected: - int width, height; -@@ -86,7 +86,7 @@ - bool ClearWithBackground(void) { return clearWithBackground; } - eDvbFont SetFont(eDvbFont Font); - bool Dirty(int &x1, int &y1, int &x2, int &y2); -- void SetIndex(int x, int y, char Index); -+ void SetIndex(int x, int y, unsigned char Index); - void SetPixel(int x, int y, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); - int Width(void) { return width; } -@@ -97,7 +97,7 @@ - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void Clean(void); - void Clear(void); -- const char *Data(int x, int y); -+ const unsigned char *Data(int x, int y); - }; - - #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 -@@ -122,7 +122,7 @@ - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); - void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); -- const char *Data(int x, int y); -+ const unsigned char *Data(int x, int y); - }; - - typedef int tWindowHandle; diff --git a/patches/vdr-1.2.6-256-palette.diff b/patches/vdr-1.2.6-256-palette.diff deleted file mode 100644 index aab4f69..0000000 --- a/patches/vdr-1.2.6-256-palette.diff +++ /dev/null @@ -1,137 +0,0 @@ ---- vdrold/osdbase.c 2004-06-13 13:58:22.000000000 +0200 -+++ vdr-1.2.6/osdbase.c 2004-06-13 14:01:26.000000000 +0200 -@@ -104,6 +104,12 @@ - } - } - -+void cPalette::Replace(const cPalette &Palette) -+{ -+ for (int i = 0; i < Palette.numColors; i++) -+ SetColor(i, Palette.color[i]); -+} -+ - // --- cBitmap --------------------------------------------------------------- - - cBitmap::cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground) -@@ -116,7 +122,7 @@ - fontType = fontOsd; - font = NULL; - if (width > 0 && height > 0) { -- bitmap = MALLOC(char, width * height); -+ bitmap = MALLOC(unsigned char, width * height); - if (bitmap) { - Clean(); - memset(bitmap, 0x00, width * height); -@@ -188,7 +194,7 @@ - dirtyY2 = -1; - } - --void cBitmap::SetIndex(int x, int y, char Index) -+void cBitmap::SetIndex(int x, int y, unsigned char Index) - { - if (bitmap) { - if (0 <= x && x < width && 0 <= y && y < height) { -@@ -220,6 +226,17 @@ - } - } - -+void cBitmap::SetBitmap256(int x, int y, const cBitmap &Bitmap) -+{ -+ if (bitmap && Bitmap.bitmap) { -+ Replace(Bitmap); -+ for (int ix = 0; ix < Bitmap.width; ix++) { -+ for (int iy = 0; iy < Bitmap.height; iy++) -+ SetIndex(x + ix, y + iy, Bitmap.bitmap[Bitmap.width * iy + ix]); -+ } -+ } -+} -+ - int cBitmap::Width(unsigned char c) - { - return font ? font->Width(c) : -1; -@@ -269,7 +286,7 @@ - Fill(0, 0, width - 1, height - 1, clrBackground); - } - --const char *cBitmap::Data(int x, int y) -+const unsigned char *cBitmap::Data(int x, int y) - { - return &bitmap[y * width + x]; - } -@@ -317,7 +334,10 @@ - x -= x0; - y -= y0; - } -- cBitmap::SetBitmap(x, y, Bitmap); -+ if (bpp == 8) -+ cBitmap::SetBitmap256(x, y, Bitmap); -+ else -+ cBitmap::SetBitmap(x, y, Bitmap); - } - - void cWindow::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg) -@@ -329,7 +349,7 @@ - cBitmap::Text(x, y, s, ColorFg, ColorBg); - } - --const char *cWindow::Data(int x, int y) -+const unsigned char *cWindow::Data(int x, int y) - { - return cBitmap::Data(x, y); - } ---- vdrold/osdbase.h 2004-06-13 14:05:47.000000000 +0200 -+++ vdr-1.2.6/osdbase.h 2004-06-13 13:59:45.000000000 +0200 -@@ -14,6 +14,7 @@ - #include "font.h" - - #define MAXNUMCOLORS 256 -+#define VDR_OSDPIP_PATCHED - - enum eDvbColor { - #ifdef DEBUG_OSD -@@ -69,13 +70,14 @@ - // stored yet, NumColors will be set to 0 and the function will - // return NULL. - void Take(const cPalette &Palette, tIndexes *Indexes = NULL); -+ void Replace(const cPalette &Palette); - }; - - class cBitmap : public cPalette { - private: - cFont *font; - eDvbFont fontType; -- char *bitmap; -+ unsigned char *bitmap; - bool clearWithBackground; - protected: - int width, height; -@@ -86,9 +88,10 @@ - bool ClearWithBackground(void) { return clearWithBackground; } - eDvbFont SetFont(eDvbFont Font); - bool Dirty(int &x1, int &y1, int &x2, int &y2); -- void SetIndex(int x, int y, char Index); -+ void SetIndex(int x, int y, unsigned char Index); - void SetPixel(int x, int y, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); -+ void SetBitmap256(int x, int y, const cBitmap &Bitmap); - int Width(void) { return width; } - int Width(unsigned char c); - int Width(const char *s); -@@ -97,7 +100,7 @@ - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void Clean(void); - void Clear(void); -- const char *Data(int x, int y); -+ const unsigned char *Data(int x, int y); - }; - - #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 -@@ -122,7 +125,7 @@ - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); - void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); -- const char *Data(int x, int y); -+ const unsigned char *Data(int x, int y); - }; - - typedef int tWindowHandle; diff --git a/patches/vdr-1.2.6-indexes.diff b/patches/vdr-1.2.6-indexes.diff deleted file mode 100644 index 26ec1be..0000000 --- a/patches/vdr-1.2.6-indexes.diff +++ /dev/null @@ -1,85 +0,0 @@ ---- vdrold/osdbase.c 2004-06-13 13:52:47.000000000 +0200 -+++ vdr-1.2.6/osdbase.c 2004-06-13 13:49:23.000000000 +0200 -@@ -116,7 +116,7 @@ - fontType = fontOsd; - font = NULL; - if (width > 0 && height > 0) { -- bitmap = MALLOC(char, width * height); -+ bitmap = MALLOC(unsigned char, width * height); - if (bitmap) { - Clean(); - memset(bitmap, 0x00, width * height); -@@ -188,7 +188,7 @@ - dirtyY2 = -1; - } - --void cBitmap::SetIndex(int x, int y, char Index) -+void cBitmap::SetIndex(int x, int y, unsigned char Index) - { - if (bitmap) { - if (0 <= x && x < width && 0 <= y && y < height) { -@@ -269,7 +269,7 @@ - Fill(0, 0, width - 1, height - 1, clrBackground); - } - --const char *cBitmap::Data(int x, int y) -+const unsigned char *cBitmap::Data(int x, int y) - { - return &bitmap[y * width + x]; - } -@@ -329,7 +329,7 @@ - cBitmap::Text(x, y, s, ColorFg, ColorBg); - } - --const char *cWindow::Data(int x, int y) -+const unsigned char *cWindow::Data(int x, int y) - { - return cBitmap::Data(x, y); - } ---- vdrold/osdbase.h 2004-06-13 13:52:47.000000000 +0200 -+++ vdr-1.2.6/osdbase.h 2004-06-13 13:48:49.000000000 +0200 -@@ -13,7 +13,7 @@ - #include <stdio.h> - #include "font.h" - --#define MAXNUMCOLORS 16 -+#define MAXNUMCOLORS 256 - - enum eDvbColor { - #ifdef DEBUG_OSD -@@ -75,7 +75,7 @@ - private: - cFont *font; - eDvbFont fontType; -- char *bitmap; -+ unsigned char *bitmap; - bool clearWithBackground; - protected: - int width, height; -@@ -86,7 +86,7 @@ - bool ClearWithBackground(void) { return clearWithBackground; } - eDvbFont SetFont(eDvbFont Font); - bool Dirty(int &x1, int &y1, int &x2, int &y2); -- void SetIndex(int x, int y, char Index); -+ void SetIndex(int x, int y, unsigned char Index); - void SetPixel(int x, int y, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); - int Width(void) { return width; } -@@ -97,7 +97,7 @@ - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void Clean(void); - void Clear(void); -- const char *Data(int x, int y); -+ const unsigned char *Data(int x, int y); - }; - - #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 -@@ -122,7 +122,7 @@ - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); - void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); -- const char *Data(int x, int y); -+ const unsigned char *Data(int x, int y); - }; - - typedef int tWindowHandle; diff --git a/patches/vdr-1.2.6-palette.diff b/patches/vdr-1.2.6-palette.diff deleted file mode 100644 index 46559a9..0000000 --- a/patches/vdr-1.2.6-palette.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- vdrold/osdbase.c 2004-06-13 13:58:22.000000000 +0200 -+++ vdr-1.2.6/osdbase.c 2004-06-13 14:01:26.000000000 +0200 -@@ -104,6 +104,12 @@ - } - } - -+void cPalette::Replace(const cPalette &Palette) -+{ -+ for (int i = 0; i < Palette.numColors; i++) -+ SetColor(i, Palette.color[i]); -+} -+ - // --- cBitmap --------------------------------------------------------------- - - cBitmap::cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground) -@@ -116,7 +122,7 @@ - fontType = fontOsd; - font = NULL; - if (width > 0 && height > 0) { -- bitmap = MALLOC(char, width * height); -+ bitmap = MALLOC(unsigned char, width * height); - if (bitmap) { - Clean(); - memset(bitmap, 0x00, width * height); -@@ -188,7 +194,7 @@ - dirtyY2 = -1; - } - --void cBitmap::SetIndex(int x, int y, char Index) -+void cBitmap::SetIndex(int x, int y, unsigned char Index) - { - if (bitmap) { - if (0 <= x && x < width && 0 <= y && y < height) { -@@ -220,6 +226,17 @@ - } - } - -+void cBitmap::SetBitmap256(int x, int y, const cBitmap &Bitmap) -+{ -+ if (bitmap && Bitmap.bitmap) { -+ Replace(Bitmap); -+ for (int ix = 0; ix < Bitmap.width; ix++) { -+ for (int iy = 0; iy < Bitmap.height; iy++) -+ SetIndex(x + ix, y + iy, Bitmap.bitmap[Bitmap.width * iy + ix]); -+ } -+ } -+} -+ - int cBitmap::Width(unsigned char c) - { - return font ? font->Width(c) : -1; -@@ -269,7 +286,7 @@ - Fill(0, 0, width - 1, height - 1, clrBackground); - } - --const char *cBitmap::Data(int x, int y) -+const unsigned char *cBitmap::Data(int x, int y) - { - return &bitmap[y * width + x]; - } -@@ -317,7 +334,10 @@ - x -= x0; - y -= y0; - } -- cBitmap::SetBitmap(x, y, Bitmap); -+ if (bpp == 8) -+ cBitmap::SetBitmap256(x, y, Bitmap); -+ else -+ cBitmap::SetBitmap(x, y, Bitmap); - } - - void cWindow::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg) -@@ -329,7 +349,7 @@ - cBitmap::Text(x, y, s, ColorFg, ColorBg); - } - --const char *cWindow::Data(int x, int y) -+const unsigned char *cWindow::Data(int x, int y) - { - return cBitmap::Data(x, y); - } ---- vdrold/osdbase.h 2004-06-13 14:05:47.000000000 +0200 -+++ vdr-1.2.6/osdbase.h 2004-06-13 13:59:45.000000000 +0200 -@@ -13,7 +13,8 @@ - #include <stdio.h> - #include "font.h" - --#define MAXNUMCOLORS 16 -+#define MAXNUMCOLORS 256 -+#define VDR_OSDPIP_PATCHED - - enum eDvbColor { - #ifdef DEBUG_OSD -@@ -69,13 +70,14 @@ - // stored yet, NumColors will be set to 0 and the function will - // return NULL. - void Take(const cPalette &Palette, tIndexes *Indexes = NULL); -+ void Replace(const cPalette &Palette); - }; - - class cBitmap : public cPalette { - private: - cFont *font; - eDvbFont fontType; -- char *bitmap; -+ unsigned char *bitmap; - bool clearWithBackground; - protected: - int width, height; -@@ -86,9 +88,10 @@ - bool ClearWithBackground(void) { return clearWithBackground; } - eDvbFont SetFont(eDvbFont Font); - bool Dirty(int &x1, int &y1, int &x2, int &y2); -- void SetIndex(int x, int y, char Index); -+ void SetIndex(int x, int y, unsigned char Index); - void SetPixel(int x, int y, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); -+ void SetBitmap256(int x, int y, const cBitmap &Bitmap); - int Width(void) { return width; } - int Width(unsigned char c); - int Width(const char *s); -@@ -97,7 +100,7 @@ - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void Clean(void); - void Clear(void); -- const char *Data(int x, int y); -+ const unsigned char *Data(int x, int y); - }; - - #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 -@@ -122,7 +125,7 @@ - void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); - void SetBitmap(int x, int y, const cBitmap &Bitmap); - void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); -- const char *Data(int x, int y); -+ const unsigned char *Data(int x, int y); - }; - - typedef int tWindowHandle; diff --git a/patches/vdr-osd.diff b/patches/vdr-osd.diff new file mode 100644 index 0000000..0acc0f2 --- /dev/null +++ b/patches/vdr-osd.diff @@ -0,0 +1,51 @@ +diff -Nu vdr-1.3.24/osd.c vdr/osd.c +--- vdr-1.3.24/osd.c 2004-12-19 13:27:38.000000000 +0100 ++++ vdr/osd.c 2005-05-14 13:59:03.000000000 +0200 +@@ -574,7 +574,7 @@ + + // --- cOsd ------------------------------------------------------------------ + +-bool cOsd::isOpen = false; ++int cOsd::isOpen = 0; + + cOsd::cOsd(int Left, int Top) + { +@@ -585,7 +585,7 @@ + left = Left; + top = Top; + width = height = 0; +- isOpen = true; ++ isOpen++; + } + + cOsd::~cOsd() +@@ -593,7 +593,7 @@ + for (int i = 0; i < numBitmaps; i++) + delete bitmaps[i]; + delete savedRegion; +- isOpen = false; ++ isOpen--; + } + + cBitmap *cOsd::GetBitmap(int Area) +diff -Nu vdr-1.3.24/osd.h vdr/osd.h +--- vdr-1.3.24/osd.h 2004-10-16 12:33:44.000000000 +0200 ++++ vdr/osd.h 2005-05-14 13:58:08.000000000 +0200 +@@ -210,7 +210,7 @@ + class cOsd { + friend class cOsdProvider; + private: +- static bool isOpen; ++ static int isOpen; + cBitmap *savedRegion; + cBitmap *bitmaps[MAXOSDAREAS]; + int numBitmaps; +@@ -235,7 +235,7 @@ + public: + virtual ~cOsd(); + ///< Shuts down the OSD. +- static bool IsOpen(void) { return isOpen; } ++ static int IsOpen(void) { return isOpen; } + int Left(void) { return left; } + int Top(void) { return top; } + int Width(void) { return width; } @@ -23,8 +23,9 @@ private: public: cPESPacket(unsigned char * data, int length); void Dump(FILE * fp = stdout); - unsigned char StreamId() { return streamId; } + unsigned char StreamId() const { return streamId; } unsigned char * Payload(int & length); + unsigned short PacketLength() const { return packetLength; } }; #endif // VDR_OSDPIP_PES_H @@ -46,13 +46,8 @@ cQuantizeFixed::cQuantizeFixed() { for (int r = 0; r < redLevelCount; r++) { for (int g = 0; g < greenLevelCount; g++) { for (int b = 0; b < blueLevelCount; b++) { -#if VDRVERSNUM >= 10307 paletteOutput[r * greenLevelCount * blueLevelCount + g * blueLevelCount + b] = (redLevels[r] << 16) | (greenLevels[g] << 8) | blueLevels[b]; -#else - paletteOutput[r * greenLevelCount * blueLevelCount + g * blueLevelCount + b] = - (blueLevels[b] << 16) | (greenLevels[g] << 8) | redLevels[r]; -#endif } } } @@ -188,7 +183,6 @@ int cQuantizeWu::Quantize(unsigned char * input, int size, int colors) weight = Vol(&cube[k], wt); if (weight) { -#if VDRVERSNUM >= 10307 #ifdef NOINVERT palette[k * 4 + 2] = (Vol(&cube[k], mb) / weight) WEIG; palette[k * 4 + 0] = (Vol(&cube[k], mr) / weight) WEIG; @@ -196,15 +190,6 @@ int cQuantizeWu::Quantize(unsigned char * input, int size, int colors) palette[k * 4 + 0] = (Vol(&cube[k], mb) / weight) WEIG; palette[k * 4 + 2] = (Vol(&cube[k], mr) / weight) WEIG; #endif -#else -#ifdef NOINVERT - palette[k * 4 + 2] = (Vol(&cube[k], mr) / weight) WEIG; - palette[k * 4 + 0] = (Vol(&cube[k], mb) / weight) WEIG; -#else - palette[k * 4 + 0] = (Vol(&cube[k], mr) / weight) WEIG; - palette[k * 4 + 2] = (Vol(&cube[k], mb) / weight) WEIG; -#endif -#endif palette[k * 4 + 1] = (Vol(&cube[k], mg) / weight) WEIG; } else @@ -12,14 +12,12 @@ #include <vdr/remux.h> #include <vdr/ringbuffer.h> -cOsdPipReceiver::cOsdPipReceiver(const cChannel *Channel, +cOsdPipReceiver::cOsdPipReceiver(const cChannel *Channel, cRingBufferFrame *ESBuffer): #if VDRVERSNUM >= 10319 - cReceiver(Channel->Ca(), 0, Channel->Vpid(), Channel->Apids()) -#elif VDRVERSNUM >= 10318 - cReceiver(Channel->Ca(), 0, 2, Channel->Vpid(), Channel->Apid(0)) + cReceiver(Channel->Ca(), 0, Channel->Vpid()) #else - cReceiver(Channel->Ca(), 0, 2, Channel->Vpid(), Channel->Apid1()) + cReceiver(Channel->Ca(), 0, 1, Channel->Vpid()) #endif { m_TSBuffer = new cRingBufferLinear(MEGABYTE(3), TS_SIZE * 2, true); @@ -28,11 +26,9 @@ cOsdPipReceiver::cOsdPipReceiver(const cChannel *Channel, #endif m_ESBuffer = ESBuffer; #if VDRVERSNUM >= 10319 - m_Remux = new cRemux(Channel->Vpid(), Channel->Apids(), 0, 0, true); -#elif VDRVERSNUM >= 10318 - m_Remux = new cRemux(Channel->Vpid(), Channel->Apid(0), 0, 0, 0, true); + m_Remux = new cRemux(Channel->Vpid(), NULL, NULL, NULL, true); #else - m_Remux = new cRemux(Channel->Vpid(), Channel->Apid1(), 0, 0, 0, true); + m_Remux = new cRemux(Channel->Vpid(), 0, 0, 0, 0, true); #endif m_Active = false; } @@ -137,22 +133,21 @@ void cOsdPipReceiver::Action(void) VideoBufferPos = 0; } - int t = 0; - int l = ((p[4] << 8) | p[5]) + 6; - while (t + l <= Result) { - cPESPacket Packet(p + t, l); + int pos = 0; + while (pos + 6 < Result) + { + cPESPacket Packet(p + pos, Result - pos); + if (pos + 6 + Packet.PacketLength() > Result) + break; int PayloadLength = 0; unsigned char * PayloadData = Packet.Payload(PayloadLength); if ((Packet.StreamId() & 0xF0) == 0xE0) { // video packet memcpy(&VideoBuffer[VideoBufferPos], PayloadData, PayloadLength); VideoBufferPos += PayloadLength; } - t += l; - if (t >= Result) - break; - l = ((p[t + 4] << 8) | p[t + 5]) + 6; + pos += Packet.PacketLength() + 6; } - m_Remux->Del(t); + m_Remux->Del(pos); } #endif } @@ -8,44 +8,30 @@ #include "setup.h" -#if VDRVERSNUM < 10307 -# if MAXNUMCOLORS < 256 -# warning WARNING: YOU WILL NOT BE ABLE TO USE 256 COLOR PIP -# endif - -# ifndef VDR_OSDPIP_PATCHED -# warning WARNING: YOU WILL NOT BE ABLE TO USE VARIABLE COLOR PIP -# endif - -# if MAXNUMCOLORS < 256 -const int kColorDepths = 1; -# else -# ifndef VDR_OSDPIP_PATCHED -const int kColorDepths = 3; -# else const int kColorDepths = 4; -# endif -# endif -#else -const int kColorDepths = 4; -#endif - -const int kSizes = 6; +const int kSizes = 11; const int kFrameModes = 3; const int kFrameDrops = 4; +const int kShowInfoTypes = 4; const int kInfoPositions = 4; const char * ColorDepthItems[] = {NULL, NULL, NULL, NULL, NULL}; // initialized later +const char * ShowInfoItems[] = {NULL, NULL, NULL, NULL, NULL}; // initialized later const char * InfoPositionItems[] = {NULL, NULL, NULL, NULL, NULL}; // initialized later const char * FrameDropItems[] = {NULL, NULL, NULL, NULL, NULL}; // initialized later const char * SizeItems[] = { + "100x80", "120x96", + "140x112", "160x128", + "180x144", "200x160", + "220x176", "240x192", + "260x208", "280x224", - "320x256", + "300x240", NULL }; @@ -66,7 +52,7 @@ cOsdPipSetup::cOsdPipSetup(void) CropTop = 5; CropBottom = 5; ColorDepth = kDepthGrey16; - Size = 2; + Size = 5; FrameMode = kFrameModeI; FrameDrop = -1; SwapFfmpeg = 1; @@ -105,6 +91,11 @@ cOsdPipSetupPage::cOsdPipSetupPage(void) ColorDepthItems[2] = tr("Color (256, fixed)"); ColorDepthItems[3] = tr("Color (128, variable)"); + ShowInfoItems[0] = tr("no"); + ShowInfoItems[1] = tr("channel only"); + ShowInfoItems[2] = tr("simple"); + ShowInfoItems[3] = tr("complete"); + InfoPositionItems[0] = tr("top left"); InfoPositionItems[1] = tr("top right"); InfoPositionItems[2] = tr("bottom left"); @@ -126,7 +117,7 @@ cOsdPipSetupPage::cOsdPipSetupPage(void) Add(new cMenuEditStraItem(tr("Frames to display"), &m_NewOsdPipSetup.FrameMode, kFrameModes, FrameModeItems)); Add(new cMenuEditStraItem(tr("Drop frames"), &m_NewOsdPipSetup.FrameDrop, kFrameDrops, FrameDropItems)); Add(new cMenuEditBoolItem(tr("Swap FFMPEG output"), &m_NewOsdPipSetup.SwapFfmpeg)); - Add(new cMenuEditBoolItem(tr("Show info window"), &m_NewOsdPipSetup.ShowInfo)); + Add(new cMenuEditStraItem(tr("Show info window"), &m_NewOsdPipSetup.ShowInfo, kShowInfoTypes, ShowInfoItems)); Add(new cMenuEditIntItem(tr("Info window width"), &m_NewOsdPipSetup.InfoWidth, 200, 600)); Add(new cMenuEditStraItem(tr("Info window position"), &m_NewOsdPipSetup.InfoPosition, kInfoPositions, InfoPositionItems)); } |