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

Implemented displaying audio channel

This commit is contained in:
Klaus Schmidinger 2005-01-09 12:08:34 +01:00
parent f79f81dfd4
commit 264fa085bd
14 changed files with 145 additions and 30 deletions

View File

@ -3262,7 +3262,8 @@ Video Disk Recorder Revision History
- 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.
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
@ -3273,8 +3274,6 @@ Video Disk Recorder Revision History
- 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).
Currently there is no visual indicator of the audio channel, yet, and it
doesn't work with the selected audio languages.
- 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).

4
MANUAL
View File

@ -200,7 +200,7 @@ Version 1.2
The "Left" and "Right" keys can be used to switch between "mono left", "stereo"
and "mono right" for channels that broadcast different audio tracks in the
left and right stereo channels (as was often done in the old analog days).
left and right stereo channels.
The "Ok" key explicitly switches to the selected track (in case the device
for some reason doesn't play it) and closes the "Audio" menu.
@ -211,7 +211,7 @@ Version 1.2
Once a Dolby Digital track has been selected on any channel, further channel
switches will first search for a Dolby Digital track of one of the preferred
audio languages. If no such track can be found, a normal audio track will
be selected. Note that this only works is the broadcasters use actual language
be selected. Note that this only works if the broadcasters use actual language
codes in their PID data, not things like "dd" or "2ch".
* Switching through channel groups

View File

@ -1493,13 +1493,15 @@ repectively.
<b>Audio selection</b>
<p>
If the device can provide more than a single audio track, it can implement the
following functions to make them available:
following function to make them available:
<!--X1.3.18--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
<p><table><tr><td bgcolor=#F0F0F0><pre>
virtual int NumAudioTracksDevice(void) const;
virtual const char **GetAudioTracksDevice(int *CurrentTrack = NULL) const;
virtual void SetAudioTrackDevice(int Index);
virtual void SetAudioTrackDevice(eTrackType Type);
virtual int GetAudioChannelDevice(void);
virtual void SetAudioChannelDevice(int AudioChannel);
</pre></td></tr></table><p>
<!--X1.3.18--></td></tr></table>
<p>
<b>Recording</b>

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: skincurses.c 1.4 2005/01/02 15:11:29 kls Exp $
* $Id: skincurses.c 1.5 2005/01/09 11:56:26 kls Exp $
*/
#include <ncurses.h>
@ -570,6 +570,7 @@ public:
cSkinCursesDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks);
virtual ~cSkinCursesDisplayTracks();
virtual void SetTrack(int Index, const char * const *Tracks);
virtual void SetAudioChannel(int AudioChannel) {}
virtual void Flush(void);
};

32
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.331 2005/01/08 10:46:44 kls Exp $
* $Id: menu.c 1.332 2005/01/09 11:55:12 kls Exp $
*/
#include "menu.h"
@ -2857,6 +2857,7 @@ cDisplayTracks::cDisplayTracks(void)
SetTrackDescriptions();
currentDisplayTracks = this;
numTracks = track = 0;
audioChannel = cDevice::PrimaryDevice()->GetAudioChannel();
eTrackType CurrentAudioTrack = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
for (int i = ttAudioFirst; i <= ttDolbyLast; i++) {
const tTrackId *TrackId = cDevice::PrimaryDevice()->GetTrack(eTrackType(i));
@ -2884,9 +2885,12 @@ cDisplayTracks::~cDisplayTracks()
void cDisplayTracks::Show(void)
{
int ac = IS_AUDIO_TRACK(types[track]) ? audioChannel : -1;
displayTracks->SetTrack(track, descriptions);
displayTracks->SetAudioChannel(ac);
displayTracks->Flush();
cStatus::MsgSetAudioTrack(track, descriptions);
cStatus::MsgSetAudioChannel(ac);
}
cDisplayTracks *cDisplayTracks::Create(void)
@ -2909,6 +2913,7 @@ void cDisplayTracks::Process(eKeys Key)
eOSState cDisplayTracks::ProcessKey(eKeys Key)
{
int oldTrack = track;
int oldAudioChannel = audioChannel;
switch (Key) {
case kUp|k_Repeat:
case kUp:
@ -2923,16 +2928,16 @@ eOSState cDisplayTracks::ProcessKey(eKeys Key)
case kLeft|k_Repeat:
case kLeft:
case kRight|k_Repeat:
case kRight: {
static int ac[] = { 1, 0, 2 };
int AudioChannel = ac[cDevice::PrimaryDevice()->GetAudioChannel()];
if (NORMALKEY(Key) == kLeft && AudioChannel > 0)
AudioChannel--;
else if (NORMALKEY(Key) == kRight && AudioChannel < 2)
AudioChannel++;
cDevice::PrimaryDevice()->SetAudioChannel(ac[AudioChannel]);
timeout.Set(TRACKTIMEOUT);
}
case kRight: if (IS_AUDIO_TRACK(types[track])) {
static int ac[] = { 1, 0, 2 };
audioChannel = ac[cDevice::PrimaryDevice()->GetAudioChannel()];
if (NORMALKEY(Key) == kLeft && audioChannel > 0)
audioChannel--;
else if (NORMALKEY(Key) == kRight && audioChannel < 2)
audioChannel++;
audioChannel = ac[audioChannel];
timeout.Set(TRACKTIMEOUT);
}
break;
case kAudio:
if (++track >= numTracks)
@ -2948,11 +2953,14 @@ eOSState cDisplayTracks::ProcessKey(eKeys Key)
default: if ((Key & k_Release) == 0)
return osEnd;
}
if (track != oldTrack) {
if (track != oldTrack || audioChannel != oldAudioChannel)
Show();
if (track != oldTrack) {
cDevice::PrimaryDevice()->SetCurrentAudioTrack(types[track]);
Setup.CurrentDolby = IS_DOLBY_TRACK(types[track]);
}
if (audioChannel != oldAudioChannel)
cDevice::PrimaryDevice()->SetAudioChannel(audioChannel);
return timeout.TimedOut() ? osEnd : osContinue;
}

4
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.67 2005/01/06 14:29:46 kls Exp $
* $Id: menu.h 1.68 2005/01/08 15:48:57 kls Exp $
*/
#ifndef __MENU_H
@ -81,7 +81,7 @@ private:
cTimeMs timeout;
eTrackType types[ttMaxTrackTypes];
char *descriptions[ttMaxTrackTypes];
int numTracks, track;
int numTracks, track, audioChannel;
static cDisplayTracks *currentDisplayTracks;
virtual void Show(void);
cDisplayTracks(void);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinclassic.c 1.10 2005/01/02 14:41:08 kls Exp $
* $Id: skinclassic.c 1.11 2005/01/09 11:56:29 kls Exp $
*/
#include "skinclassic.h"
@ -516,6 +516,7 @@ public:
cSkinClassicDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks);
virtual ~cSkinClassicDisplayTracks();
virtual void SetTrack(int Index, const char * const *Tracks);
virtual void SetAudioChannel(int AudioChannel) {}
virtual void Flush(void);
};

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skins.h 1.5 2005/01/02 14:36:19 kls Exp $
* $Id: skins.h 1.6 2005/01/09 11:49:37 kls Exp $
*/
#ifndef __SKINS_H
@ -66,7 +66,6 @@ public:
Red = Video options
Green = Info now
Yellow = Info next
VideoOptions
*/
};
@ -227,6 +226,9 @@ public:
virtual void SetTrack(int Index, const char * const *Tracks) = 0;
///< Sets the current track to the one given by Index, which
///< points into the Tracks array of strings.
virtual void SetAudioChannel(int AudioChannel) = 0;
///< Sets the audio channel indicator.
///< 0=stereo, 1=left, 2=right, -1=don't display the audio channel indicator.
};
class cSkinDisplayMessage : public cSkinDisplay {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinsttng.c 1.11 2005/01/08 10:15:00 kls Exp $
* $Id: skinsttng.c 1.12 2005/01/08 15:37:55 kls Exp $
*/
// Star Trek: The Next Generation® is a registered trademark of Paramount Pictures
@ -20,6 +20,9 @@
#include "symbols/arrowdown.xpm"
#include "symbols/arrowup.xpm"
#include "symbols/audio.xpm"
#include "symbols/audioleft.xpm"
#include "symbols/audioright.xpm"
#include "symbols/audiostereo.xpm"
#include "symbols/dolbydigital.xpm"
#include "symbols/encrypted.xpm"
#include "symbols/ffwd.xpm"
@ -835,14 +838,20 @@ private:
int lineHeight;
tColor frameColor;
int currentIndex;
static cBitmap bmAudioLeft, bmAudioRight, bmAudioStereo;
void SetItem(const char *Text, int Index, bool Current);
public:
cSkinSTTNGDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks);
virtual ~cSkinSTTNGDisplayTracks();
virtual void SetTrack(int Index, const char * const *Tracks);
virtual void SetAudioChannel(int AudioChannel);
virtual void Flush(void);
};
cBitmap cSkinSTTNGDisplayTracks::bmAudioLeft(audioleft_xpm);
cBitmap cSkinSTTNGDisplayTracks::bmAudioRight(audioright_xpm);
cBitmap cSkinSTTNGDisplayTracks::bmAudioStereo(audiostereo_xpm);
cSkinSTTNGDisplayTracks::cSkinSTTNGDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks)
{
const cFont *font = cFont::GetFont(fontOsd);
@ -954,6 +963,20 @@ void cSkinSTTNGDisplayTracks::SetTrack(int Index, const char * const *Tracks)
SetItem(Tracks[Index], Index, true);
}
void cSkinSTTNGDisplayTracks::SetAudioChannel(int AudioChannel)
{
cBitmap *bm = NULL;
switch (AudioChannel) {
case 0: bm = &bmAudioStereo; break;
case 1: bm = &bmAudioLeft; break;
case 2: bm = &bmAudioRight; break;
}
if (bm)
osd->DrawBitmap(x3 + 5, y6 + (y7 - y6 - bm->Height()) / 2, *bm, Theme.Color(clrChannelSymbolOn), frameColor);
else
osd->DrawRectangle(x3, y6, x4 - 1, y7 - 1, frameColor);
}
void cSkinSTTNGDisplayTracks::Flush(void)
{
osd->Flush();

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: status.c 1.6 2005/01/02 12:09:12 kls Exp $
* $Id: status.c 1.7 2005/01/09 11:51:04 kls Exp $
*/
#include "status.h"
@ -53,6 +53,12 @@ void cStatus::MsgSetAudioTrack(int Index, const char * const *Tracks)
sm->SetAudioTrack(Index, Tracks);
}
void cStatus::MsgSetAudioChannel(int AudioChannel)
{
for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
sm->SetAudioChannel(AudioChannel);
}
void cStatus::MsgOsdClear(void)
{
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
* how to reach the author.
*
* $Id: status.h 1.7 2005/01/02 12:08:12 kls Exp $
* $Id: status.h 1.8 2005/01/09 11:50:21 kls Exp $
*/
#ifndef __STATUS_H
@ -39,6 +39,9 @@ protected:
virtual void SetAudioTrack(int Index, const char * const *Tracks) {}
// The audio track has been set to the one given by Index, which
// points into the Tracks array of strings.
virtual void SetAudioChannel(int AudioChannel) {}
// The audio channel has been set to the given value.
// 0=stereo, 1=left, 2=right, -1=no information available.
virtual void OsdClear(void) {}
// The OSD has been cleared.
virtual void OsdTitle(const char *Title) {}
@ -71,6 +74,7 @@ public:
static void MsgReplaying(const cControl *Control, const char *Name);
static void MsgSetVolume(int Volume, bool Absolute);
static void MsgSetAudioTrack(int Index, const char * const *Tracks);
static void MsgSetAudioChannel(int AudioChannel);
static void MsgOsdClear(void);
static void MsgOsdTitle(const char *Title);
static void MsgOsdStatusMessage(const char *Message);

23
symbols/audioleft.xpm Normal file
View File

@ -0,0 +1,23 @@
/* XPM */
static char * audioleft_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",
"...........................",
"...........................",
"...........................",
"...........................",
".....++++.........++++.....",
"...++++++++.....++++++++...",
"...++++++++.....++....++...",
"..++++++++++...++......++..",
"..++++++++++...++......++..",
"..++++++++++...++......++..",
"..++++++++++...++......++..",
"...++++++++.....++....++...",
"...++++++++.....++++++++...",
".....++++.........++++.....",
"...........................",
"...........................",
"...........................",
"..........................."};

23
symbols/audioright.xpm Normal file
View File

@ -0,0 +1,23 @@
/* XPM */
static char * audioright_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",
"...........................",
"...........................",
"...........................",
"...........................",
".....++++.........++++.....",
"...++++++++.....++++++++...",
"...++....++.....++++++++...",
"..++......++...++++++++++..",
"..++......++...++++++++++..",
"..++......++...++++++++++..",
"..++......++...++++++++++..",
"...++....++.....++++++++...",
"...++++++++.....++++++++...",
".....++++.........++++.....",
"...........................",
"...........................",
"...........................",
"..........................."};

23
symbols/audiostereo.xpm Normal file
View File

@ -0,0 +1,23 @@
/* XPM */
static char * audiostereo_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",
"...........................",
"...........................",
"...........................",
"...........................",
".....++++.........++++.....",
"...++++++++.....++++++++...",
"...++++++++.....++++++++...",
"..++++++++++...++++++++++..",
"..++++++++++...++++++++++..",
"..++++++++++...++++++++++..",
"..++++++++++...++++++++++..",
"...++++++++.....++++++++...",
"...++++++++.....++++++++...",
".....++++.........++++.....",
"...........................",
"...........................",
"...........................",
"..........................."};