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

Displaying audio track description in channel display

This commit is contained in:
Klaus Schmidinger 2005-01-08 10:15:30 +01:00
parent 64623e762b
commit ec27c329cf
5 changed files with 54 additions and 37 deletions

View File

@ -3265,6 +3265,8 @@ Video Disk Recorder Revision History
used to get notified when the audio track has been switched. used to get notified when the audio track has been switched.
- Skins need to implement the new cSkinDisplayTrack class to display the audio - Skins need to implement the new cSkinDisplayTrack class to display the audio
track menu. 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 - 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 language shall be selected in case a channel broadcasts in different languages
(see MANUAL for details). (see MANUAL for details).

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.70 2005/01/06 16:45:12 kls Exp $ * $Id: device.c 1.71 2005/01/08 10:15:00 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -644,9 +644,14 @@ void cDevice::SetVolume(int Volume, bool Absolute)
} }
} }
void cDevice::ClrAvailableTracks(void) void cDevice::ClrAvailableTracks(bool DescriptionsOnly)
{ {
memset(availableTracks, 0, sizeof(availableTracks)); if (DescriptionsOnly) {
for (int i = ttNone; i < ttMaxTrackTypes; i++)
*availableTracks[i].description = 0;
}
else
memset(availableTracks, 0, sizeof(availableTracks));
} }
bool cDevice::SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language, const char *Description, uint32_t Flags) bool cDevice::SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language, const char *Description, uint32_t Flags)

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.50 2005/01/06 13:27:42 kls Exp $ * $Id: device.h 1.51 2005/01/08 10:15:00 kls Exp $
*/ */
#ifndef __DEVICE_H #ifndef __DEVICE_H
@ -319,7 +319,7 @@ 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.
public: public:
void ClrAvailableTracks(void); 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); 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. ///< 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. ///< Type must be one of the basic eTrackType values, like ttAudio or ttDolby.

69
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.329 2005/01/06 13:27:00 kls Exp $ * $Id: menu.c 1.330 2005/01/08 10:15:00 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -2541,6 +2541,40 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
return state; return state;
} }
// --- SetTrackDescriptions --------------------------------------------------
static void SetTrackDescriptions(void)
{
cDevice::PrimaryDevice()->ClrAvailableTracks(true);
cChannel *Channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (Channel) {
cSchedulesLock SchedulesLock;
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
if (Schedules) {
const cSchedule *Schedule = Schedules->GetSchedule(Channel->GetChannelID());
if (Schedule) {
const cEvent *Present = Schedule->GetPresentEvent(true);
if (Present) {
const cComponents *Components = Present->Components();
if (Components) {
int indexAudio = 0;
int indexDolby = 0;
for (int i = 0; i < Components->NumComponents(); i++) {
const tComponent *p = Components->Component(i);
if (p->stream == 2) {
if (p->type == 0x05)
cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, indexDolby++, 0, NULL, p->description);
else
cDevice::PrimaryDevice()->SetAvailableTrack(ttAudio, indexAudio++, 0, NULL, p->description);
}
}
}
}
}
}
}
}
// --- cDisplayChannel ------------------------------------------------------- // --- cDisplayChannel -------------------------------------------------------
#define DIRECTCHANNELTIMEOUT 1000 //ms #define DIRECTCHANNELTIMEOUT 1000 //ms
@ -2599,6 +2633,7 @@ void cDisplayChannel::DisplayInfo(void)
const cEvent *Present = Schedule->GetPresentEvent(true); const cEvent *Present = Schedule->GetPresentEvent(true);
const cEvent *Following = Schedule->GetFollowingEvent(true); const cEvent *Following = Schedule->GetFollowingEvent(true);
if (Present != lastPresent || Following != lastFollowing) { if (Present != lastPresent || Following != lastFollowing) {
SetTrackDescriptions();
displayChannel->SetEvents(Present, Following); displayChannel->SetEvents(Present, Following);
cStatus::MsgOsdProgramme(Present ? Present->StartTime() : 0, Present ? Present->Title() : NULL, Present ? Present->ShortText() : NULL, Following ? Following->StartTime() : 0, Following ? Following->Title() : NULL, Following ? Following->ShortText() : NULL); cStatus::MsgOsdProgramme(Present ? Present->StartTime() : 0, Present ? Present->Title() : NULL, Present ? Present->ShortText() : NULL, Following ? Following->StartTime() : 0, Following ? Following->Title() : NULL, Following ? Following->ShortText() : NULL);
lastPresent = Present; lastPresent = Present;
@ -2818,36 +2853,8 @@ cDisplayTracks::cDisplayTracks(void)
:cOsdObject(true) :cOsdObject(true)
{ {
// Get the actual audio track descriptions from the EPG if we're not replaying: // Get the actual audio track descriptions from the EPG if we're not replaying:
if (!cDevice::PrimaryDevice()->Replaying() || cTransferControl::ReceiverDevice()) { if (!cDevice::PrimaryDevice()->Replaying() || cTransferControl::ReceiverDevice())
cChannel *Channel = Channels.GetByNumber(cDevice::CurrentChannel()); SetTrackDescriptions();
if (Channel) {
cSchedulesLock SchedulesLock;
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
if (Schedules) {
const cSchedule *Schedule = Schedules->GetSchedule(Channel->GetChannelID());
if (Schedule) {
const cEvent *Present = Schedule->GetPresentEvent(true);
if (Present) {
const cComponents *Components = Present->Components();
if (Components) {
int indexAudio = 0;
int indexDolby = 0;
for (int i = 0; i < Components->NumComponents(); i++) {
const tComponent *p = Components->Component(i);
if (p->stream == 2) {
if (p->type == 0x05)
cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, indexDolby++, 0, NULL, p->description);
else
cDevice::PrimaryDevice()->SetAvailableTrack(ttAudio, indexAudio++, 0, NULL, p->description);
}
}
}
}
}
}
}
}
currentDisplayTracks = this; currentDisplayTracks = this;
numTracks = track = 0; numTracks = track = 0;
eTrackType CurrentAudioTrack = cDevice::PrimaryDevice()->GetCurrentAudioTrack(); eTrackType CurrentAudioTrack = cDevice::PrimaryDevice()->GetCurrentAudioTrack();

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: skinsttng.c 1.10 2005/01/02 14:41:49 kls Exp $ * $Id: skinsttng.c 1.11 2005/01/08 10:15:00 kls Exp $
*/ */
// Star Trek: The Next Generation® is a registered trademark of Paramount Pictures // Star Trek: The Next Generation® is a registered trademark of Paramount Pictures
@ -265,6 +265,9 @@ void cSkinSTTNGDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Fo
osd->DrawText(x3 + 2, y3 + (2 * i + 1) * lineHeight, e->ShortText(), Theme.Color(clrChannelEpgShortText), Theme.Color(clrBackground), cFont::GetFont(fontSml), x4 - x3 - 2); osd->DrawText(x3 + 2, y3 + (2 * i + 1) * lineHeight, e->ShortText(), Theme.Color(clrChannelEpgShortText), Theme.Color(clrBackground), cFont::GetFont(fontSml), x4 - x3 - 2);
} }
} }
cDevice *Device = cDevice::PrimaryDevice();
const tTrackId *Track = Device->GetTrack(Device->GetCurrentAudioTrack());
osd->DrawText(x3 + 2, y6, Track ? Track->description : "", Theme.Color(clrChannelName), frameColor, cFont::GetFont(fontSml), x4 - x3 - 2);
} }
void cSkinSTTNGDisplayChannel::SetMessage(eMessageType Type, const char *Text) void cSkinSTTNGDisplayChannel::SetMessage(eMessageType Type, const char *Text)