comparison libmpdemux/muxer_mpeg.c @ 14927:4aa57ea6d129

fixed support for mp3 at <32000 sample_rate
author nicodvb
date Mon, 07 Mar 2005 07:36:27 +0000
parents 8511347a0475
children c73c1ea04d9c
comparison
equal deleted inserted replaced
14926:56df5a1c7a3f 14927:4aa57ea6d129
997 #define min(a, b) ((a) <= (b) ? (a) : (b)) 997 #define min(a, b) ((a) <= (b) ? (a) : (b))
998 998
999 999
1000 static uint32_t get_audio_frame_size(muxer_headers_t *spriv, uint8_t *buf, int format, int samples_ps) 1000 static uint32_t get_audio_frame_size(muxer_headers_t *spriv, uint8_t *buf, int format, int samples_ps)
1001 { 1001 {
1002 uint32_t sz, tmp; 1002 uint32_t sz, tmp, spf;
1003 1003
1004 #ifdef USE_LIBA52 1004 #ifdef USE_LIBA52
1005 #include "../liba52/a52.h" 1005 #include "../liba52/a52.h"
1006 if(format == 0x2000) 1006 if(format == 0x2000)
1007 { 1007 {
1009 sz = (uint32_t) a52_syncinfo(buf, &t1, &t2, &t3); 1009 sz = (uint32_t) a52_syncinfo(buf, &t1, &t2, &t3);
1010 if(sz) 1010 if(sz)
1011 return sz; 1011 return sz;
1012 } 1012 }
1013 #endif 1013 #endif
1014 tmp = spriv->bitrate * (format == 0x2000 ? 1536 : 1152); 1014 if(format == 0x2000)
1015 spf = 1536;
1016 else if((format == 0x55) && (samples_ps < 32000))
1017 spf = 576;
1018 else
1019 spf = 1152;
1020
1021 tmp = spriv->bitrate * spf;
1015 sz = tmp / samples_ps; 1022 sz = tmp / samples_ps;
1016 if(sz % 2) 1023 if(sz % 2)
1017 sz++; 1024 sz++;
1018 1025
1019 return sz; 1026 return sz;