summaryrefslogtreecommitdiff
path: root/device.h
diff options
context:
space:
mode:
Diffstat (limited to 'device.h')
-rw-r--r--device.h46
1 files changed, 42 insertions, 4 deletions
diff --git a/device.h b/device.h
index e74c884..825aadf 100644
--- a/device.h
+++ b/device.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.h 1.82 2007/07/22 11:20:13 kls Exp $
+ * $Id: device.h 1.85 2007/10/14 13:09:12 kls Exp $
*/
#ifndef __DEVICE_H
@@ -12,6 +12,7 @@
#include "channels.h"
#include "ci.h"
+#include "dvbsubtitle.h"
#include "eit.h"
#include "filter.h"
#include "nit.h"
@@ -70,16 +71,15 @@ enum eTrackType { ttNone,
ttDolby,
ttDolbyFirst = ttDolby,
ttDolbyLast = ttDolbyFirst + 15, // MAXDPIDS - 1
- /* future...
ttSubtitle,
ttSubtitleFirst = ttSubtitle,
- ttSubtitleLast = ttSubtitleFirst + 7, // MAXSPIDS - 1
- */
+ ttSubtitleLast = ttSubtitleFirst + 31, // MAXSPIDS - 1
ttMaxTrackTypes
};
#define IS_AUDIO_TRACK(t) (ttAudioFirst <= (t) && (t) <= ttAudioLast)
#define IS_DOLBY_TRACK(t) (ttDolbyFirst <= (t) && (t) <= ttDolbyLast)
+#define IS_SUBTITLE_TRACK(t) (ttSubtitleFirst <= (t) && (t) <= ttSubtitleLast)
struct tTrackId {
uint16_t id; // The PES packet id or the PID.
@@ -90,10 +90,12 @@ struct tTrackId {
class cPlayer;
class cReceiver;
class cPesAssembler;
+class cLiveSubtitle;
/// The cDevice class is the base from which actual devices can be derived.
class cDevice : public cThread {
+ friend class cLiveSubtitle;
private:
static int numDevices;
static int useDevice;
@@ -185,6 +187,9 @@ public:
// SPU facilities
+private:
+ cLiveSubtitle *liveSubtitle;
+ cDvbSubtitleConverter *dvbSubtitleConverter;
public:
virtual cSpuDecoder *GetSpuDecoder(void);
///< Returns a pointer to the device's SPU decoder (or NULL, if this
@@ -303,6 +308,11 @@ public:
///< Opens a file handle for the given filter data.
///< A derived device that provides section data must
///< implement this function.
+ virtual void CloseFilter(int Handle);
+ ///< Closes a file handle that has previously been opened
+ ///< by OpenFilter(). If this is as simple as calling close(Handle),
+ ///< a derived class need not implement this function, because this
+ ///< is done by the default implementation.
void AttachFilter(cFilter *Filter);
///< Attaches the given filter to this device.
void Detach(cFilter *Filter);
@@ -362,8 +372,11 @@ public:
private:
tTrackId availableTracks[ttMaxTrackTypes];
eTrackType currentAudioTrack;
+ eTrackType currentSubtitleTrack;
cMutex mutexCurrentAudioTrack;
+ cMutex mutexCurrentSubtitleTrack;
int currentAudioTrackMissingCount;
+ bool autoSelectPreferredSubtitleLanguage;
bool pre_1_3_19_PrivateStream;
protected:
virtual void SetAudioTrackDevice(eTrackType Type);
@@ -384,18 +397,33 @@ public:
const tTrackId *GetTrack(eTrackType Type);
///< Returns a pointer to the given track id, or NULL if Type is not
///< less than ttMaxTrackTypes.
+ int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const;
+ ///< Returns the number of tracks in the given range that are currently
+ ///< available.
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.
+ int NumSubtitleTracks(void) const;
+ ///< Returns the number of subtitle tracks that are currently available.
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.
+ eTrackType GetCurrentSubtitleTrack(void) { return currentSubtitleTrack; }
+ bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual = false);
+ ///< Sets the current subtitle track to the given Type.
+ ///< IF Manual is true, no automatic preferred subtitle language selection
+ ///< will be done for the rest of the current replay session, or until
+ ///< the channel is changed.
+ ///< \return Returns true if Type is a valid subtitle track, false otherwise.
void EnsureAudioTrack(bool Force = false);
///< Makes sure an audio track is selected that is actually available.
///< If Force is true, the language and Dolby Digital settings will
///< be verified even if the current audio track is available.
+ void EnsureSubtitleTrack(void);
+ ///< Makes sure one of the preferred language subtitle tracks is selected.
+ ///< Only has an effect if Setup.DisplaySubtitles is on.
// Audio facilities
@@ -454,6 +482,13 @@ protected:
///< 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 PlaySubtitle(const uchar *Data, int Length);
+ ///< Plays the given data block as a subtitle.
+ ///< Data points to exactly one complete PES packet of the given Length.
+ ///< PlaySubtitle() 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,
@@ -464,6 +499,9 @@ public:
///< Gets the current System Time Counter, which can be used to
///< synchronize audio and video. If this device is unable to
///< provide the STC, -1 will be returned.
+ virtual bool HasIBPTrickSpeed(void) { return false; }
+ ///< Returns true if this device can handle all frames in 'fast forward'
+ ///< trick speeds.
virtual void TrickSpeed(int Speed);
///< Sets the device into a mode where replay is done slower.
///< Every single frame shall then be displayed the given number of