mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-17 09:02:38 -05:00
Move the code segment that corrects the value of (number of packets) to
the parser. This is strictly parser-related and main.c shouldn't have to deal with it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21043 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b63028d80a
commit
95fa7f6a2e
2 changed files with 12 additions and 7 deletions
|
|
@ -121,7 +121,7 @@ void close_wav(int fd, RMContext *rmctx) {
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd, fd_dec;
|
int fd, fd_dec;
|
||||||
int res, datasize,x,i;
|
int res, datasize,i;
|
||||||
int nb_frames = 0;
|
int nb_frames = 0;
|
||||||
#ifdef DUMP_RAW_FRAMES
|
#ifdef DUMP_RAW_FRAMES
|
||||||
char filename[15];
|
char filename[15];
|
||||||
|
|
@ -167,12 +167,6 @@ int main(int argc, char *argv[])
|
||||||
h = rmctx.sub_packet_h;
|
h = rmctx.sub_packet_h;
|
||||||
cook_decode_init(&rmctx,&q);
|
cook_decode_init(&rmctx,&q);
|
||||||
DEBUGF("nb_frames = %d\n",nb_frames);
|
DEBUGF("nb_frames = %d\n",nb_frames);
|
||||||
x = 0;
|
|
||||||
if(packet_count % h)
|
|
||||||
{
|
|
||||||
packet_count += h - (packet_count % h);
|
|
||||||
rmctx.nb_packets = packet_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* change the buffer pointer to point at the first audio frame */
|
/* change the buffer pointer to point at the first audio frame */
|
||||||
advance_buffer(&filebuf, rmctx.data_offset+ DATA_HEADER_SIZE);
|
advance_buffer(&filebuf, rmctx.data_offset+ DATA_HEADER_SIZE);
|
||||||
|
|
|
||||||
|
|
@ -434,6 +434,17 @@ int real_parse_header(int fd, RMContext *rmctx)
|
||||||
skipped += 4;
|
skipped += 4;
|
||||||
if (!rmctx->nb_packets && (rmctx->flags & 4))
|
if (!rmctx->nb_packets && (rmctx->flags & 4))
|
||||||
rmctx->nb_packets = 3600 * 25;
|
rmctx->nb_packets = 3600 * 25;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* nb_packets correction :
|
||||||
|
* in some samples, number of packets may not exactly form
|
||||||
|
* an integer number of scrambling units. This is corrected
|
||||||
|
* by constructing a partially filled unit out of the few
|
||||||
|
* remaining samples at the end of decoding.
|
||||||
|
***/
|
||||||
|
if(rmctx->nb_packets % rmctx->sub_packet_h)
|
||||||
|
rmctx->nb_packets += rmctx->sub_packet_h - (rmctx->nb_packets % rmctx->sub_packet_h);
|
||||||
|
|
||||||
printf(" data_nb_packets = %d\n",rmctx->nb_packets);
|
printf(" data_nb_packets = %d\n",rmctx->nb_packets);
|
||||||
printf(" next DATA offset = %d\n",next_data_off);
|
printf(" next DATA offset = %d\n",next_data_off);
|
||||||
header_end = 1;
|
header_end = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue