decoder/mad: parse_rva2() returns bool

This commit is contained in:
Max Kellermann 2010-07-20 18:11:58 +02:00
parent 898a13f196
commit 172182b18f
1 changed files with 8 additions and 9 deletions

View File

@ -209,14 +209,14 @@ mp3_fill_buffer(struct mp3_data *data)
#ifdef HAVE_ID3TAG #ifdef HAVE_ID3TAG
/* Parse mp3 RVA2 frame. Shamelessly stolen from madplay. */ /* Parse mp3 RVA2 frame. Shamelessly stolen from madplay. */
static int parse_rva2(struct id3_tag * tag, struct replay_gain_info * replay_gain_info) static bool
parse_rva2(struct id3_tag *tag, struct replay_gain_info *replay_gain_info)
{ {
struct id3_frame const * frame; struct id3_frame const * frame;
id3_latin1_t const *id; id3_latin1_t const *id;
id3_byte_t const *data; id3_byte_t const *data;
id3_length_t length; id3_length_t length;
int found;
enum { enum {
CHANNEL_OTHER = 0x00, CHANNEL_OTHER = 0x00,
@ -230,18 +230,18 @@ static int parse_rva2(struct id3_tag * tag, struct replay_gain_info * replay_gai
CHANNEL_SUBWOOFER = 0x08 CHANNEL_SUBWOOFER = 0x08
}; };
found = 0;
/* relative volume adjustment information */ /* relative volume adjustment information */
frame = id3_tag_findframe(tag, "RVA2", 0); frame = id3_tag_findframe(tag, "RVA2", 0);
if (!frame) return 0; if (frame == NULL)
return false;
id = id3_field_getlatin1(id3_frame_field(frame, 0)); id = id3_field_getlatin1(id3_frame_field(frame, 0));
data = id3_field_getbinarydata(id3_frame_field(frame, 1), data = id3_field_getbinarydata(id3_frame_field(frame, 1),
&length); &length);
if (!id || !data) return 0; if (id == NULL || data == NULL)
return false;
/* /*
* "The 'identification' string is used to identify the * "The 'identification' string is used to identify the
@ -284,15 +284,14 @@ static int parse_rva2(struct id3_tag * tag, struct replay_gain_info * replay_gai
"%+.1f dB adjustment (%s)\n", "%+.1f dB adjustment (%s)\n",
voladj_float, id); voladj_float, id);
found = 1; return true;
break;
} }
data += 4 + peak_bytes; data += 4 + peak_bytes;
length -= 4 + peak_bytes; length -= 4 + peak_bytes;
} }
return found; return false;
} }
#endif #endif