Version 2.3.1

VDR developer version 2.3.1 is now available at

       ftp://ftp.tvdr.de/vdr/Developer/vdr-2.3.1.tar.bz2

A 'diff' against the previous version is available at

       ftp://ftp.tvdr.de/vdr/Developer/vdr-2.2.0-2.3.1.diff

MD5 checksums:

391c2ed60e2f7d24563fe3ed5854bc4f  vdr-2.3.1.tar.bz2
983fd4bad7d19cd98301d54173107129  vdr-2.2.0-2.3.1.diff

WARNING:
========

This is a *developer* version. Even though *I* use it in my productive
environment, I strongly recommend that you only use it under controlled
conditions and for testing and debugging.

*** PLEASE BE VERY CAREFUL WHEN USING THIS DEVELOPER VERSION, ESPECIALLY
*** IF YOU ENABLE THE NEW SVDRP PEERING! KEEP BACKUPS OF ALL YOUR TIMERS
*** AND OBSERVE VERY CLOSELY WHETHER EVERYTHING WORKS AS EXPECTED. THIS
*** VERSION INTRODUCES SOME MAJOR CHANGES IN HANDLING GLOBAL LISTS AND
*** LOCKING, SO ANYTHING CAN HAPPEN! YOU HAVE BEEN WARNED!

The main focus of this developer version is on the new locking mechanism
for global lists, and the ability to handle remote timers.
Any plugins that access the global lists of timers, channels, schedules
or recordings, will need to be adjusted (see below for details). Please
do initial tests with plain vanilla VDR and just the output plugin you
need.

Known bugs/problems:

- After deleting the last recording in a sub folder, the cursor may not
   be positioned correctly.
- Instant recordings and pausing live video don't (yet) use the default
   SVDRP host for recording.

From the HISTORY file:
 - The new function cOsd::MaxPixmapSize() can be called to determine the maximum size
  a cPixmap may have on the current OSD. The 'osddemo' example has been modified
  accordingly. Plugin authors may want to use this function in case they use pixmaps
  that are larger than the full OSD size. The default implementation sets this limit
  to 2048x2048 pixel.
- The Setup/CAM menu now displays which device an individual CAM is currently
  assigned to (suggested by Frank Neumann).
- Added detection of 24fps (thanks to Thomas Reufer).
- Added a note about the VDR User Counter and VDR's facebook page to the README file.
- The dvbhddevice plugin is no longer part of the VDR source archive.
  You can get the latest version of this plugin from the author's repository at
  https://bitbucket.org/powARman/dvbhddevice.
- The dvbsddevice and rcu plugins are no longer part of the VDR source archive.
  You can get the latest versions of these plugins from ftp://ftp.tvdr.de/vdr/Plugins.
- Added a section about Output Devices to the INSTALL file.
- Fixed setting the source value of newly created channels, in case the NIT is
  received from a different, but very close satellite position (reported by Daniel
  Ribeiro). The code for handling different NITs has been removed from nit.c, because
  according to the DVB standard table id 0x40 carries only the NIT of the actual
  network.
- Added some comment to cPixmap about the relation between OSD, ViewPort and DrawPort
  (suggested by Thomas Reufer).
- Improved syncing on sections when parsing the NIT and SDT.
- Fixed scaling subtitles (their areas could sometimes extend outside the actual OSD).
- Reduced the priority of the "video directory scanner" thread (suggested by Thomas
  Reufer) and checking cIoThrottle::Engaged() when it is running.
- The script that gets called for recordings is now also called right before a
  recording is edited, with the first parameter being "editing" (suggested by
  Dieter Ferdinand).
- The new setup option "OSD/Default sort mode for recordings" can be used to define
  how recordings shall be sorted by default (either by time or by name, with "by time"
  being the default). If a particular sort mode has been selected for a folder by
  pressing '0', the default no longer applies to that folder. Repeating timers no
  longer write a ".sort" file into a recordings folder to have the recordings sorted
  by time.
- The command line option -D now accepts the value '-' (as in -D-), which prevents
  VDR from using any DVB devices (suggested by Dietmar Spingler).
- The -V and -h options now list the plugins in alphabetical order (suggested by
  Dietmar Spingler).
- Fixed a compiler warning in font.c.
- Commented out the line
  #define DEPRECATED_VIDEOSYSTEM
  in device.h. If a plugin doesn't compile with this version of VDR, you can uncomment
  this line as a quick workaround. In the long run the plugin will need to be adapted.
- The function cOsd::GetBitmap() is now 'protected'. If a plugin doesn't compile with
  this version of VDR, you can uncomment the line
  //#define DEPRECATED_GETBITMAP
  in osd.h as a quick workaround. In the long run the plugin will need to be adapted.
- The -u option now also accepts a numerical user id (suggested by Derek Kelly).
- The SVDRP port now accepts multiple concurrent connections. You can now keep an
  SVDRP connection open as long as you wish, without preventing others from
  connecting. Note, though, that SVDRP connections still get closed automatically
  if there has been no activity for 300 seconds (configurable via
  "Setup/Miscellaneous/SVDRP timeout (s)").
- The SVDRP log messages have been unified and now always contain the IP and port
  number of the remote host.
- SVDRP connections are now handled in a separate "SVDRP server handler" thread,
  which makes them more responsive. Note that there is only one thread that handles
  all concurrent SVDRP connections. That way each SVDRP command is guaranteed to be
  processed separately, without interfering with any other SVDRP commands that might
  be issued at the same time. Plugins that implement SVDRP commands may need to take
  care of proper locking if the commands access global data.
- VDR now sends out a broadcast to port 6419/udp, which was assigned to 'svdrp-disc'
  by the IANA. VDRs listening on that port will automatically initiate an SVDRP
  connection to the broadcasting VDR, and in turn send out a broadcast to make
  other VDRs connect to them. That way all VDRs within the local network will
  have permanent "peer-to-peer" SVDRP connections between each other. The
  configuration in the svdrphosts.conf file is taken into account when considering
  whether or not to respond to an SVDRP discover broadcast.
- The new SVDRP command PING is used by automatically established peer-to-peer
  connections to keep them alive.
- The new function GetSVDRPServerNames() can be used to get a list of all VDRs
  this VDR is connected to via SVDRP.
- The new function ExecSVDRPCommand() can be used to execute an SVDRP command on
  one of the servers this VDR is connected to, and retrieve the result.
  The helper functions SVDRPCode() and SVDRPValue() can be used to easily access
  the codes and values returned by ExecSVDRPCommand().
- The cTimer class now has a new member named 'remote', which holds the name of the
  remote server this timer will record on. If this is NULL, it is a local timer.
- Timers from other VDRs that are connected to this VDR via SVDRP are now
  automatically fetched and stored in the global Timers list. In order for this
  to work, all of the channels used by timers on the remote VDR must also be
  defined on the local VDR (however, not necessarily in the same sequence).
  Automatic channel syncing will be implemented later.
- The main menu of the LCARS skin now displays a small rectangle on the left side
  of a timer if this is a remote timer. The color of that rectangle changes if
  the timer is currently recording on the remote VDR.
- Accessing the global Timers list now has to be protected by proper locking,
  because SVDRP commands are now executed in a separate thread.
  The introduction of this locking mechanism required the following changes:
  + The new classes cStateLock and cStateKey are used to implement locking
    with quick detection of state changes.
  + cConfig::cConfig() now has a parameter that indicates whether this list
    requires locking.
  + The global lists of Timers, Channels, Schedules and Recordings are no longer
    static variables. They are now pointers that need to be retrieved through
    a call to cTimers::GetTimersRead/Write(), cChannels::GetChannelsRead/Write(),
    cSchedules::GetSchedulesRead/Write() and cRecordings::GetRecordingsRead/Write(),
    respectively.
  + References from/to link channels are now removed in cChannels::Del() rather
    than cChannel::~cChannel(), to make sure the caller holds a proper lock.
  + cChannel::HasTimer() has been removed. This information is now retrieved
    via cSchedule::HasTimer().
  + Several member functions of cChannel, cTimer, cMarks and cRecording have
    been made 'const', and some of them are now available as both 'const' and
    'non-const' versions.
  + The cChannel::Set...() functions are now 'bool' and return true if they have
    actually changed any of the channels's members.
  + cChannels::SetModified() has been renamed to cChannels::SetModifiedByUser().
  + cChannels::Modified() has been renamed to cChannels::ModifiedByUser(), and
    now has a 'State' parameter that allows the caller to see whether a channel
    has been modified since the last call to this function with the same State
    variable.
  + The macros CHANNELSMOD_NONE/_AUTO/_USER have been removed.
  + cMarks now requires locking via cStateKey.
  + cSortedTimers now requires a pointer to the list of timers.
  + cEvent::HasTimer() no longer scans the list of timers to check whether an event
    is referenced by a timer, but rather keeps score of how many timers reference
    it. This was necessary in order to avoid having to lock the list of timers from
    within a cEvent.
  + The new class cListGarbageCollector is used to temporary store any objects deleted
    from cLists that require locking. This allows pointers to such objects to be
    dereferenced even if the objects are no longer part of the list.
  + cListBase::Contains() can be used to check whether a particular object is still
    contained in that list.
  + Outdated events are no longer "phased out", but rather deleted right away and thus
    taken care of by the new "garbage collector" of the list.
  + Deleted cRecording objects are no longer kept in a list of "vanished" recordings,
    but are rather taken care of by the new "garbage collector" of the list.
  + cSchedules::ClearAll() has been removed. The functionality is now implemented
    directly in cSVDRPServer::CmdCLRE().
  + tEventID has been changed to u_int16_t in order to make room for the new member
    numTimers in cEvent.
  + cSchedule now has a member Modified(), which can be used with a State variable
    to quickly determine whether this schedule has been modified since the last call
    to this function with the same State variable.
  + cSchedulesLock has been removed. Locking the list of schedules is now done via
    the cList's new locking mechanism.
  + The 'OnlyRunningStatus' parameters in cEpgHandler::BeginSegmentTransfer() and
    cEpgHandler::EndSegmentTransfer() are now obsolete. They are still present in
    the interface for backward compatibility, but may be removed in a future version.
    Their value is always 'false'.
  + The constant tcMod is no longer used in cStatus::TimerChange(). The definition is
    still there for backward compatibility.
  Plugins that access the global lists of Timers, Channels, Recordings or Schedules
  will need to be adapted as follows:
  + Instead of directly accessing the global variables Timers, Channels or Recordings,
    they need to set up a cStateKey variable and call the proper getter function,
    as in
      cStateKey StateKey;
      if (const cTimers *Timers = cTimers::GetTimersRead(StateKey)) {
         // access the timers
         StateKey.Remove();
         }
    and
      cStateKey StateKey;
      if (cTimers *Timers = cTimers::GetTimersWrite(StateKey)) {
         // access the timers
         StateKey.Remove();
         }
    See timers.h, thread.h and tools.h for details on this new locking mechanism.
  + There are convenience macros for easily accessing these lists without having
    to explicitly set up a cStateKey and calling its Remove() function. These macros
    have the form LOCK_*_READ/WRITE (with '*' being TIMERS, CHANNELS, SCHEDULES or
    RECORDINGS). Simply put such a macro before the point where you need to access
    the respective list, and there will be a pointer named Timers, Channels, Schedules
    or Recordings, respectively, which is valid until the end of the current block.
  + If a plugin needs to access several of the global lists in parallel, locking must
    always be done in the sequence Timers, Channels, Recordings, Schedules. This is
    necessary to make sure that different threads that need to lock several lists at
    the same time don't end up in a deadlock.
  + Some pointer variables may need to be made 'const'. The compiler will tell you
    about these.
- cSectionSyncer has been improved to better handle missed sections.
- Added a missing initialization of 'seen' in cChannel's copy constructor.
- Background modifications of channels, timers and events are now displayed immediately
  in the corresponding menus.
- cEIT now checks the version of the tables before doing any processing, which saves
  a lot of locking and processing.
- If a timer is newly created with the Red button in the Schedule menu, and the timer
  is presented to the user in the "Edit timer" menu because it will start immediately,
  it now *must* be confirmed with "Ok" to set the timer. Otherwise the timer will not
  be created.
- Recordings and deleted recordings are now scanned in a single thread.
- The new SVDRP command POLL is used by automatically established peer-to-peer
  connections to trigger fetching remote timers.
- You can now set DumpSVDRPDataTransfer in svdrp.c to true to have all SVDRP
  communication printed to the console for debugging.
- Added a missing 'const' to cReceiver::Receive(), to protect the given Data from
  being modified.
- The SVDRP commands that deal with timers (DELT, LSTT, MODT, NEWT, NEXT and UPDT)
  as well as any log messages that refer to timers, now use a unique id for each
  timer, which remains valid as long as this instance of VDR is running. This means
  that timers are no longer continuously numbered from 1 to N in LSTT. There may be
  gaps in the sequence, in case timers have been deleted.
- The Timers menu now displays the name of the remote VDR in front of the timer's
  file name, if this is a remote timer.
- The new options "Setup/Miscellaneous/SVDRP peering", ".../SVDRP host name" and
  ".../SVDRP default host" can be used to configure automatic peering between VDRs
  in the same network. Peering is disabled by default and can be enabled by setting
  "SVDRP peering" to "yes".
- The function cTimer::ToText() no longer returns a newline character at the end of
  the string. The newline is now added by the caller as necessary. This was changed
  because cTimer::ToText() is now also needed in a context where the terminating
  newline can't be used. Consequently, cChannel::ToText() and cMark::ToText() have
  been modified accordingly.
- All timer related response strings from SVDRP commands now use the channel ID
  instead of channel numbers.
- The "Edit timer" menu now has a new parameter "Record on", which can be used to
  select the VDR on which this timer shall record. Timers can be freely moved
  between connected VDRs by simply selecting the desired machine in this field.
- The SVDRP command DELT no longer checks whether the timer that shall be deleted
  is currently recording.
- The character 0x0D is now stripped from EPG texts (reported by Janne Pänkälä).
- The EPG scanner no longer moves the dish if there is a positioner.
- The 'newplugin' script now creates the 'po' subdirectory for translations (thanks
  to Thomas Reufer).
- Skins can now implement cSkinDisplayMenu::MenuOrientation() to display horizontal
  menus (thanks to Stefan Braun).
- Fixed a possible stack overflow in cListBase::Sort() (thanks to Oliver Endriss).
- Changed the description of the --chartab option in the INSTALL file to refer to
  "DVB SI table strings" instead of "EPG data".
- The width and height of the OSD are now limited to the actual maximum dimensions
  of the output device, taking into account the top and left offset.
- The new setup option "Recording/Record key handling" can be used to define
  what happens if the Record key on the remote control is pressed during
  live tv (suggested by Dietmar Spingler).
- Empty adaptation field TS packets are now skipped when recording (thanks to
  Christopher Reimer, based on the "AFFcleaner" by Stefan Pöschel).
This commit is contained in:
Klaus Schmidinger 2015-09-14 16:24:00 +02:00 committed by Dieter Hametner
parent 9ab55b4090
commit a26aae3ce8
245 changed files with 6337 additions and 12508 deletions

View File

@ -714,6 +714,7 @@ Oliver Endriss <o.endriss@gmx.de>
to detect the frame type
for suggesting to ignore channels with an RID that is not 0 when checking for obsolete
channels
for fixing a possible stack overflow in cListBase::Sort()
Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf'
@ -2842,6 +2843,7 @@ Derek Kelly <user.vdr@gmail.com>
for reporting a missing template for DVBDIR in Make.config.template
for suggesting to add ARGSDIR to the ONEDIR section of Make.config.template
for suggesting to change the naming of "binary skip mode" to "adaptive skip mode"
for suggesting to make the -u option also accept a numerical user id
Marcel Unbehaun <frostworks@gmx.de>
for adding cRecordingInfo::GetEvent()
@ -2964,6 +2966,7 @@ Christopher Reimer <vdr@creimer.net>
for reporting a possible crash in the OSD demo
for adding support for systemd
for suggesting to replace VDR_CHARSET_OVERRIDE with a command line option
for making the recorder skip empty adaptation field TS packets
Stefan Huskamp <coca_cola1@gmx.de>
for suggesting to make entering characters via the number keys
@ -3003,6 +3006,8 @@ Frank Neumann <fnu@yavdr.org>
for reporting a problem with tuning timeouts when using SCR with multiple tuners
for fixing the German translation of "VDR will shut down in %s minutes"
for adding support for "Satellite Channel Routing" (SCR) according to EN50607 ("JESS")
for suggesting to make the Setup/CAM menu display which device an individual CAM
is currently assigned to
Gerald Dachs <vdr@dachsweb.de>
for reporting a problem with checking for minimum line length of 21 characters in
@ -3262,6 +3267,7 @@ Stefan Braun <louis.braun@gmx.de>
for suggesting to add the menu category mcRecordingEdit for marking menus that edit
recording properties
for suggesting to make cRecording::GetResume() public
for implementing the possibility for skins to display horizontal menus
Jochen Dolze <vdr@dolze.de>
for changing cThread::SetIOPriority() from "best effort class" to "idle class" in order
@ -3311,6 +3317,11 @@ Thomas Reufer <thomas@reufer.ch>
skipping"
for suggesting to change the return value of cOsd::RenderPixmaps() from cPixmapMemory
to cPixmap
for adding detection of 24fps
for suggesting to add some comment to cPixmap about the relation between OSD,
ViewPort and DrawPort
for suggesting to reduce the priority of the "video directory scanner" thread
for making the 'newplugin' script create the 'po' subdirectory for translations
Eike Sauer <EikeSauer@t-online.de>
for reporting a problem with channels that need more than 5 TS packets for detecting
@ -3345,6 +3356,9 @@ Dietmar Spingler <d_spingler@gmx.de>
for reporting a problem that led to a fix with EMM pids not being properly reset for
CAMs that need to receive the TS
for suggesting to add the channel name to log messages that reference a channel
for suggesting to provide a way of using no DVB devices at all
for suggesting that the -V and -h options should list the plugins in alphabetical order
for suggesting to implement the setup option "Recording/Record key handling"
Stefan Schallenberg <infos@nafets.de>
for adding the functions IndexOf(), InsertUnique(), AppendUnique() and RemoveElement()
@ -3359,6 +3373,8 @@ Dieter Ferdinand <dieter.ferdinand@gmx.de>
case replay was paused
for reporting a problem with the system getting unresponsive when removing a huge
number of files in the thread that removes deleted recordings
for suggesting to call the script that gets called for recordings also right before a
recording is edited
Jasmin Jessich <jasmin@anw.at>
for modifying the CAM API so that it is possible to implement CAMs that can be freely
@ -3400,3 +3416,15 @@ Tomasz Maciej Nowak <tmn505@gmail.com>
Gabriel Bonich <gbonich@gmail.com>
for translating OSD texts to the Spanish language
Daniel Ribeiro <drwyrm@gmail.com>
for reporting a problem with setting the source value of newly created channels, in
case the NIT is received from a different, but very close satellite position, and
for helping to debug this
Janne Pänkälä <epankala@gmail.com>
for reporting that some broadcasters use the character 0x0D in EPG texts
Stefan Pöschel <basic.master@gmx.de>
for coding the AFFcleaner, parts of which were used to make the recorder skip empty
adaptation field TS packets

View File

@ -9,7 +9,7 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: Doxyfile.filter 3.0 2013/02/17 10:54:05 kls Exp $
# $Id: Doxyfile.filter 4.0 2013/02/17 10:54:05 kls Exp $
$TAG = "///<";

232
HISTORY
View File

@ -8595,3 +8595,235 @@ Video Disk Recorder Revision History
- Fixed leading/trailing/multiple blanks in the translation files.
- Bumped all version numbers to 2.2.0.
- Official release.
2015-09-14: Version 2.3.1
- The new function cOsd::MaxPixmapSize() can be called to determine the maximum size
a cPixmap may have on the current OSD. The 'osddemo' example has been modified
accordingly. Plugin authors may want to use this function in case they use pixmaps
that are larger than the full OSD size. The default implementation sets this limit
to 2048x2048 pixel.
- The Setup/CAM menu now displays which device an individual CAM is currently
assigned to (suggested by Frank Neumann).
- Added detection of 24fps (thanks to Thomas Reufer).
- Added a note about the VDR User Counter and VDR's facebook page to the README file.
- The dvbhddevice plugin is no longer part of the VDR source archive.
You can get the latest version of this plugin from the author's repository at
https://bitbucket.org/powARman/dvbhddevice.
- The dvbsddevice and rcu plugins are no longer part of the VDR source archive.
You can get the latest versions of these plugins from ftp://ftp.tvdr.de/vdr/Plugins.
- Added a section about Output Devices to the INSTALL file.
- Fixed setting the source value of newly created channels, in case the NIT is
received from a different, but very close satellite position (reported by Daniel
Ribeiro). The code for handling different NITs has been removed from nit.c, because
according to the DVB standard table id 0x40 carries only the NIT of the actual
network.
- Added some comment to cPixmap about the relation between OSD, ViewPort and DrawPort
(suggested by Thomas Reufer).
- Improved syncing on sections when parsing the NIT and SDT.
- Fixed scaling subtitles (their areas could sometimes extend outside the actual OSD).
- Reduced the priority of the "video directory scanner" thread (suggested by Thomas
Reufer) and checking cIoThrottle::Engaged() when it is running.
- The script that gets called for recordings is now also called right before a
recording is edited, with the first parameter being "editing" (suggested by
Dieter Ferdinand).
- The new setup option "OSD/Default sort mode for recordings" can be used to define
how recordings shall be sorted by default (either by time or by name, with "by time"
being the default). If a particular sort mode has been selected for a folder by
pressing '0', the default no longer applies to that folder. Repeating timers no
longer write a ".sort" file into a recordings folder to have the recordings sorted
by time.
- The command line option -D now accepts the value '-' (as in -D-), which prevents
VDR from using any DVB devices (suggested by Dietmar Spingler).
- The -V and -h options now list the plugins in alphabetical order (suggested by
Dietmar Spingler).
- Fixed a compiler warning in font.c.
- Commented out the line
#define DEPRECATED_VIDEOSYSTEM
in device.h. If a plugin doesn't compile with this version of VDR, you can uncomment
this line as a quick workaround. In the long run the plugin will need to be adapted.
- The function cOsd::GetBitmap() is now 'protected'. If a plugin doesn't compile with
this version of VDR, you can uncomment the line
//#define DEPRECATED_GETBITMAP
in osd.h as a quick workaround. In the long run the plugin will need to be adapted.
- The -u option now also accepts a numerical user id (suggested by Derek Kelly).
- The SVDRP port now accepts multiple concurrent connections. You can now keep an
SVDRP connection open as long as you wish, without preventing others from
connecting. Note, though, that SVDRP connections still get closed automatically
if there has been no activity for 300 seconds (configurable via
"Setup/Miscellaneous/SVDRP timeout (s)").
- The SVDRP log messages have been unified and now always contain the IP and port
number of the remote host.
- SVDRP connections are now handled in a separate "SVDRP server handler" thread,
which makes them more responsive. Note that there is only one thread that handles
all concurrent SVDRP connections. That way each SVDRP command is guaranteed to be
processed separately, without interfering with any other SVDRP commands that might
be issued at the same time. Plugins that implement SVDRP commands may need to take
care of proper locking if the commands access global data.
- VDR now sends out a broadcast to port 6419/udp, which was assigned to 'svdrp-disc'
by the IANA. VDRs listening on that port will automatically initiate an SVDRP
connection to the broadcasting VDR, and in turn send out a broadcast to make
other VDRs connect to them. That way all VDRs within the local network will
have permanent "peer-to-peer" SVDRP connections between each other. The
configuration in the svdrphosts.conf file is taken into account when considering
whether or not to respond to an SVDRP discover broadcast.
- The new SVDRP command PING is used by automatically established peer-to-peer
connections to keep them alive.
- The new function GetSVDRPServerNames() can be used to get a list of all VDRs
this VDR is connected to via SVDRP.
- The new function ExecSVDRPCommand() can be used to execute an SVDRP command on
one of the servers this VDR is connected to, and retrieve the result.
The helper functions SVDRPCode() and SVDRPValue() can be used to easily access
the codes and values returned by ExecSVDRPCommand().
- The cTimer class now has a new member named 'remote', which holds the name of the
remote server this timer will record on. If this is NULL, it is a local timer.
- Timers from other VDRs that are connected to this VDR via SVDRP are now
automatically fetched and stored in the global Timers list. In order for this
to work, all of the channels used by timers on the remote VDR must also be
defined on the local VDR (however, not necessarily in the same sequence).
Automatic channel syncing will be implemented later.
- The main menu of the LCARS skin now displays a small rectangle on the left side
of a timer if this is a remote timer. The color of that rectangle changes if
the timer is currently recording on the remote VDR.
- Accessing the global Timers list now has to be protected by proper locking,
because SVDRP commands are now executed in a separate thread.
The introduction of this locking mechanism required the following changes:
+ The new classes cStateLock and cStateKey are used to implement locking
with quick detection of state changes.
+ cConfig::cConfig() now has a parameter that indicates whether this list
requires locking.
+ The global lists of Timers, Channels, Schedules and Recordings are no longer
static variables. They are now pointers that need to be retrieved through
a call to cTimers::GetTimersRead/Write(), cChannels::GetChannelsRead/Write(),
cSchedules::GetSchedulesRead/Write() and cRecordings::GetRecordingsRead/Write(),
respectively.
+ References from/to link channels are now removed in cChannels::Del() rather
than cChannel::~cChannel(), to make sure the caller holds a proper lock.
+ cChannel::HasTimer() has been removed. This information is now retrieved
via cSchedule::HasTimer().
+ Several member functions of cChannel, cTimer, cMarks and cRecording have
been made 'const', and some of them are now available as both 'const' and
'non-const' versions.
+ The cChannel::Set...() functions are now 'bool' and return true if they have
actually changed any of the channels's members.
+ cChannels::SetModified() has been renamed to cChannels::SetModifiedByUser().
+ cChannels::Modified() has been renamed to cChannels::ModifiedByUser(), and
now has a 'State' parameter that allows the caller to see whether a channel
has been modified since the last call to this function with the same State
variable.
+ The macros CHANNELSMOD_NONE/_AUTO/_USER have been removed.
+ cMarks now requires locking via cStateKey.
+ cSortedTimers now requires a pointer to the list of timers.
+ cEvent::HasTimer() no longer scans the list of timers to check whether an event
is referenced by a timer, but rather keeps score of how many timers reference
it. This was necessary in order to avoid having to lock the list of timers from
within a cEvent.
+ The new class cListGarbageCollector is used to temporary store any objects deleted
from cLists that require locking. This allows pointers to such objects to be
dereferenced even if the objects are no longer part of the list.
+ cListBase::Contains() can be used to check whether a particular object is still
contained in that list.
+ Outdated events are no longer "phased out", but rather deleted right away and thus
taken care of by the new "garbage collector" of the list.
+ Deleted cRecording objects are no longer kept in a list of "vanished" recordings,
but are rather taken care of by the new "garbage collector" of the list.
+ cSchedules::ClearAll() has been removed. The functionality is now implemented
directly in cSVDRPServer::CmdCLRE().
+ tEventID has been changed to u_int16_t in order to make room for the new member
numTimers in cEvent.
+ cSchedule now has a member Modified(), which can be used with a State variable
to quickly determine whether this schedule has been modified since the last call
to this function with the same State variable.
+ cSchedulesLock has been removed. Locking the list of schedules is now done via
the cList's new locking mechanism.
+ The 'OnlyRunningStatus' parameters in cEpgHandler::BeginSegmentTransfer() and
cEpgHandler::EndSegmentTransfer() are now obsolete. They are still present in
the interface for backward compatibility, but may be removed in a future version.
Their value is always 'false'.
+ The constant tcMod is no longer used in cStatus::TimerChange(). The definition is
still there for backward compatibility.
Plugins that access the global lists of Timers, Channels, Recordings or Schedules
will need to be adapted as follows:
+ Instead of directly accessing the global variables Timers, Channels or Recordings,
they need to set up a cStateKey variable and call the proper getter function,
as in
cStateKey StateKey;
if (const cTimers *Timers = cTimers::GetTimersRead(StateKey)) {
// access the timers
StateKey.Remove();
}
and
cStateKey StateKey;
if (cTimers *Timers = cTimers::GetTimersWrite(StateKey)) {
// access the timers
StateKey.Remove();
}
See timers.h, thread.h and tools.h for details on this new locking mechanism.
+ There are convenience macros for easily accessing these lists without having
to explicitly set up a cStateKey and calling its Remove() function. These macros
have the form LOCK_*_READ/WRITE (with '*' being TIMERS, CHANNELS, SCHEDULES or
RECORDINGS). Simply put such a macro before the point where you need to access
the respective list, and there will be a pointer named Timers, Channels, Schedules
or Recordings, respectively, which is valid until the end of the current block.
+ If a plugin needs to access several of the global lists in parallel, locking must
always be done in the sequence Timers, Channels, Recordings, Schedules. This is
necessary to make sure that different threads that need to lock several lists at
the same time don't end up in a deadlock.
+ Some pointer variables may need to be made 'const'. The compiler will tell you
about these.
- cSectionSyncer has been improved to better handle missed sections.
- Added a missing initialization of 'seen' in cChannel's copy constructor.
- Background modifications of channels, timers and events are now displayed immediately
in the corresponding menus.
- cEIT now checks the version of the tables before doing any processing, which saves
a lot of locking and processing.
- If a timer is newly created with the Red button in the Schedule menu, and the timer
is presented to the user in the "Edit timer" menu because it will start immediately,
it now *must* be confirmed with "Ok" to set the timer. Otherwise the timer will not
be created.
- Recordings and deleted recordings are now scanned in a single thread.
- The new SVDRP command POLL is used by automatically established peer-to-peer
connections to trigger fetching remote timers.
- You can now set DumpSVDRPDataTransfer in svdrp.c to true to have all SVDRP
communication printed to the console for debugging.
- Added a missing 'const' to cReceiver::Receive(), to protect the given Data from
being modified.
- The SVDRP commands that deal with timers (DELT, LSTT, MODT, NEWT, NEXT and UPDT)
as well as any log messages that refer to timers, now use a unique id for each
timer, which remains valid as long as this instance of VDR is running. This means
that timers are no longer continuously numbered from 1 to N in LSTT. There may be
gaps in the sequence, in case timers have been deleted.
- The Timers menu now displays the name of the remote VDR in front of the timer's
file name, if this is a remote timer.
- The new options "Setup/Miscellaneous/SVDRP peering", ".../SVDRP host name" and
".../SVDRP default host" can be used to configure automatic peering between VDRs
in the same network. Peering is disabled by default and can be enabled by setting
"SVDRP peering" to "yes".
- The function cTimer::ToText() no longer returns a newline character at the end of
the string. The newline is now added by the caller as necessary. This was changed
because cTimer::ToText() is now also needed in a context where the terminating
newline can't be used. Consequently, cChannel::ToText() and cMark::ToText() have
been modified accordingly.
- All timer related response strings from SVDRP commands now use the channel ID
instead of channel numbers.
- The "Edit timer" menu now has a new parameter "Record on", which can be used to
select the VDR on which this timer shall record. Timers can be freely moved
between connected VDRs by simply selecting the desired machine in this field.
- The SVDRP command DELT no longer checks whether the timer that shall be deleted
is currently recording.
- The character 0x0D is now stripped from EPG texts (reported by Janne Pänkälä).
- The EPG scanner no longer moves the dish if there is a positioner.
- The 'newplugin' script now creates the 'po' subdirectory for translations (thanks
to Thomas Reufer).
- Skins can now implement cSkinDisplayMenu::MenuOrientation() to display horizontal
menus (thanks to Stefan Braun).
- Fixed a possible stack overflow in cListBase::Sort() (thanks to Oliver Endriss).
- Changed the description of the --chartab option in the INSTALL file to refer to
"DVB SI table strings" instead of "EPG data".
- The width and height of the OSD are now limited to the actual maximum dimensions
of the output device, taking into account the top and left offset.
- The new setup option "Recording/Record key handling" can be used to define
what happens if the Record key on the remote control is pressed during
live tv (suggested by Dietmar Spingler).
- Empty adaptation field TS packets are now skipped when recording (thanks to
Christopher Reimer, based on the "AFFcleaner" by Stefan Pöschel).

37
INSTALL
View File

@ -94,6 +94,24 @@ vdr:123:respawn:/usr/local/bin/vdr --terminal=/dev/tty8 -w 60
See the man page vdr(1) for complete information about all command line options.
Output devices
--------------
VDR by itself doesn't produce any audio or video output. In order to watch
live tv or recordings, you will need to use a plugin that supports the actual
hardware in your system, for instance:
Plugin: Device:
dvbsddevice Full-Featured SD DVB cards (Fujitsu-Siemens Design)
(comes with the VDR source)
dvbhddevice Full-featured HD DVB cards (Technotrend TT S2-6400)
https://bitbucket.org/powARman/dvbhddevice
rpihddevice Raspberry Pi
http://projects.vdr-developer.org/git/vdr-plugin-rpihddevice.git
See http://linuxtv.org/vdrwiki/index.php/Output_devices for more.
Standard compliance
-------------------
@ -134,10 +152,10 @@ displayed correctly. Since BiDi support adds some runtime overhead by requiring
additional memory allocation and copying, this feature is not compiled in
by default, so that users that have no need for this don't get any overhead.
Workaround for providers not encoding their EPG data correctly
--------------------------------------------------------------
Workaround for providers not encoding their DVB SI table strings correctly
--------------------------------------------------------------------------
According to "ETSI EN 300 468" the default character set fo SI data is
According to "ETSI EN 300 468" the default character set for SI data is
ISO6937. But unfortunately some broadcasters actually use ISO-8859-9 or
other encodings, but fail to correctly announce that.
Users who want to set the default character set to something different can
@ -250,19 +268,20 @@ You can use the '-r' option to define a program or script that gets called
before and after a recording is performed, and after an editing process
has finished or a recording has been deleted.
The program will be called with two or three (in case of "edited") string
parameters. The first parameter is one of
The program will be called with two or three (in case of "editing" and "edited")
string parameters. The first parameter is one of
before if this is *before* a recording starts
started if this is after a recording has *started*
after if this is *after* a recording has finished
editing if this is before *editing* a recording
edited if this is after a recording has been *edited*
deleted if this is after a recording has been *deleted*
and the second parameter contains the full name of the recording's
directory (which may not yet exists at that moment in the "before" case).
In the "edited" case it will be the name of the edited version (second
parameter) and the name of the source version (third parameter).
In the "editing" and "edited" case it will be the name of the edited version
(second parameter) and the name of the source version (third parameter).
In the "deleted" case the extension of the directory name is ".del"
instead of ".rec".
@ -286,6 +305,10 @@ case "$1" in
after)
echo "After recording $2"
;;
editing)
echo "Editing recording $2"
echo "Source recording $3"
;;
edited)
echo "Edited recording $2"
echo "Source recording $3"

29
MANUAL
View File

@ -498,6 +498,9 @@ Version 2.2
the name of the recording.
First day: The date of the first day when this timer shall start recording
(only available for repeating timers).
Record on: The name of the remote VDR this timer shall record on (only available
if there are any remote VDRs connected to this VDR). If this field
is empty, the timer will record on the local VDR.
A timer can also be programmed by pressing the "Red" key on the "Schedule",
"Now", "Next" or "Event" menus.
@ -654,6 +657,11 @@ Version 2.2
plain recordings. Set this option to "no" if you want folders
to be interspersed with recordings when sorted alphabetically.
Default sort mode for recordings = by time
Controls whether recordings are sorted by time or by name.
If a particular sort mode has been selected for a folder by
pressing '0', the default no longer applies to that folder.
Number keys for characters = yes
Controls whether the number keys can be used to enter
characters in a text input field. You may want to set this
@ -882,8 +890,13 @@ Version 2.2
means that this recording will never be deleted
automatically.
Pause priority = 10 The Priority and Lifetime values used when pausing live
Pause lifetime = 1 video.
Record key handling = 2
Defines what happens if the Record key on the remote control
is pressed during live tv.
0 = no instant recording
1 = confirm instant recording
2 = record instantly
The default is 2.
Pause key handling = 2 Defines what happens if the Pause key on the remote control
is pressed during live tv.
@ -892,6 +905,9 @@ Version 2.2
2 = pause live video
The default is 2.
Pause priority = 10 The Priority and Lifetime values used when pausing live
Pause lifetime = 1 video.
Use episode name = yes Repeating timers use the EPG's 'Episode name' information
to create recording file names in a hierarchical structure
(for instance to gather all episodes of a series in a
@ -1066,6 +1082,15 @@ Version 2.2
connection after which the connection is automatically
closed. Default is 300, a value of 0 means no timeout.
SVDRP peering = no Activates automatic connections between VDRs in the same
network.
SVDRP host name The name of this VDR, which is used when connecting VDRs
via SVDRP. By default, the machine's host name is used.
SVDRP default host The name of the VDR to be used by default when creating a
new timer.
Zap timeout = 3 The time (in seconds) until a channel counts as "previous"
for switching with '0'

View File

@ -6,7 +6,7 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: Make.config.template 3.4 2015/02/09 09:58:45 kls Exp $
# $Id: Make.config.template 4.0 2015/02/09 09:58:45 kls Exp $
### The C compiler and options:

View File

@ -4,7 +4,7 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: Make.global 3.0 2012/12/29 12:03:01 kls Exp $
# $Id: Make.global 4.0 2012/12/29 12:03:01 kls Exp $
# This is just a dummy file for plugins that use old style (version 1.7.33
# or earlier) Makefiles.

View File

@ -4,7 +4,7 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: Makefile 3.6 2015/02/09 12:28:24 kls Exp $
# $Id: Makefile 4.0 2015/02/09 12:28:24 kls Exp $
.DELETE_ON_ERROR:

View File

@ -38,7 +38,7 @@ Copyright &copy; 2015 Klaus Schmidinger<br>
<a href="http://www.tvdr.de">www.tvdr.de</a>
</div>
<div class="center">
<modified>Important modifications introduced since version 2.0 are marked like this.</modified>
<modified>Important modifications introduced since version 2.2 are marked like this.</modified>
</div>
<p>
VDR provides an easy to use plugin interface that allows additional functionality
@ -99,12 +99,12 @@ structures and allows it to hook itself into specific areas to perform special a
<li><a href="#Skins">Skins</a>
<li><a href="#Themes">Themes</a>
<li><a href="#Devices">Devices</a>
<li><modified><a href="#Positioners">Positioners</a></modified>
<li><a href="#Positioners">Positioners</a>
<li><a href="#Audio">Audio</a>
<li><a href="#Remote Control">Remote Control</a>
<li><a href="#Conditional Access">Conditional Access</a>
<li><a href="#Electronic Program Guide">Electronic Program Guide</a>
<li><modified><a href="#The video directory">The video directory</a></modified>
<li><a href="#The video directory">The video directory</a>
</ul>
</ul>
@ -1161,6 +1161,12 @@ The returned string may consist of several lines, separated by the newline chara
('<tt>\n</tt>'). Each of these lines will be preceded with the <tt>ReplyCode</tt>
when presenting them to the caller, and the continuation character ('<tt>-</tt>')
will be set for all but the last one.
<p>
<modified>
<b>The SVDRP functions are called from the separate "SVDRP server handler" thread.
Therefore the plugin needs to take care of proper locking if it accesses any
global data.</b>
</modified>
<hr><h2><a name="Loading plugins into VDR">Loading plugins into VDR</a></h2>
@ -1877,7 +1883,7 @@ virtual bool SetPlayMode(ePlayMode PlayMode);
virtual int64_t GetSTC(void);
virtual bool IsPlayingVideo(void) const;
virtual bool HasIBPTrickSpeed(void);
virtual void TrickSpeed(int Speed<modified>, bool Forward</modified>);
virtual void TrickSpeed(int Speed, bool Forward);
virtual void Clear(void);
virtual void Play(void);
virtual void Freeze(void);
@ -2026,7 +2032,6 @@ new cMyDeviceHook;
and shall not delete this object. It will be automatically deleted when the program ends.
<div class="modified">
<hr><h2><a name="Positioners">Positioners</a></h2>
<div class="blurb">Now you see me - now you don't!</div><p>
@ -2065,7 +2070,6 @@ You should create your derived positioner object in the
Note that the object has to be created on the heap (using <tt>new</tt>),
and you shall not delete it at any point (it will be deleted automatically
when the program ends).
</div modified>
<hr><h2><a name="Audio">Audio</a></h2>
@ -2301,7 +2305,6 @@ to signal VDR that no other EPG handlers shall be queried after this one.
<p>
See <tt>VDR/epg.h</tt> for details.
<div class="modified">
<hr><h2><a name="The video directory">The video directory</a></h2>
<div class="blurb">Bits and pieces...</div><p>
@ -2335,7 +2338,6 @@ You should create your derived video directory object in the
Note that the object has to be created on the heap (using <tt>new</tt>),
and you shall not delete it at any point (it will be deleted automatically
when the program ends).
</div modified>
</body>
</html>

View File

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -1,108 +0,0 @@
VDR Plugin 'dvbhddevice' Revision History
-----------------------------------------
2009-12-29: Version 0.0.1
- Initial revision.
2010-01-04: Version 0.0.2
- Calling the MakePrimaryDevice() function of the base class to allow
the cDevice to stop displaying subtitles.
- Added support for DVB cards with multiple frontends.
2011-04-17: Version 0.0.3
- Improved trickmodes
- No transfer mode needed for dolby digital
- Clear audio and video PID when Clear() ist called to stop audio decoding when jumping to cutting marks
- Support still frames in H264 format
- Remote control setup
- Added analogue video setting, support volume control.
- Support setting of audio delay.
- Support setting of audio channel (Stereo, Left, Right)
- Support setting of audio downmix mode.
- Playback of PES data is working now.
- Fall back to MPEG2 stream type when no PMT is available.
- Added support for PES PCM playback
- Support HDMI-CEC. (One-Touch Play)
- Added low level OSD implementation.
- Added option to select between high level and low level OSD.
- high level OSD: Implement SaveRegion and RestoreRegion.
- Fix not working video playback when PCR PID is different from video PID.
- Fix not working pause when playing H.264 video
- Improvements in transfer mode, fix audio dropouts or no audio at all
- Add implementation of CanHandleAreas method to support VDR 1.7.17
- in cHdffOsdRaw::Flush fix reusing of loop variable i in subloop that lead to OSD update problems
- Specify container format when starting audio decoding to support PES-DVD containers
- Added support for True Color OSD
- Allow to disable true color OSD support via setup option
2011-04-xx: Version 0.0.4
- locally define DVB OSD API extensions to support compiling with original DVB headers
- Return correct pixel aspect ratio in GetOsdSize
- Adapt Makefile to changes introduced in recent VDR versions
2012-12-27: Version 0.0.5
- Adapted Makefile to changes introduced in recent VDR versions.
2013-01-12: Version 0.0.6
- Adapted Makefile to changes introduced in recent VDR versions.
2013-01-24: Version 0.0.7
- Fixed cHdffOsd::SetAreas() (didn't clear the OSD).
2013-02-16: Version 0.0.8
- Added missing $(LDFLAGS) to the Makefile (thanks to Ville Skyttä).
2013-02-24: Version 0.0.9
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Fixed flashing OSD in "high level OSD" mode in case a menu is open while subtitles
are being displayed.
- Fixed immediately disappearing subtitle track menu when selecting "No subtitles".
2013-03-31: Version 2.0.0
- Official release.
2013-04-11: Version 2.0.1
- Fixed aspect ratio and position of scaled video.
2013-08-23: Version 2.1.1
- Fixed aspect ratio and position of scaled video.
- Added yellow button in main menu to send CEC TV-Off command.
2013-08-26: Version 2.1.2
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
2014-01-01: Version 2.1.3
- Avoiding unnecessary pkg-config warnings in plugin Makefiles.
- cDevice::TrickSpeed() now has an additional parameter named Forward.
2014-01-17: Version 2.1.4
- Using PCR based clock recovery in transfer mode.
2014-03-15: Version 2.1.6
- The function cDevice::GetVideoSystem() has been deprecated.
- Removed old-style video format setting functions.
2015-02-11: Version 2.1.7
- Adapted to the new return value of cOsd::RenderPixmaps().
2015-02-19: Version 2.2.0
- Official release.

View File

@ -1,123 +0,0 @@
#
# Makefile for a Video Disk Recorder plugin
#
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
# By default the main source file also carries this name.
PLUGIN = dvbhddevice
### The version number of this plugin (taken from the main source file):
VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
### The directory environment:
# Use package data if installed...otherwise assume we're under the VDR source directory:
PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
LIBDIR = $(call PKGCFG,libdir)
LOCDIR = $(call PKGCFG,locdir)
PLGCFG = $(call PKGCFG,plgcfg)
#
TMPDIR ?= /tmp
### The compiler options:
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
### The version number of VDR's plugin API:
APIVERSION = $(call PKGCFG,apiversion)
### Allow user defined options to overwrite defaults:
-include $(PLGCFG)
### The name of the distribution archive:
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
### The name of the shared object file:
SOFILE = libvdr-$(PLUGIN).so
### Includes and Defines (add further entries here):
INCLUDES +=
DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
### The object files (add further files here):
OBJS = $(PLUGIN).o dvbhdffdevice.o hdffcmd.o hdffosd.o menu.o setup.o
### The main target:
all: $(SOFILE) i18n
### Implicit rules:
%.o: %.c
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
### Dependencies:
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
-include $(DEPFILE)
### Internationalization (I18N):
PODIR = po
I18Npo = $(wildcard $(PODIR)/*.po)
I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
I18Npot = $(PODIR)/$(PLUGIN).pot
%.mo: %.po
msgfmt -c -o $@ $<
$(I18Npot): $(wildcard *.c)
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
%.po: $(I18Npot)
msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
@touch $@
$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
install -D -m644 $< $@
.PHONY: i18n
i18n: $(I18Nmo) $(I18Npot)
install-i18n: $(I18Nmsgs)
### Targets:
$(SOFILE): $(OBJS) libhdffcmd
@$(MAKE) --no-print-directory -C libhdffcmd all
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) libhdffcmd/libhdffcmd.a -o $@
install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
install: install-lib install-i18n
dist: $(I18Npo) clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@echo Distribution package created as $(PACKAGE).tgz
clean:
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
@-$(MAKE) --no-print-directory -C libhdffcmd clean

View File

@ -1,18 +0,0 @@
This is a "plugin" for the Video Disk Recorder (VDR).
Written by: Andreas Regel <andreas.regel@gmx.de>
Project's homepage: http://powarman.dyndns.org/hg/dvbhddevice
Latest version available at: http://powarman.dyndns.org/hg/dvbhddevice
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
See the file COPYING for more information.
Description:
The 'dvbhddevice' plugin implements the output device for the
"Full Featured TechnoTrend S2-6400" DVB cards.

View File

@ -1,97 +0,0 @@
/*
* dvbhddevice.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*/
#include <vdr/plugin.h>
#include <vdr/shutdown.h>
#include "dvbhdffdevice.h"
#include "menu.h"
#include "setup.h"
static const char *VERSION = "2.2.0";
static const char *DESCRIPTION = trNOOP("HD Full Featured DVB device");
static const char *MAINMENUENTRY = "dvbhddevice";
class cPluginDvbhddevice : public cPlugin {
private:
cDvbHdFfDeviceProbe *probe;
bool mIsUserInactive;
public:
cPluginDvbhddevice(void);
virtual ~cPluginDvbhddevice();
virtual const char *Version(void) { return VERSION; }
virtual const char *Description(void) { return tr(DESCRIPTION); }
virtual void MainThreadHook(void);
virtual void Stop(void);
virtual const char *MainMenuEntry(void);
virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value);
};
cPluginDvbhddevice::cPluginDvbhddevice(void)
: mIsUserInactive(true)
{
probe = new cDvbHdFfDeviceProbe;
}
cPluginDvbhddevice::~cPluginDvbhddevice()
{
delete probe;
}
void cPluginDvbhddevice::MainThreadHook(void)
{
bool isUserInactive = ShutdownHandler.IsUserInactive();
if (isUserInactive != mIsUserInactive)
{
mIsUserInactive = isUserInactive;
if (gHdffSetup.CecEnabled && gHdffSetup.CecTvOn)
{
HDFF::cHdffCmdIf * hdffCmdIf = cDvbHdFfDevice::GetHdffCmdHandler();
if (hdffCmdIf && !mIsUserInactive)
{
hdffCmdIf->CmdHdmiSendCecCommand(HDFF_CEC_COMMAND_TV_ON);
}
}
}
}
void cPluginDvbhddevice::Stop(void)
{
if (gHdffSetup.CecEnabled && gHdffSetup.CecTvOff)
{
HDFF::cHdffCmdIf * hdffCmdIf = cDvbHdFfDevice::GetHdffCmdHandler();
if (hdffCmdIf)
{
hdffCmdIf->CmdHdmiSendCecCommand(HDFF_CEC_COMMAND_TV_OFF);
isyslog("HDFF_CEC_COMMAND_TV_OFF");
}
}
}
const char *cPluginDvbhddevice::MainMenuEntry(void)
{
return gHdffSetup.HideMainMenu ? NULL : MAINMENUENTRY;
}
cOsdObject *cPluginDvbhddevice::MainMenuAction(void)
{
HDFF::cHdffCmdIf * hdffCmdIf = cDvbHdFfDevice::GetHdffCmdHandler();
return hdffCmdIf ? new cHdffMenu(hdffCmdIf) : NULL;
}
cMenuSetupPage *cPluginDvbhddevice::SetupMenu(void)
{
HDFF::cHdffCmdIf * hdffCmdIf = cDvbHdFfDevice::GetHdffCmdHandler();
return hdffCmdIf ? new cHdffSetupPage(hdffCmdIf) : NULL;
}
bool cPluginDvbhddevice::SetupParse(const char *Name, const char *Value)
{
return gHdffSetup.SetupParse(Name, Value);
}
VDRPLUGINCREATOR(cPluginDvbhddevice); // Don't touch this!

File diff suppressed because it is too large Load Diff

View File

@ -1,130 +0,0 @@
/*
* dvbhdffdevice.h: The DVB HD Full Featured device interface
*
* See the README file for copyright information and how to reach the author.
*/
#ifndef __DVBHDFFDEVICE_H
#define __DVBHDFFDEVICE_H
#include "hdffcmd.h"
#include <vdr/dvbdevice.h>
#include <vdr/dvbspu.h>
/// The cDvbHdFfDevice implements a DVB device which can be accessed through the Linux DVB driver API.
class cDvbHdFfDevice : public cDvbDevice {
private:
int fd_osd, fd_audio, fd_video;
protected:
virtual void MakePrimaryDevice(bool On);
public:
static bool Probe(int Adapter, int Frontend);
cDvbHdFfDevice(int Adapter, int Frontend);
virtual ~cDvbHdFfDevice();
virtual bool HasDecoder(void) const;
// SPU facilities
private:
cDvbSpuDecoder *spuDecoder;
public:
virtual cSpuDecoder *GetSpuDecoder(void);
// Channel facilities
private:
void TurnOffLiveMode(bool LiveView);
protected:
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
// PID handle facilities
protected:
virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
// Image Grab facilities
public:
virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
// Video format facilities
public:
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
// Track facilities
protected:
virtual void SetAudioTrackDevice(eTrackType Type);
// Audio facilities
private:
int audioChannel;
protected:
virtual int GetAudioChannelDevice(void);
virtual void SetAudioChannelDevice(int AudioChannel);
virtual void SetVolumeDevice(int Volume);
// Player facilities
private:
int playVideoPid;
int playAudioPid;
int playPcrPid;
bool freezed;
bool trickMode;
bool isPlayingVideo;
bool isTransferMode;
bool supportsPcrInTransferMode;
// Pes2Ts conversion stuff
uint8_t videoCounter;
uint8_t audioCounter;
void BuildTsPacket(uint8_t * TsBuffer, bool PusiSet, uint16_t Pid, uint8_t Counter, const uint8_t * Data, uint32_t Length);
uint32_t PesToTs(uint8_t * TsBuffer, uint16_t Pid, uint8_t & Counter, const uint8_t * Data, uint32_t Length);
protected:
ePlayMode playMode;
virtual bool CanReplay(void) const;
virtual bool SetPlayMode(ePlayMode PlayMode);
virtual int PlayVideo(const uchar *Data, int Length);
virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
virtual int PlayTsVideo(const uchar *Data, int Length);
virtual int PlayTsAudio(const uchar *Data, int Length);
public:
virtual int64_t GetSTC(void);
virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter);
virtual void ScaleVideo(const cRect &Rect = cRect::Null);
#if (APIVERSNUM >= 20103)
virtual void TrickSpeed(int Speed, bool Forward);
#else
virtual void TrickSpeed(int Speed);
#endif
virtual void Clear(void);
virtual void Play(void);
virtual void Freeze(void);
virtual void Mute(void);
virtual void StillPicture(const uchar *Data, int Length);
virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
virtual bool Flush(int TimeoutMs = 0);
// HDFF specific things
public:
static HDFF::cHdffCmdIf *GetHdffCmdHandler(void);
private:
static int devHdffOffset;//TODO
bool isHdffPrimary;//TODO implicit!
HDFF::cHdffCmdIf *mHdffCmdIf;
};
class cDvbHdFfDeviceProbe : public cDvbDeviceProbe {
public:
virtual bool Probe(int Adapter, int Frontend);
};
#endif //__DVBHDFFDEVICE_H

View File

@ -1,401 +0,0 @@
/*
* hdffcmd.c: TODO(short description)
*
* See the README file for copyright information and how to reach the author.
*/
#include <stdint.h>
#include "hdffcmd.h"
#include "libhdffcmd/hdffcmd.h"
#include <stdio.h>
#include <string.h>
#include <vdr/tools.h>
namespace HDFF
{
cHdffCmdIf::cHdffCmdIf(int OsdDev)
{
mOsdDev = OsdDev;
if (mOsdDev < 0)
{
//printf("ERROR: invalid OSD device handle (%d)!\n", mOsdDev);
}
}
cHdffCmdIf::~cHdffCmdIf(void)
{
}
uint32_t cHdffCmdIf::CmdGetFirmwareVersion(char * pString, uint32_t MaxLength)
{
uint32_t version;
int err;
err = HdffCmdGetFirmwareVersion(mOsdDev, &version, pString, MaxLength);
if (err == 0)
return version;
return 0;
}
uint32_t cHdffCmdIf::CmdGetInterfaceVersion(char * pString, uint32_t MaxLength)
{
uint32_t version;
int err;
err = HdffCmdGetInterfaceVersion(mOsdDev, &version, pString, MaxLength);
if (err == 0)
return version;
return 0;
}
uint32_t cHdffCmdIf::CmdGetCopyrights(uint8_t Index, char * pString, uint32_t MaxLength)
{
int err;
err = HdffCmdGetCopyrights(mOsdDev, Index, pString, MaxLength);
if (err == 0)
return strlen(pString);
return 0;
}
void cHdffCmdIf::CmdAvSetPlayMode(uint8_t PlayMode, bool Realtime)
{
HdffCmdAvSetPlayMode(mOsdDev, PlayMode, Realtime);
}
void cHdffCmdIf::CmdAvSetVideoPid(uint8_t DecoderIndex, uint16_t VideoPid, HdffVideoStreamType_t StreamType, bool PlaybackMode)
{
//printf("SetVideoPid %d %d\n", VideoPid, StreamType);
HdffCmdAvSetVideoPid(mOsdDev, DecoderIndex, VideoPid, StreamType);
}
void cHdffCmdIf::CmdAvSetAudioPid(uint8_t DecoderIndex, uint16_t AudioPid, HdffAudioStreamType_t StreamType, HdffAvContainerType_t ContainerType)
{
//printf("SetAudioPid %d %d %d\n", AudioPid, StreamType, ContainerType);
HdffCmdAvSetAudioPid(mOsdDev, DecoderIndex, AudioPid, StreamType,
ContainerType);
}
void cHdffCmdIf::CmdAvSetPcrPid(uint8_t DecoderIndex, uint16_t PcrPid)
{
//printf("SetPcrPid %d\n", PcrPid);
HdffCmdAvSetPcrPid(mOsdDev, DecoderIndex, PcrPid);
}
void cHdffCmdIf::CmdAvSetTeletextPid(uint8_t DecoderIndex, uint16_t TeletextPid)
{
HdffCmdAvSetTeletextPid(mOsdDev, DecoderIndex, TeletextPid);
}
void cHdffCmdIf::CmdAvSetVideoWindow(uint8_t DecoderIndex, bool Enable, uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height)
{
HdffCmdAvSetVideoWindow(mOsdDev, DecoderIndex, Enable, X, Y, Width, Height);
}
void cHdffCmdIf::CmdAvShowStillImage(uint8_t DecoderIndex, const uint8_t * pStillImage, int Size, HdffVideoStreamType_t StreamType)
{
HdffCmdAvShowStillImage(mOsdDev, DecoderIndex, pStillImage, Size,
StreamType);
}
void cHdffCmdIf::CmdAvSetDecoderInput(uint8_t DecoderIndex, uint8_t DemultiplexerIndex)
{
HdffCmdAvSetDecoderInput(mOsdDev, DecoderIndex, DemultiplexerIndex);
}
void cHdffCmdIf::CmdAvSetDemultiplexerInput(uint8_t DemultiplexerIndex, uint8_t TsInputIndex)
{
HdffCmdAvSetDemultiplexerInput(mOsdDev, DemultiplexerIndex, TsInputIndex);
}
void cHdffCmdIf::CmdAvSetVideoFormat(uint8_t DecoderIndex, const HdffVideoFormat_t * pVideoFormat)
{
HdffCmdAvSetVideoFormat(mOsdDev, DecoderIndex, pVideoFormat);
}
void cHdffCmdIf::CmdAvSetVideoOutputMode(uint8_t DecoderIndex, HdffVideoOutputMode_t OutputMode)
{
HdffCmdAvSetVideoOutputMode(mOsdDev, DecoderIndex, OutputMode);
}
void cHdffCmdIf::CmdAvSetStc(uint8_t DecoderIndex, uint64_t Stc)
{
HdffCmdAvSetStc(mOsdDev, DecoderIndex, Stc);
}
void cHdffCmdIf::CmdAvFlushBuffer(uint8_t DecoderIndex, bool FlushAudio, bool FlushVideo)
{
HdffCmdAvFlushBuffer(mOsdDev, DecoderIndex, FlushAudio, FlushVideo);
}
void cHdffCmdIf::CmdAvEnableSync(uint8_t DecoderIndex, bool EnableSync)
{
HdffCmdAvEnableSync(mOsdDev, DecoderIndex, EnableSync, EnableSync);
}
void cHdffCmdIf::CmdAvSetVideoSpeed(uint8_t DecoderIndex, int32_t Speed)
{
HdffCmdAvSetVideoSpeed(mOsdDev, DecoderIndex, Speed);
}
void cHdffCmdIf::CmdAvSetAudioSpeed(uint8_t DecoderIndex, int32_t Speed)
{
HdffCmdAvSetAudioSpeed(mOsdDev, DecoderIndex, Speed);
}
void cHdffCmdIf::CmdAvEnableVideoAfterStop(uint8_t DecoderIndex, bool EnableVideoAfterStop)
{
HdffCmdAvEnableVideoAfterStop(mOsdDev, DecoderIndex, EnableVideoAfterStop);
}
void cHdffCmdIf::CmdAvSetAudioDelay(int16_t Delay)
{
HdffCmdAvSetAudioDelay(mOsdDev, Delay);
}
void cHdffCmdIf::CmdAvSetAudioDownmix(HdffAudioDownmixMode_t DownmixMode)
{
HdffCmdAvSetAudioDownmix(mOsdDev, DownmixMode);
}
void cHdffCmdIf::CmdAvSetAudioChannel(uint8_t AudioChannel)
{
HdffCmdAvSetAudioChannel(mOsdDev, AudioChannel);
}
void cHdffCmdIf::CmdAvSetSyncShift(int16_t SyncShift)
{
HdffCmdAvSetSyncShift(mOsdDev, SyncShift);
}
void cHdffCmdIf::CmdAvMuteAudio(uint8_t DecoderIndex, bool Mute)
{
HdffCmdAvMuteAudio(mOsdDev, DecoderIndex, Mute);
}
void cHdffCmdIf::CmdOsdConfigure(const HdffOsdConfig_t * pConfig)
{
HdffCmdOsdConfigure(mOsdDev, pConfig);
}
void cHdffCmdIf::CmdOsdReset(void)
{
HdffCmdOsdReset(mOsdDev);
}
uint32_t cHdffCmdIf::CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, HdffColorType_t ColorType)
{
//printf("CreateDisplay %d %d %d\n", Width, Height, ColorType);
uint32_t newDisplay;
if (HdffCmdOsdCreateDisplay(mOsdDev, Width, Height, ColorType, &newDisplay) == 0)
return newDisplay;
LOG_ERROR_STR("Error creating display");
return HDFF_INVALID_HANDLE;
}
void cHdffCmdIf::CmdOsdDeleteDisplay(uint32_t hDisplay)
{
//printf("DeleteDisplay\n");
HdffCmdOsdDeleteDisplay(mOsdDev, hDisplay);
}
void cHdffCmdIf::CmdOsdEnableDisplay(uint32_t hDisplay, bool Enable)
{
//printf("EnableDisplay\n");
HdffCmdOsdEnableDisplay(mOsdDev, hDisplay, Enable);
}
void cHdffCmdIf::CmdOsdSetDisplayOutputRectangle(uint32_t hDisplay, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
{
//printf("SetOutputRect %d %d %d %d %d\n", hDisplay, X, Y, Width, Height);
HdffCmdOsdSetDisplayOutputRectangle(mOsdDev, hDisplay, X, Y, Width, Height);
}
void cHdffCmdIf::CmdOsdSetDisplayClippingArea(uint32_t hDisplay, bool Enable, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
{
//printf("SetClippingArea %d %d %d %d %d %d\n", hDisplay, Enable, X, Y, Width, Height);
HdffCmdOsdSetDisplayClippingArea(mOsdDev, hDisplay, Enable, X, Y, Width, Height);
}
void cHdffCmdIf::CmdOsdRenderDisplay(uint32_t hDisplay)
{
//printf("Render %08X\n", hDisplay);
HdffCmdOsdRenderDisplay(mOsdDev, hDisplay);
}
uint32_t cHdffCmdIf::CmdOsdCreatePalette(HdffColorType_t ColorType, HdffColorFormat_t ColorFormat,
uint32_t NumColors, const uint32_t * pColors)
{
uint32_t newPalette;
int err;
err = HdffCmdOsdCreatePalette(mOsdDev, ColorType, ColorFormat, NumColors,
pColors, &newPalette);
if (err == 0)
return newPalette;
LOG_ERROR_STR("Error creating palette");
return HDFF_INVALID_HANDLE;
}
void cHdffCmdIf::CmdOsdDeletePalette(uint32_t hPalette)
{
HdffCmdOsdDeletePalette(mOsdDev, hPalette);
}
void cHdffCmdIf::CmdOsdSetDisplayPalette(uint32_t hDisplay, uint32_t hPalette)
{
HdffCmdOsdSetDisplayPalette(mOsdDev, hDisplay, hPalette);
}
void cHdffCmdIf::CmdOsdSetPaletteColors(uint32_t hPalette, HdffColorFormat_t ColorFormat,
uint8_t StartColor, uint32_t NumColors, const uint32_t * pColors)
{
HdffCmdOsdSetPaletteColors(mOsdDev, hPalette, ColorFormat, StartColor,
NumColors, pColors);
}
uint32_t cHdffCmdIf::CmdOsdCreateFontFace(const uint8_t * pFontData, uint32_t DataSize)
{
//printf("CreateFontFace %d\n", DataSize);
uint32_t newFontFace;
int err;
err = HdffCmdOsdCreateFontFace(mOsdDev, pFontData, DataSize, &newFontFace);
if (err == 0)
return newFontFace;
LOG_ERROR_STR("Error creating font face");
return HDFF_INVALID_HANDLE;
}
void cHdffCmdIf::CmdOsdDeleteFontFace(uint32_t hFontFace)
{
//printf("DeleteFontFace %08X\n", hFontFace);
HdffCmdOsdDeleteFontFace(mOsdDev, hFontFace);
}
uint32_t cHdffCmdIf::CmdOsdCreateFont(uint32_t hFontFace, uint32_t Size)
{
//printf("CreateFont %d\n", Size);
uint32_t newFont;
int err;
err = HdffCmdOsdCreateFont(mOsdDev, hFontFace, Size, &newFont);
if (err == 0)
return newFont;
LOG_ERROR_STR("Error creating font");
return HDFF_INVALID_HANDLE;
}
void cHdffCmdIf::CmdOsdDeleteFont(uint32_t hFont)
{
//printf("DeleteFont %08X\n", hFont);
HdffCmdOsdDeleteFont(mOsdDev, hFont);
}
void cHdffCmdIf::CmdOsdDrawRectangle(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color)
{
//printf("Rect (%d,%d) %d x %d, %08X\n", X, Y, Width, Height, Color);
HdffCmdOsdDrawRectangle(mOsdDev, hDisplay, X, Y, Width, Height, Color);
}
void cHdffCmdIf::CmdOsdDrawEllipse(uint32_t hDisplay, int CX, int CY, int RadiusX, int RadiusY,
uint32_t Color, uint32_t Flags)
{
//printf("Ellipse (%d,%d) %d x %d, %08X, %d\n", CX, CY, RadiusX, RadiusY, Color, Flags);
HdffCmdOsdDrawEllipse(mOsdDev, hDisplay, CX, CY, RadiusX, RadiusY, Color, Flags);
}
void cHdffCmdIf::CmdOsdDrawSlope(uint32_t hDisplay, int X, int Y, int Width, int Height,
uint32_t Color, uint32_t Type)
{
//printf("Slope (%d,%d) %d x %d, %08X, %X\n", X, Y, Width, Height, Color, Type);
HdffCmdOsdDrawSlope(mOsdDev, hDisplay, X, Y, Width, Height, Color, Type);
}
void cHdffCmdIf::CmdOsdDrawText(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char * pText, uint32_t Color)
{
//printf("Text %08X (%d,%d), %s, %08X\n", hFont, X, Y, pText, Color);
HdffCmdOsdDrawText(mOsdDev, hDisplay, hFont, X, Y, pText, Color);
}
void cHdffCmdIf::CmdOsdDrawUtf8Text(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char * pText, uint32_t Color)
{
//printf("Text(UTF8) %08X (%d,%d), %s, %08X\n", hFont, X, Y, pText, Color);
HdffCmdOsdDrawUtf8Text(mOsdDev, hDisplay, hFont, X, Y, pText, Color);
}
void cHdffCmdIf::CmdOsdDrawTextW(uint32_t hDisplay, uint32_t hFont, int X, int Y, const uint16_t * pText, uint32_t Color)
{
//printf("TextW %08X (%d,%d), %08X\n", hFont, X, Y, Color);
HdffCmdOsdDrawWideText(mOsdDev, hDisplay, hFont, X, Y, pText, Color);
}
void cHdffCmdIf::CmdOsdDrawBitmap(uint32_t hDisplay, int X, int Y, const uint8_t * pBitmap,
int BmpWidth, int BmpHeight, int BmpSize,
HdffColorType_t ColorType, uint32_t hPalette)
{
//printf("Bitmap %08X (%d,%d) %d x %d, %08X\n", hDisplay, X, Y, BmpWidth, BmpHeight, hPalette);
HdffCmdOsdDrawBitmap(mOsdDev, hDisplay, X, Y, pBitmap, BmpWidth, BmpHeight,
BmpSize, ColorType, hPalette);
}
void cHdffCmdIf::CmdOsdSaveRegion(uint32_t hDisplay, int X, int Y, int Width, int Height)
{
HdffCmdOsdSaveRegion(mOsdDev, hDisplay, X, Y, Width, Height);
}
void cHdffCmdIf::CmdOsdRestoreRegion(uint32_t hDisplay)
{
HdffCmdOsdRestoreRegion(mOsdDev, hDisplay);
}
void cHdffCmdIf::CmdMuxSetVideoOut(HdffVideoOut_t VideoOut)
{
HdffCmdMuxSetVideoOut(mOsdDev, VideoOut);
}
void cHdffCmdIf::CmdMuxSetVolume(uint8_t Volume)
{
HdffCmdMuxSetVolume(mOsdDev, Volume);
}
void cHdffCmdIf::CmdMuxMuteAudio(bool Mute)
{
HdffCmdMuxMuteAudio(mOsdDev, Mute);
}
void cHdffCmdIf::CmdHdmiSetVideoMode(HdffVideoMode_t VideoMode)
{
//printf("HdmiSetVideoMode %d\n", VideoMode);
HdffCmdHdmiSetVideoMode(mOsdDev, VideoMode);
}
void cHdffCmdIf::CmdHdmiConfigure(const HdffHdmiConfig_t * pConfig)
{
HdffCmdHdmiConfigure(mOsdDev, pConfig);
}
void cHdffCmdIf::CmdHdmiSendCecCommand(HdffCecCommand_t Command)
{
HdffCmdHdmiSendCecCommand(mOsdDev, Command);
}
void cHdffCmdIf::CmdRemoteSetProtocol(HdffRemoteProtocol_t Protocol)
{
//printf("%s %d\n", __func__, Protocol);
HdffCmdRemoteSetProtocol(mOsdDev, Protocol);
}
void cHdffCmdIf::CmdRemoteSetAddressFilter(bool Enable, uint32_t Address)
{
//printf("%s %d %d\n", __func__, Enable, Address);
HdffCmdRemoteSetAddressFilter(mOsdDev, Enable, Address);
}
} // end of namespace

View File

@ -1,100 +0,0 @@
/*
* hdffcmd.h: TODO(short description)
*
* See the README file for copyright information and how to reach the author.
*/
#ifndef _HDFF_CMD_H_
#define _HDFF_CMD_H_
#include "libhdffcmd/hdffcmd.h"
namespace HDFF
{
class cHdffCmdIf
{
private:
int mOsdDev;
public:
cHdffCmdIf(int OsdDev);
~cHdffCmdIf(void);
uint32_t CmdGetFirmwareVersion(char * pString, uint32_t MaxLength);
uint32_t CmdGetInterfaceVersion(char * pString, uint32_t MaxLength);
uint32_t CmdGetCopyrights(uint8_t Index, char * pString, uint32_t MaxLength);
void CmdAvSetPlayMode(uint8_t PlayMode, bool Realtime);
void CmdAvSetVideoPid(uint8_t DecoderIndex, uint16_t VideoPid, HdffVideoStreamType_t StreamType, bool PlaybackMode = false);
void CmdAvSetAudioPid(uint8_t DecoderIndex, uint16_t AudioPid, HdffAudioStreamType_t StreamType, HdffAvContainerType_t ContainerType = HDFF_AV_CONTAINER_PES);
void CmdAvSetPcrPid(uint8_t DecoderIndex, uint16_t PcrPid);
void CmdAvSetTeletextPid(uint8_t DecoderIndex, uint16_t TeletextPid);
void CmdAvSetVideoWindow(uint8_t DecoderIndex, bool Enable, uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height);
void CmdAvShowStillImage(uint8_t DecoderIndex, const uint8_t * pStillImage, int Size, HdffVideoStreamType_t StreamType);
void CmdAvSetDecoderInput(uint8_t DecoderIndex, uint8_t DemultiplexerIndex);
void CmdAvSetDemultiplexerInput(uint8_t DemultiplexerIndex, uint8_t TsInputIndex);
void CmdAvSetVideoFormat(uint8_t DecoderIndex, const HdffVideoFormat_t * pVideoFormat);
void CmdAvSetVideoOutputMode(uint8_t DecoderIndex, HdffVideoOutputMode_t OutputMode);
void CmdAvSetStc(uint8_t DecoderIndex, uint64_t Stc);
void CmdAvFlushBuffer(uint8_t DecoderIndex, bool FlushAudio, bool FlushVideo);
void CmdAvEnableSync(uint8_t DecoderIndex, bool EnableSync);
void CmdAvSetVideoSpeed(uint8_t DecoderIndex, int32_t Speed);
void CmdAvSetAudioSpeed(uint8_t DecoderIndex, int32_t Speed);
void CmdAvEnableVideoAfterStop(uint8_t DecoderIndex, bool EnableVideoAfterStop);
void CmdAvSetAudioDelay(int16_t Delay);
void CmdAvSetAudioDownmix(HdffAudioDownmixMode_t DownmixMode);
void CmdAvSetAudioChannel(uint8_t AudioChannel);
void CmdAvSetSyncShift(int16_t SyncShift);
void CmdAvMuteAudio(uint8_t DecoderIndex, bool Mute);
void CmdOsdConfigure(const HdffOsdConfig_t * pConfig);
void CmdOsdReset(void);
uint32_t CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, HdffColorType_t ColorType);
void CmdOsdDeleteDisplay(uint32_t hDisplay);
void CmdOsdEnableDisplay(uint32_t hDisplay, bool Enable);
void CmdOsdSetDisplayOutputRectangle(uint32_t hDisplay, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height);
void CmdOsdSetDisplayClippingArea(uint32_t hDisplay, bool Enable, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height);
void CmdOsdRenderDisplay(uint32_t hDisplay);
uint32_t CmdOsdCreatePalette(HdffColorType_t ColorType, HdffColorFormat_t ColorFormat,
uint32_t NumColors, const uint32_t * pColors);
void CmdOsdDeletePalette(uint32_t hPalette);
void CmdOsdSetDisplayPalette(uint32_t hDisplay, uint32_t hPalette);
void CmdOsdSetPaletteColors(uint32_t hPalette, HdffColorFormat_t ColorFormat,
uint8_t StartColor, uint32_t NumColors, const uint32_t * pColors);
uint32_t CmdOsdCreateFontFace(const uint8_t * pFontData, uint32_t DataSize);
void CmdOsdDeleteFontFace(uint32_t hFontFace);
uint32_t CmdOsdCreateFont(uint32_t hFontFace, uint32_t Size);
void CmdOsdDeleteFont(uint32_t hFont);
void CmdOsdDrawRectangle(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color);
void CmdOsdDrawEllipse(uint32_t hDisplay, int CX, int CY, int RadiusX, int RadiusY,
uint32_t Color, uint32_t Flags);
void CmdOsdDrawSlope(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color, uint32_t Type);
void CmdOsdDrawText(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char * pText, uint32_t Color);
void CmdOsdDrawUtf8Text(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char * pText, uint32_t Color);
void CmdOsdDrawTextW(uint32_t hDisplay, uint32_t hFont, int X, int Y, const uint16_t * pText, uint32_t Color);
void CmdOsdDrawBitmap(uint32_t hDisplay, int X, int Y, const uint8_t * pBitmap,
int BmpWidth, int BmpHeight, int BmpSize,
HdffColorType_t ColorType, uint32_t hPalette);
void CmdOsdSaveRegion(uint32_t hDisplay, int X, int Y, int Width, int Height);
void CmdOsdRestoreRegion(uint32_t hDisplay);
void CmdMuxSetVideoOut(HdffVideoOut_t VideoOut);
void CmdMuxSetVolume(uint8_t Volume);
void CmdMuxMuteAudio(bool Mute);
void CmdHdmiSetVideoMode(HdffVideoMode_t VideoMode);
void CmdHdmiConfigure(const HdffHdmiConfig_t * pConfig);
void CmdHdmiSendCecCommand(HdffCecCommand_t Command);
void CmdRemoteSetProtocol(HdffRemoteProtocol_t Protocol);
void CmdRemoteSetAddressFilter(bool Enable, uint32_t Address);
};
} // end of namespace
#endif

View File

@ -1,836 +0,0 @@
/*
* hdffosd.c: Implementation of the DVB HD Full Featured On Screen Display
*
* See the README file for copyright information and how to reach the author.
*/
#include "hdffosd.h"
#include <linux/dvb/osd.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include "hdffcmd.h"
#include "setup.h"
#define MAX_NUM_FONTFACES 8
#define MAX_NUM_FONTS 8
#define MAX_BITMAP_SIZE (1024*1024)
typedef struct _tFontFace
{
cString Name;
uint32_t Handle;
} tFontFace;
typedef struct _tFont
{
uint32_t hFontFace;
int Size;
uint32_t Handle;
} tFont;
class cHdffOsd : public cOsd
{
private:
HDFF::cHdffCmdIf * mHdffCmdIf;
int mLeft;
int mTop;
int mDispWidth;
int mDispHeight;
bool mChanged;
uint32_t mDisplay;
tFontFace mFontFaces[MAX_NUM_FONTFACES];
tFont mFonts[MAX_NUM_FONTS];
uint32_t mBitmapPalette;
uint32_t mBitmapColors[256];
bool mSupportsUtf8Text;
protected:
virtual void SetActive(bool On);
public:
cHdffOsd(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level);
virtual ~cHdffOsd();
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas);
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
virtual void SaveRegion(int x1, int y1, int x2, int y2);
virtual void RestoreRegion(void);
virtual void DrawPixel(int x, int y, tColor Color);
virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false, bool Overlay = false);
virtual void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width = 0, int Height = 0, int Alignment = taDefault);
virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color);
virtual void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants = 0);
virtual void DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type);
virtual void Flush(void);
};
cHdffOsd::cHdffOsd(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level)
: cOsd(Left, Top, Level)
{
double pixelAspect;
HdffOsdConfig_t config;
//printf("cHdffOsd %d, %d, %d\n", Left, Top, Level);
mHdffCmdIf = pHdffCmdIf;
mLeft = Left;
mTop = Top;
mChanged = false;
mBitmapPalette = HDFF_INVALID_HANDLE;
mSupportsUtf8Text = false;
if (mHdffCmdIf->CmdGetFirmwareVersion(NULL, 0) >= 0x309)
mSupportsUtf8Text = true;
memset(&config, 0, sizeof(config));
config.FontKerning = true;
config.FontAntialiasing = Setup.AntiAlias ? true : false;
mHdffCmdIf->CmdOsdConfigure(&config);
gHdffSetup.GetOsdSize(mDispWidth, mDispHeight, pixelAspect);
mDisplay = mHdffCmdIf->CmdOsdCreateDisplay(mDispWidth, mDispHeight, HDFF_COLOR_TYPE_ARGB8888);
mHdffCmdIf->CmdOsdSetDisplayOutputRectangle(mDisplay, 0, 0, HDFF_SIZE_FULL_SCREEN, HDFF_SIZE_FULL_SCREEN);
for (int i = 0; i < MAX_NUM_FONTFACES; i++)
{
mFontFaces[i].Name = "";
mFontFaces[i].Handle = HDFF_INVALID_HANDLE;
}
for (int i = 0; i < MAX_NUM_FONTS; i++)
{
mFonts[i].hFontFace = HDFF_INVALID_HANDLE;
mFonts[i].Size = 0;
mFonts[i].Handle = HDFF_INVALID_HANDLE;
}
}
cHdffOsd::~cHdffOsd()
{
//printf("~cHdffOsd %d %d\n", mLeft, mTop);
if (Active()) {
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
}
SetActive(false);
for (int i = 0; i < MAX_NUM_FONTS; i++)
{
if (mFonts[i].Handle == HDFF_INVALID_HANDLE)
break;
mHdffCmdIf->CmdOsdDeleteFont(mFonts[i].Handle);
}
for (int i = 0; i < MAX_NUM_FONTFACES; i++)
{
if (mFontFaces[i].Handle == HDFF_INVALID_HANDLE)
break;
mHdffCmdIf->CmdOsdDeleteFontFace(mFontFaces[i].Handle);
}
if (mBitmapPalette != HDFF_INVALID_HANDLE)
mHdffCmdIf->CmdOsdDeletePalette(mBitmapPalette);
mHdffCmdIf->CmdOsdDeleteDisplay(mDisplay);
}
eOsdError cHdffOsd::CanHandleAreas(const tArea *Areas, int NumAreas)
{
eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas);
if (Result == oeOk)
{
for (int i = 0; i < NumAreas; i++)
{
if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8)
return oeBppNotSupported;
}
}
return Result;
}
eOsdError cHdffOsd::SetAreas(const tArea *Areas, int NumAreas)
{
eOsdError error;
cBitmap * bitmap;
for (int i = 0; i < NumAreas; i++)
{
//printf("SetAreas %d: %d %d %d %d %d\n", i, Areas[i].x1, Areas[i].y1, Areas[i].x2, Areas[i].y2, Areas[i].bpp);
}
if (Active() && mDisplay != HDFF_INVALID_HANDLE)
{
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
}
error = cOsd::SetAreas(Areas, NumAreas);
for (int i = 0; (bitmap = GetBitmap(i)) != NULL; i++)
{
bitmap->Clean();
}
return error;
}
void cHdffOsd::SetActive(bool On)
{
if (On != Active())
{
cOsd::SetActive(On);
if (On)
{
if (GetBitmap(0)) // only flush here if there are already bitmaps
Flush();
}
else if (mDisplay != HDFF_INVALID_HANDLE)
{
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
}
}
}
void cHdffOsd::SaveRegion(int x1, int y1, int x2, int y2)
{
mHdffCmdIf->CmdOsdSaveRegion(mDisplay, mLeft + x1, mTop + y1, x2 - x1 + 1, y2 - y1 + 1);
mChanged = true;
}
void cHdffOsd::RestoreRegion(void)
{
mHdffCmdIf->CmdOsdRestoreRegion(mDisplay);
mChanged = true;
}
void cHdffOsd::DrawPixel(int x, int y, tColor Color)
{
//printf("DrawPixel\n");
}
void cHdffOsd::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg, bool ReplacePalette, bool Overlay)
{
//printf("DrawBitmap %d %d %d x %d\n", x, y, Bitmap.Width(), Bitmap.Height());
int i;
int numColors;
const tColor * colors = Bitmap.Colors(numColors);
for (i = 0; i < numColors; i++)
{
mBitmapColors[i] = colors[i];
if (ColorFg || ColorBg)
{
if (i == 0)
mBitmapColors[i] = ColorBg;
else if (i == 1)
mBitmapColors[i] = ColorFg;
}
}
if (mBitmapPalette == HDFF_INVALID_HANDLE)
{
mBitmapPalette = mHdffCmdIf->CmdOsdCreatePalette(HDFF_COLOR_TYPE_CLUT8,
HDFF_COLOR_FORMAT_ARGB, numColors, mBitmapColors);
}
else
{
mHdffCmdIf->CmdOsdSetPaletteColors(mBitmapPalette,
HDFF_COLOR_FORMAT_ARGB, 0, numColors, mBitmapColors);
}
int width = Bitmap.Width();
int height = Bitmap.Height();
int chunk = MAX_BITMAP_SIZE / width;
if (chunk > height)
chunk = height;
for (int yc = 0; yc < height; yc += chunk)
{
int hc = chunk;
if (yc + hc > height)
hc = height - yc;
mHdffCmdIf->CmdOsdDrawBitmap(mDisplay, mLeft + x, mTop + y + yc,
(uint8_t *) Bitmap.Data(0, yc), width, hc,
width * hc, HDFF_COLOR_TYPE_CLUT8, mBitmapPalette);
}
mChanged = true;
}
void cHdffOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment)
{
int w = Font->Width(s);
int h = Font->Height();
int cw = Width ? Width : w;
int ch = Height ? Height : h;
int i;
int size = Font->Size();
tFontFace * pFontFace;
tFont * pFont;
if (ColorBg != clrTransparent)
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, mLeft + x, mTop + y, cw, ch, ColorBg);
if (s == NULL)
return;
pFontFace = NULL;
for (i = 0; i < MAX_NUM_FONTFACES; i++)
{
if (mFontFaces[i].Handle == HDFF_INVALID_HANDLE)
break;
if (strcmp(mFontFaces[i].Name, Font->FontName()) == 0)
{
pFontFace = &mFontFaces[i];
break;
}
}
if (pFontFace == NULL)
{
if (i < MAX_NUM_FONTFACES)
{
cString fontFileName = Font->FontName();
FILE * fp = fopen(fontFileName, "rb");
if (fp)
{
fseek(fp, 0, SEEK_END);
long fileSize = ftell(fp);
fseek(fp, 0, SEEK_SET);
if (fileSize > 0)
{
uint8_t * buffer = new uint8_t[fileSize];
if (buffer)
{
if (fread(buffer, fileSize, 1, fp) == 1)
{
mFontFaces[i].Handle = mHdffCmdIf->CmdOsdCreateFontFace(buffer, fileSize);
if (mFontFaces[i].Handle != HDFF_INVALID_HANDLE)
{
mFontFaces[i].Name = Font->FontName();
pFontFace = &mFontFaces[i];
}
}
delete[] buffer;
}
}
fclose(fp);
}
}
}
if (pFontFace == NULL)
return;
pFont = NULL;
for (i = 0; i < MAX_NUM_FONTS; i++)
{
if (mFonts[i].Handle == HDFF_INVALID_HANDLE)
break;
if (mFonts[i].hFontFace == pFontFace->Handle
&& mFonts[i].Size == size)
{
pFont = &mFonts[i];
break;
}
}
if (pFont == NULL)
{
if (i < MAX_NUM_FONTS)
{
mFonts[i].Handle = mHdffCmdIf->CmdOsdCreateFont(pFontFace->Handle, size);
if (mFonts[i].Handle != HDFF_INVALID_HANDLE)
{
mFonts[i].hFontFace = pFontFace->Handle;
mFonts[i].Size = size;
pFont = &mFonts[i];
}
}
}
if (pFont == NULL)
return;
mHdffCmdIf->CmdOsdSetDisplayClippingArea(mDisplay, true, mLeft + x, mTop + y, cw, ch);
if (Width || Height)
{
if (Width)
{
if ((Alignment & taLeft) != 0)
{
#if (APIVERSNUM >= 10728)
if ((Alignment & taBorder) != 0)
x += max(h / TEXT_ALIGN_BORDER, 1);
#endif
}
else if ((Alignment & taRight) != 0)
{
if (w < Width)
x += Width - w;
#if (APIVERSNUM >= 10728)
if ((Alignment & taBorder) != 0)
x -= max(h / TEXT_ALIGN_BORDER, 1);
#endif
}
else
{ // taCentered
if (w < Width)
x += (Width - w) / 2;
}
}
if (Height)
{
if ((Alignment & taTop) != 0)
;
else if ((Alignment & taBottom) != 0)
{
if (h < Height)
y += Height - h;
}
else
{ // taCentered
if (h < Height)
y += (Height - h) / 2;
}
}
}
#if 0
if (mSupportsUtf8Text)
{
mHdffCmdIf->CmdOsdDrawUtf8Text(mDisplay, pFont->Handle, x + mLeft, y + mTop + h, s, ColorFg);
}
else
#endif
{
uint16_t tmp[1000];
uint16_t len = 0;
while (*s && (len < (sizeof(tmp) - 1)))
{
int sl = Utf8CharLen(s);
uint sym = Utf8CharGet(s, sl);
s += sl;
tmp[len] = sym;
len++;
}
tmp[len] = 0;
mHdffCmdIf->CmdOsdDrawTextW(mDisplay, pFont->Handle, x + mLeft, y + mTop + h, tmp, ColorFg);
}
mHdffCmdIf->CmdOsdSetDisplayClippingArea(mDisplay, false, 0, 0, 0, 0);
mChanged = true;
}
void cHdffOsd::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color)
{
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, mLeft + x1, mTop + y1, x2 - x1 + 1, y2 - y1 + 1, Color);
mChanged = true;
}
void cHdffOsd::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants)
{
uint32_t flags;
int cx;
int cy;
int rx;
int ry;
switch (abs(Quadrants))
{
case 1:
if (Quadrants > 0)
flags = HDFF_DRAW_QUARTER_TOP_RIGHT;
else
flags = HDFF_DRAW_QUARTER_TOP_RIGHT_INVERTED;
cx = x1;
cy = y2;
rx = x2 - x1;
ry = y2 - y1;
break;
case 2:
if (Quadrants > 0)
flags = HDFF_DRAW_QUARTER_TOP_LEFT;
else
flags = HDFF_DRAW_QUARTER_TOP_LEFT_INVERTED;
cx = x2;
cy = y2;
rx = x2 - x1;
ry = y2 - y1;
break;
case 3:
if (Quadrants > 0)
flags = HDFF_DRAW_QUARTER_BOTTOM_LEFT;
else
flags = HDFF_DRAW_QUARTER_BOTTOM_LEFT_INVERTED;
cx = x2;
cy = y1;
rx = x2 - x1;
ry = y2 - y1;
break;
case 4:
if (Quadrants > 0)
flags = HDFF_DRAW_QUARTER_BOTTOM_RIGHT;
else
flags = HDFF_DRAW_QUARTER_BOTTOM_RIGHT_INVERTED;
cx = x1;
cy = y1;
rx = x2 - x1;
ry = y2 - y1;
break;
case 5:
flags = HDFF_DRAW_HALF_RIGHT;
cx = x1;
cy = (y1 + y2) / 2;
rx = x2 - x1;
ry = (y2 - y1) / 2;
break;
case 6:
flags = HDFF_DRAW_HALF_TOP;
cx = (x1 + x2) / 2;
cy = y2;
rx = (x2 - x1) / 2;
ry = y2 - y1;
break;
case 7:
flags = HDFF_DRAW_HALF_LEFT;
cx = x2;
cy = (y1 + y2) / 2;
rx = x2 - x1;
ry = (y2 - y1) / 2;
break;
case 8:
flags = HDFF_DRAW_HALF_BOTTOM;
cx = (x1 + x2) / 2;
cy = y1;
rx = (x2 - x1) / 2;
ry = y2 - y1;
break;
default:
flags = HDFF_DRAW_FULL;
cx = (x1 + x2) / 2;
cy = (y1 + y2) / 2;
rx = (x2 - x1) / 2;
ry = (y2 - y1) / 2;
break;
}
mHdffCmdIf->CmdOsdDrawEllipse(mDisplay, mLeft + cx, mTop + cy, rx, ry, Color, flags);
mChanged = true;
}
void cHdffOsd::DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type)
{
//printf("DrawSlope\n");
mHdffCmdIf->CmdOsdDrawSlope(mDisplay, mLeft + x1, mTop + y1,
x2 - x1 + 1, y2 - y1 + 1, Color, Type);
mChanged = true;
}
void cHdffOsd::Flush(void)
{
if (!Active())
return;
//printf("Flush\n");
cBitmap * Bitmap;
for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++)
{
int x1;
int y1;
int x2;
int y2;
if (Bitmap->Dirty(x1, y1, x2, y2))
{
//printf("dirty %d %d, %d %d\n", x1, y1, x2, y2);
DrawBitmap(0, 0, *Bitmap);
Bitmap->Clean();
}
}
if (!mChanged)
return;
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
mChanged = false;
}
class cHdffOsdRaw : public cOsd
{
private:
HDFF::cHdffCmdIf * mHdffCmdIf;
int mDispWidth;
int mDispHeight;
bool refresh;
uint32_t mDisplay;
uint32_t mBitmapPalette;
uint32_t mBitmapColors[256];
protected:
virtual void SetActive(bool On);
public:
cHdffOsdRaw(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level);
virtual ~cHdffOsdRaw();
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas);
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
virtual void Flush(void);
};
cHdffOsdRaw::cHdffOsdRaw(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level)
: cOsd(Left, Top, Level)
{
double pixelAspect;
//printf("cHdffOsdRaw %d, %d, %d\n", Left, Top, Level);
mHdffCmdIf = pHdffCmdIf;
refresh = true;
mBitmapPalette = HDFF_INVALID_HANDLE;
mDisplay = HDFF_INVALID_HANDLE;
gHdffSetup.GetOsdSize(mDispWidth, mDispHeight, pixelAspect);
}
cHdffOsdRaw::~cHdffOsdRaw()
{
//printf("~cHdffOsdRaw %d %d\n", Left(), Top());
if (mDisplay != HDFF_INVALID_HANDLE)
{
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
}
if (mBitmapPalette != HDFF_INVALID_HANDLE)
mHdffCmdIf->CmdOsdDeletePalette(mBitmapPalette);
mBitmapPalette = HDFF_INVALID_HANDLE;
if (mDisplay != HDFF_INVALID_HANDLE)
mHdffCmdIf->CmdOsdDeleteDisplay(mDisplay);
mDisplay = HDFF_INVALID_HANDLE;
}
void cHdffOsdRaw::SetActive(bool On)
{
if (On != Active())
{
cOsd::SetActive(On);
if (On)
{
if (mDisplay == HDFF_INVALID_HANDLE)
{
mDisplay = mHdffCmdIf->CmdOsdCreateDisplay(mDispWidth, mDispHeight, HDFF_COLOR_TYPE_ARGB8888);
if (mDisplay != HDFF_INVALID_HANDLE)
mHdffCmdIf->CmdOsdSetDisplayOutputRectangle(mDisplay, 0, 0, HDFF_SIZE_FULL_SCREEN, HDFF_SIZE_FULL_SCREEN);
}
refresh = true;
if (GetBitmap(0)) // only flush here if there are already bitmaps
Flush();
}
else
{
if (mDisplay != HDFF_INVALID_HANDLE)
{
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
}
if (mBitmapPalette != HDFF_INVALID_HANDLE)
mHdffCmdIf->CmdOsdDeletePalette(mBitmapPalette);
mBitmapPalette = HDFF_INVALID_HANDLE;
if (mDisplay != HDFF_INVALID_HANDLE)
mHdffCmdIf->CmdOsdDeleteDisplay(mDisplay);
mDisplay = HDFF_INVALID_HANDLE;
}
}
}
eOsdError cHdffOsdRaw::CanHandleAreas(const tArea *Areas, int NumAreas)
{
eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas);
if (Result == oeOk)
{
for (int i = 0; i < NumAreas; i++)
{
if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8
&& (Areas[i].bpp != 32 || !gHdffSetup.TrueColorOsd))
return oeBppNotSupported;
}
}
return Result;
}
eOsdError cHdffOsdRaw::SetAreas(const tArea *Areas, int NumAreas)
{
for (int i = 0; i < NumAreas; i++)
{
//printf("SetAreas %d: %d %d %d %d %d\n", i, Areas[i].x1, Areas[i].y1, Areas[i].x2, Areas[i].y2, Areas[i].bpp);
}
if (mDisplay != HDFF_INVALID_HANDLE)
{
mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, 0, 0, mDispWidth, mDispHeight, 0);
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
refresh = true;
}
return cOsd::SetAreas(Areas, NumAreas);
}
void cHdffOsdRaw::Flush(void)
{
if (!Active() || (mDisplay == HDFF_INVALID_HANDLE))
return;
#ifdef MEASURE_OSD_TIME
struct timeval start;
struct timeval end;
struct timezone timeZone;
gettimeofday(&start, &timeZone);
#endif
bool render = false;
if (IsTrueColor())
{
uint8_t * buffer = 0;
if (gHdffSetup.TrueColorFormat != 0)
{
buffer = new uint8_t[MAX_BITMAP_SIZE];
if (!buffer)
return;
}
LOCK_PIXMAPS;
while (cPixmapMemory *pm = dynamic_cast<cPixmapMemory *>(RenderPixmaps()))
{
int w = pm->ViewPort().Width();
int h = pm->ViewPort().Height();
int d = w * sizeof(tColor);
int Chunk = MAX_BITMAP_SIZE / w / sizeof(tColor);
if (Chunk > h)
Chunk = h;
for (int y = 0; y < h; y += Chunk)
{
int hc = Chunk;
if (y + hc > h)
hc = h - y;
if (gHdffSetup.TrueColorFormat == 0) // ARGB8888 (32 bit)
{
mHdffCmdIf->CmdOsdDrawBitmap(mDisplay,
Left() + pm->ViewPort().X(), Top() + pm->ViewPort().Y() + y,
pm->Data() + y * d, w, hc, hc * d,
HDFF_COLOR_TYPE_ARGB8888, HDFF_INVALID_HANDLE);
}
else if (gHdffSetup.TrueColorFormat == 1) // ARGB8565 (24 bit)
{
const tColor * pixmapData = (const tColor *) (pm->Data() + y * d);
uint8_t * bitmapData = buffer;
for (int i = 0; i < hc * w; i++)
{
bitmapData[2] = (pixmapData[i] & 0xFF000000) >> 24;
bitmapData[1] = ((pixmapData[i] & 0x00F80000) >> 16)
| ((pixmapData[i] & 0x0000E000) >> 13);
bitmapData[0] = ((pixmapData[i] & 0x00001C00) >> 5)
| ((pixmapData[i] & 0x000000F8) >> 3);
bitmapData += 3;
}
mHdffCmdIf->CmdOsdDrawBitmap(mDisplay,
Left() + pm->ViewPort().X(), Top() + pm->ViewPort().Y() + y,
buffer, w, hc, hc * w * 3,
HDFF_COLOR_TYPE_ARGB8565, HDFF_INVALID_HANDLE);
}
else if (gHdffSetup.TrueColorFormat == 2) // ARGB4444 (16 bit)
{
const tColor * pixmapData = (const tColor *) (pm->Data() + y * d);
uint16_t * bitmapData = (uint16_t *) buffer;
for (int i = 0; i < hc * w; i++)
{
bitmapData[i] = ((pixmapData[i] & 0xF0000000) >> 16)
| ((pixmapData[i] & 0x00F00000) >> 12)
| ((pixmapData[i] & 0x0000F000) >> 8)
| ((pixmapData[i] & 0x000000F0) >> 4);
}
mHdffCmdIf->CmdOsdDrawBitmap(mDisplay,
Left() + pm->ViewPort().X(), Top() + pm->ViewPort().Y() + y,
buffer, w, hc, hc * w * 2,
HDFF_COLOR_TYPE_ARGB4444, HDFF_INVALID_HANDLE);
}
}
DestroyPixmap(pm);
render = true;
}
if (buffer)
delete[] buffer;
}
else
{
uint8_t * buffer = new uint8_t[MAX_BITMAP_SIZE];
if (!buffer)
return;
cBitmap * bitmap;
for (int i = 0; (bitmap = GetBitmap(i)) != NULL; i++)
{
int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
if (refresh || bitmap->Dirty(x1, y1, x2, y2))
{
if (refresh)
{
x2 = bitmap->Width() - 1;
y2 = bitmap->Height() - 1;
}
// commit colors:
int numColors;
const tColor * colors = bitmap->Colors(numColors);
if (colors)
{
for (int c = 0; c < numColors; c++)
mBitmapColors[c] = colors[c];
if (mBitmapPalette == HDFF_INVALID_HANDLE)
{
mBitmapPalette = mHdffCmdIf->CmdOsdCreatePalette(HDFF_COLOR_TYPE_CLUT8,
HDFF_COLOR_FORMAT_ARGB, numColors, mBitmapColors);
}
else
{
mHdffCmdIf->CmdOsdSetPaletteColors(mBitmapPalette,
HDFF_COLOR_FORMAT_ARGB, 0, numColors, mBitmapColors);
}
}
// commit modified data:
int width = x2 - x1 + 1;
int height = y2 - y1 + 1;
int chunk = MAX_BITMAP_SIZE / width;
if (chunk > height)
chunk = height;
for (int y = 0; y < height; y += chunk)
{
int hc = chunk;
if (y + hc > height)
hc = height - y;
for (int r = 0; r < hc; r++)
memcpy(buffer + r * width, bitmap->Data(x1, y1 + y + r), width);
mHdffCmdIf->CmdOsdDrawBitmap(mDisplay,
Left() + bitmap->X0() + x1, Top() + bitmap->Y0() + y1 + y,
buffer, width, hc, hc * width,
HDFF_COLOR_TYPE_CLUT8, mBitmapPalette);
}
render = true;
}
bitmap->Clean();
}
delete[] buffer;
}
if (render)
{
mHdffCmdIf->CmdOsdRenderDisplay(mDisplay);
#ifdef MEASURE_OSD_TIME
gettimeofday(&end, &timeZone);
int timeNeeded = end.tv_usec - start.tv_usec;
timeNeeded += (end.tv_sec - start.tv_sec) * 1000000;
printf("time = %d\n", timeNeeded);
#endif
}
refresh = false;
}
cHdffOsdProvider::cHdffOsdProvider(HDFF::cHdffCmdIf * HdffCmdIf)
{
mHdffCmdIf = HdffCmdIf;
}
cOsd *cHdffOsdProvider::CreateOsd(int Left, int Top, uint Level)
{
//printf("CreateOsd %d %d %d\n", Left, Top, Level);
if (gHdffSetup.HighLevelOsd)
return new cHdffOsd(Left, Top, mHdffCmdIf, Level);
else
return new cHdffOsdRaw(Left, Top, mHdffCmdIf, Level);
}
bool cHdffOsdProvider::ProvidesTrueColor(void)
{
return gHdffSetup.TrueColorOsd && !gHdffSetup.HighLevelOsd;
}

View File

@ -1,24 +0,0 @@
/*
* hdffosd.h: Implementation of the DVB HD Full Featured On Screen Display
*
* See the README file for copyright information and how to reach the author.
*/
#ifndef _HDFF_OSD_H_
#define _HDFF_OSD_H_
#include <vdr/osd.h>
#include "hdffcmd.h"
class cHdffOsdProvider : public cOsdProvider
{
private:
HDFF::cHdffCmdIf * mHdffCmdIf;
public:
cHdffOsdProvider(HDFF::cHdffCmdIf * pHdffCmdIf);
virtual cOsd *CreateOsd(int Left, int Top, uint Level);
virtual bool ProvidesTrueColor(void);
};
#endif

View File

@ -1,68 +0,0 @@
#
# Makefile for the HDFF firmware command interface library
#
VERSION = 0.1.0
INSTALL_PATH ?= /usr/local
INSTALL_LIB_PATH ?= $(INSTALL_PATH)/lib
INSTALL_INCLUDE_PATH ?= $(INSTALL_PATH)/include
LIB_NAME = libhdffcmd
LIB_OBJS = bitbuffer.o hdffcmd_av.o hdffcmd_base.o hdffcmd_generic.o \
hdffcmd_hdmi.o hdffcmd_mux.o hdffcmd_osd.o hdffcmd_remote.o
LIB_HEADERS = hdffcmd.h hdffcmd_av.h hdffcmd_generic.h hdffcmd_hdmi.h \
hdffcmd_mux.h hdffcmd_osd.h hdffcmd_remote.h
LIB_STATIC = $(LIB_NAME).a
LIB_SHARED = $(LIB_NAME)-$(VERSION).so
CC ?= gcc
CFLAGS ?= -g -O2 -fPIC -Wall
AR ?= ar
ARFLAGS ?= r
### Implicit rules:
%.o: %.c
$(CC) $(CFLAGS) -c $(DEFINES) $(INCLUDES) $<
### Dependencies:
MAKEDEP = $(CC) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(LIB_OBJS:%.o=%.c) > $@
-include $(DEPFILE)
### Targets:
all: $(LIB_STATIC) $(LIB_SHARED)
$(LIB_STATIC): $(LIB_OBJS)
$(AR) $(ARFLAGS) $(LIB_STATIC) $(LIB_OBJS)
$(LIB_SHARED): $(LIB_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -fPIC -shared -o $(LIB_SHARED) $(LIB_OBJS)
ln -sf $(LIB_SHARED) $(LIB_NAME).so
clean:
@-rm -f $(LIB_OBJS) $(DEPFILE) $(LIB_STATIC) $(LIB_NAME)*.so
install: $(LIB_SHARED)
chown root $(LIB_SHARED)
chgrp root $(LIB_SHARED)
chmod 0755 $(LIB_SHARED)
cp -f $(LIB_SHARED) $(INSTALL_LIB_PATH)/
ln -sf $(LIB_SHARED) $(INSTALL_LIB_PATH)/$(LIB_NAME).so
mkdir -p $(INSTALL_INCLUDE_PATH)/libhdffcmd
list='$(LIB_HEADERS)'; \
for headerfile in $$list; do \
cp -f $$headerfile $(INSTALL_INCLUDE_PATH)/libhdffcmd/ ; \
chown root $(INSTALL_INCLUDE_PATH)/libhdffcmd/$$headerfile ; \
chgrp root $(INSTALL_INCLUDE_PATH)/libhdffcmd/$$headerfile ; \
chmod 0644 $(INSTALL_INCLUDE_PATH)/libhdffcmd/$$headerfile ; \
done

View File

@ -1,79 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#include <string.h>
#include "bitbuffer.h"
void BitBuffer_Init(BitBuffer_t * BitBuffer,
uint8_t * Data, uint32_t MaxLength)
{
memset(Data, 0, MaxLength);
BitBuffer->Data = Data;
BitBuffer->MaxLength = MaxLength * 8;
BitBuffer->BitPos = 0;
}
void BitBuffer_SetBits(BitBuffer_t * BitBuffer, int NumBits, uint32_t Data)
{
uint32_t nextBitPos;
uint32_t bytePos;
uint32_t bitsInByte;
int shift;
if (NumBits <= 0 || NumBits > 32)
return;
nextBitPos = BitBuffer->BitPos + NumBits;
if (nextBitPos > BitBuffer->MaxLength)
return;
bytePos = BitBuffer->BitPos / 8;
bitsInByte = BitBuffer->BitPos % 8;
BitBuffer->Data[bytePos] &= (uint8_t) (0xFF << (8 - bitsInByte));
shift = NumBits - (8 - bitsInByte);
if (shift > 0)
BitBuffer->Data[bytePos] |= (uint8_t) (Data >> shift);
else
BitBuffer->Data[bytePos] |= (uint8_t) (Data << (-shift));
NumBits -= 8 - bitsInByte;
bytePos++;
while (NumBits > 0)
{
shift = NumBits - 8;
if (shift > 0)
BitBuffer->Data[bytePos] = (uint8_t) (Data >> shift);
else
BitBuffer->Data[bytePos] = (uint8_t) (Data << (-shift));
NumBits -= 8;
bytePos++;
}
BitBuffer->BitPos = nextBitPos;
}
uint32_t BitBuffer_GetByteLength(BitBuffer_t * BitBuffer)
{
return (BitBuffer->BitPos + 7) / 8;
}

View File

@ -1,43 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef BITBUFFER_H
#define BITBUFFER_H
#include <stdint.h>
typedef struct BitBuffer_t
{
uint8_t * Data;
uint32_t MaxLength;
uint32_t BitPos;
} BitBuffer_t;
void BitBuffer_Init(BitBuffer_t * BitBuffer,
uint8_t * Data, uint32_t MaxLength);
void BitBuffer_SetBits(BitBuffer_t * BitBuffer, int NumBits, uint32_t Data);
uint32_t BitBuffer_GetByteLength(BitBuffer_t * BitBuffer);
#endif /* BITBUFFER_H */

View File

@ -1,42 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_H
#define HDFFCMD_H
#ifdef __cplusplus
extern "C" {
#endif
#include "hdffcmd_av.h"
#include "hdffcmd_generic.h"
#include "hdffcmd_hdmi.h"
#include "hdffcmd_mux.h"
#include "hdffcmd_osd.h"
#include "hdffcmd_remote.h"
#ifdef __cplusplus
}
#endif
#endif /* HDFFCMD_H */

View File

@ -1,506 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include "hdffcmd.h"
#include "hdffcmd_base.h"
#include "hdffcmd_defs.h"
int HdffCmdAvSetPlayMode(int OsdDevice, uint8_t PlayMode, int Realtime)
{
uint8_t cmdData[8];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_PLAY_MODE);
BitBuffer_SetBits(&cmdBuf, 1, Realtime ? 1 : 0);
BitBuffer_SetBits(&cmdBuf, 7, PlayMode);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetVideoPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid,
HdffVideoStreamType_t StreamType)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_VIDEO_PID);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 4, StreamType);
BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 13, Pid);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetAudioPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid,
HdffAudioStreamType_t StreamType,
HdffAvContainerType_t ContainerType)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_AUDIO_PID);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 4, StreamType);
BitBuffer_SetBits(&cmdBuf, 2, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 1, ContainerType);
BitBuffer_SetBits(&cmdBuf, 13, Pid);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetPcrPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_PCR_PID);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 13, Pid);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetTeletextPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_TELETEXT_PID);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 13, Pid);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetVideoWindow(int OsdDevice, uint8_t DecoderIndex, int Enable,
uint16_t X, uint16_t Y, uint16_t Width,
uint16_t Height)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_VIDEO_WINDOW);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
if (Enable)
BitBuffer_SetBits(&cmdBuf, 1, 1);
else
BitBuffer_SetBits(&cmdBuf, 1, 0);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 16, Width);
BitBuffer_SetBits(&cmdBuf, 16, Height);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvShowStillImage(int OsdDevice, uint8_t DecoderIndex,
const uint8_t * StillImage, int Size,
HdffVideoStreamType_t StreamType)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
osd_raw_data_t osd_data;
int err;
memset(&osd_data, 0, sizeof(osd_raw_data_t));
osd_data.data_buffer = StillImage;
osd_data.data_length = Size;
err = ioctl(OsdDevice, OSD_RAW_DATA, &osd_data);
if (err != 0)
return err;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SHOW_STILL_IMAGE);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 4, StreamType);
BitBuffer_SetBits(&cmdBuf, 16, osd_data.data_handle);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetDecoderInput(int OsdDevice, uint8_t DecoderIndex,
uint8_t DemultiplexerIndex)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_DECODER_INPUT);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 4, DemultiplexerIndex);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetDemultiplexerInput(int OsdDevice, uint8_t DemultiplexerIndex,
uint8_t TsInputIndex)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_DEMULTIPLEXER_INPUT);
BitBuffer_SetBits(&cmdBuf, 4, DemultiplexerIndex);
BitBuffer_SetBits(&cmdBuf, 4, TsInputIndex);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetVideoFormat(int OsdDevice, uint8_t DecoderIndex,
const HdffVideoFormat_t * VideoFormat)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_VIDEO_FORMAT);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 1, VideoFormat->AutomaticEnabled ? 1 : 0);
BitBuffer_SetBits(&cmdBuf, 1, VideoFormat->AfdEnabled ? 1 : 0);
BitBuffer_SetBits(&cmdBuf, 2, VideoFormat->TvFormat);
BitBuffer_SetBits(&cmdBuf, 8, VideoFormat->VideoConversion);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetVideoOutputMode(int OsdDevice, uint8_t DecoderIndex,
HdffVideoOutputMode_t OutputMode)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_VIDEO_OUTPUT_MODE);
BitBuffer_SetBits(&cmdBuf, 8, OutputMode);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetStc(int OsdDevice, uint8_t DecoderIndex, uint64_t Stc)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_STC);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 3, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 1, (uint32_t) (Stc >> 32));
BitBuffer_SetBits(&cmdBuf, 32, (uint32_t) Stc);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvFlushBuffer(int OsdDevice, uint8_t DecoderIndex, int FlushAudio,
int FlushVideo)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_FLUSH_BUFFER);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
if (FlushAudio)
{
BitBuffer_SetBits(&cmdBuf, 1, 1);
}
else
{
BitBuffer_SetBits(&cmdBuf, 1, 0);
}
if (FlushVideo)
{
BitBuffer_SetBits(&cmdBuf, 1, 1);
}
else
{
BitBuffer_SetBits(&cmdBuf, 1, 0);
}
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvEnableSync(int OsdDevice, uint8_t DecoderIndex, int SyncAudio,
int SyncVideo)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_ENABLE_SYNC);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 1, SyncAudio ? 1 : 0);
BitBuffer_SetBits(&cmdBuf, 1, SyncVideo ? 1 : 0);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetVideoSpeed(int OsdDevice, uint8_t DecoderIndex, int32_t Speed)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_VIDEO_SPEED);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 4, 0);
BitBuffer_SetBits(&cmdBuf, 32, Speed);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetAudioSpeed(int OsdDevice, uint8_t DecoderIndex, int32_t Speed)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_AUDIO_SPEED);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 4, 0);
BitBuffer_SetBits(&cmdBuf, 32, Speed);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvEnableVideoAfterStop(int OsdDevice, uint8_t DecoderIndex,
int EnableVideoAfterStop)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_ENABLE_VIDEO_AFTER_STOP);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 1, EnableVideoAfterStop ? 1 : 0);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetAudioDelay(int OsdDevice, int16_t Delay)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_AUDIO_DELAY);
BitBuffer_SetBits(&cmdBuf, 16, Delay);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetAudioDownmix(int OsdDevice, HdffAudioDownmixMode_t DownmixMode)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_AUDIO_DOWNMIX);
BitBuffer_SetBits(&cmdBuf, 8, DownmixMode);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetAudioChannel(int OsdDevice, uint8_t AudioChannel)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_AUDIO_CHANNEL);
BitBuffer_SetBits(&cmdBuf, 8, AudioChannel);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvSetSyncShift(int OsdDevice, int16_t SyncShift)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_SET_OPTIONS);
BitBuffer_SetBits(&cmdBuf, 1, 1);
BitBuffer_SetBits(&cmdBuf, 31, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 16, SyncShift);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvMuteAudio(int OsdDevice, uint8_t DecoderIndex, int Mute)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_MUTE_AUDIO);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 1, Mute ? 1 : 0);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdAvMuteVideo(int OsdDevice, uint8_t DecoderIndex, int Mute)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_AV_MUTE_VIDEO);
BitBuffer_SetBits(&cmdBuf, 4, DecoderIndex);
BitBuffer_SetBits(&cmdBuf, 1, Mute ? 1 : 0);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}

View File

@ -1,159 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_AV_H
#define HDFFCMD_AV_H
typedef enum HdffAvContainerType_t
{
HDFF_AV_CONTAINER_PES,
HDFF_AV_CONTAINER_PES_DVD
} HdffAvContainerType_t;
typedef enum HdffAudioStreamType_t
{
HDFF_AUDIO_STREAM_INVALID = -1,
HDFF_AUDIO_STREAM_MPEG1 = 0,
HDFF_AUDIO_STREAM_MPEG2,
HDFF_AUDIO_STREAM_AC3,
HDFF_AUDIO_STREAM_AAC,
HDFF_AUDIO_STREAM_HE_AAC,
HDFF_AUDIO_STREAM_PCM,
HDFF_AUDIO_STREAM_EAC3,
HDFF_AUDIO_STREAM_DTS
} HdffAudioStreamType_t;
typedef enum HdffVideoStreamType_t
{
HDFF_VIDEO_STREAM_INVALID = -1,
HDFF_VIDEO_STREAM_MPEG1 = 0,
HDFF_VIDEO_STREAM_MPEG2,
HDFF_VIDEO_STREAM_H264,
HDFF_VIDEO_STREAM_MPEG4_ASP,
HDFF_VIDEO_STREAM_VC1
} HdffVideoStreamType_t;
typedef enum HdffTvFormat_t
{
HDFF_TV_FORMAT_4_BY_3,
HDFF_TV_FORMAT_16_BY_9
} HdffTvFormat_t;
typedef enum HdffVideoConversion_t
{
HDFF_VIDEO_CONVERSION_AUTOMATIC,
HDFF_VIDEO_CONVERSION_LETTERBOX_16_BY_9,
HDFF_VIDEO_CONVERSION_LETTERBOX_14_BY_9,
HDFF_VIDEO_CONVERSION_PILLARBOX,
HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT,
HDFF_VIDEO_CONVERSION_ALWAYS_16_BY_9,
HDFF_VIDEO_CONVERSION_ZOOM_16_BY_9
} HdffVideoConversion_t;
typedef struct HdffVideoFormat_t
{
int AutomaticEnabled;
int AfdEnabled;
HdffTvFormat_t TvFormat;
HdffVideoConversion_t VideoConversion;
} HdffVideoFormat_t;
typedef enum HdffVideoOutputMode_t
{
HDFF_VIDEO_OUTPUT_CLONE,
HDFF_VIDEO_OUTPUT_HD_ONLY
} HdffVideoOutputMode_t;
typedef enum HdffAudioDownmixMode_t
{
HDFF_AUDIO_DOWNMIX_OFF,
HDFF_AUDIO_DOWNMIX_ANALOG,
HDFF_AUDIO_DOWNMIX_ALWAYS,
HDFF_AUDIO_DOWNMIX_AUTOMATIC,
HDFF_AUDIO_DOWNMIX_HDMI_ONLY
} HdffAudioDownmixMode_t;
int HdffCmdAvSetPlayMode(int OsdDevice, uint8_t PlayMode, int Realtime);
int HdffCmdAvSetVideoPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid,
HdffVideoStreamType_t StreamType);
int HdffCmdAvSetAudioPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid,
HdffAudioStreamType_t StreamType,
HdffAvContainerType_t ContainerType);
int HdffCmdAvSetPcrPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid);
int HdffCmdAvSetTeletextPid(int OsdDevice, uint8_t DecoderIndex, uint16_t Pid);
int HdffCmdAvSetVideoWindow(int OsdDevice, uint8_t DecoderIndex, int Enable,
uint16_t X, uint16_t Y, uint16_t Width,
uint16_t Height);
int HdffCmdAvShowStillImage(int OsdDevice, uint8_t DecoderIndex,
const uint8_t * StillImage, int Size,
HdffVideoStreamType_t StreamType);
int HdffCmdAvSetDecoderInput(int OsdDevice, uint8_t DecoderIndex,
uint8_t DemultiplexerIndex);
int HdffCmdAvSetDemultiplexerInput(int OsdDevice, uint8_t DemultiplexerIndex,
uint8_t TsInputIndex);
int HdffCmdAvSetVideoFormat(int OsdDevice, uint8_t DecoderIndex,
const HdffVideoFormat_t * VideoFormat);
int HdffCmdAvSetVideoOutputMode(int OsdDevice, uint8_t DecoderIndex,
HdffVideoOutputMode_t OutputMode);
int HdffCmdAvSetStc(int OsdDevice, uint8_t DecoderIndex, uint64_t Stc);
int HdffCmdAvFlushBuffer(int OsdDevice, uint8_t DecoderIndex, int FlushAudio,
int FlushVideo);
int HdffCmdAvEnableSync(int OsdDevice, uint8_t DecoderIndex, int SyncAudio,
int SyncVideo);
int HdffCmdAvSetVideoSpeed(int OsdDevice, uint8_t DecoderIndex, int32_t Speed);
int HdffCmdAvSetAudioSpeed(int OsdDevice, uint8_t DecoderIndex, int32_t Speed);
int HdffCmdAvEnableVideoAfterStop(int OsdDevice, uint8_t DecoderIndex,
int EnableVideoAfterStop);
int HdffCmdAvSetAudioDelay(int OsdDevice, int16_t Delay);
int HdffCmdAvSetAudioDownmix(int OsdDevice,
HdffAudioDownmixMode_t DownmixMode);
int HdffCmdAvSetAudioChannel(int OsdDevice, uint8_t AudioChannel);
int HdffCmdAvSetSyncShift(int OsdDevice, int16_t SyncShift);
int HdffCmdAvMuteAudio(int OsdDevice, uint8_t DecoderIndex, int Mute);
int HdffCmdAvMuteVideo(int OsdDevice, uint8_t DecoderIndex, int Mute);
#endif /* HDFFCMD_AV_H */

View File

@ -1,45 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#include "hdffcmd_base.h"
void HdffCmdBuildHeader(BitBuffer_t * MsgBuf, HdffMessageType_t MsgType,
HdffMessageGroup_t MsgGroup, HdffMessageId_t MsgId)
{
BitBuffer_SetBits(MsgBuf, 16, 0); // length field will be set later
BitBuffer_SetBits(MsgBuf, 6, 0); // reserved
BitBuffer_SetBits(MsgBuf, 2, MsgType);
BitBuffer_SetBits(MsgBuf, 8, MsgGroup);
BitBuffer_SetBits(MsgBuf, 16, MsgId);
}
uint32_t HdffCmdSetLength(BitBuffer_t * MsgBuf)
{
uint32_t length;
length = BitBuffer_GetByteLength(MsgBuf) - 2;
MsgBuf->Data[0] = (uint8_t) (length >> 8);
MsgBuf->Data[1] = (uint8_t) length;
return length + 2;
}

View File

@ -1,55 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_BASE_H
#define HDFFCMD_BASE_H
#include <linux/dvb/osd.h>
#if !defined OSD_RAW_CMD
typedef struct osd_raw_cmd_s {
const void *cmd_data;
int cmd_len;
void *result_data;
int result_len;
} osd_raw_cmd_t;
typedef struct osd_raw_data_s {
const void *data_buffer;
int data_length;
int data_handle;
} osd_raw_data_t;
#define OSD_RAW_CMD _IOWR('o', 162, osd_raw_cmd_t)
#define OSD_RAW_DATA _IOWR('o', 163, osd_raw_data_t)
#endif
#include "bitbuffer.h"
#include "hdffcmd_defs.h"
void HdffCmdBuildHeader(BitBuffer_t * MsgBuf, HdffMessageType_t MsgType,
HdffMessageGroup_t MsgGroup, HdffMessageId_t MsgId);
uint32_t HdffCmdSetLength(BitBuffer_t * MsgBuf);
#endif /* HDFFCMD_BASE_H */

View File

@ -1,125 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_DEFS_H
#define HDFFCMD_DEFS_H
typedef enum HdffMessageType_t
{
HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_TYPE_ANSWER,
HDFF_MSG_TYPE_RESULT,
HDFF_MSG_TYPE_EVENT
} HdffMessageType_t;
typedef enum HdffMessageGroup_t
{
HDFF_MSG_GROUP_GENERIC,
HDFF_MSG_GROUP_AV_DECODER,
HDFF_MSG_GROUP_AV_MUX,
HDFF_MSG_GROUP_FRONTEND,
HDFF_MSG_GROUP_OSD,
HDFF_MSG_GROUP_HDMI,
HDFF_MSG_GROUP_REMOTE_CONTROL
} HdffMessageGroup_t;
typedef enum HdffMessageId_t
{
HDFF_MSG_GEN_GET_FIRMWARE_VERSION = 0,
HDFF_MSG_GEN_GET_INTERFACE_VERSION,
HDFF_MSG_GEN_GET_COPYRIGHTS,
HDFF_MSG_AV_SET_AUDIO_PID = 0,
HDFF_MSG_AV_SET_VIDEO_PID,
HDFF_MSG_AV_SET_PCR_PID,
HDFF_MSG_AV_SET_TELETEXT_PID,
HDFF_MSG_AV_SHOW_STILL_IMAGE,
HDFF_MSG_AV_SET_VIDEO_WINDOW,
HDFF_MSG_AV_SET_DECODER_INPUT,
HDFF_MSG_AV_SET_DEMULTIPLEXER_INPUT,
HDFF_MSG_AV_SET_VIDEO_FORMAT,
HDFF_MSG_AV_SET_VIDEO_OUTPUT_MODE,
HDFF_MSG_AV_SET_STC,
HDFF_MSG_AV_FLUSH_BUFFER,
HDFF_MSG_AV_ENABLE_SYNC,
HDFF_MSG_AV_SET_VIDEO_SPEED,
HDFF_MSG_AV_SET_AUDIO_SPEED,
HDFF_MSG_AV_ENABLE_VIDEO_AFTER_STOP,
HDFF_MSG_AV_GET_VIDEO_FORMAT_INFO,
HDFF_MSG_AV_SET_AUDIO_DELAY,
HDFF_MSG_AV_SET_AUDIO_DOWNMIX,
HDFF_MSG_AV_SET_AUDIO_CHANNEL,
HDFF_MSG_AV_SET_PLAY_MODE,
HDFF_MSG_AV_SET_OPTIONS,
HDFF_MSG_AV_MUTE_AUDIO,
HDFF_MSG_AV_MUTE_VIDEO,
HDFF_MSG_MUX_SET_VIDEO_OUT = 0,
HDFF_MSG_MUX_SET_SLOW_BLANK,
HDFF_MSG_MUX_SET_FAST_BLANK,
HDFF_MSG_MUX_SET_VOLUME,
HDFF_MSG_MUX_SET_AUDIO_MUTE,
HDFF_MSG_OSD_CONFIGURE = 0,
HDFF_MSG_OSD_RESET,
HDFF_MSG_OSD_CREATE_DISPLAY = 10,
HDFF_MSG_OSD_DELETE_DISPLAY,
HDFF_MSG_OSD_ENABLE_DISPLAY,
HDFF_MSG_OSD_SET_DISPLAY_OUTPUT_RECTANGLE,
HDFF_MSG_OSD_SET_DISPLAY_CLIPPLING_AREA,
HDFF_MSG_OSD_RENDER_DISPLAY,
HDFF_MSG_OSD_SAVE_REGION,
HDFF_MSG_OSD_RESTORE_REGION,
HDFF_MSG_OSD_CREATE_PALETTE = 30,
HDFF_MSG_OSD_DELETE_PALETTE,
HDFF_MSG_OSD_SET_DISPLAY_PALETTE,
HDFF_MSG_OSD_SET_PALETTE_COLORS,
HDFF_MSG_OSD_CREATE_FONT_FACE = 50,
HDFF_MSG_OSD_DELETE_FONT_FACE,
HDFF_MSG_OSD_CREATE_FONT,
HDFF_MSG_OSD_DELETE_FONT,
HDFF_MSG_OSD_DRAW_PIXEL = 70,
HDFF_MSG_OSD_DRAW_RECTANGLE,
HDFF_MSG_OSD_DRAW_CIRCLE,
HDFF_MSG_OSD_DRAW_ELLIPSE,
HDFF_MSG_OSD_DRAW_SLOPE,
HDFF_MSG_OSD_DRAW_TEXT,
HDFF_MSG_OSD_DRAW_WIDE_TEXT,
HDFF_MSG_OSD_DRAW_BITMAP,
HDFF_MSG_OSD_DRAW_UTF8_TEXT,
HDFF_MSG_HDMI_ENABLE_OUTPUT = 0,
HDFF_MSG_HDMI_SET_VIDEO_MODE,
HDFF_MSG_HDMI_CONFIGURE,
HDFF_MSG_HDMI_IS_DISPLAY_CONNECTED,
HDFF_MSG_HDMI_GET_DISPLAY_INFO,
HDFF_MSG_HDMI_GET_VIDEO_MODE,
HDFF_MSG_HDMI_SEND_CEC_COMMAND,
HDFF_MSG_HDMI_SEND_RAW_CEC_COMMAND,
HDFF_MSG_REMOTE_SET_PROTOCOL = 0,
HDFF_MSG_REMOTE_SET_ADDRESS_FILTER,
HDFF_MSG_REMOTE_KEY_EVENT
} HdffMessageId_t;
#endif /* HDFFCMD_DEFS_H */

View File

@ -1,165 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#include <errno.h>
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include "hdffcmd.h"
#include "hdffcmd_base.h"
#include "hdffcmd_defs.h"
int HdffCmdGetFirmwareVersion(int OsdDevice, uint32_t * Version, char * String,
uint32_t MaxLength)
{
uint8_t cmdData[8];
uint8_t resultData[64];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int err;
if (Version == NULL)
return -EINVAL;
*Version = 0;
if (String)
String[0] = 0;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
osd_cmd.result_data = resultData;
osd_cmd.result_len = sizeof(resultData);
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_GENERIC,
HDFF_MSG_GEN_GET_FIRMWARE_VERSION);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
if (err == 0)
{
if (osd_cmd.result_len > 0)
{
if (String)
{
uint8_t textLength = resultData[9];
if (textLength >= MaxLength)
textLength = MaxLength - 1;
memcpy(String, &resultData[10], textLength);
String[textLength] = 0;
}
*Version = (resultData[6] << 16)
| (resultData[7] << 8)
| resultData[8];
}
}
return err;
}
int HdffCmdGetInterfaceVersion(int OsdDevice, uint32_t * Version, char * String,
uint32_t MaxLength)
{
uint8_t cmdData[8];
uint8_t resultData[64];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int err;
if (Version == NULL)
return -EINVAL;
*Version = 0;
if (String)
String[0] = 0;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
osd_cmd.result_data = resultData;
osd_cmd.result_len = sizeof(resultData);
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_GENERIC,
HDFF_MSG_GEN_GET_INTERFACE_VERSION);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
if (err == 0)
{
if (osd_cmd.result_len > 0)
{
if (String)
{
uint8_t textLength = resultData[9];
if (textLength >= MaxLength)
textLength = MaxLength - 1;
memcpy(String, &resultData[10], textLength);
String[textLength] = 0;
}
*Version = (resultData[6] << 16)
| (resultData[7] << 8)
| resultData[8];
}
}
return err;
}
int HdffCmdGetCopyrights(int OsdDevice, uint8_t Index, char * String,
uint32_t MaxLength)
{
uint8_t cmdData[8];
uint8_t resultData[280];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int err;
if (String == NULL)
return -EINVAL;
String[0] = 0;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
osd_cmd.result_data = resultData;
osd_cmd.result_len = sizeof(resultData);
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_GENERIC,
HDFF_MSG_GEN_GET_COPYRIGHTS);
BitBuffer_SetBits(&cmdBuf, 8, Index);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
if (err == 0)
{
if (osd_cmd.result_len > 0)
{
uint8_t index = resultData[6];
uint8_t textLen = resultData[7];
if (index == Index && textLen > 0)
{
if (textLen >= MaxLength)
{
textLen = MaxLength - 1;
}
memcpy(String, resultData + 8, textLen);
String[textLen] = 0;
}
}
}
return err;
}

View File

@ -1,36 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_GENERIC_H
#define HDFFCMD_GENERIC_H
int HdffCmdGetFirmwareVersion(int OsdDevice, uint32_t * Version, char * String,
uint32_t MaxLength);
int HdffCmdGetInterfaceVersion(int OsdDevice, uint32_t * Version, char * String,
uint32_t MaxLength);
int HdffCmdGetCopyrights(int OsdDevice, uint8_t Index, char * String,
uint32_t MaxLength);
#endif /* HDFFCMD_GENERIC_H */

View File

@ -1,120 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include "hdffcmd.h"
#include "hdffcmd_base.h"
#include "hdffcmd_defs.h"
int HdffCmdHdmiSetVideoMode(int OsdDevice, HdffVideoMode_t VideoMode)
{
uint8_t cmdData[8];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_HDMI,
HDFF_MSG_HDMI_SET_VIDEO_MODE);
BitBuffer_SetBits(&cmdBuf, 8, VideoMode);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdHdmiConfigure(int OsdDevice, const HdffHdmiConfig_t * Config)
{
uint8_t cmdData[24];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
size_t nameLen;
int i;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_HDMI,
HDFF_MSG_HDMI_CONFIGURE);
BitBuffer_SetBits(&cmdBuf, 1, Config->TransmitAudio ? 1 : 0);
BitBuffer_SetBits(&cmdBuf, 1, Config->ForceDviMode ? 1 : 0);
BitBuffer_SetBits(&cmdBuf, 1, Config->CecEnabled ? 1 : 0);
BitBuffer_SetBits(&cmdBuf, 3, Config->VideoModeAdaption);
BitBuffer_SetBits(&cmdBuf, 6, 0); // reserved
nameLen = strlen(Config->CecDeviceName);
if (nameLen > 13)
nameLen = 13;
BitBuffer_SetBits(&cmdBuf, 4, nameLen);
for (i = 0; i < nameLen; i++)
BitBuffer_SetBits(&cmdBuf, 8, Config->CecDeviceName[i]);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdHdmiSendCecCommand(int OsdDevice, HdffCecCommand_t Command)
{
uint8_t cmdData[8];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_HDMI,
HDFF_MSG_HDMI_SEND_CEC_COMMAND);
BitBuffer_SetBits(&cmdBuf, 8, Command);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdHdmiSendRawCecCommand(int OsdDevice, uint8_t Destination,
uint8_t Opcode, const uint8_t * Operand,
uint8_t OperandLength)
{
uint8_t cmdData[24];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int i;
if (OperandLength > 14)
OperandLength = 14;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_HDMI,
HDFF_MSG_HDMI_SEND_RAW_CEC_COMMAND);
BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 4, Destination);
BitBuffer_SetBits(&cmdBuf, 8, Opcode);
BitBuffer_SetBits(&cmdBuf, 8, OperandLength);
for (i = 0; i < OperandLength; i++)
BitBuffer_SetBits(&cmdBuf, 8, Operand[i]);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}

View File

@ -1,72 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_HDMI_H
#define HDFFCMD_HDMI_H
typedef enum HdffVideoMode_t
{
HDFF_VIDEO_MODE_576P50 = 18,
HDFF_VIDEO_MODE_720P50 = 19,
HDFF_VIDEO_MODE_1080I50 = 20,
HDFF_VIDEO_MODE_576I50 = 22
} HdffVideoMode_t;
typedef enum HdffVideoModeAdaption_t
{
HDFF_VIDEO_MODE_ADAPT_OFF,
HDFF_VIDEO_MODE_ADAPT_FRAME_RATE,
HDFF_VIDEO_MODE_ADAPT_ONLY_FOR_HD,
HDFF_VIDEO_MODE_ADAPT_ALWAYS
} HdffVideoModeAdaption_t;
typedef struct HdffHdmiConfig_t
{
int TransmitAudio;
int ForceDviMode;
int CecEnabled;
HdffVideoModeAdaption_t VideoModeAdaption;
char CecDeviceName[14];
} HdffHdmiConfig_t;
typedef enum HdffCecCommand_t
{
HDFF_CEC_COMMAND_TV_ON,
HDFF_CEC_COMMAND_TV_OFF,
HDFF_CEC_COMMAND_ACTIVE_SOURCE,
HDFF_CEC_COMMAND_INACTIVE_SOURCE
} HdffCecCommand_t;
int HdffCmdHdmiSetVideoMode(int OsdDevice, HdffVideoMode_t VideoMode);
int HdffCmdHdmiConfigure(int OsdDevice, const HdffHdmiConfig_t * Config);
int HdffCmdHdmiSendCecCommand(int OsdDevice, HdffCecCommand_t Command);
int HdffCmdHdmiSendRawCecCommand(int OsdDevice, uint8_t Destination,
uint8_t Opcode, const uint8_t * Operand,
uint8_t OperandLength);
#endif /* HDFFCMD_HDMI_H */

View File

@ -1,81 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include "hdffcmd.h"
#include "hdffcmd_base.h"
#include "hdffcmd_defs.h"
int HdffCmdMuxSetVideoOut(int OsdDevice, HdffVideoOut_t VideoOut)
{
uint8_t cmdData[8];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
HDFF_MSG_MUX_SET_VIDEO_OUT);
BitBuffer_SetBits(&cmdBuf, 4, VideoOut);
BitBuffer_SetBits(&cmdBuf, 4, 0); // reserved
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdMuxSetVolume(int OsdDevice, uint8_t Volume)
{
uint8_t cmdData[8];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
HDFF_MSG_MUX_SET_VOLUME);
BitBuffer_SetBits(&cmdBuf, 8, Volume);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdMuxMuteAudio(int OsdDevice, int Mute)
{
uint8_t cmdData[8];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_AV_MUX,
HDFF_MSG_MUX_SET_AUDIO_MUTE);
BitBuffer_SetBits(&cmdBuf, 1, Mute);
BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}

View File

@ -1,56 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_MUX_H
#define HDFFCMD_MUX_H
typedef enum HdffVideoOut_t
{
HDFF_VIDEO_OUT_DISABLED,
HDFF_VIDEO_OUT_CVBS_RGB,
HDFF_VIDEO_OUT_CVBS_YUV,
HDFF_VIDEO_OUT_YC
} HdffVideoOut_t;
typedef enum HdffSlowBlank_t
{
HDFF_SLOW_BLANK_OFF,
HDFF_SLOW_BLANK_16_BY_9,
HDFF_SLOW_BLANK_4_BY_3
} HdffSlowBlank_t;
typedef enum HdffFastBlank_t
{
HDFF_FAST_BLANK_CVBS,
HDFF_FAST_BLANK_RGB
} HdffFastBlank_t;
int HdffCmdMuxSetVideoOut(int OsdDevice, HdffVideoOut_t VideoOut);
int HdffCmdMuxSetVolume(int OsdDevice, uint8_t Volume);
int HdffCmdMuxMuteAudio(int OsdDevice, int Mute);
#endif /* HDFFCMD_MUX_H */

View File

@ -1,720 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include "hdffcmd.h"
#include "hdffcmd_base.h"
#include "hdffcmd_defs.h"
int HdffCmdOsdConfigure(int OsdDevice, const HdffOsdConfig_t * Config)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_CONFIGURE);
if (Config->FontAntialiasing)
{
BitBuffer_SetBits(&cmdBuf, 1, 1);
}
else
{
BitBuffer_SetBits(&cmdBuf, 1, 0);
}
if (Config->FontKerning)
{
BitBuffer_SetBits(&cmdBuf, 1, 1);
}
else
{
BitBuffer_SetBits(&cmdBuf, 1, 0);
}
BitBuffer_SetBits(&cmdBuf, 6, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 16, Config->FontDpi);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdReset(int OsdDevice)
{
uint8_t cmdData[8];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_RESET);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdCreateDisplay(int OsdDevice, uint16_t Width, uint16_t Height,
HdffColorType_t ColorType, uint32_t * NewDisplay)
{
uint8_t cmdData[16];
uint8_t resultData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int err;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
osd_cmd.result_data = resultData;
osd_cmd.result_len = sizeof(resultData);
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_CREATE_DISPLAY);
BitBuffer_SetBits(&cmdBuf, 16, Width);
BitBuffer_SetBits(&cmdBuf, 16, Height);
BitBuffer_SetBits(&cmdBuf, 8, ColorType);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
*NewDisplay = HDFF_INVALID_HANDLE;
if (err == 0)
{
if (osd_cmd.result_len > 0)
{
if (resultData[2] == HDFF_MSG_TYPE_ANSWER)
{
*NewDisplay = (resultData[6] << 24)
| (resultData[7] << 16)
| (resultData[8] << 8)
| resultData[9];
}
else
err = -1;
}
}
return err;
}
int HdffCmdOsdDeleteDisplay(int OsdDevice, uint32_t Display)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DELETE_DISPLAY);
BitBuffer_SetBits(&cmdBuf, 32, Display);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdEnableDisplay(int OsdDevice, uint32_t Display, int Enable)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_ENABLE_DISPLAY);
BitBuffer_SetBits(&cmdBuf, 32, Display);
if (Enable)
{
BitBuffer_SetBits(&cmdBuf, 1, 1);
}
else
{
BitBuffer_SetBits(&cmdBuf, 1, 0);
}
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdSetDisplayOutputRectangle(int OsdDevice, uint32_t Display,
uint16_t X, uint16_t Y,
uint16_t Width, uint16_t Height)
{
uint8_t cmdData[20];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_SET_DISPLAY_OUTPUT_RECTANGLE);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 16, Width);
BitBuffer_SetBits(&cmdBuf, 16, Height);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdSetDisplayClippingArea(int OsdDevice, uint32_t Display,
int Enable, uint16_t X, uint16_t Y,
uint16_t Width, uint16_t Height)
{
uint8_t cmdData[20];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_SET_DISPLAY_CLIPPLING_AREA);
BitBuffer_SetBits(&cmdBuf, 32, Display);
if (Enable)
{
BitBuffer_SetBits(&cmdBuf, 1, 1);
}
else
{
BitBuffer_SetBits(&cmdBuf, 1, 0);
}
BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 16, Width);
BitBuffer_SetBits(&cmdBuf, 16, Height);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdRenderDisplay(int OsdDevice, uint32_t Display)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_RENDER_DISPLAY);
BitBuffer_SetBits(&cmdBuf, 32, Display);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdSaveRegion(int OsdDevice, uint32_t Display,
uint16_t X, uint16_t Y,
uint16_t Width, uint16_t Height)
{
uint8_t cmdData[20];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_SAVE_REGION);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 16, Width);
BitBuffer_SetBits(&cmdBuf, 16, Height);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdRestoreRegion(int OsdDevice, uint32_t Display)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_RESTORE_REGION);
BitBuffer_SetBits(&cmdBuf, 32, Display);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdCreatePalette(int OsdDevice, HdffColorType_t ColorType,
HdffColorFormat_t ColorFormat,
uint32_t NumColors, const uint32_t * Colors,
uint32_t * NewPalette)
{
uint8_t cmdData[1060];
uint8_t resultData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int i;
int err;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
osd_cmd.result_data = resultData;
osd_cmd.result_len = sizeof(resultData);
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_CREATE_PALETTE);
BitBuffer_SetBits(&cmdBuf, 8, ColorType);
BitBuffer_SetBits(&cmdBuf, 8, ColorFormat);
if (NumColors > 256)
NumColors = 256;
BitBuffer_SetBits(&cmdBuf, 8, NumColors == 256 ? 0 : NumColors);
for (i = 0; i < NumColors; i++)
{
BitBuffer_SetBits(&cmdBuf, 32, Colors[i]);
}
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
*NewPalette = HDFF_INVALID_HANDLE;
if (err == 0)
{
if (osd_cmd.result_len > 0)
{
if (resultData[2] == HDFF_MSG_TYPE_ANSWER)
{
*NewPalette = (resultData[6] << 24)
| (resultData[7] << 16)
| (resultData[8] << 8)
| resultData[9];
}
else
err = -1;
}
}
return err;
}
int HdffCmdOsdDeletePalette(int OsdDevice, uint32_t Palette)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DELETE_PALETTE);
BitBuffer_SetBits(&cmdBuf, 32, Palette);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdSetDisplayPalette(int OsdDevice, uint32_t Display,
uint32_t Palette)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_SET_DISPLAY_PALETTE);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 32, Palette);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdSetPaletteColors(int OsdDevice, uint32_t Palette,
HdffColorFormat_t ColorFormat,
uint8_t StartColor, uint32_t NumColors,
const uint32_t * Colors)
{
uint8_t cmdData[1060];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int i;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_SET_PALETTE_COLORS);
BitBuffer_SetBits(&cmdBuf, 32, Palette);
BitBuffer_SetBits(&cmdBuf, 8, ColorFormat);
BitBuffer_SetBits(&cmdBuf, 8, StartColor);
if (NumColors > 256)
NumColors = 256;
BitBuffer_SetBits(&cmdBuf, 8, NumColors == 256 ? 0 : NumColors);
for (i = 0; i < NumColors; i++)
{
BitBuffer_SetBits(&cmdBuf, 32, Colors[i]);
}
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdCreateFontFace(int OsdDevice, const uint8_t * FontData,
uint32_t DataSize, uint32_t * NewFontFace)
{
uint8_t cmdData[16];
uint8_t resultData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
osd_raw_data_t osd_data;
int err;
*NewFontFace = HDFF_INVALID_HANDLE;
memset(&osd_data, 0, sizeof(osd_raw_data_t));
osd_data.data_buffer = FontData;
osd_data.data_length = DataSize;
err = ioctl(OsdDevice, OSD_RAW_DATA, &osd_data);
if (err != 0)
return err;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
osd_cmd.result_data = resultData;
osd_cmd.result_len = sizeof(resultData);
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_CREATE_FONT_FACE);
BitBuffer_SetBits(&cmdBuf, 16, osd_data.data_handle);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
if (err == 0)
{
if (osd_cmd.result_len > 0)
{
if (resultData[2] == HDFF_MSG_TYPE_ANSWER)
{
*NewFontFace = (resultData[6] << 24)
| (resultData[7] << 16)
| (resultData[8] << 8)
| resultData[9];
}
else
err = -1;
}
}
return err;
}
int HdffCmdOsdDeleteFontFace(int OsdDevice, uint32_t FontFace)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DELETE_FONT_FACE);
BitBuffer_SetBits(&cmdBuf, 32, FontFace);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdCreateFont(int OsdDevice, uint32_t FontFace, uint32_t Size,
uint32_t * NewFont)
{
uint8_t cmdData[16];
uint8_t resultData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int err;
*NewFont = HDFF_INVALID_HANDLE;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
osd_cmd.result_data = resultData;
osd_cmd.result_len = sizeof(resultData);
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_CREATE_FONT);
BitBuffer_SetBits(&cmdBuf, 32, FontFace);
BitBuffer_SetBits(&cmdBuf, 32, Size);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
err = ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
if (err == 0)
{
if (osd_cmd.result_len > 0)
{
if (resultData[2] == HDFF_MSG_TYPE_ANSWER)
{
*NewFont = (resultData[6] << 24)
| (resultData[7] << 16)
| (resultData[8] << 8)
| resultData[9];
}
else
err = -1;
}
}
return err;
}
int HdffCmdOsdDeleteFont(int OsdDevice, uint32_t Font)
{
uint8_t cmdData[16];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DELETE_FONT);
BitBuffer_SetBits(&cmdBuf, 32, Font);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdDrawRectangle(int OsdDevice, uint32_t Display, uint16_t X,
uint16_t Y, uint16_t Width, uint16_t Height,
uint32_t Color)
{
uint8_t cmdData[24];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DRAW_RECTANGLE);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 16, Width);
BitBuffer_SetBits(&cmdBuf, 16, Height);
BitBuffer_SetBits(&cmdBuf, 32, Color);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdDrawEllipse(int OsdDevice, uint32_t Display, uint16_t CX,
uint16_t CY, uint16_t RadiusX, uint16_t RadiusY,
uint32_t Color, uint32_t Flags)
{
uint8_t cmdData[28];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DRAW_ELLIPSE);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 16, CX);
BitBuffer_SetBits(&cmdBuf, 16, CY);
BitBuffer_SetBits(&cmdBuf, 16, RadiusX);
BitBuffer_SetBits(&cmdBuf, 16, RadiusY);
BitBuffer_SetBits(&cmdBuf, 32, Color);
BitBuffer_SetBits(&cmdBuf, 32, Flags);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdDrawSlope(int OsdDevice, uint32_t Display, uint16_t X,
uint16_t Y, uint16_t Width, uint16_t Height,
uint32_t Color, uint32_t Type)
{
uint8_t cmdData[28];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DRAW_SLOPE);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 16, Width);
BitBuffer_SetBits(&cmdBuf, 16, Height);
BitBuffer_SetBits(&cmdBuf, 32, Color);
BitBuffer_SetBits(&cmdBuf, 32, Type);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdDrawText(int OsdDevice, uint32_t Display, uint32_t Font,
uint16_t X, uint16_t Y, const char * Text,
uint32_t Color)
{
uint8_t cmdData[1060];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int i;
int length;
length = 0;
while (Text[length])
{
length++;
}
if (length > 980)
length = 980;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DRAW_TEXT);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 32, Font);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 32, Color);
BitBuffer_SetBits(&cmdBuf, 16, length);
for (i = 0; i < length; i++)
{
BitBuffer_SetBits(&cmdBuf, 8, Text[i]);
}
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdDrawUtf8Text(int OsdDevice, uint32_t Display, uint32_t Font,
uint16_t X, uint16_t Y, const char * Text,
uint32_t Color)
{
uint8_t cmdData[1060];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int i;
int length;
length = 0;
while (Text[length])
{
length++;
}
if (length > 980)
length = 980;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DRAW_UTF8_TEXT);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 32, Font);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 32, Color);
BitBuffer_SetBits(&cmdBuf, 16, length);
for (i = 0; i < length; i++)
{
BitBuffer_SetBits(&cmdBuf, 8, Text[i]);
}
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdDrawWideText(int OsdDevice, uint32_t Display, uint32_t Font,
uint16_t X, uint16_t Y, const uint16_t * Text,
uint32_t Color)
{
uint8_t cmdData[1060];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
int i;
int length;
length = 0;
while (Text[length])
{
length++;
}
if (length > 480)
length = 480;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DRAW_WIDE_TEXT);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 32, Font);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 32, Color);
BitBuffer_SetBits(&cmdBuf, 16, length);
for (i = 0; i < length; i++)
{
BitBuffer_SetBits(&cmdBuf, 16, Text[i]);
}
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdOsdDrawBitmap(int OsdDevice, uint32_t Display, uint16_t X,
uint16_t Y, const uint8_t * Bitmap, uint16_t BmpWidth,
uint16_t BmpHeight, uint32_t BmpSize,
HdffColorType_t ColorType, uint32_t Palette)
{
uint8_t cmdData[32];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
osd_raw_data_t osd_data;
int err;
memset(&osd_data, 0, sizeof(osd_raw_data_t));
osd_data.data_buffer = Bitmap;
osd_data.data_length = BmpSize;
err = ioctl(OsdDevice, OSD_RAW_DATA, &osd_data);
if (err != 0)
return err;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, HDFF_MSG_GROUP_OSD,
HDFF_MSG_OSD_DRAW_BITMAP);
BitBuffer_SetBits(&cmdBuf, 32, Display);
BitBuffer_SetBits(&cmdBuf, 16, X);
BitBuffer_SetBits(&cmdBuf, 16, Y);
BitBuffer_SetBits(&cmdBuf, 16, BmpWidth);
BitBuffer_SetBits(&cmdBuf, 16, BmpHeight);
BitBuffer_SetBits(&cmdBuf, 8, ColorType);
BitBuffer_SetBits(&cmdBuf, 6, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 2, 0); // uncompressed
BitBuffer_SetBits(&cmdBuf, 32, Palette);
BitBuffer_SetBits(&cmdBuf, 16, osd_data.data_handle);
BitBuffer_SetBits(&cmdBuf, 32, 0);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}

View File

@ -1,170 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_OSD_H
#define HDFFCMD_OSD_H
#define HDFF_INVALID_HANDLE 0xFFFFFFFF
#define HDFF_SCREEN_DISPLAY_HANDLE 0xFFFFFFFE
#define HDFF_POSITION_SCREEN_CENTERED 0xFFFF
#define HDFF_SIZE_FULL_SCREEN 0xFFFF
#define HDFF_SIZE_SAME_AS_SOURCE 0xFFFE
#define HDFF_FONT_FACE_TIRESIAS 0x00000000
typedef struct HdffOsdConfig_t
{
int FontAntialiasing;
int FontKerning;
uint16_t FontDpi;
} HdffOsdConfig_t;
typedef enum HdffColorType_t
{
HDFF_COLOR_TYPE_CLUT1,
HDFF_COLOR_TYPE_CLUT2,
HDFF_COLOR_TYPE_CLUT4,
HDFF_COLOR_TYPE_CLUT8,
HDFF_COLOR_TYPE_ARGB8888,
HDFF_COLOR_TYPE_ARGB8565,
HDFF_COLOR_TYPE_ARGB4444,
HDFF_COLOR_TYPE_ARGB1555,
HDFF_COLOR_TYPE_RGB888,
HDFF_COLOR_TYPE_RGB565
} HdffColorType_t;
typedef enum HdffColorFormat_t
{
HDFF_COLOR_FORMAT_ARGB,
HDFF_COLOR_FORMAT_ACBYCR
} HdffColorFormat_t;
typedef enum HdffDrawingFlags_t
{
HDFF_DRAW_FULL,
HDFF_DRAW_HALF_TOP,
HDFF_DRAW_HALF_LEFT,
HDFF_DRAW_HALF_BOTTOM,
HDFF_DRAW_HALF_RIGHT,
HDFF_DRAW_QUARTER_TOP_LEFT,
HDFF_DRAW_QUARTER_TOP_RIGHT,
HDFF_DRAW_QUARTER_BOTTOM_LEFT,
HDFF_DRAW_QUARTER_BOTTOM_RIGHT,
HDFF_DRAW_QUARTER_TOP_LEFT_INVERTED,
HDFF_DRAW_QUARTER_TOP_RIGHT_INVERTED,
HDFF_DRAW_QUARTER_BOTTOM_LEFT_INVERTED,
HDFF_DRAW_QUARTER_BOTTOM_RIGHT_INVERTED
} HdffDrawingFlags_t;
int HdffCmdOsdConfigure(int OsdDevice, const HdffOsdConfig_t * Config);
int HdffCmdOsdReset(int OsdDevice);
int HdffCmdOsdCreateDisplay(int OsdDevice, uint16_t Width, uint16_t Height,
HdffColorType_t ColorType, uint32_t * NewDisplay);
int HdffCmdOsdDeleteDisplay(int OsdDevice, uint32_t Display);
int HdffCmdOsdEnableDisplay(int OsdDevice, uint32_t Display, int Enable);
int HdffCmdOsdSetDisplayOutputRectangle(int OsdDevice, uint32_t Display,
uint16_t X, uint16_t Y,
uint16_t Width, uint16_t Height);
int HdffCmdOsdSetDisplayClippingArea(int OsdDevice, uint32_t Display,
int Enable, uint16_t X, uint16_t Y,
uint16_t Width, uint16_t Height);
int HdffCmdOsdRenderDisplay(int OsdDevice, uint32_t Display);
int HdffCmdOsdSaveRegion(int OsdDevice, uint32_t Display,
uint16_t X, uint16_t Y,
uint16_t Width, uint16_t Height);
int HdffCmdOsdRestoreRegion(int OsdDevice, uint32_t Display);
int HdffCmdOsdCreatePalette(int OsdDevice, HdffColorType_t ColorType,
HdffColorFormat_t ColorFormat,
uint32_t NumColors, const uint32_t * Colors,
uint32_t * NewPalette);
int HdffCmdOsdDeletePalette(int OsdDevice, uint32_t Palette);
int HdffCmdOsdSetDisplayPalette(int OsdDevice, uint32_t Display,
uint32_t Palette);
int HdffCmdOsdSetPaletteColors(int OsdDevice, uint32_t Palette,
HdffColorFormat_t ColorFormat,
uint8_t StartColor, uint32_t NumColors,
const uint32_t * Colors);
int HdffCmdOsdCreateFontFace(int OsdDevice, const uint8_t * FontData,
uint32_t DataSize, uint32_t * NewFontFace);
int HdffCmdOsdDeleteFontFace(int OsdDevice, uint32_t FontFace);
int HdffCmdOsdCreateFont(int OsdDevice, uint32_t FontFace, uint32_t Size,
uint32_t * NewFont);
int HdffCmdOsdDeleteFont(int OsdDevice, uint32_t Font);
int HdffCmdOsdDrawRectangle(int OsdDevice, uint32_t Display, uint16_t X,
uint16_t Y, uint16_t Width, uint16_t Height,
uint32_t Color);
int HdffCmdOsdDrawEllipse(int OsdDevice, uint32_t Display, uint16_t CX,
uint16_t CY, uint16_t RadiusX, uint16_t RadiusY,
uint32_t Color, uint32_t Flags);
int HdffCmdOsdDrawSlope(int OsdDevice, uint32_t Display, uint16_t X,
uint16_t Y, uint16_t Width, uint16_t Height,
uint32_t Color, uint32_t Type);
int HdffCmdOsdDrawText(int OsdDevice, uint32_t Display, uint32_t Font,
uint16_t X, uint16_t Y, const char * Text,
uint32_t Color);
int HdffCmdOsdDrawUtf8Text(int OsdDevice, uint32_t Display, uint32_t Font,
uint16_t X, uint16_t Y, const char * Text,
uint32_t Color);
int HdffCmdOsdDrawWideText(int OsdDevice, uint32_t Display, uint32_t Font,
uint16_t X, uint16_t Y, const uint16_t * Text,
uint32_t Color);
int HdffCmdOsdDrawBitmap(int OsdDevice, uint32_t Display, uint16_t X,
uint16_t Y, const uint8_t * Bitmap, uint16_t BmpWidth,
uint16_t BmpHeight, uint32_t BmpSize,
HdffColorType_t ColorType, uint32_t Palette);
#endif /* HDFFCMD_OSD_H */

View File

@ -1,67 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include "hdffcmd.h"
#include "hdffcmd_base.h"
#include "hdffcmd_defs.h"
int HdffCmdRemoteSetProtocol(int OsdDevice, HdffRemoteProtocol_t Protocol)
{
uint8_t cmdData[8];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_REMOTE_CONTROL,
HDFF_MSG_REMOTE_SET_PROTOCOL);
BitBuffer_SetBits(&cmdBuf, 8, Protocol);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}
int HdffCmdRemoteSetAddressFilter(int OsdDevice, int Enable, uint32_t Address)
{
uint8_t cmdData[12];
BitBuffer_t cmdBuf;
osd_raw_cmd_t osd_cmd;
BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
osd_cmd.cmd_data = cmdData;
HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND,
HDFF_MSG_GROUP_REMOTE_CONTROL,
HDFF_MSG_REMOTE_SET_ADDRESS_FILTER);
BitBuffer_SetBits(&cmdBuf, 1, Enable);
BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
BitBuffer_SetBits(&cmdBuf, 32, Address);
osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
}

View File

@ -1,39 +0,0 @@
/**********************************************************************
*
* HDFF firmware command interface library
*
* Copyright (C) 2011 Andreas Regel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*********************************************************************/
#ifndef HDFFCMD_REMOTE_H
#define HDFFCMD_REMOTE_H
typedef enum HdffRemoteProtocol_t
{
HDFF_REMOTE_PROTOCOL_NONE,
HDFF_REMOTE_PROTOCOL_RC5,
HDFF_REMOTE_PROTOCOL_RC6
} HdffRemoteProtocol_t;
int HdffCmdRemoteSetProtocol(int OsdDevice, HdffRemoteProtocol_t Protocol);
int HdffCmdRemoteSetAddressFilter(int OsdDevice, int Enable, uint32_t Address);
#endif /* HDFFCMD_REMOTE_H */

View File

@ -1,65 +0,0 @@
/*
* menu.c: The DVB HD Full Featured device main menu
*
* See the README file for copyright information and how to reach the author.
*/
#include "menu.h"
#include "setup.h"
cHdffMenu::cHdffMenu(HDFF::cHdffCmdIf * pHdffCmdIf)
: cOsdMenu("dvbhddevice"),
mHdffCmdIf(pHdffCmdIf)
{
mVideoConversionItem = new cOsdItem("", osUnknown, false);
Add(mVideoConversionItem);
SetHelp(tr("Video Conversion"), tr("TV on"), tr("TV off"));
SetVideoConversion();
}
cHdffMenu::~cHdffMenu()
{
}
eOSState cHdffMenu::ProcessKey(eKeys key)
{
eOSState state = cOsdMenu::ProcessKey(key);
if (state == osUnknown)
{
switch (key)
{
case kRed:
gHdffSetup.SetNextVideoConversion();
SetVideoConversion();
break;
case kGreen:
mHdffCmdIf->CmdHdmiSendCecCommand(HDFF_CEC_COMMAND_TV_ON);
state = osEnd;
break;
case kYellow:
mHdffCmdIf->CmdHdmiSendCecCommand(HDFF_CEC_COMMAND_TV_OFF);
state = osEnd;
break;
case kOk:
state = osEnd;
break;
default:
break;
}
}
return state;
}
void cHdffMenu::SetVideoConversion(void)
{
gHdffSetup.SetVideoFormat(mHdffCmdIf);
char str[128];
sprintf(str, "%s: %s", tr("Video Conversion"), gHdffSetup.GetVideoConversionString());
mVideoConversionItem->SetText(str);
Display();
}

View File

@ -1,29 +0,0 @@
/*
* menu.h: The DVB HD Full Featured device main menu
*
* See the README file for copyright information and how to reach the author.
*/
#ifndef _HDFF_MENU_H_
#define _HDFF_MENU_H_
#include <vdr/osd.h>
#include <vdr/plugin.h>
#include "hdffcmd.h"
class cHdffMenu : public cOsdMenu
{
private:
HDFF::cHdffCmdIf * mHdffCmdIf;
cOsdItem * mVideoConversionItem;
void SetVideoConversion(void);
public:
cHdffMenu(HDFF::cHdffCmdIf * pHdffCmdIf);
virtual ~cHdffMenu();
virtual eOSState ProcessKey(eKeys Key);
};
#endif

View File

@ -1,128 +0,0 @@
# VDR plugin language source file
# Copyright (C) 2015 Andreas Regel
# This file is distributed under the same license as the dvbhddevice package.
# Christoph Haubrich <christoph1.haubrich@arcor.de>, 2011
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-dvbhddevice 2.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-09-21 14:01+0200\n"
"PO-Revision-Date: 2011-04-25 21:44+0200\n"
"Last-Translator: Christoph Haubrich\n"
"Language-Team: <see README>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "HD Full Featured DVB device"
msgstr "HD Full Featured DVB device"
msgid "Video Conversion"
msgstr "Bildanpassung"
msgid "TV on"
msgstr "TV ein"
msgid "TV off"
msgstr "TV aus"
msgid "Automatic"
msgstr "automatisch"
msgid "Letterbox 16/9"
msgstr "Letterbox 16:9"
msgid "Letterbox 14/9"
msgstr "Letterbox 14:9"
msgid "Pillarbox"
msgstr "Pillarbox"
msgid "CentreCutOut"
msgstr "CentreCutOut"
msgid "Always 16/9"
msgstr "immer 16:9"
msgid "Zoom 16/9"
msgstr "Zoome 16:9"
msgid "Off"
msgstr "aus"
msgid "Frame rate"
msgstr "passende Framerate"
msgid "HD Only"
msgstr "nur bei HD"
msgid "Always"
msgstr "immer"
msgid "Disabled"
msgstr "abgeschaltet"
msgid "Analogue only"
msgstr "nur analoge Ausgänge"
msgid "HDMI only"
msgstr "nur HDMI"
msgid "Follow resolution"
msgstr "folge Auflösung"
msgid "none"
msgstr "keins"
msgid "Resolution"
msgstr "Auflösung"
msgid "Video Mode Adaption"
msgstr "Auflösungsanpassung"
msgid "TV format"
msgstr "TV-Format"
msgid "Analogue Video"
msgstr "Analoges Video"
msgid "Audio Delay (ms)"
msgstr "Audio Verzögerung (ms)"
msgid "Audio Downmix"
msgstr "Audio Downmix"
msgid "A/V Sync Shift (ms)"
msgstr "A/V-Sync Verschiebung (ms)"
msgid "OSD Size"
msgstr "OSD Größe"
msgid "HDMI CEC"
msgstr "HDMI CEC"
msgid "CEC: Switch TV on"
msgstr "CEC: TV einschalten"
msgid "CEC: Switch TV off"
msgstr "CEC: TV ausschalten"
msgid "Remote Control Protocol"
msgstr "Fernbedienungsprotokoll"
msgid "Remote Control Address"
msgstr "Fernbedienungsadresse"
msgid "High Level OSD"
msgstr "High Level OSD"
msgid "Allow True Color OSD"
msgstr "Erlaube True Color OSD"
msgid "True Color format"
msgstr "True Color Format"
msgid "Hide mainmenu entry"
msgstr "Hauptmenüeintrag verstecken"

View File

@ -1,128 +0,0 @@
# VDR plugin language source file
# Copyright (C) 2015 Andreas Regel
# This file is distributed under the same license as the dvbhddevice package.
# Arthur Konovalov <artlov@gmail.com>, 2015
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-dvbhddevice 2.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-09-21 14:01+0200\n"
"PO-Revision-Date: 2011-04-25 21:44+0200\n"
"Last-Translator: Arthur Konovalov <artlov@gmail.com>\n"
"Language-Team: Estonian <vdr@linuxtv.org>\n"
"Language: et\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "HD Full Featured DVB device"
msgstr "Täisfunktsionaalne HD DVB seade"
msgid "Video Conversion"
msgstr "Video konverteerimine"
msgid "TV on"
msgstr "TV sisse"
msgid "TV off"
msgstr "TV välja"
msgid "Automatic"
msgstr "automaatne"
msgid "Letterbox 16/9"
msgstr "letterbox 16:9"
msgid "Letterbox 14/9"
msgstr "letterbox 14:9"
msgid "Pillarbox"
msgstr "pillarbox"
msgid "CentreCutOut"
msgstr "center cut out"
msgid "Always 16/9"
msgstr "alati 16:9"
msgid "Zoom 16/9"
msgstr "suum 16/9"
msgid "Off"
msgstr "väljas"
msgid "Frame rate"
msgstr "kaadrisagedus"
msgid "HD Only"
msgstr "ainult HD-resolutsioon"
msgid "Always"
msgstr "alati"
msgid "Disabled"
msgstr "keelatud"
msgid "Analogue only"
msgstr "ainult analoog"
msgid "HDMI only"
msgstr "ainult HDMI"
msgid "Follow resolution"
msgstr "vastavalt resolutsioonile"
msgid "none"
msgstr "ei"
msgid "Resolution"
msgstr "Resolutsioon"
msgid "Video Mode Adaption"
msgstr "Videorežiimi sobitus"
msgid "TV format"
msgstr "TV külgsuhe"
msgid "Analogue Video"
msgstr "Analoogvideo"
msgid "Audio Delay (ms)"
msgstr "Heli viide (ms)"
msgid "Audio Downmix"
msgstr "Heli downmix"
msgid "A/V Sync Shift (ms)"
msgstr "A/V-sünkro nihe (ms)"
msgid "OSD Size"
msgstr "Ekraanimenüü suurus"
msgid "HDMI CEC"
msgstr "HDMI CEC"
msgid "CEC: Switch TV on"
msgstr "CEC: TV sisselülitus"
msgid "CEC: Switch TV off"
msgstr "CEC: TV väljalülitus"
msgid "Remote Control Protocol"
msgstr "Kaugjuhtimispuldi protokoll"
msgid "Remote Control Address"
msgstr "Kaugjuhtimispuldi aadress"
msgid "High Level OSD"
msgstr "Kõrgema taseme ekraanimenüü"
msgid "Allow True Color OSD"
msgstr "True Color ekraanimenüü"
msgid "True Color format"
msgstr "True Color formaat"
msgid "Hide mainmenu entry"
msgstr "Peita peamenüü valikus"

View File

@ -1,128 +0,0 @@
# VDR plugin language source file
# Copyright (C) 2015 Andreas Regel
# This file is distributed under the same license as the dvbhddevice package.
# Christoph Haubrich <christoph1.haubrich@arcor.de>, 2011
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-dvbhddevice 2.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-09-21 14:01+0200\n"
"PO-Revision-Date: 2011-04-25 21:44+0200\n"
"Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "HD Full Featured DVB device"
msgstr "DVB-laite HD-ulostulolla"
msgid "Video Conversion"
msgstr "Näyttömuoto"
msgid "TV on"
msgstr "TV päälle"
msgid "TV off"
msgstr "TV kiinni"
msgid "Automatic"
msgstr "automaattinen"
msgid "Letterbox 16/9"
msgstr "letterbox 16:9"
msgid "Letterbox 14/9"
msgstr "letterbox 14:9"
msgid "Pillarbox"
msgstr "pillarbox"
msgid "CentreCutOut"
msgstr "center cut out"
msgid "Always 16/9"
msgstr "aina 16:9"
msgid "Zoom 16/9"
msgstr "zoom 16/9"
msgid "Off"
msgstr "ei"
msgid "Frame rate"
msgstr "kuvataajuuden mukaan"
msgid "HD Only"
msgstr "vain HD-resoluutiolla"
msgid "Always"
msgstr "aina"
msgid "Disabled"
msgstr "ei käytössä"
msgid "Analogue only"
msgstr "vain analoginen"
msgid "HDMI only"
msgstr "vain HDMI"
msgid "Follow resolution"
msgstr "resoluution mukaan"
msgid "none"
msgstr "ei"
msgid "Resolution"
msgstr "Kuvaresoluutio"
msgid "Video Mode Adaption"
msgstr "Sovita näyttömoodi"
msgid "TV format"
msgstr "Näytön kuvasuhde"
msgid "Analogue Video"
msgstr "Analoginen kuvalähtö"
msgid "Audio Delay (ms)"
msgstr "Äänen viive (ms)"
msgid "Audio Downmix"
msgstr "Äänen alasmiksaus"
msgid "A/V Sync Shift (ms)"
msgstr "A/V-synkronointi (ms)"
msgid "OSD Size"
msgstr "Kuvaruutunäytön koko"
msgid "HDMI CEC"
msgstr "Käytä HDMI CEC-toimintoa"
msgid "CEC: Switch TV on"
msgstr "CEC: Laita TV päälle"
msgid "CEC: Switch TV off"
msgstr "CEC: Sammuta TV"
msgid "Remote Control Protocol"
msgstr "Kaukosäätimen protokolla"
msgid "Remote Control Address"
msgstr "Kaukosäätimen osoite"
msgid "High Level OSD"
msgstr "Käytä korkean tason kuvaruutunäyttöä"
msgid "Allow True Color OSD"
msgstr "Salli tosivärit kuvaruutunäytölle"
msgid "True Color format"
msgstr "Näytä tosivärit muodossa"
msgid "Hide mainmenu entry"
msgstr "Piilota valinta päävalikosta"

View File

@ -1,131 +0,0 @@
# VDR plugin language source file
# Copyright (C) 2015 Andreas Regel
# This file is distributed under the same license as the dvbhddevice package.
# Christoph Haubrich <christoph1.haubrich@arcor.de>, 2011
# Diego Pierotto <vdr-italian@tiscali.it>, 2013
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-dvbhddevice 2.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-09-21 14:01+0200\n"
"PO-Revision-Date: 2015-02-08 19:48+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: <see README>\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Generator: Poedit 1.5.4\n"
msgid "HD Full Featured DVB device"
msgstr "Scheda DVB HD Full Featured"
msgid "Video Conversion"
msgstr "Conversione video"
msgid "TV on"
msgstr "TV accesa"
msgid "TV off"
msgstr "TV spenta"
msgid "Automatic"
msgstr "Automatica"
msgid "Letterbox 16/9"
msgstr "Letterbox 16:9"
msgid "Letterbox 14/9"
msgstr "Letterbox 14:9"
msgid "Pillarbox"
msgstr "Pillarbox"
msgid "CentreCutOut"
msgstr "CentreCutOut"
msgid "Always 16/9"
msgstr "Sempre 16:9"
msgid "Zoom 16/9"
msgstr "Ingrandimento 16/9"
msgid "Off"
msgstr "Spento"
msgid "Frame rate"
msgstr "Frame rate"
msgid "HD Only"
msgstr "Solo HD"
msgid "Always"
msgstr "Sempre"
msgid "Disabled"
msgstr "Disabilitata"
msgid "Analogue only"
msgstr "Solo analogica"
msgid "HDMI only"
msgstr "Solo HDMI"
msgid "Follow resolution"
msgstr "Risoluzione seguente"
msgid "none"
msgstr "nessuna"
msgid "Resolution"
msgstr "Risoluzione"
msgid "Video Mode Adaption"
msgstr "Adattamento modalità video"
msgid "TV format"
msgstr "Formato TV"
msgid "Analogue Video"
msgstr "Video analogico"
msgid "Audio Delay (ms)"
msgstr "Ritardo audio (ms)"
msgid "Audio Downmix"
msgstr "Scala Audio"
msgid "A/V Sync Shift (ms)"
msgstr "Alterna sincro A/V (ms)"
msgid "OSD Size"
msgstr "Dimensione OSD"
msgid "HDMI CEC"
msgstr "HDMI CEC"
msgid "CEC: Switch TV on"
msgstr "CEC: Passa a TV accesa"
msgid "CEC: Switch TV off"
msgstr "CEC: Passa a TV spenta"
msgid "Remote Control Protocol"
msgstr "Protocollo controllo remoto"
msgid "Remote Control Address"
msgstr "Indirizzo controllo remoto"
msgid "High Level OSD"
msgstr "OSD alto livello"
msgid "Allow True Color OSD"
msgstr "Permetti OSD True Color"
msgid "True Color format"
msgstr "Formato True Color"
msgid "Hide mainmenu entry"
msgstr "Nascondi voce menu principale"

View File

@ -1,129 +0,0 @@
# VDR plugin language source file.
# Copyright (C) 2015 Andreas Regel
# This file is distributed under the same license as the dvbhddevice package.
# Yarema Aka Knedlyk <yupadmin@gmail.com>, 2015
#
msgid ""
msgstr ""
"Project-Id-Version: vdr-dvbhddevice 2.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2015-02-03 13:28+0100\n"
"PO-Revision-Date: 2015-02-01 23:31+0100\n"
"Last-Translator: Yarema aka Knedlyk <yupadmin@gmail.com>\n"
"Language-Team: Ukrainian <vdr@linuxtv.org>\n"
"Language: uk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.7.3\n"
msgid "HD Full Featured DVB device"
msgstr "HD Full Featured DVB device"
msgid "Video Conversion"
msgstr "Конвертація відео"
msgid "TV on"
msgstr "Вкл ТБ"
msgid "TV off"
msgstr "Викл ТБ"
msgid "Automatic"
msgstr "Автоматично"
msgid "Letterbox 16/9"
msgstr "Конверт 16:9"
msgid "Letterbox 14/9"
msgstr "Конверт 14:9"
msgid "Pillarbox"
msgstr "Pillarbox"
msgid "CentreCutOut"
msgstr "Вірізання від центру"
msgid "Always 16/9"
msgstr "Завжди 16:9"
msgid "Zoom 16/9"
msgstr "Допасувати до 16:9"
msgid "Off"
msgstr "Викл"
msgid "Frame rate"
msgstr "Частота кадрів"
msgid "HD Only"
msgstr "Тільки HD"
msgid "Always"
msgstr "Завжди"
msgid "Disabled"
msgstr "Відключено"
msgid "Analogue only"
msgstr "Тільки аналоговий"
msgid "HDMI only"
msgstr "Тільки HDMI"
msgid "Follow resolution"
msgstr "Відносно розд. здатн."
msgid "none"
msgstr "немає"
msgid "Resolution"
msgstr "Розд. здатність"
msgid "Video Mode Adaption"
msgstr "Адаптація відео режиму"
msgid "TV format"
msgstr "Формат ТБ"
msgid "Analogue Video"
msgstr "Аналогове відео"
msgid "Audio Delay (ms)"
msgstr "Затримка аудіо (мс)"
msgid "Audio Downmix"
msgstr "Міксування аудіо"
msgid "A/V Sync Shift (ms)"
msgstr "А/В зсув синхронізації (мс)"
msgid "OSD Size"
msgstr "Розмір OSD"
msgid "HDMI CEC"
msgstr "HDMI CEC"
msgid "CEC: Switch TV on"
msgstr "CEC: включити ТБ"
msgid "CEC: Switch TV off"
msgstr "CEC: виключити ТБ"
msgid "Remote Control Protocol"
msgstr "Протокол пульта"
msgid "Remote Control Address"
msgstr "Адрес пульта"
msgid "High Level OSD"
msgstr "High Level OSD"
msgid "Allow True Color OSD"
msgstr "Включити True Color OSD"
msgid "True Color format"
msgstr "Формат True Color"
msgid "Hide mainmenu entry"
msgstr "Приховати в головному меню"

View File

@ -1,476 +0,0 @@
/*
* setup.c: Setup for the DVB HD Full Featured On Screen Display
*
* See the README file for copyright information and how to reach the author.
*/
#include "setup.h"
#include "hdffcmd.h"
const int kResolution1080i = 0;
const int kResolution720p = 1;
const int kResolution576p = 2;
const int kResolution576i = 3;
cHdffSetup gHdffSetup;
cHdffSetup::cHdffSetup(void)
{
Resolution = kResolution1080i;
VideoModeAdaption = HDFF_VIDEO_MODE_ADAPT_OFF;
TvFormat = HDFF_TV_FORMAT_16_BY_9;
VideoConversion = HDFF_VIDEO_CONVERSION_PILLARBOX;
AnalogueVideo = HDFF_VIDEO_OUT_CVBS_YUV;
AudioDelay = 0;
AudioDownmix = HDFF_AUDIO_DOWNMIX_AUTOMATIC;
AvSyncShift = 0;
OsdSize = 0;
CecEnabled = 1;
CecTvOn = 1;
CecTvOff = 0;
RemoteProtocol = 1;
RemoteAddress = -1;
HighLevelOsd = 1;
TrueColorOsd = 1;
TrueColorFormat = 0;
HideMainMenu = 0;
}
bool cHdffSetup::SetupParse(const char *Name, const char *Value)
{
if (strcmp(Name, "Resolution") == 0) Resolution = atoi(Value);
else if (strcmp(Name, "VideoModeAdaption") == 0) VideoModeAdaption = atoi(Value);
else if (strcmp(Name, "TvFormat") == 0) TvFormat = atoi(Value);
else if (strcmp(Name, "VideoConversion") == 0) VideoConversion = atoi(Value);
else if (strcmp(Name, "AnalogueVideo") == 0) AnalogueVideo = atoi(Value);
else if (strcmp(Name, "AudioDelay") == 0) AudioDelay = atoi(Value);
else if (strcmp(Name, "AudioDownmix") == 0) AudioDownmix = atoi(Value);
else if (strcmp(Name, "AvSyncShift") == 0) AvSyncShift = atoi(Value);
else if (strcmp(Name, "OsdSize") == 0) OsdSize = atoi(Value);
else if (strcmp(Name, "CecEnabled") == 0) CecEnabled = atoi(Value);
else if (strcmp(Name, "CecTvOn") == 0) CecTvOn = atoi(Value);
else if (strcmp(Name, "CecTvOff") == 0) CecTvOff = atoi(Value);
else if (strcmp(Name, "RemoteProtocol") == 0) RemoteProtocol = atoi(Value);
else if (strcmp(Name, "RemoteAddress") == 0) RemoteAddress = atoi(Value);
else if (strcmp(Name, "HighLevelOsd") == 0) HighLevelOsd = atoi(Value);
else if (strcmp(Name, "TrueColorOsd") == 0) TrueColorOsd = atoi(Value);
else if (strcmp(Name, "TrueColorFormat") == 0) TrueColorFormat = atoi(Value);
else if (strcmp(Name, "HideMainMenu") == 0) HideMainMenu = atoi(Value);
else return false;
return true;
}
void cHdffSetup::GetOsdSize(int &Width, int &Height, double &PixelAspect)
{
if (OsdSize == 0) {
if (Resolution == kResolution1080i) {
Width = 1920;
Height = 1080;
}
else if (Resolution == kResolution720p) {
Width = 1280;
Height = 720;
}
else {
Width = 720;
Height = 576;
}
if (TvFormat == HDFF_TV_FORMAT_16_BY_9)
PixelAspect = 16.0 / 9.0;
else
PixelAspect = 4.0 / 3.0;
}
else if (OsdSize == 1) {
Width = 1920;
Height = 1080;
PixelAspect = 16.0 / 9.0;
}
else if (OsdSize == 2) {
Width = 1280;
Height = 720;
PixelAspect = 16.0 / 9.0;
}
else if (OsdSize == 3) {
Width = 1024;
Height = 576;
PixelAspect = 16.0 / 9.0;
}
else {
Width = 720;
Height = 576;
PixelAspect = 4.0 / 3.0;
}
PixelAspect /= double(Width) / Height;
}
HdffVideoMode_t cHdffSetup::GetVideoMode(void)
{
switch (Resolution)
{
case kResolution1080i:
default:
return HDFF_VIDEO_MODE_1080I50;
case kResolution720p:
return HDFF_VIDEO_MODE_720P50;
case kResolution576p:
return HDFF_VIDEO_MODE_576P50;
case kResolution576i:
return HDFF_VIDEO_MODE_576I50;
}
}
void cHdffSetup::SetNextVideoConversion(void)
{
int nextVideoConversion = HDFF_VIDEO_CONVERSION_AUTOMATIC;
if (TvFormat == HDFF_TV_FORMAT_16_BY_9)
{
switch (VideoConversion)
{
case HDFF_VIDEO_CONVERSION_PILLARBOX:
nextVideoConversion = HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT;
break;
case HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT:
nextVideoConversion = HDFF_VIDEO_CONVERSION_ALWAYS_16_BY_9;
break;
case HDFF_VIDEO_CONVERSION_ALWAYS_16_BY_9:
nextVideoConversion = HDFF_VIDEO_CONVERSION_ZOOM_16_BY_9;
break;
case HDFF_VIDEO_CONVERSION_ZOOM_16_BY_9:
nextVideoConversion = HDFF_VIDEO_CONVERSION_PILLARBOX;
break;
}
}
else
{
switch (VideoConversion)
{
case HDFF_VIDEO_CONVERSION_LETTERBOX_16_BY_9:
nextVideoConversion = HDFF_VIDEO_CONVERSION_LETTERBOX_14_BY_9;
break;
case HDFF_VIDEO_CONVERSION_LETTERBOX_14_BY_9:
nextVideoConversion = HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT;
break;
case HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT:
nextVideoConversion = HDFF_VIDEO_CONVERSION_LETTERBOX_16_BY_9;
break;
}
}
VideoConversion = nextVideoConversion;
}
const char * cHdffSetup::GetVideoConversionString(void)
{
switch (VideoConversion)
{
case HDFF_VIDEO_CONVERSION_AUTOMATIC:
default:
return tr("Automatic");
case HDFF_VIDEO_CONVERSION_LETTERBOX_16_BY_9:
return tr("Letterbox 16/9");
case HDFF_VIDEO_CONVERSION_LETTERBOX_14_BY_9:
return tr("Letterbox 14/9");
case HDFF_VIDEO_CONVERSION_PILLARBOX:
return tr("Pillarbox");
case HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT:
return tr("CentreCutOut");
case HDFF_VIDEO_CONVERSION_ALWAYS_16_BY_9:
return tr("Always 16/9");
case HDFF_VIDEO_CONVERSION_ZOOM_16_BY_9:
return tr("Zoom 16/9");
}
}
void cHdffSetup::SetVideoFormat(HDFF::cHdffCmdIf * HdffCmdIf)
{
HdffVideoFormat_t videoFormat;
videoFormat.AutomaticEnabled = true;
videoFormat.AfdEnabled = false;
videoFormat.TvFormat = (HdffTvFormat_t) TvFormat;
videoFormat.VideoConversion = (HdffVideoConversion_t) VideoConversion;
HdffCmdIf->CmdAvSetVideoFormat(0, &videoFormat);
}
cHdffSetupPage::cHdffSetupPage(HDFF::cHdffCmdIf * pHdffCmdIf)
{
const int kResolutions = 4;
const int kVideoModeAdaptions = 4;
const int kTvFormats = 2;
const int kAnalogueVideos = 4;
const int kAudioDownmixes = 5;
const int kOsdSizes = 5;
const int kRemoteProtocols = 3;
const int kTrueColorFormats = 3;
static const char * ResolutionItems[kResolutions] =
{
"1080i",
"720p",
"576p",
"576i",
};
static const char * VideoModeAdaptionItems[kVideoModeAdaptions] =
{
tr("Off"),
tr("Frame rate"),
tr("HD Only"),
tr("Always")
};
static const char * TvFormatItems[kTvFormats] =
{
"4/3",
"16/9",
};
static const char * AnalogueVideoItems[kAnalogueVideos] =
{
tr("Disabled"),
"RGB",
"CVBS + YUV",
"YC (S-Video)",
};
static const char * AudioDownmixItems[kAudioDownmixes] =
{
tr("Disabled"),
tr("Analogue only"),
tr("Always"),
tr("Automatic"),
tr("HDMI only"),
};
static const char * OsdSizeItems[kOsdSizes] =
{
tr("Follow resolution"),
"1920x1080",
"1280x720",
"1024x576",
"720x576",
};
static const char * RemoteProtocolItems[] =
{
tr("none"),
"RC5",
"RC6",
};
static const char * TrueColorFormatItems[kTrueColorFormats] =
{
"ARGB8888",
"ARGB8565",
"ARGB4444",
};
mHdffCmdIf = pHdffCmdIf;
mNewHdffSetup = gHdffSetup;
Add(new cMenuEditStraItem(tr("Resolution"), &mNewHdffSetup.Resolution, kResolutions, ResolutionItems));
Add(new cMenuEditStraItem(tr("Video Mode Adaption"), &mNewHdffSetup.VideoModeAdaption, kVideoModeAdaptions, VideoModeAdaptionItems));
mTvFormatItem = new cMenuEditStraItem(tr("TV format"), &mNewHdffSetup.TvFormat, kTvFormats, TvFormatItems);
Add(mTvFormatItem);
Add(new cMenuEditStraItem(tr("Analogue Video"), &mNewHdffSetup.AnalogueVideo, kAnalogueVideos, AnalogueVideoItems));
Add(new cMenuEditIntItem(tr("Audio Delay (ms)"), &mNewHdffSetup.AudioDelay, 0, 500));
Add(new cMenuEditStraItem(tr("Audio Downmix"), &mNewHdffSetup.AudioDownmix, kAudioDownmixes, AudioDownmixItems));
Add(new cMenuEditIntItem(tr("A/V Sync Shift (ms)"), &mNewHdffSetup.AvSyncShift, -500, 500));
Add(new cMenuEditStraItem(tr("OSD Size"), &mNewHdffSetup.OsdSize, kOsdSizes, OsdSizeItems));
Add(new cMenuEditBoolItem(tr("HDMI CEC"), &mNewHdffSetup.CecEnabled));
Add(new cMenuEditBoolItem(tr("CEC: Switch TV on"), &mNewHdffSetup.CecTvOn));
Add(new cMenuEditBoolItem(tr("CEC: Switch TV off"), &mNewHdffSetup.CecTvOff));
Add(new cMenuEditStraItem(tr("Remote Control Protocol"), &mNewHdffSetup.RemoteProtocol, kRemoteProtocols, RemoteProtocolItems));
Add(new cMenuEditIntItem(tr("Remote Control Address"), &mNewHdffSetup.RemoteAddress, -1, 31));
Add(new cMenuEditBoolItem(tr("High Level OSD"), &mNewHdffSetup.HighLevelOsd));
Add(new cMenuEditBoolItem(tr("Allow True Color OSD"), &mNewHdffSetup.TrueColorOsd));
Add(new cMenuEditStraItem(tr("True Color format"), &mNewHdffSetup.TrueColorFormat, kTrueColorFormats, TrueColorFormatItems));
Add(new cMenuEditBoolItem(tr("Hide mainmenu entry"), &mNewHdffSetup.HideMainMenu));
mVideoConversion = 0;
if (mNewHdffSetup.TvFormat == HDFF_TV_FORMAT_16_BY_9)
{
switch (mNewHdffSetup.VideoConversion)
{
case HDFF_VIDEO_CONVERSION_PILLARBOX:
mVideoConversion = 0;
break;
case HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT:
mVideoConversion = 1;
break;
case HDFF_VIDEO_CONVERSION_ALWAYS_16_BY_9:
mVideoConversion = 2;
break;
case HDFF_VIDEO_CONVERSION_ZOOM_16_BY_9:
mVideoConversion = 3;
break;
}
}
else
{
switch (mNewHdffSetup.VideoConversion)
{
case HDFF_VIDEO_CONVERSION_LETTERBOX_16_BY_9:
mVideoConversion = 0;
break;
case HDFF_VIDEO_CONVERSION_LETTERBOX_14_BY_9:
mVideoConversion = 1;
break;
case HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT:
mVideoConversion = 2;
break;
}
}
BuildVideoConversionItem();
}
cHdffSetupPage::~cHdffSetupPage(void)
{
}
void cHdffSetupPage::BuildVideoConversionItem(void)
{
const int kVideoConversions4by3 = 3;
const int kVideoConversions16by9 = 4;
static const char * VideoConversionItems4by3[kVideoConversions4by3] =
{
tr("Letterbox 16/9"),
tr("Letterbox 14/9"),
tr("CentreCutOut")
};
static const char * VideoConversionItems16by9[kVideoConversions16by9] =
{
tr("Pillarbox"),
tr("CentreCutOut"),
tr("Always 16/9"),
tr("Zoom 16/9")
};
cOsdItem * item;
cList<cOsdItem>::Del(mTvFormatItem->Next());
if (mNewHdffSetup.TvFormat == HDFF_TV_FORMAT_16_BY_9)
{
item = new cMenuEditStraItem(tr("Video Conversion"), &mVideoConversion,
kVideoConversions16by9, VideoConversionItems16by9);
}
else
{
item = new cMenuEditStraItem(tr("Video Conversion"), &mVideoConversion,
kVideoConversions4by3, VideoConversionItems4by3);
}
Add(item, false, mTvFormatItem);
}
void cHdffSetupPage::Store(void)
{
if (mNewHdffSetup.TvFormat == HDFF_TV_FORMAT_16_BY_9)
{
switch (mVideoConversion)
{
case 0:
mNewHdffSetup.VideoConversion = HDFF_VIDEO_CONVERSION_PILLARBOX;
break;
case 1:
mNewHdffSetup.VideoConversion = HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT;
break;
case 2:
mNewHdffSetup.VideoConversion = HDFF_VIDEO_CONVERSION_ALWAYS_16_BY_9;
break;
case 3:
mNewHdffSetup.VideoConversion = HDFF_VIDEO_CONVERSION_ZOOM_16_BY_9;
break;
}
}
else
{
switch (mVideoConversion)
{
case 0:
mNewHdffSetup.VideoConversion = HDFF_VIDEO_CONVERSION_LETTERBOX_16_BY_9;
break;
case 1:
mNewHdffSetup.VideoConversion = HDFF_VIDEO_CONVERSION_LETTERBOX_14_BY_9;
break;
case 2:
mNewHdffSetup.VideoConversion = HDFF_VIDEO_CONVERSION_CENTRE_CUT_OUT;
break;
}
}
SetupStore("Resolution", mNewHdffSetup.Resolution);
SetupStore("VideoModeAdaption", mNewHdffSetup.VideoModeAdaption);
SetupStore("TvFormat", mNewHdffSetup.TvFormat);
SetupStore("VideoConversion", mNewHdffSetup.VideoConversion);
SetupStore("AnalogueVideo", mNewHdffSetup.AnalogueVideo);
SetupStore("AudioDelay", mNewHdffSetup.AudioDelay);
SetupStore("AudioDownmix", mNewHdffSetup.AudioDownmix);
SetupStore("AvSyncShift", mNewHdffSetup.AvSyncShift);
SetupStore("OsdSize", mNewHdffSetup.OsdSize);
SetupStore("CecEnabled", mNewHdffSetup.CecEnabled);
SetupStore("CecTvOn", mNewHdffSetup.CecTvOn);
SetupStore("CecTvOff", mNewHdffSetup.CecTvOff);
SetupStore("RemoteProtocol", mNewHdffSetup.RemoteProtocol);
SetupStore("RemoteAddress", mNewHdffSetup.RemoteAddress);
SetupStore("HighLevelOsd", mNewHdffSetup.HighLevelOsd);
SetupStore("TrueColorOsd", mNewHdffSetup.TrueColorOsd);
SetupStore("TrueColorFormat", mNewHdffSetup.TrueColorFormat);
SetupStore("HideMainMenu", mNewHdffSetup.HideMainMenu);
if (mHdffCmdIf)
{
if (mNewHdffSetup.Resolution != gHdffSetup.Resolution)
{
mHdffCmdIf->CmdHdmiSetVideoMode(mNewHdffSetup.GetVideoMode());
}
HdffHdmiConfig_t hdmiConfig;
mNewHdffSetup.SetVideoFormat(mHdffCmdIf);
mHdffCmdIf->CmdAvSetAudioDelay(mNewHdffSetup.AudioDelay);
mHdffCmdIf->CmdAvSetAudioDownmix((HdffAudioDownmixMode_t) mNewHdffSetup.AudioDownmix);
mHdffCmdIf->CmdAvSetSyncShift(mNewHdffSetup.AvSyncShift);
mHdffCmdIf->CmdMuxSetVideoOut((HdffVideoOut_t) mNewHdffSetup.AnalogueVideo);
memset(&hdmiConfig, 0, sizeof(hdmiConfig));
hdmiConfig.TransmitAudio = true;
hdmiConfig.ForceDviMode = false;
hdmiConfig.CecEnabled = mNewHdffSetup.CecEnabled;
hdmiConfig.VideoModeAdaption = (HdffVideoModeAdaption_t) mNewHdffSetup.VideoModeAdaption;
mHdffCmdIf->CmdHdmiConfigure(&hdmiConfig);
mHdffCmdIf->CmdRemoteSetProtocol((HdffRemoteProtocol_t) mNewHdffSetup.RemoteProtocol);
mHdffCmdIf->CmdRemoteSetAddressFilter(mNewHdffSetup.RemoteAddress >= 0, mNewHdffSetup.RemoteAddress);
}
gHdffSetup = mNewHdffSetup;
}
eOSState cHdffSetupPage::ProcessKey(eKeys key)
{
eOSState state = cMenuSetupPage::ProcessKey(key);
if (state == osContinue)
{
cOsdItem * item;
switch (key)
{
case kLeft:
case kRight:
item = Get(Current());
if (item == mTvFormatItem)
{
mVideoConversion = 0;
BuildVideoConversionItem();
Display();
}
break;
default:
break;
}
}
return state;
}

View File

@ -1,66 +0,0 @@
/*
* setup.h: Setup for the DVB HD Full Featured On Screen Display
*
* See the README file for copyright information and how to reach the author.
*/
#ifndef _HDFF_SETUP_H_
#define _HDFF_SETUP_H_
#include <vdr/plugin.h>
#include "hdffcmd.h"
struct cHdffSetup
{
cHdffSetup(void);
bool SetupParse(const char * Name, const char * Value);
void GetOsdSize(int &Width, int &Height, double &PixelAspect);
HdffVideoMode_t GetVideoMode(void);
void SetNextVideoConversion(void);
const char * GetVideoConversionString(void);
void SetVideoFormat(HDFF::cHdffCmdIf * HdffCmdIf);
int Resolution;
int VideoModeAdaption;
int TvFormat;
int VideoConversion;
int AnalogueVideo;
int AudioDelay;
int AudioDownmix;
int AvSyncShift;
int OsdSize;
int CecEnabled;
int CecTvOn;
int CecTvOff;
int RemoteProtocol;
int RemoteAddress;
int HighLevelOsd;
int TrueColorOsd;
int TrueColorFormat;
int HideMainMenu;
};
extern cHdffSetup gHdffSetup;
class cHdffSetupPage : public cMenuSetupPage
{
private:
HDFF::cHdffCmdIf * mHdffCmdIf;
cHdffSetup mNewHdffSetup;
cOsdItem * mTvFormatItem;
int mVideoConversion;
void BuildVideoConversionItem(void);
protected:
virtual void Store(void);
public:
cHdffSetupPage(HDFF::cHdffCmdIf * pHdffCmdIf);
virtual ~cHdffSetupPage(void);
virtual eOSState ProcessKey(eKeys Key);
};
#endif

View File

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -1,65 +0,0 @@
VDR Plugin 'dvbsddevice' Revision History
-----------------------------------------
2009-12-28: Version 0.0.1
- Initial revision.
2010-01-04: Version 0.0.2
- Calling the MakePrimaryDevice() function of the base class to allow
the cDevice to stop displaying subtitles.
- Added support for DVB cards with multiple fontends.
2010-01-30: Version 0.0.3
- The PCR pid is now recorded for channels where this is different from the
video PID.
2011-04-17: Version 0.0.4
- Removed an obsolete local variable in dvbsdffosd.c (thanks to Paul Menzel).
2011-08-27: Version 0.0.5
- Added option --outputonly to use the device only for output (thanks to Udo Richter).
2012-03-07: Version 0.0.6
- Removed the call to EITScanner.UsesDevice(this) from dvbsddevice.c, because
the code following these calls is only executed if LiveView is true, which is
never the case when the EITScanner switches to a channel.
2012-12-27: Version 0.0.7
- Adapted Makefile to changes introduced in recent VDR versions.
2013-01-12: Version 0.0.8
- Adapted Makefile to changes introduced in recent VDR versions.
2013-01-25: Version 0.0.9
- Returning 0 from cDvbSdFfDevice::NumProvidedSystems() if option --outputonly is given.
2013-03-31: Version 2.0.0
- Official release.
2013-08-22: Version 2.0.1
- Fixed handling the -o option (short form of --outputonly; problem reported by
Mario Edelmann).
2014-01-01: Version 2.1.1
- Avoiding unnecessary pkg-config warnings in plugin Makefiles.
- cDevice::TrickSpeed() now has an additional parameter named Forward.
2014-03-15: Version 2.1.2
- The function cDevice::GetVideoSystem() has been deprecated.
2015-02-19: Version 2.2.0
- Official release.

View File

@ -1,94 +0,0 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
# By default the main source file also carries this name.
PLUGIN = dvbsddevice
### The version number of this plugin (taken from the main source file):
VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
### The directory environment:
# Use package data if installed...otherwise assume we're under the VDR source directory:
PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
LIBDIR = $(call PKGCFG,libdir)
PLGCFG = $(call PKGCFG,plgcfg)
#
TMPDIR ?= /tmp
### The compiler options:
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
### The version number of VDR's plugin API:
APIVERSION = $(call PKGCFG,apiversion)
### Allow user defined options to overwrite defaults:
-include $(PLGCFG)
### The name of the distribution archive:
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
### The name of the shared object file:
SOFILE = libvdr-$(PLUGIN).so
### Includes and Defines (add further entries here):
INCLUDES +=
DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
### The object files (add further files here):
OBJS = $(PLUGIN).o dvbsdffdevice.o dvbsdffosd.o
### The main target:
all: $(SOFILE)
### Implicit rules:
%.o: %.c
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
### Dependencies:
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
-include $(DEPFILE)
### Targets:
$(SOFILE): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
install: install-lib
dist: clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@echo Distribution package created as $(PACKAGE).tgz
clean:
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~

View File

@ -1,20 +0,0 @@
This is a "plugin" for the Video Disk Recorder (VDR).
Written by: Klaus Schmidinger <Klaus.Schmidinger@tvdr.de>
Project's homepage: http://www.tvdr.de
Latest version available at: ftp://ftp.tvdr.de/vdr
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
See the file COPYING for more information.
Description:
The 'dvbsddevice' plugin implements the output device for the
"Full Featured" DVB cards based on the TechnoTrend/Fujitsu-Siemens
design. This code was originally part of the core VDR source, and
was moved into this plugin in VDR version 1.7.11.

View File

@ -1,61 +0,0 @@
/*
* dvbsddevice.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: dvbsddevice.c 3.4 2015/02/17 13:11:55 kls Exp $
*/
#include <getopt.h>
#include <vdr/plugin.h>
#include "dvbsdffdevice.h"
static const char *VERSION = "2.2.0";
static const char *DESCRIPTION = "SD Full Featured DVB device";
class cPluginDvbsddevice : public cPlugin {
private:
cDvbSdFfDeviceProbe *probe;
public:
cPluginDvbsddevice(void);
virtual ~cPluginDvbsddevice();
virtual const char *Version(void) { return VERSION; }
virtual const char *Description(void) { return DESCRIPTION; }
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
};
cPluginDvbsddevice::cPluginDvbsddevice(void)
{
probe = new cDvbSdFfDeviceProbe;
}
cPluginDvbsddevice::~cPluginDvbsddevice()
{
delete probe;
}
const char *cPluginDvbsddevice::CommandLineHelp(void)
{
return " -o --outputonly do not receive, just use as output device\n";
}
bool cPluginDvbsddevice::ProcessArgs(int argc, char *argv[])
{
static struct option long_options[] = {
{ "outputonly", no_argument, NULL, 'o' },
{ NULL, no_argument, NULL, 0 }
};
int c;
while ((c = getopt_long(argc, argv, "o", long_options, NULL)) != -1) {
switch (c) {
case 'o': probe->SetOutputOnly(true);
break;
default: return false;
}
}
return true;
}
VDRPLUGINCREATOR(cPluginDvbsddevice); // Don't touch this!

View File

@ -1,784 +0,0 @@
/*
* dvbsdffdevice.h: The DVB SD Full Featured device interface
*
* See the README file for copyright information and how to reach the author.
*
* $Id: dvbsdffdevice.c 3.3 2014/03/15 12:35:21 kls Exp $
*/
#include "dvbsdffdevice.h"
#include <errno.h>
#include <limits.h>
#include <linux/videodev2.h>
#include <linux/dvb/audio.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/video.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <vdr/eitscan.h>
#include <vdr/transfer.h>
#include "dvbsdffosd.h"
// --- cDvbSdFfDevice --------------------------------------------------------
int cDvbSdFfDevice::devVideoOffset = -1;
cDvbSdFfDevice::cDvbSdFfDevice(int Adapter, int Frontend, bool OutputOnly)
:cDvbDevice(Adapter, Frontend)
{
spuDecoder = NULL;
digitalAudio = false;
playMode = pmNone;
outputOnly = OutputOnly;
// Devices that are only present on cards with decoders:
fd_osd = DvbOpen(DEV_DVB_OSD, adapter, frontend, O_RDWR);
fd_video = DvbOpen(DEV_DVB_VIDEO, adapter, frontend, O_RDWR | O_NONBLOCK);
fd_audio = DvbOpen(DEV_DVB_AUDIO, adapter, frontend, O_RDWR | O_NONBLOCK);
fd_stc = DvbOpen(DEV_DVB_DEMUX, adapter, frontend, O_RDWR);
// The offset of the /dev/video devices:
if (devVideoOffset < 0) { // the first one checks this
FILE *f = NULL;
char buffer[PATH_MAX];
for (int ofs = 0; ofs < 100; ofs++) {
snprintf(buffer, sizeof(buffer), "/proc/video/dev/video%d", ofs);
if ((f = fopen(buffer, "r")) != NULL) {
if (fgets(buffer, sizeof(buffer), f)) {
if (strstr(buffer, "DVB Board")) { // found the _first_ DVB card
devVideoOffset = ofs;
dsyslog("video device offset is %d", devVideoOffset);
break;
}
}
else
break;
fclose(f);
}
else
break;
}
if (devVideoOffset < 0)
devVideoOffset = 0;
if (f)
fclose(f);
}
devVideoIndex = devVideoOffset >= 0 ? devVideoOffset++ : -1;
}
cDvbSdFfDevice::~cDvbSdFfDevice()
{
delete spuDecoder;
// We're not explicitly closing any device files here, since this sometimes
// caused segfaults. Besides, the program is about to terminate anyway...
}
void cDvbSdFfDevice::MakePrimaryDevice(bool On)
{
if (On)
new cDvbOsdProvider(fd_osd);
cDvbDevice::MakePrimaryDevice(On);
}
bool cDvbSdFfDevice::HasDecoder(void) const
{
return true;
}
bool cDvbSdFfDevice::AvoidRecording(void) const
{
return true;
}
cSpuDecoder *cDvbSdFfDevice::GetSpuDecoder(void)
{
if (!spuDecoder && IsPrimaryDevice())
spuDecoder = new cDvbSpuDecoder();
return spuDecoder;
}
uchar *cDvbSdFfDevice::GrabImage(int &Size, bool Jpeg, int Quality, int SizeX, int SizeY)
{
if (devVideoIndex < 0)
return NULL;
char buffer[PATH_MAX];
snprintf(buffer, sizeof(buffer), "%s%d", DEV_VIDEO, devVideoIndex);
int videoDev = open(buffer, O_RDWR);
if (videoDev >= 0) {
uchar *result = NULL;
// set up the size and RGB
v4l2_format fmt;
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.width = SizeX;
fmt.fmt.pix.height = SizeY;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_BGR24;
fmt.fmt.pix.field = V4L2_FIELD_ANY;
if (ioctl(videoDev, VIDIOC_S_FMT, &fmt) == 0) {
v4l2_requestbuffers reqBuf;
memset(&reqBuf, 0, sizeof(reqBuf));
reqBuf.count = 2;
reqBuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
reqBuf.memory = V4L2_MEMORY_MMAP;
if (ioctl(videoDev, VIDIOC_REQBUFS, &reqBuf) >= 0) {
v4l2_buffer mbuf;
memset(&mbuf, 0, sizeof(mbuf));
mbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
mbuf.memory = V4L2_MEMORY_MMAP;
if (ioctl(videoDev, VIDIOC_QUERYBUF, &mbuf) == 0) {
int msize = mbuf.length;
unsigned char *mem = (unsigned char *)mmap(0, msize, PROT_READ | PROT_WRITE, MAP_SHARED, videoDev, 0);
if (mem && mem != (unsigned char *)-1) {
v4l2_buffer buf;
memset(&buf, 0, sizeof(buf));
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = 0;
if (ioctl(videoDev, VIDIOC_QBUF, &buf) == 0) {
v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (videoDev, VIDIOC_STREAMON, &type) == 0) {
memset(&buf, 0, sizeof(buf));
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = 0;
if (ioctl(videoDev, VIDIOC_DQBUF, &buf) == 0) {
if (ioctl(videoDev, VIDIOC_STREAMOFF, &type) == 0) {
// make RGB out of BGR:
int memsize = fmt.fmt.pix.width * fmt.fmt.pix.height;
unsigned char *mem1 = mem;
for (int i = 0; i < memsize; i++) {
unsigned char tmp = mem1[2];
mem1[2] = mem1[0];
mem1[0] = tmp;
mem1 += 3;
}
if (Quality < 0)
Quality = 100;
dsyslog("grabbing to %s %d %d %d", Jpeg ? "JPEG" : "PNM", Quality, fmt.fmt.pix.width, fmt.fmt.pix.height);
if (Jpeg) {
// convert to JPEG:
result = RgbToJpeg(mem, fmt.fmt.pix.width, fmt.fmt.pix.height, Size, Quality);
if (!result)
esyslog("ERROR: failed to convert image to JPEG");
}
else {
// convert to PNM:
char buf[32];
snprintf(buf, sizeof(buf), "P6\n%d\n%d\n255\n", fmt.fmt.pix.width, fmt.fmt.pix.height);
int l = strlen(buf);
int bytes = memsize * 3;
Size = l + bytes;
result = MALLOC(uchar, Size);
if (result) {
memcpy(result, buf, l);
memcpy(result + l, mem, bytes);
}
else
esyslog("ERROR: failed to convert image to PNM");
}
}
else
esyslog("ERROR: video device VIDIOC_STREAMOFF failed");
}
else
esyslog("ERROR: video device VIDIOC_DQBUF failed");
}
else
esyslog("ERROR: video device VIDIOC_STREAMON failed");
}
else
esyslog("ERROR: video device VIDIOC_QBUF failed");
munmap(mem, msize);
}
else
esyslog("ERROR: failed to memmap video device");
}
else
esyslog("ERROR: video device VIDIOC_QUERYBUF failed");
}
else
esyslog("ERROR: video device VIDIOC_REQBUFS failed");
}
else
esyslog("ERROR: video device VIDIOC_S_FMT failed");
close(videoDev);
return result;
}
else
LOG_ERROR_STR(buffer);
return NULL;
}
void cDvbSdFfDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat)
{
cDevice::SetVideoDisplayFormat(VideoDisplayFormat);
if (Setup.VideoFormat) {
CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_LETTER_BOX));
}
else {
switch (VideoDisplayFormat) {
case vdfPanAndScan:
CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_PAN_SCAN));
break;
case vdfLetterBox:
CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_LETTER_BOX));
break;
case vdfCenterCutOut:
CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_CENTER_CUT_OUT));
break;
default: esyslog("ERROR: unknown video display format %d", VideoDisplayFormat);
}
}
}
void cDvbSdFfDevice::SetVideoFormat(bool VideoFormat16_9)
{
CHECK(ioctl(fd_video, VIDEO_SET_FORMAT, VideoFormat16_9 ? VIDEO_FORMAT_16_9 : VIDEO_FORMAT_4_3));
SetVideoDisplayFormat(eVideoDisplayFormat(Setup.VideoDisplayFormat));
}
void cDvbSdFfDevice::GetVideoSize(int &Width, int &Height, double &VideoAspect)
{
if (fd_video >= 0) {
video_size_t vs;
if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) {
Width = vs.w;
Height = vs.h;
switch (vs.aspect_ratio) {
default:
case VIDEO_FORMAT_4_3: VideoAspect = 4.0 / 3.0; break;
case VIDEO_FORMAT_16_9: VideoAspect = 16.0 / 9.0; break;
case VIDEO_FORMAT_221_1: VideoAspect = 2.21; break;
}
return;
}
else
LOG_ERROR;
}
cDevice::GetVideoSize(Width, Height, VideoAspect);
}
void cDvbSdFfDevice::GetOsdSize(int &Width, int &Height, double &PixelAspect)
{
if (fd_video >= 0) {
video_size_t vs;
if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) {
Width = 720;
if (vs.h != 480 && vs.h != 240)
Height = 576; // PAL
else
Height = 480; // NTSC
switch (Setup.VideoFormat ? vs.aspect_ratio : VIDEO_FORMAT_4_3) {
default:
case VIDEO_FORMAT_4_3: PixelAspect = 4.0 / 3.0; break;
case VIDEO_FORMAT_221_1: // FF DVB cards only distinguish between 4:3 and 16:9
case VIDEO_FORMAT_16_9: PixelAspect = 16.0 / 9.0; break;
}
PixelAspect /= double(Width) / Height;
return;
}
else
LOG_ERROR;
}
cDevice::GetOsdSize(Width, Height, PixelAspect);
}
bool cDvbSdFfDevice::SetAudioBypass(bool On)
{
if (setTransferModeForDolbyDigital != 1)
return false;
return ioctl(fd_audio, AUDIO_SET_BYPASS_MODE, On) == 0;
}
// ptAudio ptVideo ptPcr ptTeletext ptDolby ptOther
static dmx_pes_type_t PesTypes[] = { DMX_PES_AUDIO, DMX_PES_VIDEO, DMX_PES_PCR, DMX_PES_TELETEXT, DMX_PES_OTHER, DMX_PES_OTHER };
bool cDvbSdFfDevice::SetPid(cPidHandle *Handle, int Type, bool On)
{
if (Handle->pid) {
dmx_pes_filter_params pesFilterParams;
memset(&pesFilterParams, 0, sizeof(pesFilterParams));
if (On) {
if (Handle->handle < 0) {
Handle->handle = DvbOpen(DEV_DVB_DEMUX, adapter, frontend, O_RDWR | O_NONBLOCK, true);
if (Handle->handle < 0) {
LOG_ERROR;
return false;
}
}
pesFilterParams.pid = Handle->pid;
pesFilterParams.input = DMX_IN_FRONTEND;
pesFilterParams.output = (Type <= ptTeletext && Handle->used <= 1) ? DMX_OUT_DECODER : DMX_OUT_TS_TAP;
pesFilterParams.pes_type= PesTypes[Type < ptOther ? Type : ptOther];
pesFilterParams.flags = DMX_IMMEDIATE_START;
if (ioctl(Handle->handle, DMX_SET_PES_FILTER, &pesFilterParams) < 0) {
LOG_ERROR;
return false;
}
}
else if (!Handle->used) {
CHECK(ioctl(Handle->handle, DMX_STOP));
if (Type <= ptTeletext) {
pesFilterParams.pid = 0x1FFF;
pesFilterParams.input = DMX_IN_FRONTEND;
pesFilterParams.output = DMX_OUT_DECODER;
pesFilterParams.pes_type= PesTypes[Type];
pesFilterParams.flags = DMX_IMMEDIATE_START;
CHECK(ioctl(Handle->handle, DMX_SET_PES_FILTER, &pesFilterParams));
if (PesTypes[Type] == DMX_PES_VIDEO) // let's only do this once
SetPlayMode(pmNone); // necessary to switch a PID from DMX_PES_VIDEO/AUDIO to DMX_PES_OTHER
}
close(Handle->handle);
Handle->handle = -1;
}
}
return true;
}
bool cDvbSdFfDevice::ProvidesSource(int Source) const
{
if (outputOnly)
return false;
else
return cDvbDevice::ProvidesSource(Source);
}
int cDvbSdFfDevice::NumProvidedSystems(void) const
{
if (outputOnly)
return 0;
return cDvbDevice::NumProvidedSystems();
}
void cDvbSdFfDevice::TurnOffLiveMode(bool LiveView)
{
if (LiveView) {
// Avoid noise while switching:
CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, true));
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER));
}
// Turn off live PIDs:
DetachAll(pidHandles[ptAudio].pid);
DetachAll(pidHandles[ptVideo].pid);
DetachAll(pidHandles[ptPcr].pid);
DetachAll(pidHandles[ptTeletext].pid);
DelPid(pidHandles[ptAudio].pid);
DelPid(pidHandles[ptVideo].pid);
DelPid(pidHandles[ptPcr].pid, ptPcr);
DelPid(pidHandles[ptTeletext].pid);
DelPid(pidHandles[ptDolby].pid);
}
bool cDvbSdFfDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
{
int apid = Channel->Apid(0);
int vpid = Channel->Vpid();
int dpid = Channel->Dpid(0);
bool DoTune = !IsTunedToTransponder(Channel);
bool pidHandlesVideo = vpid && pidHandles[ptVideo].pid == vpid;
bool pidHandlesAudio = apid && pidHandles[ptAudio].pid == apid;
bool TurnOffLivePIDs = DoTune
|| !IsPrimaryDevice()
|| LiveView // for a new live view the old PIDs need to be turned off
|| pidHandlesVideo // for recording the PIDs must be shifted from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER
;
bool StartTransferMode = IsPrimaryDevice() && !DoTune
&& (LiveView && HasPid(vpid ? vpid : apid) && (!pidHandlesVideo || (!pidHandlesAudio && (dpid ? pidHandles[ptAudio].pid != dpid : true)))// the PID is already set as DMX_PES_OTHER
|| !LiveView && (pidHandlesVideo || pidHandlesAudio) // a recording is going to shift the PIDs from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER
);
if (CamSlot() && !ChannelCamRelations.CamDecrypt(Channel->GetChannelID(), CamSlot()->SlotNumber()))
StartTransferMode |= LiveView && IsPrimaryDevice() && Channel->Ca() >= CA_ENCRYPTED_MIN;
bool TurnOnLivePIDs = !StartTransferMode && LiveView;
// Turn off live PIDs if necessary:
if (TurnOffLivePIDs)
TurnOffLiveMode(LiveView);
// Set the tuner:
if (!cDvbDevice::SetChannelDevice(Channel, LiveView))
return false;
// PID settings:
if (TurnOnLivePIDs) {
SetAudioBypass(false);
if (!(AddPid(Channel->Ppid(), ptPcr) && AddPid(vpid, ptVideo) && AddPid(apid, ptAudio))) {
esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->Number(), CardIndex() + 1);
return false;
}
if (IsPrimaryDevice())
AddPid(Channel->Tpid(), ptTeletext);
CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, true)); // actually one would expect 'false' here, but according to Marco Schluessler <marco@lordzodiac.de> this works
// to avoid missing audio after replaying a DVD; with 'false' there is an audio disturbance when switching
// between two channels on the same transponder on DVB-S
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
}
else if (StartTransferMode)
cControl::Launch(new cTransferControl(this, Channel));
return true;
}
int cDvbSdFfDevice::GetAudioChannelDevice(void)
{
audio_status_t as;
CHECK(ioctl(fd_audio, AUDIO_GET_STATUS, &as));
return as.channel_select;
}
void cDvbSdFfDevice::SetAudioChannelDevice(int AudioChannel)
{
CHECK(ioctl(fd_audio, AUDIO_CHANNEL_SELECT, AudioChannel));
}
void cDvbSdFfDevice::SetVolumeDevice(int Volume)
{
if (digitalAudio)
Volume = 0;
audio_mixer_t am;
// conversion for linear volume response:
am.volume_left = am.volume_right = 2 * Volume - Volume * Volume / 255;
CHECK(ioctl(fd_audio, AUDIO_SET_MIXER, &am));
}
void cDvbSdFfDevice::SetDigitalAudioDevice(bool On)
{
if (digitalAudio != On) {
if (digitalAudio)
cCondWait::SleepMs(1000); // Wait until any leftover digital data has been flushed
digitalAudio = On;
SetVolumeDevice(On || IsMute() ? 0 : CurrentVolume());
}
}
void cDvbSdFfDevice::SetAudioTrackDevice(eTrackType Type)
{
const tTrackId *TrackId = GetTrack(Type);
if (TrackId && TrackId->id) {
SetAudioBypass(false);
if (IS_AUDIO_TRACK(Type) || (IS_DOLBY_TRACK(Type) && SetAudioBypass(true))) {
if (pidHandles[ptAudio].pid && pidHandles[ptAudio].pid != TrackId->id) {
DetachAll(pidHandles[ptAudio].pid);
if (CamSlot())
CamSlot()->SetPid(pidHandles[ptAudio].pid, false);
pidHandles[ptAudio].pid = TrackId->id;
SetPid(&pidHandles[ptAudio], ptAudio, true);
if (CamSlot()) {
CamSlot()->SetPid(pidHandles[ptAudio].pid, true);
CamSlot()->StartDecrypting();
}
}
}
else if (IS_DOLBY_TRACK(Type)) {
if (setTransferModeForDolbyDigital == 0)
return;
// Currently this works only in Transfer Mode
ForceTransferMode();
}
}
}
bool cDvbSdFfDevice::CanReplay(void) const
{
return cDevice::CanReplay();
}
bool cDvbSdFfDevice::SetPlayMode(ePlayMode PlayMode)
{
if (PlayMode != pmExtern_THIS_SHOULD_BE_AVOIDED && fd_video < 0 && fd_audio < 0) {
// reopen the devices
fd_video = DvbOpen(DEV_DVB_VIDEO, adapter, frontend, O_RDWR | O_NONBLOCK);
fd_audio = DvbOpen(DEV_DVB_AUDIO, adapter, frontend, O_RDWR | O_NONBLOCK);
SetVideoFormat(Setup.VideoFormat);
}
switch (PlayMode) {
case pmNone:
// special handling to return from PCM replay:
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY));
CHECK(ioctl(fd_video, VIDEO_PLAY));
CHECK(ioctl(fd_video, VIDEO_STOP, true));
CHECK(ioctl(fd_audio, AUDIO_STOP, true));
CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER));
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX));
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_DEMUX));
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false));
break;
case pmAudioVideo:
case pmAudioOnlyBlack:
if (playMode == pmNone)
TurnOffLiveMode(true);
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY));
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, PlayMode == pmAudioVideo));
CHECK(ioctl(fd_audio, AUDIO_PLAY));
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY));
CHECK(ioctl(fd_video, VIDEO_PLAY));
break;
case pmAudioOnly:
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
CHECK(ioctl(fd_audio, AUDIO_STOP, true));
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY));
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, false));
CHECK(ioctl(fd_audio, AUDIO_PLAY));
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, false));
break;
case pmVideoOnly:
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
CHECK(ioctl(fd_video, VIDEO_STOP, true));
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_DEMUX));
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, false));
CHECK(ioctl(fd_audio, AUDIO_PLAY));
CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER));
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY));
CHECK(ioctl(fd_video, VIDEO_PLAY));
break;
case pmExtern_THIS_SHOULD_BE_AVOIDED:
close(fd_video);
close(fd_audio);
fd_video = fd_audio = -1;
break;
default: esyslog("ERROR: unknown playmode %d", PlayMode);
}
playMode = PlayMode;
return true;
}
int64_t cDvbSdFfDevice::GetSTC(void)
{
if (fd_stc >= 0) {
struct dmx_stc stc;
stc.num = 0;
if (ioctl(fd_stc, DMX_GET_STC, &stc) == -1) {
esyslog("ERROR: stc %d: %m", CardIndex() + 1);
return -1;
}
return stc.stc / stc.base;
}
return -1;
}
void cDvbSdFfDevice::TrickSpeed(int Speed, bool Forward)
{
if (fd_video >= 0)
CHECK(ioctl(fd_video, VIDEO_SLOWMOTION, Speed));
}
void cDvbSdFfDevice::Clear(void)
{
if (fd_video >= 0)
CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER));
if (fd_audio >= 0)
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
cDevice::Clear();
}
void cDvbSdFfDevice::Play(void)
{
if (playMode == pmAudioOnly || playMode == pmAudioOnlyBlack) {
if (fd_audio >= 0)
CHECK(ioctl(fd_audio, AUDIO_CONTINUE));
}
else {
if (fd_audio >= 0) {
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
CHECK(ioctl(fd_audio, AUDIO_CONTINUE));
}
if (fd_video >= 0)
CHECK(ioctl(fd_video, VIDEO_CONTINUE));
}
cDevice::Play();
}
void cDvbSdFfDevice::Freeze(void)
{
if (playMode == pmAudioOnly || playMode == pmAudioOnlyBlack) {
if (fd_audio >= 0)
CHECK(ioctl(fd_audio, AUDIO_PAUSE));
}
else {
if (fd_audio >= 0) {
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, false));
CHECK(ioctl(fd_audio, AUDIO_PAUSE));
}
if (fd_video >= 0)
CHECK(ioctl(fd_video, VIDEO_FREEZE));
}
cDevice::Freeze();
}
void cDvbSdFfDevice::Mute(void)
{
if (fd_audio >= 0) {
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, false));
CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, true));
}
cDevice::Mute();
}
void cDvbSdFfDevice::StillPicture(const uchar *Data, int Length)
{
if (!Data || Length < TS_SIZE)
return;
if (Data[0] == 0x47) {
// TS data
cDevice::StillPicture(Data, Length);
}
else if (Data[0] == 0x00 && Data[1] == 0x00 && Data[2] == 0x01 && (Data[3] & 0xF0) == 0xE0) {
// PES data
char *buf = MALLOC(char, Length);
if (!buf)
return;
int i = 0;
int blen = 0;
while (i < Length - 6) {
if (Data[i] == 0x00 && Data[i + 1] == 0x00 && Data[i + 2] == 0x01) {
int len = Data[i + 4] * 256 + Data[i + 5];
if ((Data[i + 3] & 0xF0) == 0xE0) { // video packet
// skip PES header
int offs = i + 6;
// skip header extension
if ((Data[i + 6] & 0xC0) == 0x80) {
// MPEG-2 PES header
if (Data[i + 8] >= Length)
break;
offs += 3;
offs += Data[i + 8];
len -= 3;
len -= Data[i + 8];
if (len < 0 || offs + len > Length)
break;
}
else {
// MPEG-1 PES header
while (offs < Length && len > 0 && Data[offs] == 0xFF) {
offs++;
len--;
}
if (offs <= Length - 2 && len >= 2 && (Data[offs] & 0xC0) == 0x40) {
offs += 2;
len -= 2;
}
if (offs <= Length - 5 && len >= 5 && (Data[offs] & 0xF0) == 0x20) {
offs += 5;
len -= 5;
}
else if (offs <= Length - 10 && len >= 10 && (Data[offs] & 0xF0) == 0x30) {
offs += 10;
len -= 10;
}
else if (offs < Length && len > 0) {
offs++;
len--;
}
}
if (blen + len > Length) // invalid PES length field
break;
memcpy(&buf[blen], &Data[offs], len);
i = offs + len;
blen += len;
}
else if (Data[i + 3] >= 0xBD && Data[i + 3] <= 0xDF) // other PES packets
i += len + 6;
else
i++;
}
else
i++;
}
video_still_picture sp = { buf, blen };
CHECK(ioctl(fd_video, VIDEO_STILLPICTURE, &sp));
free(buf);
}
else {
// non-PES data
video_still_picture sp = { (char *)Data, Length };
CHECK(ioctl(fd_video, VIDEO_STILLPICTURE, &sp));
}
}
bool cDvbSdFfDevice::Poll(cPoller &Poller, int TimeoutMs)
{
Poller.Add((playMode == pmAudioOnly || playMode == pmAudioOnlyBlack) ? fd_audio : fd_video, true);
return Poller.Poll(TimeoutMs);
}
bool cDvbSdFfDevice::Flush(int TimeoutMs)
{
//TODO actually this function should wait until all buffered data has been processed by the card, but how?
return true;
}
int cDvbSdFfDevice::PlayVideo(const uchar *Data, int Length)
{
return WriteAllOrNothing(fd_video, Data, Length, 1000, 10);
}
int cDvbSdFfDevice::PlayAudio(const uchar *Data, int Length, uchar Id)
{
return WriteAllOrNothing(fd_audio, Data, Length, 1000, 10);
}
int cDvbSdFfDevice::PlayTsVideo(const uchar *Data, int Length)
{
return WriteAllOrNothing(fd_video, Data, Length, 1000, 10);
}
int cDvbSdFfDevice::PlayTsAudio(const uchar *Data, int Length)
{
return WriteAllOrNothing(fd_audio, Data, Length, 1000, 10);
}
// --- cDvbSdFfDeviceProbe ---------------------------------------------------
cDvbSdFfDeviceProbe::cDvbSdFfDeviceProbe(void)
{
outputOnly = false;
}
bool cDvbSdFfDeviceProbe::Probe(int Adapter, int Frontend)
{
static uint32_t SubsystemIds[] = {
0x110A0000, // Fujitsu Siemens DVB-C
0x13C20000, // Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C
0x13C20001, // Technotrend/Hauppauge WinTV DVB-T rev1.X
0x13C20002, // Technotrend/Hauppauge WinTV DVB-C rev2.X
0x13C20003, // Technotrend/Hauppauge WinTV Nexus-S rev2.X
0x13C20004, // Galaxis DVB-S rev1.3
0x13C20006, // Fujitsu Siemens DVB-S rev1.6
0x13C20008, // Technotrend/Hauppauge DVB-T
0x13C2000A, // Technotrend/Hauppauge WinTV Nexus-CA rev1.X
0x13C2000E, // Technotrend/Hauppauge WinTV Nexus-S rev2.3
0x13C21002, // Technotrend/Hauppauge WinTV DVB-S rev1.3 SE
0x00000000
};
uint32_t SubsystemId = GetSubsystemId(Adapter, Frontend);
for (uint32_t *sid = SubsystemIds; *sid; sid++) {
if (*sid == SubsystemId) {
dsyslog("creating cDvbSdFfDevice");
new cDvbSdFfDevice(Adapter, Frontend, outputOnly);
return true;
}
}
return false;
}

View File

@ -1,115 +0,0 @@
/*
* dvbsdffdevice.h: The DVB SD Full Featured device interface
*
* See the README file for copyright information and how to reach the author.
*
* $Id: dvbsdffdevice.h 3.2 2014/03/15 12:36:35 kls Exp $
*/
#ifndef __DVBSDFFDEVICE_H
#define __DVBSDFFDEVICE_H
#include <vdr/dvbdevice.h>
#include <vdr/dvbspu.h>
/// The cDvbSdFfDevice implements a DVB device which can be accessed through the Linux DVB driver API.
class cDvbSdFfDevice : public cDvbDevice {
private:
int fd_osd, fd_audio, fd_video, fd_stc;
bool outputOnly;
protected:
virtual void MakePrimaryDevice(bool On);
public:
cDvbSdFfDevice(int Adapter, int Frontend, bool OutputOnly);
virtual ~cDvbSdFfDevice();
virtual bool HasDecoder(void) const;
virtual bool AvoidRecording(void) const;
// SPU facilities
private:
cDvbSpuDecoder *spuDecoder;
public:
virtual cSpuDecoder *GetSpuDecoder(void);
// Channel facilities
public:
virtual bool ProvidesSource(int Source) const;
virtual int NumProvidedSystems(void) const;
private:
void TurnOffLiveMode(bool LiveView);
protected:
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
// PID handle facilities
private:
bool SetAudioBypass(bool On);
protected:
virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
// Image Grab facilities
private:
static int devVideoOffset;
int devVideoIndex;
public:
virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
// Video format facilities
public:
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
virtual void SetVideoFormat(bool VideoFormat16_9);
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
// Track facilities
protected:
virtual void SetAudioTrackDevice(eTrackType Type);
// Audio facilities
private:
bool digitalAudio;
protected:
virtual int GetAudioChannelDevice(void);
virtual void SetAudioChannelDevice(int AudioChannel);
virtual void SetVolumeDevice(int Volume);
virtual void SetDigitalAudioDevice(bool On);
// Player facilities
protected:
ePlayMode playMode;
virtual bool CanReplay(void) const;
virtual bool SetPlayMode(ePlayMode PlayMode);
virtual int PlayVideo(const uchar *Data, int Length);
virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
virtual int PlayTsVideo(const uchar *Data, int Length);
virtual int PlayTsAudio(const uchar *Data, int Length);
public:
virtual int64_t GetSTC(void);
virtual void TrickSpeed(int Speed, bool Forward);
virtual void Clear(void);
virtual void Play(void);
virtual void Freeze(void);
virtual void Mute(void);
virtual void StillPicture(const uchar *Data, int Length);
virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
virtual bool Flush(int TimeoutMs = 0);
};
class cDvbSdFfDeviceProbe : public cDvbDeviceProbe {
private:
bool outputOnly;
public:
cDvbSdFfDeviceProbe(void);
void SetOutputOnly(bool On) { outputOnly = On; }
virtual bool Probe(int Adapter, int Frontend);
};
#endif //__DVBSDFFDEVICE_H

View File

@ -1,211 +0,0 @@
/*
* dvbsdffosd.c: Implementation of the DVB SD Full Featured On Screen Display
*
* See the README file for copyright information and how to reach the author.
*
* $Id: dvbsdffosd.c 3.0 2011/04/17 12:55:09 kls Exp $
*/
#include "dvbsdffosd.h"
#include <linux/dvb/osd.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/unistd.h>
#include <vdr/tools.h>
// --- cDvbSdFfOsd -----------------------------------------------------------
#define MAXNUMWINDOWS 7 // OSD windows are counted 1...7
#define MAXOSDMEMORY 92000 // number of bytes available to the OSD (for unmodified DVB cards)
class cDvbSdFfOsd : public cOsd {
private:
int osdDev;
int osdMem;
bool shown;
void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL);
protected:
virtual void SetActive(bool On);
public:
cDvbSdFfOsd(int Left, int Top, int OsdDev, uint Level);
virtual ~cDvbSdFfOsd();
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas);
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
virtual void Flush(void);
};
cDvbSdFfOsd::cDvbSdFfOsd(int Left, int Top, int OsdDev, uint Level)
:cOsd(Left, Top, Level)
{
osdDev = OsdDev;
shown = false;
if (osdDev < 0)
esyslog("ERROR: invalid OSD device handle (%d)!", osdDev);
else {
osdMem = MAXOSDMEMORY;
#ifdef OSD_CAP_MEMSIZE
// modified DVB cards may have more OSD memory:
osd_cap_t cap;
cap.cmd = OSD_CAP_MEMSIZE;
if (ioctl(osdDev, OSD_GET_CAPABILITY, &cap) == 0)
osdMem = cap.val;
#endif
}
}
cDvbSdFfOsd::~cDvbSdFfOsd()
{
SetActive(false);
}
void cDvbSdFfOsd::SetActive(bool On)
{
if (On != Active()) {
cOsd::SetActive(On);
if (On) {
// must clear all windows here to avoid flashing effects - doesn't work if done
// in Flush() only for the windows that are actually used...
for (int i = 0; i < MAXNUMWINDOWS; i++) {
Cmd(OSD_SetWindow, 0, i + 1);
Cmd(OSD_Clear);
}
if (GetBitmap(0)) // only flush here if there are already bitmaps
Flush();
}
else if (shown) {
for (int i = 0; GetBitmap(i); i++) {
Cmd(OSD_SetWindow, 0, i + 1);
Cmd(OSD_Close);
}
shown = false;
}
}
}
eOsdError cDvbSdFfOsd::CanHandleAreas(const tArea *Areas, int NumAreas)
{
eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas);
if (Result == oeOk) {
if (NumAreas > MAXNUMWINDOWS)
return oeTooManyAreas;
int TotalMemory = 0;
for (int i = 0; i < NumAreas; i++) {
if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8)
return oeBppNotSupported;
if ((Areas[i].Width() & (8 / Areas[i].bpp - 1)) != 0)
return oeWrongAlignment;
if (Areas[i].Width() < 1 || Areas[i].Height() < 1 || Areas[i].Width() > 720 || Areas[i].Height() > 576)
return oeWrongAreaSize;
TotalMemory += Areas[i].Width() * Areas[i].Height() / (8 / Areas[i].bpp);
}
if (TotalMemory > osdMem)
return oeOutOfMemory;
}
return Result;
}
eOsdError cDvbSdFfOsd::SetAreas(const tArea *Areas, int NumAreas)
{
if (shown) {
for (int i = 0; GetBitmap(i); i++) {
Cmd(OSD_SetWindow, 0, i + 1);
Cmd(OSD_Close);
}
shown = false;
}
return cOsd::SetAreas(Areas, NumAreas);
}
void cDvbSdFfOsd::Cmd(OSD_Command cmd, int color, int x0, int y0, int x1, int y1, const void *data)
{
if (osdDev >= 0) {
osd_cmd_t dc;
dc.cmd = cmd;
dc.color = color;
dc.x0 = x0;
dc.y0 = y0;
dc.x1 = x1;
dc.y1 = y1;
dc.data = (void *)data;
ioctl(osdDev, OSD_SEND_CMD, &dc);
}
}
void cDvbSdFfOsd::Flush(void)
{
if (!Active())
return;
cBitmap *Bitmap;
for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
Cmd(OSD_SetWindow, 0, i + 1);
if (!shown)
Cmd(OSD_Open, Bitmap->Bpp(), Left() + Bitmap->X0(), Top() + Bitmap->Y0(), Left() + Bitmap->X0() + Bitmap->Width() - 1, Top() + Bitmap->Y0() + Bitmap->Height() - 1, (void *)1); // initially hidden!
int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
if (!shown || Bitmap->Dirty(x1, y1, x2, y2)) {
if (!shown) {
x1 = y1 = 0;
x2 = Bitmap->Width() - 1;
y2 = Bitmap->Height() - 1;
}
//TODO Workaround: apparently the bitmap sent to the driver always has to be a multiple
//TODO of 8 bits wide, and (dx * dy) also has to be a multiple of 8.
//TODO Fix driver (should be able to handle any size bitmaps!)
while ((x1 > 0 || x2 < Bitmap->Width() - 1) && ((x2 - x1) & 7) != 7) {
if (x2 < Bitmap->Width() - 1)
x2++;
else if (x1 > 0)
x1--;
}
//TODO "... / 2" <==> Bpp???
while ((y1 > 0 || y2 < Bitmap->Height() - 1) && (((x2 - x1 + 1) * (y2 - y1 + 1) / 2) & 7) != 0) {
if (y2 < Bitmap->Height() - 1)
y2++;
else if (y1 > 0)
y1--;
}
while ((x1 > 0 || x2 < Bitmap->Width() - 1) && (((x2 - x1 + 1) * (y2 - y1 + 1) / 2) & 7) != 0) {
if (x2 < Bitmap->Width() - 1)
x2++;
else if (x1 > 0)
x1--;
}
// commit colors:
int NumColors;
const tColor *Colors = Bitmap->Colors(NumColors);
if (Colors) {
//TODO this should be fixed in the driver!
tColor colors[NumColors];
for (int i = 0; i < NumColors; i++) {
// convert AARRGGBB to AABBGGRR (the driver expects the colors the wrong way):
colors[i] = (Colors[i] & 0xFF000000) | ((Colors[i] & 0x0000FF) << 16) | (Colors[i] & 0x00FF00) | ((Colors[i] & 0xFF0000) >> 16);
}
Colors = colors;
//TODO end of stuff that should be fixed in the driver
Cmd(OSD_SetPalette, 0, NumColors - 1, 0, 0, 0, Colors);
}
// commit modified data:
Cmd(OSD_SetBlock, Bitmap->Width(), x1, y1, x2, y2, Bitmap->Data(x1, y1));
}
Bitmap->Clean();
}
if (!shown) {
// Showing the windows in a separate loop to avoid seeing them come up one after another
for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
Cmd(OSD_SetWindow, 0, i + 1);
Cmd(OSD_MoveWindow, 0, Left() + Bitmap->X0(), Top() + Bitmap->Y0());
}
shown = true;
}
}
// --- cDvbOsdProvider -------------------------------------------------------
cDvbOsdProvider::cDvbOsdProvider(int OsdDev)
{
osdDev = OsdDev;
}
cOsd *cDvbOsdProvider::CreateOsd(int Left, int Top, uint Level)
{
return new cDvbSdFfOsd(Left, Top, osdDev, Level);
}

View File

@ -1,22 +0,0 @@
/*
* dvbsdffosd.h: Implementation of the DVB SD Full Featured On Screen Display
*
* See the README file for copyright information and how to reach the author.
*
* $Id: dvbsdffosd.h 3.0 2012/12/03 13:43:55 kls Exp $
*/
#ifndef __DVBSDFFODF_H
#define __DVBSDFFODF_H
#include <vdr/osd.h>
class cDvbOsdProvider : public cOsdProvider {
private:
int osdDev;
public:
cDvbOsdProvider(int OsdDev);
virtual cOsd *CreateOsd(int Left, int Top, uint Level);
};
#endif //__DVBSDFFODF_H

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# $Id: Makefile 4.0 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: epgtableid0.c 3.2 2015/02/17 13:12:18 kls Exp $
* $Id: epgtableid0.c 4.0 2015/02/17 13:12:18 kls Exp $
*/
#include <vdr/epg.h>

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# $Id: Makefile 4.0 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: hello.c 3.2 2015/02/17 13:12:26 kls Exp $
* $Id: hello.c 4.0 2015/02/17 13:12:26 kls Exp $
*/
#include <getopt.h>

View File

@ -72,3 +72,10 @@ VDR Plugin 'osddemo' Revision History
2015-02-19: Version 2.2.0
- Official release.
2015-03-08: Version 2.3.1
- Now using cOsd::MaxPixmapSize().
- Fixed a vertical black line in the "TiledPixmaps" area on the rpihddevice OSD with
1280x800 pixel (thanks to Thomas Reufer).
- Added a demo case for storing images (thanks to Thomas Reufer).

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# $Id: Makefile 4.0 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.

View File

@ -3,13 +3,13 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: osddemo.c 3.4 2015/02/17 13:12:36 kls Exp $
* $Id: osddemo.c 4.3 2015/04/12 09:35:21 kls Exp $
*/
#include <vdr/osd.h>
#include <vdr/plugin.h>
static const char *VERSION = "2.2.0";
static const char *VERSION = "2.3.1";
static const char *DESCRIPTION = "Demo of arbitrary OSD setup";
static const char *MAINMENUENTRY = "Osd Demo";
@ -90,6 +90,52 @@ void DrawSlopes(cOsd *Osd)
Osd->Flush();
}
// --- DrawImages ------------------------------------------------------------
struct tOsdImageRef {
int image;
cSize size;
};
#define NUMOSDIMAGES 16
#define NUMOSDIMAGEVARIANTS 8
void DrawImages(cOsd *Osd)
{
// Create images:
cImage *images[NUMOSDIMAGEVARIANTS];
for (int i = 0; i < NUMOSDIMAGEVARIANTS; i++) {
images[i] = new cImage(cSize(
i == 0 || i == 1 ? Osd->MaxPixmapSize().Width() + 1 : rand() % Osd->Width(),
i == 0 || i == 2 ? Osd->MaxPixmapSize().Height() + 1 : rand() % Osd->Height()));
for (int x = 0; x < images[i]->Width(); x++) {
for (int y = 0; y < images[i]->Height(); y++) {
images[i]->SetPixel(cPoint(x, y),
(!x || !y || x == images[i]->Width() - 1 || y == images[i]->Height() - 1) ? clrWhite :
(x > images[i]->Width() / 2 ?
(y > images[i]->Height() / 2 ? clrBlue : clrGreen) :
(y > images[i]->Height() / 2 ? clrRed : clrYellow)));
}
}
}
// Store images:
tOsdImageRef osdImages[NUMOSDIMAGES];
for (int i = 0; i < NUMOSDIMAGES; i++) {
osdImages[i].image = cOsdProvider::StoreImage(*images[i % NUMOSDIMAGEVARIANTS]);
osdImages[i].size.Set(images[i % NUMOSDIMAGEVARIANTS]->Size());
}
// Delete images:
for (int i = 0; i < NUMOSDIMAGEVARIANTS; i++)
delete images[i];
// Draw images:
for (int i = 0; i < NUMOSDIMAGES; i++)
Osd->DrawImage(cPoint(rand() % (Osd->Width() + osdImages[i].size.Width()), rand() % (Osd->Height() + osdImages[i].size.Height())).Shifted(-osdImages[i].size.Width(), -osdImages[i].size.Height()), osdImages[i].image);
// Drop image references:
for (int i = 0; i < NUMOSDIMAGES; i++)
cOsdProvider::DropImage(osdImages[i].image);
Osd->Flush();
}
// --- cLineGame -------------------------------------------------------------
class cLineGame : public cOsdObject {
@ -210,7 +256,7 @@ cPixmap *cTrueColorDemo::CreateTextPixmap(const char *s, int Line, int Layer, tC
if (Pixmap) {
Pixmap->Clear();
Pixmap->SetAlpha(0);
Pixmap->DrawText(cPoint(0, 0), s, ColorFg, ColorBg, Font);
Pixmap->DrawText(cPoint(0, 0), s, ColorFg, ColorBg, Font, w);
}
return Pixmap;
}
@ -427,16 +473,20 @@ void cTrueColorDemo::Action(void)
const int Size = SmlFont->Width(Text) + 10;
const int NumDots = 12;
const int AnimFrames = NumDots;
int Rows = min(osd->MaxPixmapSize().Height() / Size, AnimFrames);
int Cols = (AnimFrames + Rows - 1) / Rows;
// Temporarily using pixmap layer 0 to have the text alpha blended:
AnimPixmap = osd->CreatePixmap(0, cRect((osd->Width() - Size) / 2, StartLine, Size, Size), cRect(0, 0, Size, Size * AnimFrames));
AnimPixmap = osd->CreatePixmap(0, cRect((osd->Width() - Size) / 2, StartLine, Size, Size), cRect(0, 0, Size * Cols, Size * Rows));
if (AnimPixmap) {
AnimPixmap->SetAlpha(0);
AnimPixmap->Clear();
const int Diameter = Size / 5;
int xc = Size / 2 - Diameter / 2;
for (int Frame = 0; Frame < AnimFrames; Frame++) {
AnimPixmap->DrawEllipse(cRect(0, Frame * Size, Size, Size), 0xDDFFFFFF);
int yc = Frame * Size + Size / 2 - Diameter / 2;
int x0 = Frame / Rows * Size;
int y0 = Frame % Rows * Size;
AnimPixmap->DrawEllipse(cRect(x0, y0, Size, Size), 0xDDFFFFFF);
int xc = x0 + Size / 2 - Diameter / 2;
int yc = y0 + Size / 2 - Diameter / 2;
int Color = 0xFF;
int Delta = Color / NumDots / 3;
for (int a = 0; a < NumDots; a++) {
@ -446,7 +496,7 @@ void cTrueColorDemo::Action(void)
AnimPixmap->DrawEllipse(cRect(x, y, Diameter, Diameter), ArgbToColor(0xFF, Color, Color, Color));
Color -= Delta;
}
AnimPixmap->DrawText(cPoint(0, Frame * Size), Text, clrBlack, clrTransparent, SmlFont, Size, Size, taCenter);
AnimPixmap->DrawText(cPoint(x0, y0), Text, clrBlack, clrTransparent, SmlFont, Size, Size, taCenter);
}
AnimPixmap->SetLayer(3); // now setting the actual pixmap layer
FadeInPixmap = AnimPixmap;
@ -536,6 +586,10 @@ eOSState cTrueColorDemo::ProcessKey(eKeys Key)
SetArea();
DrawSlopes(osd);
break;
case k3: Cancel(3);
SetArea();
DrawImages(osd);
break;
case kBack:
case kOk: return osEnd;
default: return state;

View File

@ -99,3 +99,7 @@ VDR Plugin 'pictures' Revision History
2015-02-19: Version 2.2.0
- Official release.
2015-07.23: Version 2.3.1
- Added a missing 'const'.

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# $Id: Makefile 4.0 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: entry.c 3.0 2012/02/17 14:00:28 kls Exp $
* $Id: entry.c 4.0 2012/02/17 14:00:28 kls Exp $
*/
#include "entry.h"

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: entry.h 3.0 2008/01/06 12:30:50 kls Exp $
* $Id: entry.h 4.0 2008/01/06 12:30:50 kls Exp $
*/
#ifndef _ENTRY_H

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: menu.c 3.0 2008/01/13 11:35:18 kls Exp $
* $Id: menu.c 4.1 2015/07/23 10:13:56 kls Exp $
*/
#include "menu.h"
@ -85,7 +85,7 @@ eOSState cPictureMenu::SelectItem(const char *Path, bool SlideShow)
if (Item) {
const cList<cPictureEntry> *l = pictureEntry->Entries();
if (l) {
cPictureEntry *pe = l->Get(Current());
const cPictureEntry *pe = l->Get(Current());
if (pe) {
if (SlideShow) {
cControl::Launch(new cPictureControl(pictures, pe, true));

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: menu.h 3.0 2008/01/12 11:22:52 kls Exp $
* $Id: menu.h 4.0 2008/01/12 11:22:52 kls Exp $
*/
#ifndef _MENU_H

View File

@ -7,7 +7,7 @@
#
# See the README file for copyright information and how to reach the author.
#
# $Id: pic2mpg 3.1 2013/07/01 08:33:38 kls Exp $
# $Id: pic2mpg 4.0 2013/07/01 08:33:38 kls Exp $
use File::Path;
use File::Spec;

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: pictures.c 3.2 2015/02/17 13:12:50 kls Exp $
* $Id: pictures.c 4.1 2015/07/23 10:14:22 kls Exp $
*/
#include <getopt.h>
@ -11,7 +11,7 @@
#include "menu.h"
#include "player.h"
static const char *VERSION = "2.2.0";
static const char *VERSION = "2.3.1";
static const char *DESCRIPTION = trNOOP("A simple picture viewer");
static const char *MAINMENUENTRY = trNOOP("Pictures");

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: player.c 3.1 2014/02/08 12:48:12 kls Exp $
* $Id: player.c 4.0 2014/02/08 12:48:12 kls Exp $
*/
#include "player.h"

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: player.h 3.0 2012/04/28 11:56:01 kls Exp $
* $Id: player.h 4.0 2012/04/28 11:56:01 kls Exp $
*/
#ifndef _PLAYER_H

View File

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -1,30 +0,0 @@
VDR Plugin 'rcu' Revision History
---------------------------------
2012-02-27: Version 0.0.1
- Initial revision.
2012-03-07: Version 0.0.2
- Added new parameter LiveView to ChannelSwitch().
2012-12-27: Version 0.0.3
- Adapted Makefile to changes introduced in recent VDR versions.
2013-01-12: Version 0.0.4
- Adapted Makefile to changes introduced in recent VDR versions.
2013-03-31: Version 2.0.0
- Official release.
2014-01-01: Version 2.1.1
- Avoiding unnecessary pkg-config warnings in plugin Makefiles.
2015-02-19: Version 2.2.0
- Official release.

View File

@ -1,94 +0,0 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
# By default the main source file also carries this name.
PLUGIN = rcu
### The version number of this plugin (taken from the main source file):
VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
### The directory environment:
# Use package data if installed...otherwise assume we're under the VDR source directory:
PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
LIBDIR = $(call PKGCFG,libdir)
PLGCFG = $(call PKGCFG,plgcfg)
#
TMPDIR ?= /tmp
### The compiler options:
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
### The version number of VDR's plugin API:
APIVERSION = $(call PKGCFG,apiversion)
### Allow user defined options to overwrite defaults:
-include $(PLGCFG)
### The name of the distribution archive:
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
### The name of the shared object file:
SOFILE = libvdr-$(PLUGIN).so
### Includes and Defines (add further entries here):
INCLUDES +=
DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
### The object files (add further files here):
OBJS = $(PLUGIN).o
### The main target:
all: $(SOFILE)
### Implicit rules:
%.o: %.c
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
### Dependencies:
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
-include $(DEPFILE)
### Targets:
$(SOFILE): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
install: install-lib
dist: clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@echo Distribution package created as $(PACKAGE).tgz
clean:
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~

View File

@ -1,19 +0,0 @@
This is a "plugin" for the Video Disk Recorder (VDR).
Written by: Klaus Schmidinger <Klaus.Schmidinger@tvdr.de>
Project's homepage: http://www.tvdr.de/remote.htm
Latest version available at: http://www.tvdr.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
See the file COPYING for more information.
Description:
============
The "Remote Control Unit" used to be part of the core VDR source
code, and has been moved into a separate plugin in version 1.7.25.

View File

@ -1,420 +0,0 @@
/*
* rcu.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: rcu.c 3.2 2015/02/17 13:13:00 kls Exp $
*/
#include <getopt.h>
#include <netinet/in.h>
#include <termios.h>
#include <unistd.h>
#include <vdr/plugin.h>
#include <vdr/remote.h>
#include <vdr/status.h>
#include <vdr/thread.h>
#include <vdr/tools.h>
static const char *VERSION = "2.2.0";
static const char *DESCRIPTION = "Remote Control Unit";
#define REPEATLIMIT 150 // ms
#define REPEATDELAY 350 // ms
#define HANDSHAKETIMEOUT 20 // ms
#define DEFAULTDEVICE "/dev/ttyS1"
class cRcuRemote : public cRemote, private cThread, private cStatus {
private:
enum { modeH = 'h', modeB = 'b', modeS = 's' };
int f;
unsigned char dp, code, mode;
int number;
unsigned int data;
bool receivedCommand;
bool SendCommand(unsigned char Cmd);
int ReceiveByte(int TimeoutMs = 0);
bool SendByteHandshake(unsigned char c);
bool SendByte(unsigned char c);
bool SendData(unsigned int n);
void SetCode(unsigned char Code);
void SetMode(unsigned char Mode);
void SetNumber(int n, bool Hex = false);
void SetPoints(unsigned char Dp, bool On);
void SetString(const char *s);
bool DetectCode(unsigned char *Code);
virtual void Action(void);
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView);
virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
public:
cRcuRemote(const char *DeviceName);
virtual ~cRcuRemote();
virtual bool Ready(void);
virtual bool Initialize(void);
};
cRcuRemote::cRcuRemote(const char *DeviceName)
:cRemote("RCU")
,cThread("RCU remote control")
{
dp = 0;
mode = modeB;
code = 0;
number = 0;
data = 0;
receivedCommand = false;
if ((f = open(DeviceName, O_RDWR | O_NONBLOCK)) >= 0) {
struct termios t;
if (tcgetattr(f, &t) == 0) {
cfsetspeed(&t, B9600);
cfmakeraw(&t);
if (tcsetattr(f, TCSAFLUSH, &t) == 0) {
SetNumber(8888);
const char *Setup = GetSetup();
if (Setup) {
code = *Setup;
SetCode(code);
isyslog("connecting to %s remote control using code %c", Name(), code);
}
Start();
return;
}
}
LOG_ERROR_STR(DeviceName);
close(f);
}
else
LOG_ERROR_STR(DeviceName);
f = -1;
}
cRcuRemote::~cRcuRemote()
{
Cancel();
}
bool cRcuRemote::Ready(void)
{
return f >= 0;
}
bool cRcuRemote::Initialize(void)
{
if (f >= 0) {
unsigned char Code = '0';
isyslog("trying codes for %s remote control...", Name());
for (;;) {
if (DetectCode(&Code)) {
code = Code;
break;
}
}
isyslog("established connection to %s remote control using code %c", Name(), code);
char buffer[16];
snprintf(buffer, sizeof(buffer), "%c", code);
PutSetup(buffer);
return true;
}
return false;
}
void cRcuRemote::Action(void)
{
#pragma pack(1)
union {
struct {
unsigned short address;
unsigned int command;
} data;
unsigned char raw[6];
} buffer;
#pragma pack()
time_t LastCodeRefresh = 0;
cTimeMs FirstTime;
unsigned char LastCode = 0, LastMode = 0;
uint64_t LastCommand = ~0; // 0x00 might be a valid command
unsigned int LastData = 0;
bool repeat = false;
while (Running() && f >= 0) {
if (ReceiveByte(REPEATLIMIT) == 'X') {
for (int i = 0; i < 6; i++) {
int b = ReceiveByte();
if (b >= 0) {
buffer.raw[i] = b;
if (i == 5) {
unsigned short Address = ntohs(buffer.data.address); // the PIC sends bytes in "network order"
uint64_t Command = ntohl(buffer.data.command);
if (code == 'B' && Address == 0x0000 && Command == 0x00004000)
// Well, well, if it isn't the "d-box"...
// This remote control sends the above command before and after
// each keypress - let's just drop this:
break;
Command |= uint64_t(Address) << 32;
if (Command != LastCommand) {
LastCommand = Command;
repeat = false;
FirstTime.Set();
}
else {
if (FirstTime.Elapsed() < REPEATDELAY)
break; // repeat function kicks in after a short delay
repeat = true;
}
Put(Command, repeat);
receivedCommand = true;
}
}
else
break;
}
}
else if (repeat) { // the last one was a repeat, so let's generate a release
Put(LastCommand, false, true);
repeat = false;
LastCommand = ~0;
}
else {
unsigned int d = data;
if (d != LastData) {
SendData(d);
LastData = d;
}
unsigned char c = code;
if (c != LastCode) {
SendCommand(c);
LastCode = c;
}
unsigned char m = mode;
if (m != LastMode) {
SendCommand(m);
LastMode = m;
}
LastCommand = ~0;
}
if (!repeat && code && time(NULL) - LastCodeRefresh > 60) {
SendCommand(code); // in case the PIC listens to the wrong code
LastCodeRefresh = time(NULL);
}
}
}
int cRcuRemote::ReceiveByte(int TimeoutMs)
{
// Returns the byte if one was received within a timeout, -1 otherwise
if (cFile::FileReady(f, TimeoutMs)) {
unsigned char b;
if (safe_read(f, &b, 1) == 1)
return b;
else
LOG_ERROR;
}
return -1;
}
bool cRcuRemote::SendByteHandshake(unsigned char c)
{
if (f >= 0) {
int w = write(f, &c, 1);
if (w == 1) {
for (int reply = ReceiveByte(HANDSHAKETIMEOUT); reply >= 0;) {
if (reply == c)
return true;
else if (reply == 'X') {
// skip any incoming RC code - it will come again
for (int i = 6; i--;) {
if (ReceiveByte() < 0)
return false;
}
}
else
return false;
}
}
LOG_ERROR;
}
return false;
}
bool cRcuRemote::SendByte(unsigned char c)
{
for (int retry = 5; retry--;) {
if (SendByteHandshake(c))
return true;
}
return false;
}
bool cRcuRemote::SendData(unsigned int n)
{
for (int i = 0; i < 4; i++) {
if (!SendByte(n & 0x7F))
return false;
n >>= 8;
}
return SendCommand(mode);
}
void cRcuRemote::SetCode(unsigned char Code)
{
code = Code;
}
void cRcuRemote::SetMode(unsigned char Mode)
{
mode = Mode;
}
bool cRcuRemote::SendCommand(unsigned char Cmd)
{
return SendByte(Cmd | 0x80);
}
void cRcuRemote::SetNumber(int n, bool Hex)
{
number = n;
if (!Hex) {
char buf[8];
sprintf(buf, "%4d", n & 0xFFFF);
n = 0;
for (char *d = buf; *d; d++) {
if (*d == ' ')
*d = 0xF;
n = (n << 4) | ((*d - '0') & 0x0F);
}
}
unsigned int m = 0;
for (int i = 0; i < 4; i++) {
m <<= 8;
m |= ((i & 0x03) << 5) | (n & 0x0F) | (((dp >> i) & 0x01) << 4);
n >>= 4;
}
data = m;
}
void cRcuRemote::SetString(const char *s)
{
const char *chars = mode == modeH ? "0123456789ABCDEF" : "0123456789-EHLP ";
int n = 0;
for (int i = 0; *s && i < 4; s++, i++) {
n <<= 4;
for (const char *c = chars; *c; c++) {
if (*c == *s) {
n |= c - chars;
break;
}
}
}
SetNumber(n, true);
}
void cRcuRemote::SetPoints(unsigned char Dp, bool On)
{
if (On)
dp |= Dp;
else
dp &= ~Dp;
SetNumber(number);
}
bool cRcuRemote::DetectCode(unsigned char *Code)
{
// Caller should initialize 'Code' to 0 and call DetectCode()
// until it returns true. Whenever DetectCode() returns false
// and 'Code' is not 0, the caller can use 'Code' to display
// a message like "Trying code '%c'". If false is returned and
// 'Code' is 0, all possible codes have been tried and the caller
// can either stop calling DetectCode() (and give some error
// message), or start all over again.
if (*Code < 'A' || *Code > 'D') {
*Code = 'A';
return false;
}
if (*Code <= 'D') {
SetMode(modeH);
char buf[5];
sprintf(buf, "C0D%c", *Code);
SetString(buf);
SetCode(*Code);
cCondWait::SleepMs(2 * REPEATDELAY);
if (receivedCommand) {
SetMode(modeB);
SetString("----");
return true;
}
if (*Code < 'D') {
(*Code)++;
return false;
}
}
*Code = 0;
return false;
}
void cRcuRemote::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
{
if (ChannelNumber && LiveView)
SetNumber(cDevice::CurrentChannel());
}
void cRcuRemote::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On)
{
SetPoints(1 << Device->DeviceNumber(), Device->Receiving());
}
class cPluginRcu : public cPlugin {
private:
// Add any member variables or functions you may need here.
const char *device;
public:
cPluginRcu(void);
virtual const char *Version(void) { return VERSION; }
virtual const char *Description(void) { return DESCRIPTION; }
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Start(void);
};
cPluginRcu::cPluginRcu(void)
{
// Initialize any member variables here.
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
device = DEFAULTDEVICE;
}
const char *cPluginRcu::CommandLineHelp(void)
{
// Return a string that describes all known command line options.
return " -d DEV, --device=DEV set the device to use (default is " DEFAULTDEVICE ")\n";
}
bool cPluginRcu::ProcessArgs(int argc, char *argv[])
{
// Implement command line argument processing here if applicable.
static struct option long_options[] = {
{ "dev", required_argument, NULL, 'd' },
{ NULL, no_argument, NULL, 0 }
};
int c;
while ((c = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) {
switch (c) {
case 'd': device = optarg;
break;
default: return false;
}
}
return true;
}
bool cPluginRcu::Start(void)
{
// Start any background activities the plugin shall perform.
new cRcuRemote(device);
return true;
}
VDRPLUGINCREATOR(cPluginRcu); // Don't touch this!

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# $Id: Makefile 4.0 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: svccli.c 3.2 2015/02/17 13:13:05 kls Exp $
* $Id: svccli.c 4.0 2015/02/17 13:13:05 kls Exp $
*/
#include <stdlib.h>

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: svcsvr.c 3.2 2015/02/17 13:13:09 kls Exp $
* $Id: svcsvr.c 4.0 2015/02/17 13:13:09 kls Exp $
*/
#include <stdlib.h>

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# $Id: Makefile 4.0 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: skincurses.c 3.3 2015/02/17 13:13:17 kls Exp $
* $Id: skincurses.c 4.0 2015/02/17 13:13:17 kls Exp $
*/
#include <ncurses.h>

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# $Id: Makefile 4.0 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: status.c 3.2 2015/02/17 13:13:21 kls Exp $
* $Id: status.c 4.0 2015/02/17 13:13:21 kls Exp $
*/
#include <vdr/plugin.h>

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 3.1 2014/01/01 13:29:54 kls Exp $
# $Id: Makefile 4.0 2014/01/01 13:29:54 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: svdrpdemo.c 3.2 2015/02/17 13:13:29 kls Exp $
* $Id: svdrpdemo.c 4.0 2015/02/17 13:13:29 kls Exp $
*/
#include <vdr/plugin.h>

4
README
View File

@ -32,6 +32,10 @@ of commercial set-top boxes usually are a lot more fancy than
the ones in this system, but here we have the full source code
and can modify the menus in whatever way desired.
If you actually use VDR, please add yourself to the "VDR User Counter"
at http://www.tvdr.de/counter.htm. You can also like VDR on facebook
at https://www.facebook.com/VideoDiskRecorder.
"VDR Video Disk Recorder" is a registered trademark of Klaus Schmidinger.
"TVDR TV Done Right" is a registered trademark of Klaus Schmidinger.

2
args.c
View File

@ -6,7 +6,7 @@
*
* Original version written by Lars Hanisch <dvb@flensrocker.de>.
*
* $Id: args.c 1.1 2014/04/14 12:02:38 kls Exp $
* $Id: args.c 4.0 2014/04/14 12:02:38 kls Exp $
*/
#include "args.h"

2
args.h
View File

@ -6,7 +6,7 @@
*
* Original version written by Lars Hanisch <dvb@flensrocker.de>.
*
* $Id: args.h 1.1 2014/04/14 11:54:21 kls Exp $
* $Id: args.h 4.0 2014/04/14 11:54:21 kls Exp $
*/
#ifndef __ARGS_H

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: audio.c 3.0 2010/05/16 13:30:11 kls Exp $
* $Id: audio.c 4.0 2010/05/16 13:30:11 kls Exp $
*/
#include "audio.h"

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: audio.h 3.0 2008/07/06 11:39:21 kls Exp $
* $Id: audio.h 4.0 2008/07/06 11:39:21 kls Exp $
*/
#ifndef __AUDIO_H

View File

@ -4,15 +4,13 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.c 3.8 2015/02/01 13:47:05 kls Exp $
* $Id: channels.c 4.3 2015/09/09 10:21:22 kls Exp $
*/
#include "channels.h"
#include <ctype.h>
#include "device.h"
#include "epg.h"
#include "libsi/si.h"
#include "timers.h"
// IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
// format characters in order to allow any number of blanks after a numeric
@ -79,27 +77,13 @@ cChannel::cChannel(const cChannel &Channel)
schedule = NULL;
linkChannels = NULL;
refChannel = NULL;
seen = 0;
*this = Channel;
}
cChannel::~cChannel()
{
delete linkChannels;
linkChannels = NULL; // more than one channel can link to this one, so we need the following loop
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (Channel->linkChannels) {
for (cLinkChannel *lc = Channel->linkChannels->First(); lc; lc = Channel->linkChannels->Next(lc)) {
if (lc->Channel() == this) {
Channel->linkChannels->Del(lc);
break;
}
}
if (Channel->linkChannels->Count() == 0) {
delete Channel->linkChannels;
Channel->linkChannels = NULL;
}
}
}
delete linkChannels; // any links from other channels pointing to this one have been deleted in cChannels::Del()
free(name);
free(shortName);
free(provider);
@ -167,16 +151,7 @@ int cChannel::Transponder(void) const
return tf;
}
bool cChannel::HasTimer(void) const
{
for (cTimer *Timer = Timers.First(); Timer; Timer = Timers.Next(Timer)) {
if (Timer->Channel() == this)
return true;
}
return false;
}
int cChannel::Modification(int Mask)
int cChannel::Modification(int Mask) const
{
int Result = modification & Mask;
modification = CHANNELMOD_NONE;
@ -223,41 +198,57 @@ bool cChannel::SetTransponderData(int Source, int Frequency, int Srate, const ch
if (Number() && !Quiet) {
dsyslog("changing transponder data of channel %d (%s) from %s to %s", Number(), name, *OldTransponderData, *TransponderDataToString());
modification |= CHANNELMOD_TRANSP;
Channels.SetModified();
}
return true;
}
return true;
return false;
}
void cChannel::SetId(int Nid, int Tid, int Sid, int Rid)
bool cChannel::SetSource(int Source)
{
if (source != Source) {
if (Number()) {
dsyslog("changing source of channel %d (%s) from %s to %s", Number(), name, *cSource::ToString(source), *cSource::ToString(Source));
modification |= CHANNELMOD_TRANSP;
}
source = Source;
return true;
}
return false;
}
bool cChannel::SetId(cChannels *Channels, int Nid, int Tid, int Sid, int Rid)
{
if (nid != Nid || tid != Tid || sid != Sid || rid != Rid) {
if (Number()) {
if (Channels && Number()) {
dsyslog("changing id of channel %d (%s) from %d-%d-%d-%d to %d-%d-%d-%d", Number(), name, nid, tid, sid, rid, Nid, Tid, Sid, Rid);
modification |= CHANNELMOD_ID;
Channels.SetModified();
Channels.UnhashChannel(this);
Channels->UnhashChannel(this);
}
nid = Nid;
tid = Tid;
sid = Sid;
rid = Rid;
if (Number())
Channels.HashChannel(this);
if (Channels)
Channels->HashChannel(this);
schedule = NULL;
return true;
}
return false;
}
void cChannel::SetLcn(int Lcn)
bool cChannel::SetLcn(int Lcn)
{
if (lcn != Lcn) {
if (Number())
dsyslog("changing lcn of channel %d (%s) from %d to %d\n", Number(), name, lcn, Lcn);
lcn = Lcn;
return true;
}
return false;
}
void cChannel::SetName(const char *Name, const char *ShortName, const char *Provider)
bool cChannel::SetName(const char *Name, const char *ShortName, const char *Provider)
{
if (!isempty(Name)) {
bool nn = strcmp(name, Name) != 0;
@ -267,7 +258,6 @@ void cChannel::SetName(const char *Name, const char *ShortName, const char *Prov
if (Number()) {
dsyslog("changing name of channel %d from '%s,%s;%s' to '%s,%s;%s'", Number(), name, shortName, provider, Name, ShortName, Provider);
modification |= CHANNELMOD_NAME;
Channels.SetModified();
}
if (nn) {
name = strcpyrealloc(name, Name);
@ -279,20 +269,23 @@ void cChannel::SetName(const char *Name, const char *ShortName, const char *Prov
}
if (np)
provider = strcpyrealloc(provider, Provider);
return true;
}
}
return false;
}
void cChannel::SetPortalName(const char *PortalName)
bool cChannel::SetPortalName(const char *PortalName)
{
if (!isempty(PortalName) && strcmp(portalName, PortalName) != 0) {
if (Number()) {
dsyslog("changing portal name of channel %d (%s) from '%s' to '%s'", Number(), name, portalName, PortalName);
modification |= CHANNELMOD_NAME;
Channels.SetModified();
}
portalName = strcpyrealloc(portalName, PortalName);
return true;
}
return false;
}
#define STRDIFF 0x01
@ -337,7 +330,7 @@ static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[]
return q - s;
}
void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, int *Dtypes, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid)
bool cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, int *Dtypes, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid)
{
int mod = CHANNELMOD_NONE;
if (vpid != Vpid || ppid != Ppid || vtype != Vtype)
@ -400,25 +393,33 @@ void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, c
spids[MAXSPIDS] = 0;
tpid = Tpid;
modification |= mod;
if (Number())
Channels.SetModified();
return true;
}
return false;
}
void cChannel::SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds)
bool cChannel::SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds)
{
bool Modified = false;
if (SubtitlingTypes) {
for (int i = 0; i < MAXSPIDS; i++)
for (int i = 0; i < MAXSPIDS; i++) {
Modified = subtitlingTypes[i] != SubtitlingTypes[i];
subtitlingTypes[i] = SubtitlingTypes[i];
}
}
if (CompositionPageIds) {
for (int i = 0; i < MAXSPIDS; i++)
for (int i = 0; i < MAXSPIDS; i++) {
Modified = compositionPageIds[i] != CompositionPageIds[i];
compositionPageIds[i] = CompositionPageIds[i];
}
}
if (AncillaryPageIds) {
for (int i = 0; i < MAXSPIDS; i++)
for (int i = 0; i < MAXSPIDS; i++) {
Modified = ancillaryPageIds[i] != AncillaryPageIds[i];
ancillaryPageIds[i] = AncillaryPageIds[i];
}
}
return Modified;
}
void cChannel::SetSeen(void)
@ -426,10 +427,26 @@ void cChannel::SetSeen(void)
seen = time(NULL);
}
void cChannel::SetCaIds(const int *CaIds)
void cChannel::DelLinkChannel(cChannel *LinkChannel)
{
if (linkChannels) {
for (cLinkChannel *lc = linkChannels->First(); lc; lc = linkChannels->Next(lc)) {
if (lc->Channel() == LinkChannel) {
linkChannels->Del(lc);
break;
}
}
if (linkChannels->Count() == 0) {
delete linkChannels;
linkChannels = NULL;
}
}
}
bool cChannel::SetCaIds(const int *CaIds)
{
if (caids[0] && caids[0] <= CA_USER_MAX)
return; // special values will not be overwritten
return false; // special values will not be overwritten
if (IntArraysDiffer(caids, CaIds)) {
char OldCaIdsBuf[MAXCAIDS * 5 + 10]; // 5: 4 digits plus delimiting ',', 10: paranoia
char NewCaIdsBuf[MAXCAIDS * 5 + 10];
@ -443,24 +460,26 @@ void cChannel::SetCaIds(const int *CaIds)
break;
}
modification |= CHANNELMOD_CA;
Channels.SetModified();
return true;
}
return false;
}
void cChannel::SetCaDescriptors(int Level)
bool cChannel::SetCaDescriptors(int Level)
{
if (Level > 0) {
modification |= CHANNELMOD_CA;
Channels.SetModified();
if (Number() && Level > 1)
dsyslog("changing ca descriptors of channel %d (%s)", Number(), name);
return true;
}
return false;
}
void cChannel::SetLinkChannels(cLinkChannels *LinkChannels)
bool cChannel::SetLinkChannels(cLinkChannels *LinkChannels)
{
if (!linkChannels && !LinkChannels)
return;
return false;
if (linkChannels && LinkChannels) {
cLinkChannel *lca = linkChannels->First();
cLinkChannel *lcb = LinkChannels->First();
@ -474,7 +493,7 @@ void cChannel::SetLinkChannels(cLinkChannels *LinkChannels)
}
if (!lca && !lcb) {
delete LinkChannels;
return; // linkage has not changed
return false; // linkage has not changed
}
}
char buffer[((linkChannels ? linkChannels->Count() : 0) + (LinkChannels ? LinkChannels->Count() : 0)) * 6 + 256]; // 6: 5 digit channel number plus blank, 256: other texts (see below) plus reserve
@ -502,6 +521,7 @@ void cChannel::SetLinkChannels(cLinkChannels *LinkChannels)
q += sprintf(q, " none");
if (Number())
dsyslog("%s", buffer);
return true;
}
void cChannel::SetRefChannel(cChannel *RefChannel)
@ -534,9 +554,9 @@ cString cChannel::ToText(const cChannel *Channel)
cString buffer;
if (Channel->groupSep) {
if (Channel->number)
buffer = cString::sprintf(":@%d %s\n", Channel->number, FullName);
buffer = cString::sprintf(":@%d %s", Channel->number, FullName);
else
buffer = cString::sprintf(":%s\n", FullName);
buffer = cString::sprintf(":%s", FullName);
}
else {
char vpidbuf[32];
@ -568,7 +588,7 @@ cString cChannel::ToText(const cChannel *Channel)
q = caidbuf;
q += IntArrayToString(q, Channel->caids, 16);
*q = 0;
buffer = cString::sprintf("%s:%d:%s:%s:%d:%s:%s:%s:%s:%d:%d:%d:%d\n", FullName, Channel->frequency, *Channel->parameters, *cSource::ToString(Channel->source), Channel->srate, vpidbuf, apidbuf, tpidbuf, caidbuf, Channel->sid, Channel->nid, Channel->tid, Channel->rid);
buffer = cString::sprintf("%s:%d:%s:%s:%d:%s:%s:%s:%s:%d:%d:%d:%d", FullName, Channel->frequency, *Channel->parameters, *cSource::ToString(Channel->source), Channel->srate, vpidbuf, apidbuf, tpidbuf, caidbuf, Channel->sid, Channel->nid, Channel->tid, Channel->rid);
}
return buffer;
}
@ -786,7 +806,7 @@ bool cChannel::Parse(const char *s)
bool cChannel::Save(FILE *f)
{
return fprintf(f, "%s", *ToText()) > 0;
return fprintf(f, "%s\n", *ToText()) > 0;
}
// --- cChannelSorter --------------------------------------------------------
@ -807,40 +827,52 @@ public:
// --- cChannels -------------------------------------------------------------
cChannels Channels;
cChannels cChannels::channels;
int cChannels::maxNumber = 0;
int cChannels::maxChannelNameLength = 0;
int cChannels::maxShortChannelNameLength = 0;
cChannels::cChannels(void)
:cConfig<cChannel>("Channels")
{
maxNumber = 0;
maxChannelNameLength = 0;
maxShortChannelNameLength = 0;
modified = CHANNELSMOD_NONE;
modifiedByUser = 0;
}
const cChannels *cChannels::GetChannelsRead(cStateKey &StateKey, int TimeoutMs)
{
return channels.Lock(StateKey, false, TimeoutMs) ? &channels : NULL;
}
cChannels *cChannels::GetChannelsWrite(cStateKey &StateKey, int TimeoutMs)
{
return channels.Lock(StateKey, true, TimeoutMs) ? &channels : NULL;
}
void cChannels::DeleteDuplicateChannels(void)
{
cList<cChannelSorter> ChannelSorter;
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep())
ChannelSorter.Add(new cChannelSorter(channel));
for (cChannel *Channel = First(); Channel; Channel = Next(Channel)) {
if (!Channel->GroupSep())
ChannelSorter.Add(new cChannelSorter(Channel));
}
ChannelSorter.Sort();
cChannelSorter *cs = ChannelSorter.First();
while (cs) {
cChannelSorter *next = ChannelSorter.Next(cs);
if (next && cs->channelID == next->channelID) {
dsyslog("deleting duplicate channel %s", *next->channel->ToText());
Del(next->channel);
cChannelSorter *Next = ChannelSorter.Next(cs);
if (Next && cs->channelID == Next->channelID) {
dsyslog("deleting duplicate channel %s", *Next->channel->ToText());
Del(Next->channel);
}
cs = next;
cs = Next;
}
}
bool cChannels::Load(const char *FileName, bool AllowComments, bool MustExist)
{
if (cConfig<cChannel>::Load(FileName, AllowComments, MustExist)) {
DeleteDuplicateChannels();
ReNumber();
LOCK_CHANNELS_WRITE;
if (channels.cConfig<cChannel>::Load(FileName, AllowComments, MustExist)) {
channels.DeleteDuplicateChannels();
channels.ReNumber();
return true;
}
return false;
@ -856,36 +888,36 @@ void cChannels::UnhashChannel(cChannel *Channel)
channelsHashSid.Del(Channel, Channel->Sid());
}
int cChannels::GetNextGroup(int Idx)
int cChannels::GetNextGroup(int Idx) const
{
cChannel *channel = Get(++Idx);
while (channel && !(channel->GroupSep() && *channel->Name()))
channel = Get(++Idx);
return channel ? Idx : -1;
const cChannel *Channel = Get(++Idx);
while (Channel && !(Channel->GroupSep() && *Channel->Name()))
Channel = Get(++Idx);
return Channel ? Idx : -1;
}
int cChannels::GetPrevGroup(int Idx)
int cChannels::GetPrevGroup(int Idx) const
{
cChannel *channel = Get(--Idx);
while (channel && !(channel->GroupSep() && *channel->Name()))
channel = Get(--Idx);
return channel ? Idx : -1;
const cChannel *Channel = Get(--Idx);
while (Channel && !(Channel->GroupSep() && *Channel->Name()))
Channel = Get(--Idx);
return Channel ? Idx : -1;
}
int cChannels::GetNextNormal(int Idx)
int cChannels::GetNextNormal(int Idx) const
{
cChannel *channel = Get(++Idx);
while (channel && channel->GroupSep())
channel = Get(++Idx);
return channel ? Idx : -1;
const cChannel *Channel = Get(++Idx);
while (Channel && Channel->GroupSep())
Channel = Get(++Idx);
return Channel ? Idx : -1;
}
int cChannels::GetPrevNormal(int Idx)
int cChannels::GetPrevNormal(int Idx) const
{
cChannel *channel = Get(--Idx);
while (channel && channel->GroupSep())
channel = Get(--Idx);
return channel ? Idx : -1;
const cChannel *Channel = Get(--Idx);
while (Channel && Channel->GroupSep())
Channel = Get(--Idx);
return Channel ? Idx : -1;
}
void cChannels::ReNumber(void)
@ -893,110 +925,120 @@ void cChannels::ReNumber(void)
channelsHashSid.Clear();
maxNumber = 0;
int Number = 1;
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (channel->GroupSep()) {
if (channel->Number() > Number)
Number = channel->Number();
for (cChannel *Channel = First(); Channel; Channel = Next(Channel)) {
if (Channel->GroupSep()) {
if (Channel->Number() > Number)
Number = Channel->Number();
}
else {
HashChannel(channel);
HashChannel(Channel);
maxNumber = Number;
channel->SetNumber(Number++);
Channel->SetNumber(Number++);
}
}
}
cChannel *cChannels::GetByNumber(int Number, int SkipGap)
void cChannels::Del(cChannel *Channel)
{
cChannel *previous = NULL;
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep()) {
if (channel->Number() == Number)
return channel;
else if (SkipGap && channel->Number() > Number)
return SkipGap > 0 ? channel : previous;
previous = channel;
UnhashChannel(Channel);
for (cChannel *ch = First(); ch; ch = Next(ch))
ch->DelLinkChannel(Channel);
cList<cChannel>::Del(Channel);
}
const cChannel *cChannels::GetByNumber(int Number, int SkipGap) const
{
const cChannel *Previous = NULL;
for (const cChannel *Channel = First(); Channel; Channel = Next(Channel)) {
if (!Channel->GroupSep()) {
if (Channel->Number() == Number)
return Channel;
else if (SkipGap && Channel->Number() > Number)
return SkipGap > 0 ? Channel : Previous;
Previous = Channel;
}
}
return NULL;
}
cChannel *cChannels::GetByServiceID(int Source, int Transponder, unsigned short ServiceID)
const cChannel *cChannels::GetByServiceID(int Source, int Transponder, unsigned short ServiceID) const
{
cList<cHashObject> *list = channelsHashSid.GetList(ServiceID);
if (list) {
for (cHashObject *hobj = list->First(); hobj; hobj = list->Next(hobj)) {
cChannel *channel = (cChannel *)hobj->Object();
if (channel->Sid() == ServiceID && channel->Source() == Source && ISTRANSPONDER(channel->Transponder(), Transponder))
return channel;
cChannel *Channel = (cChannel *)hobj->Object();
if (Channel->Sid() == ServiceID && Channel->Source() == Source && ISTRANSPONDER(Channel->Transponder(), Transponder))
return Channel;
}
}
return NULL;
}
cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid, bool TryWithoutPolarization)
const cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid, bool TryWithoutPolarization) const
{
int sid = ChannelID.Sid();
cList<cHashObject> *list = channelsHashSid.GetList(sid);
if (list) {
for (cHashObject *hobj = list->First(); hobj; hobj = list->Next(hobj)) {
cChannel *channel = (cChannel *)hobj->Object();
if (channel->Sid() == sid && channel->GetChannelID() == ChannelID)
return channel;
cChannel *Channel = (cChannel *)hobj->Object();
if (Channel->Sid() == sid && Channel->GetChannelID() == ChannelID)
return Channel;
}
if (TryWithoutRid) {
ChannelID.ClrRid();
for (cHashObject *hobj = list->First(); hobj; hobj = list->Next(hobj)) {
cChannel *channel = (cChannel *)hobj->Object();
if (channel->Sid() == sid && channel->GetChannelID().ClrRid() == ChannelID)
return channel;
cChannel *Channel = (cChannel *)hobj->Object();
if (Channel->Sid() == sid && Channel->GetChannelID().ClrRid() == ChannelID)
return Channel;
}
}
if (TryWithoutPolarization) {
ChannelID.ClrPolarization();
for (cHashObject *hobj = list->First(); hobj; hobj = list->Next(hobj)) {
cChannel *channel = (cChannel *)hobj->Object();
if (channel->Sid() == sid && channel->GetChannelID().ClrPolarization() == ChannelID)
return channel;
cChannel *Channel = (cChannel *)hobj->Object();
if (Channel->Sid() == sid && Channel->GetChannelID().ClrPolarization() == ChannelID)
return Channel;
}
}
}
return NULL;
}
cChannel *cChannels::GetByTransponderID(tChannelID ChannelID)
const cChannel *cChannels::GetByTransponderID(tChannelID ChannelID) const
{
int source = ChannelID.Source();
int nid = ChannelID.Nid();
int tid = ChannelID.Tid();
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (channel->Tid() == tid && channel->Nid() == nid && channel->Source() == source)
return channel;
for (const cChannel *Channel = First(); Channel; Channel = Next(Channel)) {
if (Channel->Tid() == tid && Channel->Nid() == nid && Channel->Source() == source)
return Channel;
}
return NULL;
}
bool cChannels::HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel)
bool cChannels::HasUniqueChannelID(const cChannel *NewChannel, const cChannel *OldChannel) const
{
tChannelID NewChannelID = NewChannel->GetChannelID();
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep() && channel != OldChannel && channel->GetChannelID() == NewChannelID)
for (const cChannel *Channel = First(); Channel; Channel = Next(Channel)) {
if (!Channel->GroupSep() && Channel != OldChannel && Channel->GetChannelID() == NewChannelID)
return false;
}
return true;
}
bool cChannels::SwitchTo(int Number)
bool cChannels::SwitchTo(int Number) const
{
cChannel *channel = GetByNumber(Number);
return channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true);
const cChannel *Channel = GetByNumber(Number);
return Channel && cDevice::PrimaryDevice()->SwitchChannel(Channel, true);
}
int cChannels::MaxChannelNameLength(void)
{
if (!maxChannelNameLength) {
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep())
maxChannelNameLength = max(Utf8StrLen(channel->Name()), maxChannelNameLength);
LOCK_CHANNELS_READ;
for (const cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
if (!Channel->GroupSep())
maxChannelNameLength = max(Utf8StrLen(Channel->Name()), maxChannelNameLength);
}
}
return maxChannelNameLength;
@ -1005,24 +1047,25 @@ int cChannels::MaxChannelNameLength(void)
int cChannels::MaxShortChannelNameLength(void)
{
if (!maxShortChannelNameLength) {
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep())
maxShortChannelNameLength = max(Utf8StrLen(channel->ShortName(true)), maxShortChannelNameLength);
LOCK_CHANNELS_READ;
for (const cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
if (!Channel->GroupSep())
maxShortChannelNameLength = max(Utf8StrLen(Channel->ShortName(true)), maxShortChannelNameLength);
}
}
return maxShortChannelNameLength;
}
void cChannels::SetModified(bool ByUser)
void cChannels::SetModifiedByUser(void)
{
modified = ByUser ? CHANNELSMOD_USER : !modified ? CHANNELSMOD_AUTO : modified;
modifiedByUser++;
maxChannelNameLength = maxShortChannelNameLength = 0;
}
int cChannels::Modified(void)
bool cChannels::ModifiedByUser(int &State) const
{
int Result = modified;
modified = CHANNELSMOD_NONE;
int Result = State != modifiedByUser;
State = modifiedByUser;
return Result;
}
@ -1032,7 +1075,7 @@ cChannel *cChannels::NewChannel(const cChannel *Transponder, const char *Name, c
dsyslog("creating new channel '%s,%s;%s' on %s transponder %d with id %d-%d-%d-%d", Name, ShortName, Provider, *cSource::ToString(Transponder->Source()), Transponder->Transponder(), Nid, Tid, Sid, Rid);
cChannel *NewChannel = new cChannel;
NewChannel->CopyTransponderData(Transponder);
NewChannel->SetId(Nid, Tid, Sid, Rid);
NewChannel->SetId(this, Nid, Tid, Sid, Rid);
NewChannel->SetName(Name, ShortName, Provider);
NewChannel->SetSeen();
Add(NewChannel);
@ -1045,17 +1088,19 @@ cChannel *cChannels::NewChannel(const cChannel *Transponder, const char *Name, c
#define CHANNELMARKOBSOLETE "OBSOLETE"
#define CHANNELTIMEOBSOLETE 3600 // seconds to wait before declaring a channel obsolete (in case it has actually been seen before)
void cChannels::MarkObsoleteChannels(int Source, int Nid, int Tid)
bool cChannels::MarkObsoleteChannels(int Source, int Nid, int Tid)
{
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (time(NULL) - channel->Seen() > CHANNELTIMEOBSOLETE && channel->Source() == Source && channel->Nid() == Nid && channel->Tid() == Tid && channel->Rid() == 0) {
bool ChannelsModified = false;
for (cChannel *Channel = First(); Channel; Channel = Next(Channel)) {
if (time(NULL) - Channel->Seen() > CHANNELTIMEOBSOLETE && Channel->Source() == Source && Channel->Nid() == Nid && Channel->Tid() == Tid && Channel->Rid() == 0) {
bool OldShowChannelNamesWithSource = Setup.ShowChannelNamesWithSource;
Setup.ShowChannelNamesWithSource = false;
if (!endswith(channel->Name(), CHANNELMARKOBSOLETE))
channel->SetName(cString::sprintf("%s %s", channel->Name(), CHANNELMARKOBSOLETE), channel->ShortName(), cString::sprintf("%s %s", CHANNELMARKOBSOLETE, channel->Provider()));
if (!endswith(Channel->Name(), CHANNELMARKOBSOLETE))
ChannelsModified |= Channel->SetName(cString::sprintf("%s %s", Channel->Name(), CHANNELMARKOBSOLETE), Channel->ShortName(), cString::sprintf("%s %s", CHANNELMARKOBSOLETE, Channel->Provider()));
Setup.ShowChannelNamesWithSource = OldShowChannelNamesWithSource;
}
}
return ChannelsModified;
}
cString ChannelString(const cChannel *Channel, int Number)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 3.3 2015/02/01 13:30:26 kls Exp $
* $Id: channels.h 4.2 2015/08/17 09:39:48 kls Exp $
*/
#ifndef __CHANNELS_H
@ -28,10 +28,6 @@
#define CHANNELMOD_LANGS 0x40
#define CHANNELMOD_RETUNE (CHANNELMOD_PIDS | CHANNELMOD_CA | CHANNELMOD_TRANSP)
#define CHANNELSMOD_NONE 0
#define CHANNELSMOD_AUTO 1
#define CHANNELSMOD_USER 2
#define MAXAPIDS 32 // audio
#define MAXDPIDS 16 // dolby (AC3 + DTS)
#define MAXSPIDS 32 // subtitles
@ -86,6 +82,7 @@ class cLinkChannels : public cList<cLinkChannel> {
};
class cSchedule;
class cChannels;
class cChannel : public cListObject {
friend class cSchedules;
@ -128,7 +125,7 @@ private:
mutable cString nameSource;
mutable cString shortNameSource;
cString parameters;
int modification;
mutable int modification;
time_t seen; // When this channel was last seen in the SDT of its transponder
mutable const cSchedule *schedule;
cLinkChannels *linkChannels;
@ -188,65 +185,84 @@ public:
bool IsTerr(void) const { return cSource::IsTerr(source); }
bool IsSourceType(char Source) const { return cSource::IsType(source, Source); }
tChannelID GetChannelID(void) const { return tChannelID(source, nid, (nid || tid) ? tid : Transponder(), sid, rid); }
bool HasTimer(void) const;
int Modification(int Mask = CHANNELMOD_ALL);
time_t Seen(void) { return seen; }
int Modification(int Mask = CHANNELMOD_ALL) const;
time_t Seen(void) const { return seen; }
void CopyTransponderData(const cChannel *Channel);
bool SetTransponderData(int Source, int Frequency, int Srate, const char *Parameters, bool Quiet = false);
void SetId(int Nid, int Tid, int Sid, int Rid = 0);
void SetLcn(int Lcn);
void SetName(const char *Name, const char *ShortName, const char *Provider);
void SetPortalName(const char *PortalName);
void SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, int *Dtypes, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid);
void SetCaIds(const int *CaIds); // list must be zero-terminated
void SetCaDescriptors(int Level);
void SetLinkChannels(cLinkChannels *LinkChannels);
bool SetSource(int Source);
bool SetId(cChannels *Channels, int Nid, int Tid, int Sid, int Rid = 0);
bool SetLcn(int Lcn);
bool SetName(const char *Name, const char *ShortName, const char *Provider);
bool SetPortalName(const char *PortalName);
bool SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, int *Dtypes, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid);
bool SetCaIds(const int *CaIds); // list must be zero-terminated
bool SetCaDescriptors(int Level);
bool SetLinkChannels(cLinkChannels *LinkChannels);
void SetRefChannel(cChannel *RefChannel);
void SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds);
bool SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds);
void SetSeen(void);
void DelLinkChannel(cChannel *LinkChannel);
};
class cChannels : public cRwLock, public cConfig<cChannel> {
class cChannels : public cConfig<cChannel> {
private:
int maxNumber;
int maxChannelNameLength;
int maxShortChannelNameLength;
int modified;
int beingEdited;
static cChannels channels;
static int maxNumber;
static int maxChannelNameLength;
static int maxShortChannelNameLength;
int modifiedByUser;
cHash<cChannel> channelsHashSid;
void DeleteDuplicateChannels(void);
public:
cChannels(void);
bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
static const cChannels *GetChannelsRead(cStateKey &StateKey, int TimeoutMs = 0);
///< Gets the list of channels for read access.
///< See cTimers::GetTimersRead() for details.
static cChannels *GetChannelsWrite(cStateKey &StateKey, int TimeoutMs = 0);
///< Gets the list of channels for write access.
///< See cTimers::GetTimersWrite() for details.
static bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
void HashChannel(cChannel *Channel);
void UnhashChannel(cChannel *Channel);
int GetNextGroup(int Idx); // Get next channel group
int GetPrevGroup(int Idx); // Get previous channel group
int GetNextNormal(int Idx); // Get next normal channel (not group)
int GetPrevNormal(int Idx); // Get previous normal channel (not group)
void ReNumber(void); // Recalculate 'number' based on channel type
cChannel *GetByNumber(int Number, int SkipGap = 0);
cChannel *GetByServiceID(int Source, int Transponder, unsigned short ServiceID);
cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false);
cChannel *GetByTransponderID(tChannelID ChannelID);
int BeingEdited(void) { return beingEdited; }
void IncBeingEdited(void) { beingEdited++; }
void DecBeingEdited(void) { beingEdited--; }
bool HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel = NULL);
bool SwitchTo(int Number);
int MaxNumber(void) { return maxNumber; }
int MaxChannelNameLength(void);
int MaxShortChannelNameLength(void);
void SetModified(bool ByUser = false);
int Modified(void);
///< Returns 0 if no channels have been modified, 1 if an automatic
///< modification has been made, and 2 if the user has made a modification.
///< Calling this function resets the 'modified' flag to 0.
int GetNextGroup(int Idx) const; ///< Get next channel group
int GetPrevGroup(int Idx) const; ///< Get previous channel group
int GetNextNormal(int Idx) const; ///< Get next normal channel (not group)
int GetPrevNormal(int Idx) const; ///< Get previous normal channel (not group)
void ReNumber(void); ///< Recalculate 'number' based on channel type
void Del(cChannel *Channel); ///< Delete the given Channel from the list
const cChannel *GetByNumber(int Number, int SkipGap = 0) const;
cChannel *GetByNumber(int Number, int SkipGap = 0) { return const_cast<cChannel *>(static_cast<const cChannels *>(this)->GetByNumber(Number, SkipGap)); }
const cChannel *GetByServiceID(int Source, int Transponder, unsigned short ServiceID) const;
cChannel *GetByServiceID(int Source, int Transponder, unsigned short ServiceID) { return const_cast<cChannel *>(static_cast<const cChannels *>(this)->GetByServiceID(Source, Transponder, ServiceID)); }
const cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false) const;
cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false) { return const_cast<cChannel *>(static_cast<const cChannels *>(this)->GetByChannelID(ChannelID, TryWithoutRid, TryWithoutPolarization)); }
const cChannel *GetByTransponderID(tChannelID ChannelID) const;
cChannel *GetByTransponderID(tChannelID ChannelID) { return const_cast<cChannel *>(static_cast<const cChannels *>(this)->GetByTransponderID(ChannelID)); }
bool HasUniqueChannelID(const cChannel *NewChannel, const cChannel *OldChannel = NULL) const;
bool SwitchTo(int Number) const;
static int MaxNumber(void) { return maxNumber; }
static int MaxChannelNameLength(void);
static int MaxShortChannelNameLength(void);
void SetModifiedByUser(void);
bool ModifiedByUser(int &State) const;
///< Returns true if the channels have been modified by the user since the last call
///< to this function with the same State variable. State must be initialized with 0
///< and will be set to the current value of the list's internal state variable upon
///< return from this function.
cChannel *NewChannel(const cChannel *Transponder, const char *Name, const char *ShortName, const char *Provider, int Nid, int Tid, int Sid, int Rid = 0);
void MarkObsoleteChannels(int Source, int Nid, int Tid);
bool MarkObsoleteChannels(int Source, int Nid, int Tid);
};
extern cChannels Channels;
// Provide lock controlled access to the list:
DEF_LIST_LOCK(Channels);
// These macros provide a convenient way of locking the global channels list
// and making sure the lock is released as soon as the current scope is left
// (note that these macros wait forever to obtain the lock!):
#define LOCK_CHANNELS_READ USE_LIST_LOCK_READ(Channels)
#define LOCK_CHANNELS_WRITE USE_LIST_LOCK_WRITE(Channels)
cString ChannelString(const cChannel *Channel, int Number);

17
ci.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: ci.c 3.19 2015/02/02 13:57:39 kls Exp $
* $Id: ci.c 4.2 2015/09/05 11:45:19 kls Exp $
*/
#include "ci.h"
@ -125,8 +125,8 @@ protected:
public:
cCaPidReceiver(void);
virtual ~cCaPidReceiver() { Detach(); }
virtual void Receive(uchar *Data, int Length);
bool HasCaPids(void) { return NumPids() - emmPids.Size() - 1 > 0; }
virtual void Receive(const uchar *Data, int Length);
bool HasCaPids(void) const { return NumPids() - emmPids.Size() - 1 > 0; }
void Reset(void) { DelEmmPids(); catVersion = -1; }
};
@ -160,10 +160,10 @@ void cCaPidReceiver::Activate(bool On)
catVersion = -1; // can be done independent of 'On'
}
void cCaPidReceiver::Receive(uchar *Data, int Length)
void cCaPidReceiver::Receive(const uchar *Data, int Length)
{
if (TsPid(Data) == CATPID) {
uchar *p = NULL;
const uchar *p = NULL;
if (TsPayloadStart(Data)) {
if (Data[5] == SI::TableIdCAT) {
length = (int(Data[6] & 0x03) << 8) | Data[7]; // section length
@ -251,7 +251,7 @@ private:
time_t lastScrambledTime;
int numTsPackets;
protected:
virtual void Receive(uchar *Data, int Length);
virtual void Receive(const uchar *Data, int Length);
public:
cCaActivationReceiver(const cChannel *Channel, cCamSlot *CamSlot);
virtual ~cCaActivationReceiver();
@ -270,7 +270,7 @@ cCaActivationReceiver::~cCaActivationReceiver()
Detach();
}
void cCaActivationReceiver::Receive(uchar *Data, int Length)
void cCaActivationReceiver::Receive(const uchar *Data, int Length)
{
if (numTsPackets++ % TS_PACKET_FACTOR == 0) {
time_t Now = time(NULL);
@ -1921,7 +1921,8 @@ void cCamSlot::StartActivation(void)
cMutexLock MutexLock(&mutex);
if (!caActivationReceiver) {
if (cDevice *d = Device()) {
if (cChannel *Channel = Channels.GetByNumber(cDevice::CurrentChannel())) {
LOCK_CHANNELS_READ;
if (const cChannel *Channel = Channels->GetByNumber(cDevice::CurrentChannel())) {
caActivationReceiver = new cCaActivationReceiver(Channel, this);
d->AttachReceiver(caActivationReceiver);
dsyslog("CAM %d: activating on device %d with channel %d (%s)", SlotNumber(), d->DeviceNumber() + 1, Channel->Number(), Channel->Name());

2
ci.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: ci.h 3.11 2015/01/31 14:36:41 kls Exp $
* $Id: ci.h 4.0 2015/01/31 14:36:41 kls Exp $
*/
#ifndef __CI_H

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.c 3.10 2015/02/10 12:24:13 kls Exp $
* $Id: config.c 4.4 2015/09/13 11:09:44 kls Exp $
*/
#include "config.h"
@ -412,12 +412,16 @@ cSetup::cSetup(void)
EPGBugfixLevel = 3;
EPGLinger = 0;
SVDRPTimeout = 300;
SVDRPPeering = 0;
strn0cpy(SVDRPHostName, GetHostName(), sizeof(SVDRPHostName));
strcpy(SVDRPDefaultHost, "");
ZapTimeout = 3;
ChannelEntryTimeout = 1000;
RcRepeatDelay = 300;
RcRepeatDelta = 100;
DefaultPriority = 50;
DefaultLifetime = MAXLIFETIME;
RecordKeyHandling = 2;
PauseKeyHandling = 2;
PausePriority = 10;
PauseLifetime = 1;
@ -427,6 +431,7 @@ cSetup::cSetup(void)
RecordingDirs = 1;
FoldersInTimerMenu = 1;
AlwaysSortFoldersFirst = 1;
DefaultSortModeRec = rsmTime;
NumberKeysForChars = 1;
ColorKey0 = 0;
ColorKey1 = 1;
@ -634,12 +639,16 @@ bool cSetup::Parse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "EPGBugfixLevel")) EPGBugfixLevel = atoi(Value);
else if (!strcasecmp(Name, "EPGLinger")) EPGLinger = atoi(Value);
else if (!strcasecmp(Name, "SVDRPTimeout")) SVDRPTimeout = atoi(Value);
else if (!strcasecmp(Name, "SVDRPPeering")) SVDRPPeering = atoi(Value);
else if (!strcasecmp(Name, "SVDRPHostName")) strn0cpy(SVDRPHostName, Value, sizeof(SVDRPHostName));
else if (!strcasecmp(Name, "SVDRPdefaultHost")) strn0cpy(SVDRPDefaultHost, Value, sizeof(SVDRPDefaultHost));
else if (!strcasecmp(Name, "ZapTimeout")) ZapTimeout = atoi(Value);
else if (!strcasecmp(Name, "ChannelEntryTimeout")) ChannelEntryTimeout= atoi(Value);
else if (!strcasecmp(Name, "RcRepeatDelay")) RcRepeatDelay = atoi(Value);
else if (!strcasecmp(Name, "RcRepeatDelta")) RcRepeatDelta = atoi(Value);
else if (!strcasecmp(Name, "DefaultPriority")) DefaultPriority = atoi(Value);
else if (!strcasecmp(Name, "DefaultLifetime")) DefaultLifetime = atoi(Value);
else if (!strcasecmp(Name, "RecordKeyHandling")) RecordKeyHandling = atoi(Value);
else if (!strcasecmp(Name, "PauseKeyHandling")) PauseKeyHandling = atoi(Value);
else if (!strcasecmp(Name, "PausePriority")) PausePriority = atoi(Value);
else if (!strcasecmp(Name, "PauseLifetime")) PauseLifetime = atoi(Value);
@ -649,6 +658,7 @@ bool cSetup::Parse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "RecordingDirs")) RecordingDirs = atoi(Value);
else if (!strcasecmp(Name, "FoldersInTimerMenu")) FoldersInTimerMenu = atoi(Value);
else if (!strcasecmp(Name, "AlwaysSortFoldersFirst")) AlwaysSortFoldersFirst = atoi(Value);
else if (!strcasecmp(Name, "DefaultSortModeRec")) DefaultSortModeRec = atoi(Value);
else if (!strcasecmp(Name, "NumberKeysForChars")) NumberKeysForChars = atoi(Value);
else if (!strcasecmp(Name, "ColorKey0")) ColorKey0 = atoi(Value);
else if (!strcasecmp(Name, "ColorKey1")) ColorKey1 = atoi(Value);
@ -760,12 +770,16 @@ bool cSetup::Save(void)
Store("EPGBugfixLevel", EPGBugfixLevel);
Store("EPGLinger", EPGLinger);
Store("SVDRPTimeout", SVDRPTimeout);
Store("SVDRPPeering", SVDRPPeering);
Store("SVDRPHostName", SVDRPHostName);
Store("SVDRPDefaultHost", SVDRPDefaultHost);
Store("ZapTimeout", ZapTimeout);
Store("ChannelEntryTimeout",ChannelEntryTimeout);
Store("RcRepeatDelay", RcRepeatDelay);
Store("RcRepeatDelta", RcRepeatDelta);
Store("DefaultPriority", DefaultPriority);
Store("DefaultLifetime", DefaultLifetime);
Store("RecordKeyHandling", RecordKeyHandling);
Store("PauseKeyHandling", PauseKeyHandling);
Store("PausePriority", PausePriority);
Store("PauseLifetime", PauseLifetime);
@ -775,6 +789,7 @@ bool cSetup::Save(void)
Store("RecordingDirs", RecordingDirs);
Store("FoldersInTimerMenu", FoldersInTimerMenu);
Store("AlwaysSortFoldersFirst", AlwaysSortFoldersFirst);
Store("DefaultSortModeRec", DefaultSortModeRec);
Store("NumberKeysForChars", NumberKeysForChars);
Store("ColorKey0", ColorKey0);
Store("ColorKey1", ColorKey1);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 3.21 2015/02/13 15:39:08 kls Exp $
* $Id: config.h 4.5 2015/09/11 08:07:34 kls Exp $
*/
#ifndef __CONFIG_H
@ -22,13 +22,13 @@
// VDR's own version number:
#define VDRVERSION "2.2.0"
#define VDRVERSNUM 20200 // Version * 10000 + Major * 100 + Minor
#define VDRVERSION "2.3.1"
#define VDRVERSNUM 20301 // Version * 10000 + Major * 100 + Minor
// The plugin API's version number:
#define APIVERSION "2.2.0"
#define APIVERSNUM 20200 // Version * 10000 + Major * 100 + Minor
#define APIVERSION "2.3.1"
#define APIVERSNUM 20301 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to
@ -110,7 +110,7 @@ private:
cList<T>::Clear();
}
public:
cConfig(void) { fileName = NULL; }
cConfig(const char *NeedsLocking = NULL): cList<T>(NeedsLocking) { fileName = NULL; }
virtual ~cConfig() { free(fileName); }
const char *FileName(void) { return fileName; }
bool Load(const char *FileName = NULL, bool AllowComments = false, bool MustExist = false)
@ -160,7 +160,7 @@ public:
fprintf(stderr, "vdr: error while reading '%s'\n", fileName);
return result;
}
bool Save(void)
bool Save(void) const
{
bool result = true;
T *l = (T *)this->First();
@ -288,19 +288,24 @@ public:
int EPGBugfixLevel;
int EPGLinger;
int SVDRPTimeout;
int SVDRPPeering;
char SVDRPHostName[HOST_NAME_MAX];
char SVDRPDefaultHost[HOST_NAME_MAX];
int ZapTimeout;
int ChannelEntryTimeout;
int RcRepeatDelay;
int RcRepeatDelta;
int DefaultPriority, DefaultLifetime;
int PausePriority, PauseLifetime;
int RecordKeyHandling;
int PauseKeyHandling;
int PausePriority, PauseLifetime;
int UseSubtitle;
int UseVps;
int VpsMargin;
int RecordingDirs;
int FoldersInTimerMenu;
int AlwaysSortFoldersFirst;
int DefaultSortModeRec;
int NumberKeysForChars;
int ColorKey0, ColorKey1, ColorKey2, ColorKey3;
int VideoDisplayFormat;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: cutter.c 3.4 2013/10/02 13:18:02 kls Exp $
* $Id: cutter.c 4.2 2015/08/09 12:24:28 kls Exp $
*/
#include "cutter.h"
@ -634,7 +634,6 @@ void cCuttingThread::Action(void)
}
}
}
Recordings.TouchUpdate();
}
else
esyslog("no editing marks found!");
@ -675,9 +674,11 @@ bool cCutter::Start(void)
editedVersionName = EditedFileName(originalVersionName);
if (*editedVersionName) {
if (strcmp(originalVersionName, editedVersionName) != 0) { // names must be different!
cRecordingUserCommand::InvokeCommand(RUC_EDITINGRECORDING, editedVersionName, originalVersionName);
if (cVideoDirectory::RemoveVideoFile(editedVersionName) && MakeDirs(editedVersionName, true)) {
Recording.WriteInfo(editedVersionName);
Recordings.AddByName(editedVersionName, false);
LOCK_RECORDINGS_WRITE;
Recordings->AddByName(editedVersionName, false);
cuttingThread = new cCuttingThread(originalVersionName, editedVersionName);
return true;
}
@ -702,7 +703,8 @@ void cCutter::Stop(void)
if (cReplayControl::NowReplaying() && strcmp(cReplayControl::NowReplaying(), editedVersionName) == 0)
cControl::Shutdown();
cVideoDirectory::RemoveVideoFile(editedVersionName);
Recordings.DelByName(editedVersionName);
LOCK_RECORDINGS_WRITE;
Recordings->DelByName(editedVersionName);
}
}

Some files were not shown because too many files have changed in this diff Show More