forked from len0rd/rockbox
Code-police raid - cosmetic changes only.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15862 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
aaacb7010f
commit
05b158f81e
1 changed files with 87 additions and 79 deletions
|
|
@ -309,8 +309,8 @@ static int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlen
|
|||
}
|
||||
|
||||
|
||||
static int get_timestamp(int *duration){
|
||||
|
||||
static int get_timestamp(int *duration)
|
||||
{
|
||||
uint8_t tmp8, packet_flags, packet_property;
|
||||
//int stream_id;
|
||||
int ec_length, opaque_data, ec_length_type;
|
||||
|
|
@ -333,8 +333,8 @@ static int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlen
|
|||
/* TODO: We need a better way to detect endofstream */
|
||||
if (tmp8 != 0x82) {
|
||||
DEBUGF("Get timestamp: Detected end of stream\n");
|
||||
|
||||
return ASF_ERROR_EOF; }
|
||||
return ASF_ERROR_EOF;
|
||||
}
|
||||
|
||||
|
||||
if (tmp8 & 0x80) {
|
||||
|
|
@ -354,8 +354,15 @@ static int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlen
|
|||
ec_length = 0;
|
||||
}
|
||||
|
||||
if (ci->read_filebuf(&packet_flags, 1) == 0) { DEBUGF("Detected end of stream 2\n"); return ASF_ERROR_EOF; }
|
||||
if (ci->read_filebuf(&packet_property, 1) == 0) {DEBUGF("Detected end of stream3\n"); return ASF_ERROR_EOF; }
|
||||
if (ci->read_filebuf(&packet_flags, 1) == 0) {
|
||||
DEBUGF("Detected end of stream 2\n");
|
||||
return ASF_ERROR_EOF;
|
||||
}
|
||||
|
||||
if (ci->read_filebuf(&packet_property, 1) == 0) {
|
||||
DEBUGF("Detected end of stream3\n");
|
||||
return ASF_ERROR_EOF;
|
||||
}
|
||||
bytesread += 2;
|
||||
|
||||
datalen = GETLEN2b((packet_flags >> 1) & 0x03) +
|
||||
|
|
@ -372,6 +379,7 @@ static int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlen
|
|||
datap = data;
|
||||
length = GETVALUE2b((packet_flags >> 5) & 0x03, datap);
|
||||
datap += GETLEN2b((packet_flags >> 5) & 0x03);
|
||||
|
||||
/* sequence value is not used */
|
||||
GETVALUE2b((packet_flags >> 1) & 0x03, datap);
|
||||
datap += GETLEN2b((packet_flags >> 1) & 0x03);
|
||||
|
|
@ -385,7 +393,8 @@ static int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlen
|
|||
}
|
||||
|
||||
/*entry point for seeks*/
|
||||
static int seek(int ms, asf_waveformatex_t* wfx){
|
||||
static int seek(int ms, asf_waveformatex_t* wfx)
|
||||
{
|
||||
int time, duration, delta, temp, count=0;
|
||||
|
||||
/*estimate packet number from bitrate*/
|
||||
|
|
@ -396,13 +405,15 @@ static int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlen
|
|||
if (packet_num > last_packet) {
|
||||
packet_num = last_packet;
|
||||
}
|
||||
|
||||
/*calculate byte address of the start of that packet*/
|
||||
int packet_offset = packet_num*wfx->packet_size;
|
||||
|
||||
/*seek to estimated packet*/
|
||||
ci->seek_buffer(ci->id3->first_frame_offset+packet_offset);
|
||||
temp = ms;
|
||||
while(1){
|
||||
while (1)
|
||||
{
|
||||
/*for very large files it can be difficult and unimportant to find the exact packet*/
|
||||
count++;
|
||||
|
||||
|
|
@ -532,8 +543,8 @@ next_track:
|
|||
errcount = 0;
|
||||
new_packet:
|
||||
res = asf_read_packet(&audiobuf, &audiobufsize, &packetlength, &wfx);
|
||||
if(res < 0){
|
||||
|
||||
if (res < 0) {
|
||||
/* We'll try to recover from a parse error a certain number of
|
||||
* times. If we succeed, the error counter will be reset.
|
||||
*/
|
||||
|
|
@ -546,10 +557,8 @@ new_packet:
|
|||
ci->advance_buffer(packetlength);
|
||||
goto new_packet;
|
||||
}
|
||||
|
||||
} else if (res > 0) {
|
||||
wma_decode_superframe_init(&wmadec,
|
||||
audiobuf, audiobufsize);
|
||||
wma_decode_superframe_init(&wmadec, audiobuf, audiobufsize);
|
||||
|
||||
for (i=0; i < wmadec.nb_frames; i++)
|
||||
{
|
||||
|
|
@ -560,8 +569,7 @@ new_packet:
|
|||
ci->yield ();
|
||||
|
||||
if (wmares < 0) {
|
||||
/* Do the above, but for errors in decode.
|
||||
*/
|
||||
/* Do the above, but for errors in decode. */
|
||||
errcount++;
|
||||
DEBUGF("WMA decode error %d, errcount %d\n",wmares, errcount);
|
||||
if (errcount > 5) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue