diff options
author | Andreas Regel <andreas.regel@powarman.de> | 2004-07-31 23:55:00 +0200 |
---|---|---|
committer | Andreas Regel <andreas.regel@powarman.de> | 2004-07-31 23:55:00 +0200 |
commit | c024446839241af2fa7d618ce49cc8c1e5693f7f (patch) | |
tree | 6fe9beb2336294e030a739c4039911fb3e51d477 | |
parent | 1df133b2a0565a35c3b07e043bd04b449869a0cb (diff) | |
download | vdr-plugin-osdpip-c024446839241af2fa7d618ce49cc8c1e5693f7f.tar.gz vdr-plugin-osdpip-c024446839241af2fa7d618ce49cc8c1e5693f7f.tar.bz2 |
Release version 0.0.6v0.0.6
- added channel swapping. It is now possible to swap the currently viewed
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
the ringbuffer.
- added -D_GNU_SOURCE to DEFINES in Makefile
- fixed a memory leak: missing deletion of frame ringbuffer
- fixed a memory leak: missing frame deletion in case of a full ringbuffer
- small speedup through just putting relevant frames to ringbuffer
- updated finnish translations (thanks to Rolf Ahrenberg)
-rw-r--r-- | HISTORY | 14 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | decoder.c | 8 | ||||
-rw-r--r-- | decoder.h | 2 | ||||
-rw-r--r-- | i18n.c | 96 | ||||
-rw-r--r-- | osd.c | 202 | ||||
-rw-r--r-- | osd.h | 2 | ||||
-rw-r--r-- | osdpip.c | 4 | ||||
-rw-r--r-- | patches/vdr-1.2.6-256-palette.diff | 16 | ||||
-rw-r--r-- | receiver.c | 12 | ||||
-rw-r--r-- | setup.c (renamed from config.c) | 15 | ||||
-rw-r--r-- | setup.h (renamed from config.h) | 0 |
14 files changed, 304 insertions, 76 deletions
@@ -1,6 +1,20 @@ VDR Plugin 'osdpip' Revision History ------------------------------------ +2004-08-01: Version 0.0.6 +- added channel swapping. It is now possible to swap the currently viewed + channel with the pip channel by pressing the red key. +- 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 + the ringbuffer. +- added -D_GNU_SOURCE to DEFINES in Makefile +- fixed a memory leak: missing deletion of frame ringbuffer +- fixed a memory leak: missing frame deletion in case of a full ringbuffer +- small speedup through just putting relevant frames to ringbuffer +- updated finnish translations (thanks to Rolf Ahrenberg) + + 2004-06-13: Version 0.0.5 (written by Andreas Regel) - added support for VDR version 1.3.7 and later (VDR 1.2.6 is still supported, no guarantee for 1.3.0-1.3.6) @@ -44,10 +44,11 @@ PACKAGE = vdr-$(ARCHIVE) INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include -I. -I$(FFMDIR)/libavcodec LIBS = -L$(FFMDIR)/libavcodec -lavcodec DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +DEFINES += -D_GNU_SOURCE ### The object files (add further files here): -OBJS = $(PLUGIN).o osd.o receiver.o config.o i18n.o pes.o quantize.o decoder.o +OBJS = $(PLUGIN).o osd.o receiver.o setup.o i18n.o pes.o quantize.o decoder.o ifdef FFMPEG_STATIC DEFINES += -DHAVE_FFMPEG_STATIC @@ -22,7 +22,7 @@ down now, watching the progress of the previous channel in the box. Quality is not too good yet, and only I-Frames are displayed. The plugin supports four modes: - greyscaled (16 shades of grey) - - greyscaled (128 shades of grey) + - 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 @@ -110,6 +110,7 @@ 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 @@ -1,6 +1,3 @@ - improve fixed palette color quantization -- localization - vdr-like navigation through channels -- support other aspect ratios than 4:3 -- automatic frame drop @@ -8,7 +8,7 @@ #include <stdlib.h> #include "decoder.h" -#include "config.h" +#include "setup.h" int cDecoder::Open() @@ -98,3 +98,9 @@ int cDecoder::ConvertToRGB() return 0; } +double cDecoder::AspectRatio() +{ + //printf("%d %d %f\n", m_Context->width, m_Context->height, m_Context->aspect_ratio); + return m_Context->aspect_ratio; +} + @@ -35,7 +35,7 @@ public: int ConvertToRGB(); AVFrame * PicResample() { return m_PicResample; } AVFrame * PicConvert() { return m_PicConvert; } - float AspectRatio() { return m_Context->aspect_ratio; } + double AspectRatio(); }; #endif // VDR_OSDPIP_DECODER_H @@ -583,6 +583,102 @@ const tI18nPhrase Phrases[] = { # endif #endif }, + { + "automatic", // English + "automatisch", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "automaattisesti", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala +#if VDRVERSNUM > 10302 + "", // Russian +# if VDRVERSNUM > 10307 + "", // Croatian +# endif +#endif + }, + { + "none", // English + "keine", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "ei", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala +#if VDRVERSNUM > 10302 + "", // Russian +# if VDRVERSNUM > 10307 + "", // Croatian +# endif +#endif + }, + { + "1 frame", // English + "1 Frame", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "1 kehys", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala +#if VDRVERSNUM > 10302 + "", // Russian +# if VDRVERSNUM > 10307 + "", // Croatian +# endif +#endif + }, + { + "2 frames", // English + "2 Frames", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "2 kehystä", // Suomi + "", // Polski + "", // Español + "", // Ellinika + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Catala +#if VDRVERSNUM > 10302 + "", // Russian +# if VDRVERSNUM > 10307 + "", // Croatian +# endif +#endif + }, { NULL } }; @@ -8,7 +8,7 @@ #include "decoder.h" #include "quantize.h" #include "receiver.h" -#include "config.h" +#include "setup.h" #include <vdr/ringbuffer.h> #include <vdr/remux.h> @@ -43,13 +43,10 @@ cOsdPipObject::cOsdPipObject(cDevice *Device, const cChannel *Channel) cOsdPipObject::~cOsdPipObject() { - if (m_Active) - { - m_Active = false; - Cancel(3); - } + Stop(); delete m_Receiver; + delete m_ESBuffer; if (m_Bitmap != NULL) delete m_Bitmap; if (m_BitmapInfo != NULL) @@ -58,39 +55,75 @@ cOsdPipObject::~cOsdPipObject() delete m_Osd; } +void cOsdPipObject::Stop(void) +{ + if (m_Active) + { + m_Active = false; + Cancel(3); + } + m_ESBuffer->Clear(); +} + +void cOsdPipObject::SwapChannels(void) +{ + const cChannel *chan = cDevice::CurrentChannel() != 0 + ? Channels.GetByNumber(cDevice::CurrentChannel()) : NULL; + if (chan) { + Stop(); + Channels.SwitchTo(m_Channel->Number()); + cDevice *dev = cDevice::GetDevice(chan, 1); + if (dev) { + DELETENULL(m_Receiver); + m_Channel = chan; + dev->SwitchChannel(m_Channel, false); + m_Receiver = new cOsdPipReceiver(m_Channel, m_ESBuffer); + dev->AttachReceiver(m_Receiver); + } + Start(); + } +} + void cOsdPipObject::ProcessImage(unsigned char * data, int length) { unsigned int value; unsigned int * outputPalette; unsigned char * outputImage; + int height; - if (OsdPipSetup.FrameMode == kFrameModeI) + if (m_FrameDrop != -1) { - if (m_FrameDrop == OsdPipSetup.FrameDrop) + if (OsdPipSetup.FrameMode == kFrameModeI) { - m_FrameDrop = 0; - } - else - { - m_FrameDrop++; - return; + if (m_FrameDrop == OsdPipSetup.FrameDrop) + { + m_FrameDrop = 0; + } + else + { + m_FrameDrop++; + return; + } } } if (decoder.Decode(data, length) != 0) return; - if (OsdPipSetup.FrameMode == kFrameModeIP || - OsdPipSetup.FrameMode == kFrameModeIPB) + if (m_FrameDrop != -1) { - if (m_FrameDrop == OsdPipSetup.FrameDrop) + if (OsdPipSetup.FrameMode == kFrameModeIP || + OsdPipSetup.FrameMode == kFrameModeIPB) { - m_FrameDrop = 0; - } - else - { - m_FrameDrop++; - return; + if (m_FrameDrop == OsdPipSetup.FrameDrop) + { + m_FrameDrop = 0; + } + else + { + m_FrameDrop++; + return; + } } } @@ -229,30 +262,40 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) #endif } - if (decoder.Resample(m_Width, m_Height) != 0) + if (decoder.AspectRatio() > 0.1) + height = (int) ((float) m_Width / decoder.AspectRatio() * 16.0f / 15.0f + 0.5); + else + height = m_Height; + if (decoder.Resample(m_Width, height) != 0) return; int size; - size = m_Width * m_Height; + size = m_Width * height; if (OsdPipSetup.ColorDepth == kDepthGrey16) { -#if VDRVERSNUM < 10307 +#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 < m_Height; y++) + for (int y = 0; y < height; y++) { for (int x = 0; x < m_Width; x++) { value = outputImage[y * m_Width + x]; - value = value / 16; - value = value * 16; + 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, value); + m_Bitmap->DrawPixel(x, y + (m_Height - height) / 2, value); #else - m_Bitmap->SetPixel(x, y, (eDvbColor) value); + m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) value); #endif } } @@ -261,17 +304,20 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) { 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 < m_Height; y++) + for (int y = 0; y < height; y++) { for (int x = 0; x < m_Width; x++) { #if VDRVERSNUM >= 10307 - m_Bitmap->SetIndex(x, y, outputImage[y * m_Width + x]); + m_Bitmap->SetIndex(x, y + (m_Height - height) / 2, outputImage[y * m_Width + x]); #else - m_Bitmap->SetPixel(x, y, (eDvbColor) m_Palette[outputImage[y * m_Width + x]]); + m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) m_Palette[outputImage[y * m_Width + x]]); #endif } } @@ -306,17 +352,20 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) 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 < m_Height; y++) + for (int y = 0; y < height; y++) { for (int x = 0; x < m_Width; x++) { #if VDRVERSNUM >= 10307 - m_Bitmap->SetIndex(x, y, outputImage[y * m_Width + x] + 1); + m_Bitmap->SetIndex(x, y + (m_Height - height) / 2, outputImage[y * m_Width + x] + 1); #else - m_Bitmap->SetPixel(x, y, (eDvbColor) m_Palette[outputImage[y * m_Width + x]]); + m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) m_Palette[outputImage[y * m_Width + x]]); #endif } } @@ -329,17 +378,20 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length) m_Palette[m_PaletteStart + i] |= m_AlphaBase; } - for (int i = 0; i < 256; i++) #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 < m_Height; y++) + for (int y = 0; y < height; y++) { for (int x = 0; x < m_Width; x++) { - m_Bitmap->SetIndex(x, y, m_PaletteStart + outputImage[y * m_Width + x]); + m_Bitmap->SetIndex(x, y + (m_Height - height) / 2, m_PaletteStart + outputImage[y * m_Width + x]); } } @@ -406,24 +458,45 @@ void cOsdPipObject::Action(void) m_Reset = false; } #endif - frame = m_ESBuffer->Get(); + if (m_FrameDrop == -1) { - if (frame && frame->Count() > 0) + while ((frame = m_ESBuffer->Get()) != NULL) { - pictureType = frame->Index(); - if ((OsdPipSetup.FrameMode == kFrameModeI && pictureType == I_FRAME) || - (OsdPipSetup.FrameMode == kFrameModeIP && (pictureType == I_FRAME || pictureType == P_FRAME)) || - (OsdPipSetup.FrameMode == kFrameModeIPB)) + if (frame->Count() > 0) { - ProcessImage(frame->Data(), frame->Count()); + if (m_ESBuffer->Available() == frame->Count()) + break; + if (OsdPipSetup.FrameMode == kFrameModeIP || + OsdPipSetup.FrameMode == kFrameModeIPB) + { + decoder.Decode(frame->Data(), frame->Count()); + } } m_ESBuffer->Drop(frame); } - else + if (frame) { - if (frame) + pictureType = frame->Index(); + ProcessImage(frame->Data(), frame->Count()); + m_ESBuffer->Drop(frame); + } + } + else + { + frame = m_ESBuffer->Get(); + { + if (frame && frame->Count() > 0) + { + pictureType = frame->Index(); + ProcessImage(frame->Data(), frame->Count()); m_ESBuffer->Drop(frame); - usleep(1); + } + else + { + if (frame) + m_ESBuffer->Drop(frame); + usleep(1); + } } } if (m_ShowTime != 0) @@ -431,8 +504,10 @@ void cOsdPipObject::Action(void) 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 @@ -481,6 +556,9 @@ eOSState cOsdPipObject::ProcessKey(eKeys Key) 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) { @@ -571,7 +649,9 @@ eOSState cOsdPipObject::ProcessKey(eKeys Key) if (m_ShowTime != 0) { m_ShowTime -= 2; } else { - ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel())); + //ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel())); + time(&m_ShowTime); + m_ShowInfo = true; } } break; @@ -592,7 +672,11 @@ void cOsdPipObject::ChannelSwitch(const cDevice * device, int channelNumber) if (!m_Ready) return; if (OsdPipSetup.ShowInfo) - ShowChannelInfo(Channels.GetByNumber(device->CurrentChannel())); + { + //ShowChannelInfo(Channels.GetByNumber(device->CurrentChannel())); + time(&m_ShowTime); + m_ShowInfo = true; + } } void cOsdPipObject::ShowChannelInfo(const cChannel * channel, bool show) @@ -665,6 +749,12 @@ void cOsdPipObject::ShowChannelInfo(const cChannel * channel, bool show) 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++) @@ -677,17 +767,19 @@ void cOsdPipObject::ShowChannelInfo(const cChannel * channel, bool show) } else { - m_Palette[0] = 0x00000000; + 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]); } } #else if (OsdPipSetup.ColorDepth != kDepthGrey16) - for (int i = 0; i < 256; i++) - m_BitmapInfo->SetColor(i, (eDvbColor) m_Palette[i]); + 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); @@ -60,6 +60,8 @@ 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); @@ -14,12 +14,12 @@ extern "C" } #include "osd.h" -#include "config.h" +#include "setup.h" #include "i18n.h" #include <vdr/plugin.h> -static const char *VERSION = "0.0.5"; +static const char *VERSION = "0.0.6"; static const char *DESCRIPTION = "OSD Picture-in-Picture"; static const char *MAINMENUENTRY = "Picture-in-Picture"; diff --git a/patches/vdr-1.2.6-256-palette.diff b/patches/vdr-1.2.6-256-palette.diff index 1ea1c79..aab4f69 100644 --- a/patches/vdr-1.2.6-256-palette.diff +++ b/patches/vdr-1.2.6-256-palette.diff @@ -81,14 +81,14 @@ } --- 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
+@@ -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. @@ -6,6 +6,7 @@ #include "receiver.h" #include "pes.h" +#include "setup.h" #include <vdr/channels.h> #include <vdr/remux.h> @@ -66,7 +67,16 @@ void cOsdPipReceiver::Action(void) if (p) { if (NewPictureType != NO_PICTURE) { - m_ESBuffer->Put(new cFrame(VideoBuffer, VideoBufferPos, ftVideo, CurPictureType)); + if ((OsdPipSetup.FrameMode == kFrameModeI && CurPictureType == I_FRAME) || + (OsdPipSetup.FrameMode == kFrameModeIP && (CurPictureType == I_FRAME || CurPictureType == P_FRAME)) || + (OsdPipSetup.FrameMode == kFrameModeIPB)) + { + cFrame * frame = new cFrame(VideoBuffer, VideoBufferPos, ftVideo, CurPictureType); + if (!m_ESBuffer->Put(frame)) + { + delete frame; + } + } CurPictureType = NewPictureType; VideoBufferPos = 0; } @@ -6,7 +6,7 @@ #include <vdr/config.h> -#include "config.h" +#include "setup.h" #if VDRVERSNUM < 10307 # if MAXNUMCOLORS < 256 @@ -32,10 +32,12 @@ const int kColorDepths = 4; const int kSizes = 6; const int kFrameModes = 3; +const int kFrameDrops = 4; const int kInfoPositions = 4; const char * ColorDepthItems[] = {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[] = { "120x96", @@ -66,7 +68,7 @@ cOsdPipSetup::cOsdPipSetup(void) ColorDepth = kDepthGrey16; Size = 2; FrameMode = kFrameModeI; - FrameDrop = 0; + FrameDrop = -1; SwapFfmpeg = 1; ShowInfo = 1; InfoWidth = 400; @@ -96,6 +98,7 @@ bool cOsdPipSetup::SetupParse(const char *Name, const char *Value) cOsdPipSetupPage::cOsdPipSetupPage(void) { m_NewOsdPipSetup = OsdPipSetup; + m_NewOsdPipSetup.FrameDrop += 1; ColorDepthItems[0] = tr("Greyscale (16)"); ColorDepthItems[1] = tr("Greyscale (256)"); @@ -107,6 +110,11 @@ cOsdPipSetupPage::cOsdPipSetupPage(void) InfoPositionItems[2] = tr("bottom left"); InfoPositionItems[3] = tr("bottom right"); + FrameDropItems[0] = tr("automatic"); + FrameDropItems[1] = tr("none"); + FrameDropItems[2] = tr("1 frame"); + FrameDropItems[3] = tr("2 frames"); + Add(new cMenuEditIntItem(tr("X Position"), &m_NewOsdPipSetup.XPosition, 0, 600)); Add(new cMenuEditIntItem(tr("Y Position"), &m_NewOsdPipSetup.YPosition, 0, 470)); Add(new cMenuEditIntItem(tr("Crop left"), &m_NewOsdPipSetup.CropLeft, 0, 80)); @@ -116,7 +124,7 @@ cOsdPipSetupPage::cOsdPipSetupPage(void) Add(new cMenuEditStraItem(tr("Color depth"), &m_NewOsdPipSetup.ColorDepth, kColorDepths, ColorDepthItems)); Add(new cMenuEditStraItem(tr("Size"), &m_NewOsdPipSetup.Size, kSizes, SizeItems)); Add(new cMenuEditStraItem(tr("Frames to display"), &m_NewOsdPipSetup.FrameMode, kFrameModes, FrameModeItems)); - Add(new cMenuEditIntItem(tr("Drop frames"), &m_NewOsdPipSetup.FrameDrop, 0, 2)); + 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 cMenuEditIntItem(tr("Info window width"), &m_NewOsdPipSetup.InfoWidth, 200, 600)); @@ -130,6 +138,7 @@ cOsdPipSetupPage::~cOsdPipSetupPage() void cOsdPipSetupPage::Store(void) { OsdPipSetup = m_NewOsdPipSetup; + OsdPipSetup.FrameDrop -= 1; SetupStore("XPosition", OsdPipSetup.XPosition); SetupStore("YPosition", OsdPipSetup.YPosition); |