From eae3a6a3c2558cebe27bf73d0208ae12ee7e1537 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 6 Jun 2007 21:24:20 +0000 Subject: [PATCH] Assumption about there being MPEG1-only samplerates available and therefore MPEG1-only bitrates for recording is no longer valid. Fix that. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13579 a1c6a512-1295-4272-9138-f99709370657 --- apps/enc_config.c | 20 +++++++++++++++----- firmware/export/enc_base.h | 10 ++++++---- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/apps/enc_config.c b/apps/enc_config.c index 3323c8dd94..c916b295df 100644 --- a/apps/enc_config.c +++ b/apps/enc_config.c @@ -134,7 +134,7 @@ static bool mp3_enc_bitrate(struct menucallback_data *data) /* mono only */ { "16 kBit/s", TALK_ID(16, UNIT_KBIT) }, /* 2 */ { "24 kBit/s", TALK_ID(24, UNIT_KBIT) }, /* 2 */ -#endif +#endif /* HAVE_MPEG2_SAMPR */ /* stereo/mono */ { "32 kBit/s", TALK_ID(32, UNIT_KBIT) }, /* 1,2 */ { "40 kBit/s", TALK_ID(40, UNIT_KBIT) }, /* 1,2 */ @@ -145,16 +145,19 @@ static bool mp3_enc_bitrate(struct menucallback_data *data) { "96 kBit/s", TALK_ID(96, UNIT_KBIT) }, /* 1,2 */ { "112 kBit/s", TALK_ID(112, UNIT_KBIT) }, /* 1,2 */ { "128 kBit/s", TALK_ID(128, UNIT_KBIT) }, /* 1,2 */ -#if 0 + /* Leave out 144 when there is both MPEG 1 and 2 */ +#if defined(HAVE_MPEG2_SAMPR) && !defined (HAVE_MPEG1_SAMPR) /* oddball MPEG2-only rate stuck in the middle */ { "144 kBit/s", TALK_ID(144, UNIT_KBIT) }, /* 2 */ #endif { "160 kBit/s", TALK_ID(160, UNIT_KBIT) }, /* 1,2 */ +#ifdef HAVE_MPEG1_SAMPR /* stereo only */ { "192 kBit/s", TALK_ID(192, UNIT_KBIT) }, /* 1 */ { "224 kBit/s", TALK_ID(224, UNIT_KBIT) }, /* 1 */ { "256 kBit/s", TALK_ID(256, UNIT_KBIT) }, /* 1 */ { "320 kBit/s", TALK_ID(320, UNIT_KBIT) }, /* 1 */ +#endif }; unsigned long rate_list[ARRAYLEN(items)]; @@ -163,10 +166,17 @@ static bool mp3_enc_bitrate(struct menucallback_data *data) storing and maintaining yet another list of numbers */ int n_rates = make_list_from_caps32( MPEG1_BITR_CAPS | MPEG2_BITR_CAPS, mp3_enc_bitr, - MPEG1_BITR_CAPS -#ifdef HAVE_MPEG2_SAMPR - | (MPEG2_BITR_CAPS & ~(MP3_BITR_CAP_144 | MP3_BITR_CAP_8)) + 0 +#ifdef HAVE_MPEG1_SAMPR + | MPEG1_BITR_CAPS #endif +#ifdef HAVE_MPEG2_SAMPR +#ifdef HAVE_MPEG1_SAMPR + | (MPEG2_BITR_CAPS & ~(MP3_BITR_CAP_144 | MP3_BITR_CAP_8)) +#else + | (MPEG2_BITR_CAPS & ~(MP3_BITR_CAP_8)) +#endif +#endif /* HAVE_MPEG2_SAMPR */ , rate_list); int index = round_value_to_list32(cfg->mp3_enc.bitrate, rate_list, diff --git a/firmware/export/enc_base.h b/firmware/export/enc_base.h index e1baa2545a..a9eff523ce 100644 --- a/firmware/export/enc_base.h +++ b/firmware/export/enc_base.h @@ -75,15 +75,17 @@ struct aiff_enc_config #define MPEG2_5_BITR_CAPS MPEG2_BITR_CAPS #endif -/* Assume 44100 is always available and therefore MPEG1 */ - /* HAVE_MPEG* defines mainly apply to the bitrate menu */ -#if (REC_SAMPR_CAPS & MPEG2_SAMPR_CAPS) || defined (HAVE_SPDIF_IN) +#if (REC_SAMPR_CAPS & MPEG1_SAMPR_CAPS) || defined (HAVE_SPDIF_REC) +#define HAVE_MPEG1_SAMPR +#endif + +#if (REC_SAMPR_CAPS & MPEG2_SAMPR_CAPS) || defined (HAVE_SPDIF_REC) #define HAVE_MPEG2_SAMPR #endif #if 0 -#if (REC_SAMPR_CAPS & MPEG2_5_SAMPR_CAPS) || defined (HAVE_SPDIF_IN) +#if (REC_SAMPR_CAPS & MPEG2_5_SAMPR_CAPS) || defined (HAVE_SPDIF_REC) #define HAVE_MPEG2_5_SAMPR #endif #endif /* 0 */