diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2005-01-09 18:00:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2005-01-09 18:00:00 +0100 |
commit | fb5cccb2df60361a18fe3fd572b0fe18f3a4331c (patch) | |
tree | 17ab17c399c6e9780ec75e2dc49beefa4db05060 /device.h | |
parent | 630ba21dc198e3fbf8c15c59f7ea852f7174c476 (diff) | |
download | vdr-patch-lnbsharing-fb5cccb2df60361a18fe3fd572b0fe18f3a4331c.tar.gz vdr-patch-lnbsharing-fb5cccb2df60361a18fe3fd572b0fe18f3a4331c.tar.bz2 |
Version 1.3.18vdr-1.3.18
- Removed an unused variable from cTimer::GetWDayFromMDay() (thanks to Wayne Keer
for reporting this one).
- Some more changes to the 'childTid' handling in cThread (based on suggestions by
Stefan Huelswitt).
- Fixed the spelling of 'canceling' (thanks to Wayne Keer for reporting this one).
- Re-introduced a sleep to cDvbPlayer::Action() to avoid high CPU load in still
picture mode (thanks to Reinhard Nissl for reporting this one).
- Fixed a possible race condition in generating the DVB device names (thanks to
Rainer Zocholl for reporting this one).
- Changed the way PES packets are played to allow replay of AC3 sound over the
full featured DVB cards (partially based on a patch from Werner Fink).
+ The new function cDevice::PlayPes() is now called with the complete PES data
stream and calls PlayVideo() and PlayAudio() as necessary.
+ cDevice::PlayVideo() is now only called with actual video PES packets.
+ cDevice::PlayAudio() is now called with the actual audio PES packets, which
can be either "normal" audio or AC3 data. You need at least firmware version
0x261d to replay AC3 sound over a full featured DVB card. This function now
has an 'int' return value.
+ PlayAudio() of derived cDevice classes shall no longer call the base class
function. It shall just play the given data as audio.
+ cPlayer::PlayVideo() and cPlayer::PlayAudio() are now obsolete and have been
replaced with cPlayer::PlayPes().
+ All StripAudioPackets() functions are now obsolete. The functionality has been
moved into cDevice::PlayPes(), where only the video and audio packets that are
actually required will be processed.
+ All audio track handling is now done by cDevice; cTransfer and cDvbPlayer no
longer care about audio tracks. cPlayer, however, still has the virtual hooks
for audio track handling in order to allow plugins to implement players that
have their own idea about this.
+ cChannel::[AD]pid[12]() have been replaced with cChannel::[AD]pid(int i) to
allow access to all available PIDs.
- Escaped the '-' and 'ö' characters in the man pages (thanks to Darren Salt for
pointing this out).
- Completed the Italian OSD texts (thanks to Sean Carlos).
- Fixed setting 'synced' in cRemux when recording radio channels (thanks to
Laurence Abbott).
- Removed the LOCK_THREAD from the LIRC thread (thanks to Ludwig Nussel).
- Fixed genfontfile.c (sometimes the character width was wrong, and the codes were
shifted one too far to the left).
- Fixed the character width and shifted the codes one to the right in all font
files.
- Renamed font???.c to font???-iso8859-1.c for symmetry.
- Switched the character set to iso8859-15 for English, German and Finnish (thanks
to Andreas Brugger for reporting the missing Euro sign in iso8859-1).
- Added 'channels.conf.terr' entries for Lübeck (thanks to Stefan Hußfeldt).
- Fixed a race condition in starting a thread (thanks to Reinhard Nissl for
reporting this one).
- Replaced non-threadsafe library functions with their threadsafe versions (thanks
to Rainer Zocholl for pointing this out).
- Other non-threadsafe functions have been replaced by threadsafe classes that hide
the actual buffering. In particular these are:
readdir() -> cReadDir
readline() -> cReadLine
- Several formerly non-threadsafe functions now have a return type of cString:
cChannel::ToText()
tChannelID::ToString()
cEvent::GetDateString()
cEvent::GetTimeString()
cEvent::GetEndTimeString()
cEvent::GetVpsString()
cMark::ToText()
cTimer::ToText()
cSource::ToString()
cTimer::PrintDay()
cTimer::PrintFirstDay()
PrefixVideoFileName()
IndexToHMSF()
ChannelString()
strescape()
AddDirectory()
itoa()
WeekDayName()
DayDateTime()
When using these functions in a 'const char *' context there is nothing special
to consider, except that you can no longer have a pointer to the return value,
as in
const char *date = DayDateTime();
Although this will compile without error message, the resulting 'date' will not
be valid after this line. Use this instead:
cString date = DayDateTime();
In a 'const void *' context (as in printf() etc.) the result needs to be
dereferenced with a '*', as in
printf("%s", *DayDateTime());
to make it a 'const char *'.
- Removed delay_ms(), using cCondWait::SleepMs() instead.
- Replaced time_ms() with a threadsafe and non-overflowing cTimeMs (thanks to Rainer
Zocholl for pointing out this problem).
- Added cDevice::mutexReceiver to avoid a race condition when attaching/detaching
receivers from different threads.
- The new remote control button "Audio" can be used to switch between different
audio tracks. The "Green" button in the "Main" menu has been changed from "Language"
to "Audio", since it now also controls switching between normal and Dolby Digital
audio tracks (see MANUAL for details).
- The description of the audio tracks is now taken from the "component descriptors"
that are broadcast in the EPG data. However (as no big surprise), not all channels
actually provide useful data here, so there are now some additional EPG bugfixes,
which can be activated by setting the "EPG bugfix level" to 3.
- The format of the 'epg.data' files has been extended by the new tag 'X', which
contains the stream components of an event (see man vdr(5) for details).
- The cStatus class now has the new member function SetAudioTrack(), which can be
used to get notified when the audio track has been switched, and the new member
function SetAudioChannel() which is called when the audio channel is changed.
- Skins need to implement the new cSkinDisplayTrack class to display the audio
track menu.
- The ST:TNG skin now displays the current audio track description (if any) at the
botton left side.
- The new setup option "DVB/Audio languages" can be used to control which audio
language shall be selected in case a channel broadcasts in different languages
(see MANUAL for details).
- The "Left" and "Right" keys in the "Audio" menu can be used to switch between
the left and right stereo channels in case there are different audio tracks
in these channels (see MANUAL for details).
- Fixed a possible race condition in cDevice::Action() (thanks to Mattias Grönlund).
- Fixed the default quality value when grabbing a JPEG image (thanks to Patrick
Gleichmann).
- Fixed deleting a menu item in case the next item is not selectable (thanks to
Dino Ravnic).
- Implemented displaying mandatory subtitles in the SPU decoder (thanks to Marco
Schlüßler).
- The setup option "Recording/Record Dolby Digital" has been renamed and moved to
"DVB/Use Dolby Digital". It now controls whether Dolby Digital is recorded and
whether an available DD audio track will appear in the "Audio" menu.
- Added support for circular polarization (thanks to Jonan Santiago).
- Thanks to Werner Fink, Reinhard Nissl, Sascha Volkenandt and Bjørnar Nilsen for
their support in testing and fine tuning this version.
Diffstat (limited to 'device.h')
-rw-r--r-- | device.h | 147 |
1 files changed, 102 insertions, 45 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.46 2004/10/30 14:49:56 kls Exp $ + * $Id: device.h 1.51 2005/01/07 14:57:01 kls Exp $ */ #ifndef __DEVICE_H @@ -56,10 +56,37 @@ enum eVideoSystem { vsPAL, vsNTSC }; +enum eTrackType { ttNone, + ttAudio, + ttAudioFirst = ttAudio, + ttAudioLast = ttAudioFirst + 31/*XXX MAXAPIDS - 1*/, + ttDolby, + ttDolbyFirst = ttDolby, + ttDolbyLast = ttDolbyFirst + 31/*XXX MAXAPIDS - 1*/, + /* future... + ttSubtitle, + ttSubtitleFirst = ttSubtitle, + ttSubtitleLast = ttSubtitleFirst + 31, + */ + ttMaxTrackTypes + }; + +#define IS_AUDIO_TRACK(t) (ttAudioFirst <= (t) && (t) <= ttAudioLast) +#define IS_DOLBY_TRACK(t) (ttDolbyFirst <= (t) && (t) <= ttDolbyLast) + +struct tTrackId { + uint16_t id; // The PES packet id or the PID. + char language[8]; // something like either "eng" or "deu/eng" + char description[32]; // something like "Dolby Digital 5.1" + // for future use: + uint32_t flags; // Used to further identify the actual track. + }; + class cChannel; class cPlayer; class cReceiver; class cSpuDecoder; +class cPesAssembler; /// The cDevice class is the base from which actual devices can be derived. @@ -283,69 +310,96 @@ public: ///< Returns the video system of the currently displayed material ///< (default is PAL). +// Track facilities + +private: + tTrackId availableTracks[ttMaxTrackTypes]; + eTrackType currentAudioTrack; +protected: + virtual void SetAudioTrackDevice(eTrackType Type); + ///< Sets the current audio track to the given value. +public: + void ClrAvailableTracks(bool DescriptionsOnly = false); + bool SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language = NULL, const char *Description = NULL, uint32_t Flags = 0); + ///< Sets the track of the given Type and Index to the given values. + ///< Type must be one of the basic eTrackType values, like ttAudio or ttDolby. + ///< Index tells which track of the given basic type is meant. + ///< If Id is 0 any existing id (and flags) will be left untouched and only the + ///< given Language and Description will be set. + ///< \return Returns true if the track was set correctly, false otherwise. + const tTrackId *GetTrack(eTrackType Type); + ///< Returns a pointer to the given track id, or NULL if Type is not + ///< less than ttMaxTrackTypes. + int NumAudioTracks(void) const; + ///< Returns the number of audio tracks that are currently available. + ///< This is just for information, to quickly find out whether there + ///< is more than one audio track. + eTrackType GetCurrentAudioTrack(void) { return currentAudioTrack; } + bool SetCurrentAudioTrack(eTrackType Type); + ///< Sets the current audio track to the given Type. + ///< \return Returns true if Type is a valid audio track, false otherwise. + // Audio facilities private: bool mute; int volume; protected: + virtual int GetAudioChannelDevice(void); + ///< Gets the current audio channel, which is stereo (0), mono left (1) or + ///< mono right (2). + virtual void SetAudioChannelDevice(int AudioChannel); + ///< Sets the audio channel to stereo (0), mono left (1) or mono right (2). virtual void SetVolumeDevice(int Volume); ///< Sets the audio volume on this device (Volume = 0...255). - virtual int NumAudioTracksDevice(void) const; - ///< Returns the number of audio tracks that are currently available on this - ///< device. The default return value is 0, meaning that this device - ///< doesn't have multiple audio track capabilities. The return value may - ///< change with every call and need not necessarily be the number of list - ///< entries returned by GetAudioTracksDevice(). This function is mainly called to - ///< decide whether there should be an "Audio" button in a menu. - virtual const char **GetAudioTracksDevice(int *CurrentTrack = NULL) const; - ///< Returns a list of currently available audio tracks. The last entry in the - ///< list must be NULL. The number of entries does not necessarily have to be - ///< the same as returned by a previous call to NumAudioTracksDevice(). - ///< If CurrentTrack is given, it will be set to the index of the current track - ///< in the returned list. Note that the list must not be changed after it has - ///< been returned by a call to GetAudioTracksDevice()! The only time the list may - ///< change is *inside* the GetAudioTracksDevice() function. - ///< By default the return value is NULL and CurrentTrack, if given, will not - ///< have any meaning. - virtual void SetAudioTrackDevice(int Index); - ///< Sets the current audio track to the given value, which should be within the - ///< range of the list returned by a previous call to GetAudioTracksDevice() - ///< (otherwise nothing will happen). + virtual void SetDigitalAudioDevice(bool On); + ///< Tells the actual device that digital audio output shall be switched + ///< on or off. public: bool IsMute(void) const { return mute; } bool ToggleMute(void); ///< Turns the volume off or on and returns the new mute state. + int GetAudioChannel(void); + ///< Gets the current audio channel, which is stereo (0), mono left (1) or + ///< mono right (2). + void SetAudioChannel(int AudioChannel); + ///< Sets the audio channel to stereo (0), mono left (1) or mono right (2). + ///< Any other values will be silently ignored. void SetVolume(int Volume, bool Absolute = false); ///< Sets the volume to the given value, either absolutely or relative to ///< the current volume. static int CurrentVolume(void) { return primaryDevice ? primaryDevice->volume : 0; }//XXX??? - int NumAudioTracks(void) const; - ///< Returns the number of audio tracks that are currently available on this - ///< device or a player attached to it. - const char **GetAudioTracks(int *CurrentTrack = NULL) const; - ///< Returns a list of currently available audio tracks. The last entry in the - ///< list is NULL. The number of entries does not necessarily have to be - ///< the same as returned by a previous call to NumAudioTracks(). - ///< If CurrentTrack is given, it will be set to the index of the current track - ///< in the returned list. - ///< By default the return value is NULL and CurrentTrack, if given, will not - ///< have any meaning. - void SetAudioTrack(int Index); - ///< Sets the current audio track to the given value, which should be within the - ///< range of the list returned by a previous call to GetAudioTracks() (otherwise - ///< nothing will happen). // Player facilities private: cPlayer *player; + cPesAssembler *pesAssembler; protected: virtual bool CanReplay(void) const; ///< Returns true if this device can currently start a replay session. virtual bool SetPlayMode(ePlayMode PlayMode); ///< Sets the device into the given play mode. ///< \return true if the operation was successful. + virtual int PlayVideo(const uchar *Data, int Length); + ///< Plays the given data block as video. + ///< Data points to exactly one complete PES packet of the given Length. + ///< PlayVideo() shall process the packet either as a whole (returning + ///< Length) or not at all (returning 0 or -1 and setting 'errno' to EAGAIN). + ///< \return Returns the number of bytes actually taken from Data, or -1 + ///< in case of an error. + virtual int PlayAudio(const uchar *Data, int Length); + ///< Plays the given data block as audio. + ///< Data points to exactly one complete PES packet of the given Length. + ///< PlayAudio() shall process the packet either as a whole (returning + ///< Length) or not at all (returning 0 or -1 and setting 'errno' to EAGAIN). + ///< \return Returns the number of bytes actually taken from Data, or -1 + ///< in case of an error. + virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly = false); + ///< Plays the single PES packet in Data with the given Length. + ///< If VideoOnly is true, only the video will be displayed, + ///< which is necessary for trick modes like 'fast forward'. + ///< Data must point to one single, complete PES packet. public: virtual int64_t GetSTC(void); ///< Gets the current System Time Counter, which can be used to @@ -382,14 +436,16 @@ public: ///< If TimeoutMs is not zero, the device will wait up to the given ///< number of milliseconds before returning in case there is still ///< data in the buffers.. - virtual int PlayVideo(const uchar *Data, int Length); - ///< Actually plays the given data block as video. The data must be - ///< part of a PES (Packetized Elementary Stream) which can contain - ///< one video and one audio stream. - virtual void PlayAudio(const uchar *Data, int Length); - ///< Plays additional audio streams, like Dolby Digital. - ///< A derived class must call the base class function to make sure data - ///< is distributed to all registered cAudio objects. + virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly = false); + ///< Plays all valid PES packets in Data with the given Length. + ///< If Data is NULL any leftover data from a previous call will be + ///< discarded. If VideoOnly is true, only the video will be displayed, + ///< which is necessary for trick modes like 'fast forward'. + ///< Data should point to a sequence of complete PES packets. If the + ///< last packet in Data is not complete, it will be copied and combined + ///< to a complete packet with data from the next call to PlayPes(). + ///< That way any functions called from within PlayPes() will be + ///< guaranteed to always receive complete PES packets. bool Replaying(void) const; ///< Returns true if we are currently replaying. void StopReplay(void); @@ -402,6 +458,7 @@ public: // Receiver facilities private: + cMutex mutexReceiver; cReceiver *receiver[MAXRECEIVERS]; int CanShift(int Ca, int Priority, int UsedCards = 0) const; protected: |