aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey McRae <gnif@xbmc.org>2012-04-25 16:29:10 +1200
committerJonathan Marshall <jmarshall@never.you.mind>2012-05-10 09:40:53 +1200
commit9ea3255a5a1b7194a97b3b8ad6a25cb81bd89413 (patch)
tree0e7c571267f71f7a57aa006bd2d34bc225c59c15
parent48abb610053ce8776c689e53f625be5ec15a4260 (diff)
[AE] paplayer: switch MP3Codec to pass through signed 32bpp data
-rw-r--r--xbmc/cores/paplayer/MP3codec.cpp35
-rw-r--r--xbmc/cores/paplayer/MP3codec.h2
2 files changed, 17 insertions, 20 deletions
diff --git a/xbmc/cores/paplayer/MP3codec.cpp b/xbmc/cores/paplayer/MP3codec.cpp
index 99a3797f08..bd1cc4c286 100644
--- a/xbmc/cores/paplayer/MP3codec.cpp
+++ b/xbmc/cores/paplayer/MP3codec.cpp
@@ -37,7 +37,6 @@ using namespace MUSIC_INFO;
#define CHANNELSPERSAMPLE 2
#define BITSPERSAMPLE 32
#define OUTPUTFRAMESIZE (SAMPLESPERFRAME * CHANNELSPERSAMPLE * (BITSPERSAMPLE >> 3))
-#define mad_scale_float(sample) ((float)(sample/(float)(1L << MAD_F_FRACBITS)))
MP3Codec::MP3Codec()
{
@@ -486,7 +485,7 @@ int MP3Codec::madx_init (madx_house *mxhouse )
return(1);
}
-madx_sig MP3Codec::madx_read(madx_house *mxhouse, madx_stat *mxstat, int maxwrite, bool discard)
+madx_sig MP3Codec::madx_read(madx_house *mxhouse, madx_stat *mxstat, int maxwrite)
{
if (!m_dll.IsLoaded())
m_dll.Load();
@@ -514,27 +513,25 @@ madx_sig MP3Codec::madx_read(madx_house *mxhouse, madx_stat *mxstat, int maxwrit
m_dll.mad_synth_frame( &mxhouse->synth, &mxhouse->frame );
- mxstat->framepcmsize = mxhouse->synth.pcm.length * mxhouse->synth.pcm.channels * (int)BITSPERSAMPLE/8;
+ mxstat->framepcmsize = mxhouse->synth.pcm.length * mxhouse->synth.pcm.channels * (int)(BITSPERSAMPLE >> 3);
mxhouse->frame_cnt++;
m_dll.mad_timer_add( &mxhouse->timer, mxhouse->frame.header.duration );
- float *data_f = (float *)mxhouse->output_ptr;
- if (!discard)
+
+ int32_t *dest = (int32_t*)mxhouse->output_ptr;
+ for(int i=0; i < mxhouse->synth.pcm.length; i++)
{
- for( int i=0; i < mxhouse->synth.pcm.length; i++ )
- {
- // Left channel
- *data_f++ = mad_scale_float(mxhouse->synth.pcm.samples[0][i]);
- mxhouse->output_ptr += sizeof(float);
- // Right channel
- if(MAD_NCHANNELS(&mxhouse->frame.header)==2)
- {
- *data_f++ = mad_scale_float(mxhouse->synth.pcm.samples[1][i]);
- mxhouse->output_ptr += sizeof(float);
- }
- }
- // Tell calling code buffer size
- mxstat->write_size = mxhouse->output_ptr - (m_OutputBuffer + m_OutputBufferPos);
+ // Left channel
+ *dest++ = (int32_t)(mxhouse->synth.pcm.samples[0][i] << 2);
+
+ // Right channel
+ if(MAD_NCHANNELS(&mxhouse->frame.header) == 2)
+ *dest++ = (int32_t)(mxhouse->synth.pcm.samples[1][i] << 2);
}
+
+ // Tell calling code buffer size
+ mxhouse->output_ptr = (unsigned char*)dest;
+ mxstat->write_size = mxhouse->output_ptr - (m_OutputBuffer + m_OutputBufferPos);
+
return(FLUSH_BUFFER);
}
diff --git a/xbmc/cores/paplayer/MP3codec.h b/xbmc/cores/paplayer/MP3codec.h
index 3bbbeac7eb..0f7089ca69 100644
--- a/xbmc/cores/paplayer/MP3codec.h
+++ b/xbmc/cores/paplayer/MP3codec.h
@@ -71,7 +71,7 @@ private:
virtual int Decode(int *out_len);
virtual void Flush();
int madx_init(madx_house* mxhouse);
- madx_sig madx_read(madx_house *mxhouse, madx_stat* mxstat, int maxwrite, bool discard = false);
+ madx_sig madx_read(madx_house *mxhouse, madx_stat* mxstat, int maxwrite);
void madx_deinit(madx_house* mxhouse);
/* END decoder functions */