[mythtv] [BUG] concerning 'selecting L/R/both audio channels'
Joachim Gehweiler
post at joachim-gehweiler.de
Thu Sep 30 06:32:00 EDT 2004
Hello,
thanks for the hack! The copy of your mail for the list seems to have
gotten lost, so I forward it to the list with the .diff file attached.
Maybe one of the developers can apply the hack code to mythtv in a
proper way, please?
Best,
Joachim
-------- Original Message --------
Subject: Re: [mythtv] [BUG] concerning 'selecting L/R/both audio channels'
Date: Wed, 29 Sep 2004 05:13:29 -0700
From: dcha (at) widerock (dot) com
To: mythtv-dev (at) mythtv (dot) org
CC: post (at) joachim-gehweiler (dot) de
Hello,
> I'd also like to suggest this improvement: When selecting the left audio
> channel, don't just mute the right audio channel but assign the left
> channel to the right one, too, and vice versa. When I select, for
> example, the left audio channel, my intention is to use the broadcasted
> left audio channel as a mono source and to listen to it in stereo, i.e.
> using both audio channels of my hifi (this is useful for movies
> broadcasted with, say, english on the left and german on the right audio
> channel).
I had the same problem as you some times ago and I put together an ugly
hack to
duplicate the selected audio channel on both outputs.
In my case, the mute was not working at all so perhaps you have to
disable it
in your version.
The copy as implemented in this hack is done before some buffering so it
needs
some time before being effective.
Hope this helps you.
Daniel
-------------- next part --------------
diff -r -u mythtv-0.16.org/libs/libmythtv/nuppeldecoder.cpp mythtv-0.16/libs/libmythtv/nuppeldecoder.cpp
--- mythtv-0.16.org/libs/libmythtv/nuppeldecoder.cpp 2004-09-03 08:32:48.000000000 +0200
+++ mythtv-0.16/libs/libmythtv/nuppeldecoder.cpp 2004-09-28 20:29:39.047245702 +0200
@@ -813,6 +813,7 @@
bool gotvideo = false;
bool ret = false;
int seeklen = 0;
+ kAudioMode audio_mode = AUDIO_STEREO;
while (!gotvideo)
{
@@ -992,9 +993,23 @@
pcmrbuffer);
if (lameret > 0)
- {
- m_parent->AddAudioData(pcmlbuffer, pcmrbuffer,
- lameret, frameheader.timecode);
+ {
+ audio_mode = m_parent->GetAudioMode();
+ switch (audio_mode){
+ case AUDIO_STEREO:
+ m_parent->AddAudioData(pcmlbuffer, pcmrbuffer,
+ lameret, frameheader.timecode);
+ break;
+ case AUDIO_LEFT_ONLY:
+ m_parent->AddAudioData(pcmlbuffer, pcmlbuffer,
+ lameret, frameheader.timecode);
+ break;
+ case AUDIO_RIGHT_ONLY:
+ m_parent->AddAudioData(pcmrbuffer, pcmrbuffer,
+ lameret, frameheader.timecode);
+ break;
+ }
+
}
else if (lameret < 0)
{
diff -r -u mythtv-0.16.org/libs/libmythtv/NuppelVideoPlayer.cpp mythtv-0.16/libs/libmythtv/NuppelVideoPlayer.cpp
--- mythtv-0.16.org/libs/libmythtv/NuppelVideoPlayer.cpp 2004-09-10 06:53:22.000000000 +0200
+++ mythtv-0.16/libs/libmythtv/NuppelVideoPlayer.cpp 2004-09-28 20:34:16.004374950 +0200
@@ -183,6 +183,8 @@
limitKeyRepeat = false;
+ audio_mode = AUDIO_STEREO;
+
warplbuff = NULL;
warprbuff = NULL;
warpbuffsize = 0;
diff -r -u mythtv-0.16.org/libs/libmythtv/NuppelVideoPlayer.h mythtv-0.16/libs/libmythtv/NuppelVideoPlayer.h
--- mythtv-0.16.org/libs/libmythtv/NuppelVideoPlayer.h 2004-09-07 14:09:35.000000000 +0200
+++ mythtv-0.16/libs/libmythtv/NuppelVideoPlayer.h 2004-09-28 20:32:52.686590223 +0200
@@ -41,6 +41,8 @@
typedef void (*StatusCallback)(int, void*);
+typedef enum { AUDIO_STEREO=0, AUDIO_LEFT_ONLY, AUDIO_RIGHT_ONLY } kAudioMode;
+
class NuppelVideoPlayer
{
public:
@@ -74,6 +76,9 @@
void SetAudioSampleRate(int rate) { audio_samplerate = rate; }
+ void SetAudioMode(kAudioMode mode) { audio_mode = mode; }
+ kAudioMode GetAudioMode(void) { return audio_mode; }
+
void Pause(bool waitvideo = true);
bool Play(float speed = 1.0, bool normal = true,
bool unpauseaudio = true);
@@ -440,6 +445,8 @@
bool limitKeyRepeat;
+ kAudioMode audio_mode;
+
QWidget *parentWidget;
QMutex vidExitLock;
diff -r -u mythtv-0.16.org/libs/libmythtv/tv_play.cpp mythtv-0.16/libs/libmythtv/tv_play.cpp
--- mythtv-0.16.org/libs/libmythtv/tv_play.cpp 2004-09-07 01:58:32.000000000 +0200
+++ mythtv-0.16/libs/libmythtv/tv_play.cpp 2004-09-28 20:29:39.072241750 +0200
@@ -3230,10 +3230,10 @@
switch (mute_status)
{
- case MUTE_OFF: text = tr("Mute Off"); break;
- case MUTE_BOTH: text = tr("Mute On"); break;
- case MUTE_LEFT: text = tr("Left Channel Muted"); break;
- case MUTE_RIGHT: text = tr("Right Channel Muted"); break;
+ case MUTE_OFF: text = tr("Mute Off"); nvp->SetAudioMode(AUDIO_STEREO); break;
+ case MUTE_BOTH: text = tr("Mute On"); nvp->SetAudioMode(AUDIO_STEREO); break;
+ case MUTE_LEFT: text = tr("Left Channel Muted"); nvp->SetAudioMode(AUDIO_RIGHT_ONLY); break;
+ case MUTE_RIGHT: text = tr("Right Channel Muted"); nvp->SetAudioMode(AUDIO_LEFT_ONLY); break;
}
if (osd && !browsemode)
More information about the mythtv-dev
mailing list