1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Implemented the cStatus, cDevice and cPlayer functions for setting subtitle tracks in plugins

This commit is contained in:
Klaus Schmidinger 2008-02-16 13:59:09 +01:00
parent 741400fa66
commit 6b35173789
8 changed files with 36 additions and 7 deletions

View File

@ -1968,6 +1968,8 @@ Petri Hintukainen <Petri.Hintukainen@hut.fi>
for pointing out that plugins from cRemote::PutMacro() and cRemote::CallPlugin() for pointing out that plugins from cRemote::PutMacro() and cRemote::CallPlugin()
need to be handled separately need to be handled separately
for making cTimeMs use the monotonic clock for making cTimeMs use the monotonic clock
for implementing the cStatus, cDevice and cPlayer functions for setting subtitle
tracks in plugins
Marcel Schaeben <mts280@gmx.de> Marcel Schaeben <mts280@gmx.de>
for his "Easy Input" patch for his "Easy Input" patch

View File

@ -5631,3 +5631,5 @@ Video Disk Recorder Revision History
recordings are removed, that actually are on the video directory file system(s). recordings are removed, that actually are on the video directory file system(s).
This prevents VDR from accidentally deleting recordings on other file systems, This prevents VDR from accidentally deleting recordings on other file systems,
which would not add any free space to the video directory. which would not add any free space to the video directory.
- Implemented the cStatus, cDevice and cPlayer functions for setting subtitle tracks
in plugins (thanks to Petri Hintukainen).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: device.c 1.152 2008/02/09 16:10:56 kls Exp $ * $Id: device.c 1.153 2008/02/16 13:52:11 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -890,6 +890,10 @@ void cDevice::SetAudioTrackDevice(eTrackType Type)
{ {
} }
void cDevice::SetSubtitleTrackDevice(eTrackType Type)
{
}
bool cDevice::ToggleMute(void) bool cDevice::ToggleMute(void)
{ {
int OldVolume = volume; int OldVolume = volume;
@ -1037,6 +1041,10 @@ bool cDevice::SetCurrentSubtitleTrack(eTrackType Type, bool Manual)
DELETENULL(dvbSubtitleConverter); DELETENULL(dvbSubtitleConverter);
} }
DELETENULL(liveSubtitle); DELETENULL(liveSubtitle);
if (player)
player->SetSubtitleTrack(currentSubtitleTrack, GetTrack(currentSubtitleTrack));
else
SetSubtitleTrackDevice(currentSubtitleTrack);
if (currentSubtitleTrack != ttNone && !Replaying() && !Transferring()) { if (currentSubtitleTrack != ttNone && !Replaying() && !Transferring()) {
const tTrackId *TrackId = GetTrack(currentSubtitleTrack); const tTrackId *TrackId = GetTrack(currentSubtitleTrack);
if (TrackId && TrackId->id) { if (TrackId && TrackId->id) {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: device.h 1.89 2008/02/09 16:05:24 kls Exp $ * $Id: device.h 1.90 2008/02/16 13:50:11 kls Exp $
*/ */
#ifndef __DEVICE_H #ifndef __DEVICE_H
@ -386,6 +386,8 @@ private:
protected: protected:
virtual void SetAudioTrackDevice(eTrackType Type); virtual void SetAudioTrackDevice(eTrackType Type);
///< Sets the current audio track to the given value. ///< Sets the current audio track to the given value.
virtual void SetSubtitleTrackDevice(eTrackType Type);
///< Sets the current subtitle track to the given value.
public: public:
void ClrAvailableTracks(bool DescriptionsOnly = false, bool IdsOnly = false); void ClrAvailableTracks(bool DescriptionsOnly = false, bool IdsOnly = false);
///< Clears the list of currently availabe tracks. If DescriptionsOnly ///< Clears the list of currently availabe tracks. If DescriptionsOnly

4
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 1.476 2008/02/16 12:04:12 kls Exp $ * $Id: menu.c 1.477 2008/02/16 13:53:26 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -3702,7 +3702,7 @@ void cDisplaySubtitleTracks::Show(void)
{ {
displayTracks->SetTrack(track, descriptions); displayTracks->SetTrack(track, descriptions);
displayTracks->Flush(); displayTracks->Flush();
//cStatus::MsgSetSubtitleTrack(track, descriptions); //TODO better make a more general cStatus::MsgSetTrack(tr("Subtitles"), track, descriptions) cStatus::MsgSetSubtitleTrack(track, descriptions);
} }
cDisplaySubtitleTracks *cDisplaySubtitleTracks::Create(void) cDisplaySubtitleTracks *cDisplaySubtitleTracks::Create(void)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: player.h 1.20 2007/10/13 12:18:10 kls Exp $ * $Id: player.h 1.21 2008/02/16 13:50:11 kls Exp $
*/ */
#ifndef __PLAYER_H #ifndef __PLAYER_H
@ -22,6 +22,7 @@ protected:
void DeviceClrAvailableTracks(bool DescriptionsOnly = false) { if (device) device->ClrAvailableTracks(DescriptionsOnly); } void DeviceClrAvailableTracks(bool DescriptionsOnly = false) { if (device) device->ClrAvailableTracks(DescriptionsOnly); }
bool DeviceSetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language = NULL, const char *Description = NULL) { return device ? device->SetAvailableTrack(Type, Index, Id, Language, Description) : false; } bool DeviceSetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language = NULL, const char *Description = NULL) { return device ? device->SetAvailableTrack(Type, Index, Id, Language, Description) : false; }
bool DeviceSetCurrentAudioTrack(eTrackType Type) { return device ? device->SetCurrentAudioTrack(Type) : false; } bool DeviceSetCurrentAudioTrack(eTrackType Type) { return device ? device->SetCurrentAudioTrack(Type) : false; }
bool DeviceSetCurrentSubtitleTrack(eTrackType Type) { return device ? device->SetCurrentSubtitleTrack(Type) : false; }
bool DevicePoll(cPoller &Poller, int TimeoutMs = 0) { return device ? device->Poll(Poller, TimeoutMs) : false; } bool DevicePoll(cPoller &Poller, int TimeoutMs = 0) { return device ? device->Poll(Poller, TimeoutMs) : false; }
bool DeviceFlush(int TimeoutMs = 0) { return device ? device->Flush(TimeoutMs) : true; } bool DeviceFlush(int TimeoutMs = 0) { return device ? device->Flush(TimeoutMs) : true; }
bool DeviceHasIBPTrickSpeed(void) { return device ? device->HasIBPTrickSpeed() : false; } bool DeviceHasIBPTrickSpeed(void) { return device ? device->HasIBPTrickSpeed() : false; }
@ -58,6 +59,10 @@ public:
// Sets the current audio track to the given value. // Sets the current audio track to the given value.
// This is just a virtual hook for players that need to do special things // This is just a virtual hook for players that need to do special things
// in order to switch audio tracks. // in order to switch audio tracks.
virtual void SetSubtitleTrack(eTrackType Type, const tTrackId *TrackId) {}
// Sets the current subtitle track to the given value.
// This is just a virtual hook for players that need to do special things
// in order to switch subtitle tracks.
}; };
class cControl : public cOsdObject { class cControl : public cOsdObject {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: status.c 1.8 2005/12/31 15:10:10 kls Exp $ * $Id: status.c 1.9 2008/02/16 13:50:15 kls Exp $
*/ */
#include "status.h" #include "status.h"
@ -59,6 +59,12 @@ void cStatus::MsgSetAudioChannel(int AudioChannel)
sm->SetAudioChannel(AudioChannel); sm->SetAudioChannel(AudioChannel);
} }
void cStatus::MsgSetSubtitleTrack(int Index, const char * const *Tracks)
{
for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
sm->SetSubtitleTrack(Index, Tracks);
}
void cStatus::MsgOsdClear(void) void cStatus::MsgOsdClear(void)
{ {
for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: status.h 1.10 2007/08/12 10:34:40 kls Exp $ * $Id: status.h 1.11 2008/02/16 13:50:15 kls Exp $
*/ */
#ifndef __STATUS_H #ifndef __STATUS_H
@ -44,6 +44,9 @@ protected:
virtual void SetAudioChannel(int AudioChannel) {} virtual void SetAudioChannel(int AudioChannel) {}
// The audio channel has been set to the given value. // The audio channel has been set to the given value.
// 0=stereo, 1=left, 2=right, -1=no information available. // 0=stereo, 1=left, 2=right, -1=no information available.
virtual void SetSubtitleTrack(int Index, const char * const *Tracks) {}
// The subtitle track has been set to the one given by Index, which
// points into the Tracks array of strings. Tracks is NULL terminated.
virtual void OsdClear(void) {} virtual void OsdClear(void) {}
// The OSD has been cleared. // The OSD has been cleared.
virtual void OsdTitle(const char *Title) {} virtual void OsdTitle(const char *Title) {}
@ -77,6 +80,7 @@ public:
static void MsgSetVolume(int Volume, bool Absolute); static void MsgSetVolume(int Volume, bool Absolute);
static void MsgSetAudioTrack(int Index, const char * const *Tracks); static void MsgSetAudioTrack(int Index, const char * const *Tracks);
static void MsgSetAudioChannel(int AudioChannel); static void MsgSetAudioChannel(int AudioChannel);
static void MsgSetSubtitleTrack(int Index, const char * const *Tracks);
static void MsgOsdClear(void); static void MsgOsdClear(void);
static void MsgOsdTitle(const char *Title); static void MsgOsdTitle(const char *Title);
static void MsgOsdStatusMessage(const char *Message); static void MsgOsdStatusMessage(const char *Message);