diff options
author | phintuka <phintuka> | 2008-03-16 21:40:57 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2008-03-16 21:40:57 +0000 |
commit | 3fe8690db7186ccdb455f8bee09333ebe881df51 (patch) | |
tree | dd245c7031152fd216fb4c4d4ff92efb0a32a6be | |
parent | 1b3dfe76534fcd68990c6625032059d02dec46c9 (diff) | |
download | xineliboutput-3fe8690db7186ccdb455f8bee09333ebe881df51.tar.gz xineliboutput-3fe8690db7186ccdb455f8bee09333ebe881df51.tar.bz2 |
Use defines for special suptitle "tracks" auto and none
Implement vdr>=1.5.15 SetSubtitleTrackDevice
-rw-r--r-- | device.c | 31 | ||||
-rw-r--r-- | device.h | 7 | ||||
-rw-r--r-- | frontend.c | 19 | ||||
-rw-r--r-- | frontend.h | 11 |
4 files changed, 51 insertions, 17 deletions
@@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: device.c,v 1.53 2008-02-20 04:18:43 phintuka Exp $ + * $Id: device.c,v 1.54 2008-03-16 21:40:57 phintuka Exp $ * */ @@ -197,7 +197,7 @@ cXinelibDevice::cXinelibDevice() m_spuPresent = false; #if VDRVERSNUM < 10515 - m_CurrentDvdSpuTrack = -1; + m_CurrentDvdSpuTrack = ttXSubtitleNone; m_ForcedDvdSpuTrack = false; ClrAvailableDvdSpuTracks(); #endif @@ -1538,7 +1538,7 @@ int cXinelibDevice::PlayPesPacket(const uchar *Data, int Length, #if VDRVERSNUM < 10515 bool cXinelibDevice::SetCurrentDvdSpuTrack(int Type, bool Force) { - if(Type == -1 || + if(Type == ttXSubtitleNone || ( Type >= 0 && Type < 64 && m_DvdSpuTrack[Type].id != 0xffff)) { @@ -1552,15 +1552,23 @@ bool cXinelibDevice::SetCurrentDvdSpuTrack(int Type, bool Force) } #endif +#if VDRVERSNUM >= 10515 +void cXinelibDevice::SetSubtitleTrackDevice(eTrackType Type) +{ + if (m_PlayingFile == pmAudioVideo || m_PlayingFile == pmVideoOnly) + ForEach(m_clients, &cXinelibThread::SetSubtitleTrack, Type); +} +#endif + #if VDRVERSNUM < 10515 void cXinelibDevice::ClrAvailableDvdSpuTracks(bool NotifyFrontend) { for(int i=0; i<64; i++) m_DvdSpuTrack[i].id = 0xffff; - if(m_CurrentDvdSpuTrack >=0 ) { - m_CurrentDvdSpuTrack = -1; + if(m_CurrentDvdSpuTrack >= 0 ) { + m_CurrentDvdSpuTrack = ttXSubtitleNone; if(NotifyFrontend) - ForEach(m_clients, &cXinelibThread::SpuStreamChanged, -1); + ForEach(m_clients, &cXinelibThread::SpuStreamChanged, m_CurrentDvdSpuTrack); } } #endif @@ -1669,11 +1677,12 @@ void cXinelibDevice::EnsureDvdSpuTrack(void) const char *cXinelibDevice::GetMetaInfo(eMetainfoType Type) { if(Type >= 0 && Type < mi_Count) { - if ( Type == 0 || Type > 3 || - (Type == 1 && xc.playlist_tracknumber == 1) || - (Type == 2 && xc.playlist_artist == 1) || - (Type == 3 && xc.playlist_album == 1)) { - return m_MetaInfo[Type]; + if ((Type == miTitle) || + (Type == miTracknumber && xc.playlist_tracknumber == 1) || + (Type == miArtist && xc.playlist_artist == 1) || + (Type == miAlbum && xc.playlist_album == 1) || + (Type > miAlbum)) { + return m_MetaInfo[Type]; } return ""; } @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: device.h,v 1.31 2008-02-20 04:37:52 phintuka Exp $ + * $Id: device.h,v 1.32 2008-03-16 21:40:57 phintuka Exp $ * */ @@ -29,6 +29,9 @@ typedef enum { mi_Count = 5 } eMetainfoType; +# define ttXSubtitleNone (-2) +# define ttXSubtitleAuto (-1) + #define MAX_METAINFO_LEN 63 class cXinelibDevice : public cDevice @@ -145,6 +148,8 @@ class cXinelibDevice : public cDevice int GetCurrentDvdSpuTrack(void) const { return m_CurrentDvdSpuTrack; } bool SetCurrentDvdSpuTrack(int Type, bool Force=false); void EnsureDvdSpuTrack(void); +#else + virtual void SetSubtitleTrackDevice(eTrackType Type); #endif const char *GetMetaInfo(eMetainfoType Type); @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend.c,v 1.51 2008-03-16 21:34:45 phintuka Exp $ + * $Id: frontend.c,v 1.52 2008-03-16 21:40:55 phintuka Exp $ * */ @@ -105,7 +105,7 @@ void cXinelibThread::InfoHandler(const char *info) *pt = 0; if(!strncmp(info, "TRACKMAP SPU", 12)) { - int CurrentTrack = -2; /* auto */ + int CurrentTrack = ttXSubtitleAuto; map += 12; #if VDRVERSNUM < 10515 && !defined(VDRSPUPATCH) cXinelibDevice::Instance().ClrAvailableDvdSpuTracks(false); @@ -141,9 +141,9 @@ void cXinelibThread::InfoHandler(const char *info) #if VDRVERSNUM < 10515 && !defined(VDRSPUPATCH) cXinelibDevice::Instance().EnsureDvdSpuTrack(); #else - if (CurrentTrack == -2) + if (CurrentTrack == ttXSubtitleAuto) cXinelibDevice::Instance().EnsureSubtitleTrack(); - else if (CurrentTrack == -1) + else if (CurrentTrack == ttXSubtitleNone) cXinelibDevice::Instance().SetCurrentSubtitleTrack(ttNone, true); else cXinelibDevice::Instance().SetCurrentSubtitleTrack(eTrackType(CurrentTrack+ttSubtitleFirst), true); @@ -372,11 +372,22 @@ void cXinelibThread::AudioStreamChanged(bool ac3, int StreamId) Xine_Control("AUDIOSTREAM", StreamId); } +#if VDRVERSNUM < 10515 void cXinelibThread::SpuStreamChanged(int StreamId) { TRACEF("cXinelibThread::SpuStreamChanged"); Xine_Control("SPUSTREAM", StreamId); } +#else +void cXinelibThread::SetSubtitleTrack(eTrackType Track) +{ + TRACEF("cXinelibThread::SetSubtitleTrack"); + cString buf = cString::sprintf("SPUSTREAM %d%s", + Track==ttNone ? ttXSubtitleNone : (Track - ttSubtitleFirst), + m_SpuLangAuto ? " auto" : ""); + Xine_Control(buf); +} +#endif void cXinelibThread::Clear(void) { @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend.h,v 1.18 2008-02-19 00:43:04 phelin Exp $ + * $Id: frontend.h,v 1.19 2008-03-16 21:40:55 phintuka Exp $ * */ @@ -15,6 +15,8 @@ #include <vdr/thread.h> #include <vdr/device.h> // ePlayMode +class cStatus; + //----------------------------- cXinelibThread -------------------------------- class cXinelibThread : public cThread, public cListObject @@ -55,7 +57,11 @@ class cXinelibThread : public cThread, public cListObject void SetStillMode(bool); void SetNoVideo(bool bVal); void AudioStreamChanged(bool ac3, int StreamId); +#if VDRVERSNUM < 10515 void SpuStreamChanged(int StreamId); +#else + void SetSubtitleTrack(eTrackType Track); +#endif protected: int Xine_Control(const char *cmd, const char *p1); @@ -143,6 +149,9 @@ class cXinelibThread : public cThread, public cListObject cString m_FileName; uint64_t m_StreamPos; uint32_t m_Frames; + + cStatus *m_StatusMonitor; + bool m_SpuLangAuto; }; |