aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobo1on1 <bobo1on1@svn>2010-11-29 22:12:45 +0000
committerbobo1on1 <bobo1on1@svn>2010-11-29 22:12:45 +0000
commit4657d5104e3ad55a24a06e9119af2400e4d25de7 (patch)
tree4a12d465d2c388cda845d40c07cbbdcb041e944b
parent74c827d7549b9a8481629168f80f43d6611fb4d9 (diff)
fixed: channel layout from ffmpeg is int64_t
(cherry picked from commit 571fabe155bf8d3d7042c75f7d1f0c9fa2c3307b) fixed: rebuild the channelmap when the layout changes fixed: no need to build a channel map when just requesting the number of channels fixed: init the channelmap in constructor to an empty one (cherry picked from commit 153fb81a91eed115232b724889937f0916c1c8fc) git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@35523 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp25
-rw-r--r--xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h4
2 files changed, 19 insertions, 10 deletions
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
index 29c59a771c..0a5e003520 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
@@ -38,10 +38,13 @@ CDVDAudioCodecFFmpeg::CDVDAudioCodecFFmpeg() : CDVDAudioCodec()
memset(m_pBuffer2, 0, AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
m_iBuffered = 0;
- m_channels = 0;
m_pCodecContext = NULL;
m_pConvert = NULL;
m_bOpenedCodec = false;
+
+ m_channelMap[0] = PCM_INVALID;
+ m_channels = 0;
+ m_layout = 0;
}
CDVDAudioCodecFFmpeg::~CDVDAudioCodecFFmpeg()
@@ -226,9 +229,7 @@ void CDVDAudioCodecFFmpeg::Reset()
int CDVDAudioCodecFFmpeg::GetChannels()
{
- if (m_channels != m_pCodecContext->channels)
- BuildChannelMap();
- return m_channels;
+ return m_pCodecContext->channels;
}
int CDVDAudioCodecFFmpeg::GetSampleRate()
@@ -242,7 +243,7 @@ int CDVDAudioCodecFFmpeg::GetBitsPerSample()
return 16;
}
-static unsigned count_bits(unsigned value)
+static unsigned count_bits(int64_t value)
{
unsigned bits = 0;
for(;value;++bits)
@@ -252,7 +253,13 @@ static unsigned count_bits(unsigned value)
void CDVDAudioCodecFFmpeg::BuildChannelMap()
{
- int layout;
+ if (m_channels == m_pCodecContext->channels && m_layout == m_pCodecContext->channel_layout)
+ return; //nothing to do here
+
+ m_channels = m_pCodecContext->channels;
+ m_layout = m_pCodecContext->channel_layout;
+
+ int64_t layout;
int bits = count_bits(m_pCodecContext->channel_layout);
if (bits == m_pCodecContext->channels)
@@ -285,14 +292,14 @@ void CDVDAudioCodecFFmpeg::BuildChannelMap()
//terminate the channel map
m_channelMap[index] = PCM_INVALID;
- m_channels = m_pCodecContext->channels;
}
enum PCMChannels* CDVDAudioCodecFFmpeg::GetChannelMap()
{
- if (m_channels != m_pCodecContext->channels)
- BuildChannelMap();
+ BuildChannelMap();
+
if (m_channelMap[0] == PCM_INVALID)
return NULL;
+
return m_channelMap;
}
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h
index 4a6d1968be..03f80c324b 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h
@@ -56,7 +56,9 @@ protected:
bool m_bOpenedCodec;
int m_iBuffered;
- int m_channels;
+
+ int m_channels;
+ int64_t m_layout;
DllAvCodec m_dllAvCodec;
DllAvUtil m_dllAvUtil;