summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-01-09 12:08:34 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-01-09 12:08:34 +0100
commit264fa085bd2d6941ddfa1b977372a0d0cdd5d801 (patch)
treea4137fbfe750c36705393cbac8a4809670036097
parentf79f81dfd4e5e482f251f0ae53731cd8c6a42d2f (diff)
downloadvdr-264fa085bd2d6941ddfa1b977372a0d0cdd5d801.tar.gz
vdr-264fa085bd2d6941ddfa1b977372a0d0cdd5d801.tar.bz2
Implemented displaying audio channel
-rw-r--r--HISTORY5
-rw-r--r--MANUAL4
-rw-r--r--PLUGINS.html10
-rw-r--r--PLUGINS/src/skincurses/skincurses.c3
-rw-r--r--menu.c32
-rw-r--r--menu.h4
-rw-r--r--skinclassic.c3
-rw-r--r--skins.h6
-rw-r--r--skinsttng.c25
-rw-r--r--status.c8
-rw-r--r--status.h6
-rw-r--r--symbols/audioleft.xpm23
-rw-r--r--symbols/audioright.xpm23
-rw-r--r--symbols/audiostereo.xpm23
14 files changed, 145 insertions, 30 deletions
diff --git a/HISTORY b/HISTORY
index 57e766f6..3fd064bf 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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).
diff --git a/MANUAL b/MANUAL
index 9de3ebeb..b4163ad8 100644
--- a/MANUAL
+++ b/MANUAL
@@ -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
diff --git a/PLUGINS.html b/PLUGINS.html
index 6897504b..9132aa23 100644
--- a/PLUGINS.html
+++ b/PLUGINS.html
@@ -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>
diff --git a/PLUGINS/src/skincurses/skincurses.c b/PLUGINS/src/skincurses/skincurses.c
index ee1df052..a1c59540 100644
--- a/PLUGINS/src/skincurses/skincurses.c
+++ b/PLUGINS/src/skincurses/skincurses.c
@@ -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);
};
diff --git a/menu.c b/menu.c
index a82f6b21..6c2f643a 100644
--- a/menu.c
+++ b/menu.c
@@ -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;
}
diff --git a/menu.h b/menu.h
index bca78657..d63fdafa 100644
--- a/menu.h
+++ b/menu.h
@@ -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);
diff --git a/skinclassic.c b/skinclassic.c
index b184bc5d..7eb0513b 100644
--- a/skinclassic.c
+++ b/skinclassic.c
@@ -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);
};
diff --git a/skins.h b/skins.h
index 618fd61f..ae2733c4 100644
--- a/skins.h
+++ b/skins.h
@@ -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 {
diff --git a/skinsttng.c b/skinsttng.c
index a229838f..94a4b66f 100644
--- a/skinsttng.c
+++ b/skinsttng.c
@@ -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();
diff --git a/status.c b/status.c
index a39c7acb..5fd4f8ec 100644
--- a/status.c
+++ b/status.c
@@ -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))
diff --git a/status.h b/status.h
index 1d6494ac..58aec57e 100644
--- a/status.h
+++ b/status.h
@@ -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);
diff --git a/symbols/audioleft.xpm b/symbols/audioleft.xpm
new file mode 100644
index 00000000..3536c25a
--- /dev/null
+++ b/symbols/audioleft.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static char * audioleft_xpm[] = {
+"27 18 2 1",
+". c #FFFFFF",
+"+ c #000000",
+"...........................",
+"...........................",
+"...........................",
+"...........................",
+".....++++.........++++.....",
+"...++++++++.....++++++++...",
+"...++++++++.....++....++...",
+"..++++++++++...++......++..",
+"..++++++++++...++......++..",
+"..++++++++++...++......++..",
+"..++++++++++...++......++..",
+"...++++++++.....++....++...",
+"...++++++++.....++++++++...",
+".....++++.........++++.....",
+"...........................",
+"...........................",
+"...........................",
+"..........................."};
diff --git a/symbols/audioright.xpm b/symbols/audioright.xpm
new file mode 100644
index 00000000..fc03cd3d
--- /dev/null
+++ b/symbols/audioright.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static char * audioright_xpm[] = {
+"27 18 2 1",
+". c #FFFFFF",
+"+ c #000000",
+"...........................",
+"...........................",
+"...........................",
+"...........................",
+".....++++.........++++.....",
+"...++++++++.....++++++++...",
+"...++....++.....++++++++...",
+"..++......++...++++++++++..",
+"..++......++...++++++++++..",
+"..++......++...++++++++++..",
+"..++......++...++++++++++..",
+"...++....++.....++++++++...",
+"...++++++++.....++++++++...",
+".....++++.........++++.....",
+"...........................",
+"...........................",
+"...........................",
+"..........................."};
diff --git a/symbols/audiostereo.xpm b/symbols/audiostereo.xpm
new file mode 100644
index 00000000..fdd7b845
--- /dev/null
+++ b/symbols/audiostereo.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static char * audiostereo_xpm[] = {
+"27 18 2 1",
+". c #FFFFFF",
+"+ c #000000",
+"...........................",
+"...........................",
+"...........................",
+"...........................",
+".....++++.........++++.....",
+"...++++++++.....++++++++...",
+"...++++++++.....++++++++...",
+"..++++++++++...++++++++++..",
+"..++++++++++...++++++++++..",
+"..++++++++++...++++++++++..",
+"..++++++++++...++++++++++..",
+"...++++++++.....++++++++...",
+"...++++++++.....++++++++...",
+".....++++.........++++.....",
+"...........................",
+"...........................",
+"...........................",
+"..........................."};