aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2015-11-21 10:16:59 +0100
committerStefan Pöschel <github@basicmaster.de>2015-11-21 10:16:59 +0100
commite7ad517d42eb83402de23552bea61274c5f89e4f (patch)
tree2029acf84c9f6da74e54b4828f17443f545a8801
parent24ace15491f76184c7e67ddd8ce7331c178df86d (diff)
downloadtoolame-dab-e7ad517d42eb83402de23552bea61274c5f89e4f.tar.gz
toolame-dab-e7ad517d42eb83402de23552bea61274c5f89e4f.tar.bz2
toolame-dab-e7ad517d42eb83402de23552bea61274c5f89e4f.zip
Fix wrong X-PAD location at 48khz and bitrates < 56kbps per channel
-rw-r--r--toolame.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/toolame.c b/toolame.c
index b648c99..1acde80 100644
--- a/toolame.c
+++ b/toolame.c
@@ -275,9 +275,6 @@ int main (int argc, char **argv)
adb = available_bits (&header, &glopts);
lg_frame = adb / 8;
if (header.dab_extension) {
- /* in 24 kHz we always have 4 bytes */
- if (header.sampling_frequency == 1)
- header.dab_extension = 4;
/* You must have one frame in memory if you are in DAB mode */
/* in conformity of the norme ETS 300 401 http://www.etsi.org */
/* see bitstream.c */
@@ -1034,20 +1031,10 @@ void parse_args (int argc, char **argv, frame_info * frame, int *psy,
/* Always enable DAB mode */
header->error_protection = TRUE;
- header->dab_extension = 2;
+ header->dab_extension = 4;
header->padding = 0;
glopts.dab = TRUE;
- if (header->dab_extension) {
- /* in 48 kHz */
- /* if the bit rate per channel is less then 56 kbit/s, we have 2 scf-crc */
- /* else we have 4 scf-crc */
- /* in 24 kHz, we have 4 scf-crc, see main loop */
- if (brate / (header->mode == MPG_MD_MONO ? 1 : 2) >= 56)
- header->dab_extension = 4;
- }
-
-
if (err)
usage (); /* If err has occured, then call usage() */
@@ -1113,6 +1100,15 @@ void parse_args (int argc, char **argv, frame_info * frame, int *psy,
if ((header->bitrate_index = BitrateIndex (brate, header->version)) < 0)
err = 1;
+ if (header->dab_extension) {
+ /* in 48 kHz (= MPEG-1) */
+ /* if the bit rate per channel is less then 56 kbit/s, we have 2 scf-crc */
+ /* else we have 4 scf-crc */
+ /* in 24 kHz (= MPEG-2), we have 4 scf-crc */
+ if (header->version == MPEG_AUDIO_ID && (brate / (header->mode == MPG_MD_MONO ? 1 : 2) < 56))
+ header->dab_extension = 2;
+ }
+
bs.zmq_framesize = 3 * brate;
/* All options are hunky dory, open the input audio file and