mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
Remove ATRAC3 specific fields (channels, extradata_size) from mp3entry
Also fixes typo of using never initialized id3->channels in wav metadata (introduced in 2d1937a1)
Change-Id: I28cddec2b9d9bd1e756ffaa004b4f6e8528a7566
This commit is contained in:
parent
be16edc94b
commit
76ec55cc49
11 changed files with 22 additions and 35 deletions
|
|
@ -272,10 +272,6 @@ struct mp3entry {
|
|||
bool has_toc; /* True if there is a VBR header in the file */
|
||||
unsigned char toc[100]; /* table of contents */
|
||||
|
||||
/* Added for ATRAC3 */
|
||||
unsigned int channels; /* Number of channels in the stream */
|
||||
unsigned int extradata_size; /* Size (in bytes) of the codec's extradata from the container */
|
||||
|
||||
/* Added for AAC HE SBR */
|
||||
bool needs_upsampling_correction; /* flag used by aac codec */
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ bool get_musepack_metadata(int fd, struct mp3entry *id3)
|
|||
id3->frequency = sfreqs[(sv8_header[k++] >> 5) & 0x0003];
|
||||
|
||||
/* Number of channels */
|
||||
id3->channels = (sv8_header[k++] >> 4) + 1;
|
||||
//uint8_t channels = (sv8_header[k++] >> 4) + 1;
|
||||
|
||||
/* Skip to next tag: k = size -2 */
|
||||
k = size - 2;
|
||||
|
|
|
|||
|
|
@ -149,10 +149,6 @@ static int oma_read_header(int fd, struct mp3entry* id3)
|
|||
|
||||
id3->bitrate = id3->frequency * id3->bytesperframe * 8 / (1024 * 1000);
|
||||
|
||||
/* fake the atrac3 extradata (wav format, makes stream copy to wav work) */
|
||||
/* ATRAC3 expects and extra-data size of 14 bytes for wav format, and *
|
||||
* looks for that in the id3v2buf. */
|
||||
id3->extradata_size = 14;
|
||||
AV_WL16(&id3->id3v2buf[0], 1); // always 1
|
||||
AV_WL32(&id3->id3v2buf[2], id3->frequency); // samples rate
|
||||
AV_WL16(&id3->id3v2buf[6], jsflag); // coding mode
|
||||
|
|
@ -160,7 +156,6 @@ static int oma_read_header(int fd, struct mp3entry* id3)
|
|||
AV_WL16(&id3->id3v2buf[10], 1); // always 1
|
||||
AV_WL16(&id3->id3v2buf[12], 0); // always 0
|
||||
|
||||
id3->channels = 2;
|
||||
DEBUGF("sample_rate = %d\n", id3->frequency);
|
||||
DEBUGF("frame_size = %d\n", id3->bytesperframe);
|
||||
DEBUGF("stereo_coding_mode = %d\n", jsflag);
|
||||
|
|
|
|||
|
|
@ -502,8 +502,6 @@ bool get_rm_metadata(int fd, struct mp3entry* id3)
|
|||
break;
|
||||
}
|
||||
|
||||
id3->channels = rmctx->nb_channels;
|
||||
id3->extradata_size = rmctx->extradata_size;
|
||||
id3->bitrate = (rmctx->bit_rate + 500) / 1000;
|
||||
id3->frequency = rmctx->sample_rate;
|
||||
id3->length = rmctx->duration;
|
||||
|
|
|
|||
|
|
@ -93,21 +93,21 @@ bool get_tta_metadata(int fd, struct mp3entry* id3)
|
|||
|
||||
/* skip check CRC */
|
||||
|
||||
id3->channels = (GET_HEADER(ttahdr, NUM_CHANNELS));
|
||||
unsigned short channels = (GET_HEADER(ttahdr, NUM_CHANNELS));
|
||||
id3->frequency = (GET_HEADER(ttahdr, SAMPLE_RATE));
|
||||
id3->length = ((GET_HEADER(ttahdr, DATA_LENGTH)) / id3->frequency) * 1000LL;
|
||||
bps = (GET_HEADER(ttahdr, BITS_PER_SAMPLE));
|
||||
|
||||
datasize = id3->filesize - id3->first_frame_offset;
|
||||
origsize = (GET_HEADER(ttahdr, DATA_LENGTH)) * ((bps + 7) / 8) * id3->channels;
|
||||
origsize = (GET_HEADER(ttahdr, DATA_LENGTH)) * ((bps + 7) / 8) * channels;
|
||||
|
||||
id3->bitrate = (int) ((uint64_t) datasize * id3->frequency * id3->channels * bps
|
||||
id3->bitrate = (int) ((uint64_t) datasize * id3->frequency * channels * bps
|
||||
/ (origsize * 1000LL));
|
||||
|
||||
/* output header info (for debug) */
|
||||
DEBUGF("TTA header info ----\n");
|
||||
DEBUGF("id: %x\n", (unsigned int)(GET_HEADER(ttahdr, ID)));
|
||||
DEBUGF("channels: %d\n", id3->channels);
|
||||
DEBUGF("channels: %d\n", channels);
|
||||
DEBUGF("frequency: %ld\n", id3->frequency);
|
||||
DEBUGF("length: %ld\n", id3->length);
|
||||
DEBUGF("bitrate: %d\n", id3->bitrate);
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ static void set_totalsamples(struct wave_fmt *fmt, struct mp3entry* id3)
|
|||
fmt->samplesperblock = 1;
|
||||
break;
|
||||
case WAVE_FORMAT_YAMAHA_ADPCM:
|
||||
if (id3->channels != 0)
|
||||
if (fmt->channels != 0)
|
||||
{
|
||||
fmt->samplesperblock =
|
||||
(fmt->blockalign == ((id3->frequency / 60) + 4) * fmt->channels)?
|
||||
|
|
@ -172,7 +172,7 @@ static void set_totalsamples(struct wave_fmt *fmt, struct mp3entry* id3)
|
|||
fmt->samplesperblock = 2;
|
||||
break;
|
||||
case WAVE_FORMAT_SWF_ADPCM:
|
||||
if (fmt->bitspersample != 0 && id3->channels != 0)
|
||||
if (fmt->bitspersample != 0 && fmt->channels != 0)
|
||||
{
|
||||
fmt->samplesperblock
|
||||
= (((fmt->blockalign << 3) - 2) / fmt->channels - 22)
|
||||
|
|
@ -226,8 +226,6 @@ static void parse_riff_format(unsigned char* buf, int fmtsize, struct wave_fmt *
|
|||
if(id3->bitrate == 66 || id3->bitrate == 94)
|
||||
jsflag = 1;
|
||||
|
||||
id3->extradata_size = 14;
|
||||
id3->channels = 2;
|
||||
id3->codectype = AFMT_OMA_ATRAC3;
|
||||
id3->bytesperframe = fmt->blockalign;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue