diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2009-02-23 07:37:49 +0100 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2009-02-23 07:37:49 +0100 |
commit | 8e3918bce7b2e1e0e23cab69334df52b58d10f4d (patch) | |
tree | fa39f91234e5d810aac097ddb08f598ad251b1f7 | |
parent | 635a610cb7ca6a2b6d6a8d66a50e9f06ec31da8f (diff) | |
download | vdr-plugin-dxr3-8e3918bce7b2e1e0e23cab69334df52b58d10f4d.tar.gz vdr-plugin-dxr3-8e3918bce7b2e1e0e23cab69334df52b58d10f4d.tar.bz2 |
simplify audiochannel handling
-rw-r--r-- | dxr3audiodecoder.c | 4 | ||||
-rw-r--r-- | dxr3device.h | 4 | ||||
-rw-r--r-- | dxr3interface.c | 19 | ||||
-rw-r--r-- | dxr3syncbuffer.c | 1 | ||||
-rw-r--r-- | dxr3syncbuffer.h | 15 |
5 files changed, 15 insertions, 28 deletions
diff --git a/dxr3audiodecoder.c b/dxr3audiodecoder.c index 8ce0812..1b33ed1 100644 --- a/dxr3audiodecoder.c +++ b/dxr3audiodecoder.c @@ -146,13 +146,13 @@ void cDxr3AudioDecoder::Decode(const uint8_t* buf, int length, uint32_t pts, if (rate != -1) throw UNEXPECTED_PARAMETER_CHANGE; rate = Codec.codec_context.sample_rate; } - if (Codec.codec_context.channels != channels + 1) + if (Codec.codec_context.channels != channels) { dsyslog("dxr3: audiodecoder: channels=%d", Codec.codec_context.channels); if (channels != -1) throw UNEXPECTED_PARAMETER_CHANGE; - channels = (Codec.codec_context.channels == 2) ? 1 : 0; + channels = Codec.codec_context.channels; } if (out_size) { diff --git a/dxr3device.h b/dxr3device.h index 4ea31d7..d58319f 100644 --- a/dxr3device.h +++ b/dxr3device.h @@ -40,7 +40,6 @@ class iAudio; class cDxr3Device : public cDevice { public: cDxr3Device(); - cDxr3Device(cDxr3Interface& demuxDevice); ~cDxr3Device(); virtual void MakePrimaryDevice(bool On); @@ -84,9 +83,6 @@ protected: std::string m_strBuf; int m_Offset; - //virtual bool SetPlayMode(ePlayMode PlayMode); - //uint8_t m_pBuffer[MAX_VIDEO_BUFFER_SIZE]; - //cDxr3StartStopThread* m_pStartStopThread; cDxr3SpuDecoder* m_spuDecoder; private: diff --git a/dxr3interface.c b/dxr3interface.c index 9eedf5c..8a9a523 100644 --- a/dxr3interface.c +++ b/dxr3interface.c @@ -192,17 +192,16 @@ void cDxr3Interface::SetAudioSpeed(uint32_t speed) //! set number of channels void cDxr3Interface::SetChannelCount(uint32_t count) { + // 0 = mono, 1 = stereo + uint32_t ioval = count - 1; + if (!m_ExternalReleased && m_audioMode != EM8300_AUDIOMODE_DIGITALAC3 && - m_audioChannelCount != count && count != UNKNOWN_CHANNEL_COUNT) - { - if (ioctl(m_fdAudio, SNDCTL_DSP_STEREO, &count) == -1) - { - esyslog("dxr3: unable to set channel count to %d: %m", count); - } - else - { - m_audioChannelCount = count; - } + m_audioChannelCount != count) { + if (ioctl(m_fdAudio, SNDCTL_DSP_STEREO, &ioval) == -1) { + esyslog("dxr3: unable to set channel count to %d: %m", count); + } else { + m_audioChannelCount = count; + } } } diff --git a/dxr3syncbuffer.c b/dxr3syncbuffer.c index 95fdbd2..d5c5ce2 100644 --- a/dxr3syncbuffer.c +++ b/dxr3syncbuffer.c @@ -107,7 +107,6 @@ void cFixedLengthFrame::SetPts(uint32_t pts) } // ================================== -uint32_t cFixedLengthFrame::m_staticAudioChannelCount = 0; uint32_t cFixedLengthFrame::m_staticAudioDataRate = 0; diff --git a/dxr3syncbuffer.h b/dxr3syncbuffer.h index 75b19e0..f72b121 100644 --- a/dxr3syncbuffer.h +++ b/dxr3syncbuffer.h @@ -50,11 +50,8 @@ public: void SetPts(uint32_t pts); void SetChannelCount(uint32_t channelCount) { - if (channelCount != UNKNOWN_CHANNEL_COUNT) - m_staticAudioChannelCount = m_audioChannelCount = channelCount; - else - m_audioChannelCount = m_staticAudioChannelCount; - }; + m_audioChannelCount = channelCount; + } void SetDataRate(uint32_t dataRate) { if (m_audioDataRate != UNKNOWN_DATA_RATE) @@ -68,10 +65,8 @@ public: }; uint32_t GetChannelCount(void) { - return ((m_audioChannelCount == m_staticAudioChannelCount || - !m_staticAudioChannelCount)? - m_audioChannelCount : m_staticAudioChannelCount); - }; + return m_audioChannelCount; + } uint32_t GetDataRate(void) { return ((m_audioDataRate == m_staticAudioDataRate || @@ -90,7 +85,6 @@ public: static void Clear(void) { m_staticAudioDataRate = 0; - m_staticAudioChannelCount = 0; }; protected: @@ -104,7 +98,6 @@ protected: uint32_t m_audioDataRate; uint32_t m_videoAspectRatio; - static uint32_t m_staticAudioChannelCount; static uint32_t m_staticAudioDataRate; }; |