You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(7) |
Apr
(22) |
May
(66) |
Jun
(60) |
Jul
(35) |
Aug
(43) |
Sep
(42) |
Oct
(76) |
Nov
(16) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(10) |
Feb
|
Mar
|
Apr
(72) |
May
(18) |
Jun
(7) |
Jul
(7) |
Aug
(5) |
Sep
(49) |
Oct
(6) |
Nov
(22) |
Dec
(23) |
2006 |
Jan
|
Feb
(14) |
Mar
|
Apr
(11) |
May
|
Jun
(18) |
Jul
|
Aug
|
Sep
|
Oct
(34) |
Nov
|
Dec
|
From: Francois B <mrs...@us...> - 2006-10-20 02:27:59
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3733 Modified Files: metadata.c Log Message: Added function to get next free buffer pointer Index: metadata.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/metadata.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** metadata.c 10 Oct 2006 23:47:57 -0000 1.1 --- metadata.c 20 Oct 2006 02:27:57 -0000 1.2 *************** *** 13,28 **** #include <string.h> ! int meta_get_used_buffer_size( const struct meta_data *meta ) { int i; ! short max_offset = 0; ! short* off_array = (short*)meta; //find largest offset for( i=0; i< 9; ++i ) { ! if( off_array[i] > max_offset ) ! max_offset = off_array[i]; } return (max_offset + strlen(meta->buffer + max_offset) + 1); } --- 13,38 ---- #include <string.h> ! unsigned int meta_get_used_buffer_size( const struct meta_data *meta ) { int i; ! unsigned short max_offset = 0; ! unsigned short* offset_array = &meta->title_offset; //find largest offset for( i=0; i< 9; ++i ) { ! if( offset_array[i] > max_offset ) ! max_offset = offset_array[i]; } return (max_offset + strlen(meta->buffer + max_offset) + 1); } + + unsigned char* meta_get_avail_buffer( const struct meta_data *meta ) + { + unsigned int used = meta_get_used_buffer_size( meta ); + + if( used < METADATA_BUFFER_SIZE ) + return meta->buffer + used; + + return NULL; + } |
From: Francois B <mrs...@us...> - 2006-10-20 02:27:22
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3687 Modified Files: id3.c Log Message: Fixed text parsing Index: id3.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/id3.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** id3.c 10 Oct 2006 23:47:13 -0000 1.10 --- id3.c 20 Oct 2006 02:27:20 -0000 1.11 *************** *** 489,493 **** char tmp[4]; unsigned char *buffer = meta->buffer; ! int bufferpos = 1; int bytesread = 0; int buffersize = METADATA_BUFFER_SIZE; --- 489,493 ---- char tmp[4]; unsigned char *buffer = meta->buffer; ! unsigned int bufferpos = 1; int bytesread = 0; int buffersize = METADATA_BUFFER_SIZE; *************** *** 536,541 **** //Read extended header size ! if(read(fd, buffer, 4)!=4) return -2; framelen = UNSYNC(buffer[0], buffer[1], buffer[2], buffer[3]); --- 536,542 ---- //Read extended header size ! if(read(fd, buffer, 4)!=4) { return -2; + } framelen = UNSYNC(buffer[0], buffer[1], buffer[2], buffer[3]); *************** *** 654,658 **** const struct tag_resolver* tr = &taglist[i]; ! short* ptag_offset = 0; int bytes_to_read; int len; --- 655,659 ---- const struct tag_resolver* tr = &taglist[i]; ! unsigned short* ptag_offset = 0; int bytes_to_read; int len; *************** *** 670,676 **** bytesread = read(fd, tmp_buffer, bytes_to_read); ! if( bytesread != bytes_to_read ) return -2; ! //Skip the rest of the frame we couldn't fit in our buffer if( framelen > bytes_to_read ) --- 671,679 ---- bytesread = read(fd, tmp_buffer, bytes_to_read); ! if( bytesread != bytes_to_read ) { ! //msg_error( "Error -2!" ); return -2; ! } ! //Skip the rest of the frame we couldn't fit in our buffer if( framelen > bytes_to_read ) *************** *** 687,698 **** if( tr->offset != (size_t)(-1) ) { ! ptag_offset = (short*) ((char*)meta + tr->offset); len = tr->ppFunc(version, tmp_buffer, bytesread, buffer + bufferpos, buffersize - bufferpos ); if( len ) { ! len++; *ptag_offset = bufferpos; ! // msg_error( "%s\n%s", tr->tag, buffer + bufferpos ); } } --- 690,701 ---- if( tr->offset != (size_t)(-1) ) { ! ptag_offset = (unsigned short*) ((char*)meta + tr->offset); len = tr->ppFunc(version, tmp_buffer, bytesread, buffer + bufferpos, buffersize - bufferpos ); if( len ) { ! ++len; *ptag_offset = bufferpos; ! //msg_error( "%s\n%d\n%s", tr->tag, bufferpos, buffer + bufferpos ); } } *************** *** 709,713 **** if( desc_len > 0 ) { ! if( strcmp( desc_text, "replaygain_track_gain" ) == 0 ) { len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); --- 712,716 ---- if( desc_len > 0 ) { ! if( strcasecmp( desc_text, "replaygain_track_gain" ) == 0 ) { len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); *************** *** 719,723 **** } } ! else if( strcmp( desc_text, "replaygain_track_peak" ) == 0 ) { len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); --- 722,726 ---- } } ! else if( strcasecmp( desc_text, "replaygain_track_peak" ) == 0 ) { len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); *************** *** 729,733 **** } } ! else if( strcmp( desc_text, "replaygain_album_gain" ) == 0 ) { len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); --- 732,736 ---- } } ! else if( strcasecmp( desc_text, "replaygain_album_gain" ) == 0 ) { len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); *************** *** 778,781 **** --- 781,785 ---- int i; bool bom = false; + unsigned char *outptr = decoded; if( encoding != 0x01 && encoding != 0x02 ) { *************** *** 783,795 **** int len = MIN( max_decoded-1, encoded_len ); ! //ansi or UTF-8, copy only characters that can be displayed ! while( *encoded && --len ) { ! ! if( isalnum(*encoded) ) ! *decoded++ = *encoded; encoded++; } ! *decoded = 0; } else { --- 787,797 ---- int len = MIN( max_decoded-1, encoded_len ); ! //ansi or UTF-8 ! while( *encoded && len-- ) { + *outptr++ = *encoded; encoded++; } ! *outptr = 0; } else { *************** *** 826,832 **** while( (encoded[0] || encoded[1]) && i < max_decoded ) { if(encoded[1]) ! decoded[i++] = '.'; else ! decoded[i++] = encoded[0]; encoded +=2; --- 828,834 ---- while( (encoded[0] || encoded[1]) && i < max_decoded ) { if(encoded[1]) ! outptr[i++] = '.'; else ! outptr[i++] = encoded[0]; encoded +=2; *************** *** 837,843 **** while( (encoded[0] || encoded[1]) && i < max_decoded ) { if(encoded[0]) ! decoded[i++] = '.'; else ! decoded[i++] = encoded[1]; encoded +=2; --- 839,845 ---- while( (encoded[0] || encoded[1]) && i < max_decoded ) { if(encoded[0]) ! outptr[i++] = '.'; else ! outptr[i++] = encoded[1]; encoded +=2; *************** *** 845,849 **** } ! decoded[i]=0; //terminate the string } --- 847,851 ---- } ! outptr[i]=0; //terminate the string } |
From: Francois B <mrs...@us...> - 2006-10-20 02:27:08
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3571 Modified Files: ape.c Log Message: Ape tags parsed in addition to id3 Index: ape.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/ape.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ape.c 10 Oct 2006 23:45:38 -0000 1.1 --- ape.c 20 Oct 2006 02:27:03 -0000 1.2 *************** *** 102,107 **** total_size += 32; ! //We might not need to parse the values if we already parsed id3v2 tags ! if( !meta || meta->buffer[1] != 0 ) return total_size; --- 102,106 ---- total_size += 32; ! if( !meta ) return total_size; *************** *** 112,117 **** // msg_error( "items: %i", item_count ); ! out_buffer = &meta->buffer[1]; ! while( item_count-- ) { --- 111,116 ---- // msg_error( "items: %i", item_count ); ! out_buffer = meta_get_avail_buffer( meta ); ! while( item_count-- ) { *************** *** 142,160 **** p_meta_offset = (short*) ((char*)meta + taglist[i].offset); ! ! *p_meta_offset = (size_t)out_buffer - (size_t)meta->buffer; ! if( taglist[i].parser ) { ! int len = taglist[i].parser( buffer + 9 + key_len, value_len, out_buffer, METADATA_BUFFER_SIZE - ((size_t)out_buffer - (size_t)meta->buffer) ); ! out_buffer += (len + 1); } - else { ! //default text tag ! memcpy( out_buffer, buffer + 9 + key_len, value_len ); ! out_buffer[value_len] = 0; ! out_buffer += (value_len + 1); ! } } } --- 141,166 ---- p_meta_offset = (short*) ((char*)meta + taglist[i].offset); ! ! //No need to parse a tag that was already parsed in the id3v2 block ! if( *p_meta_offset == 0 ) { ! *p_meta_offset = (size_t)out_buffer - (size_t)meta->buffer; ! //msg_error( "Parsing: %s\n%d", taglist[i].key, *p_meta_offset ); ! if( taglist[i].parser ) { ! ! int len = taglist[i].parser( buffer + 9 + key_len, value_len, out_buffer, METADATA_BUFFER_SIZE - ((size_t)out_buffer - (size_t)meta->buffer) ); ! out_buffer += (len + 1); ! } ! else { ! ! //default text tag ! memcpy( out_buffer, buffer + 9 + key_len, value_len ); ! out_buffer[value_len] = 0; ! out_buffer += (value_len + 1); ! } } ! break; } } |
From: Francois B <mrs...@us...> - 2006-10-20 02:26:34
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3287 Modified Files: VERSION Log Message: bumped version Index: VERSION =================================================================== RCS file: /cvsroot/openneo/openneo/apps/VERSION,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VERSION 10 Oct 2006 23:39:32 -0000 1.5 --- VERSION 20 Oct 2006 02:26:31 -0000 1.6 *************** *** 1 **** ! 2.1 beta 12 --- 1 ---- ! 2.1 beta 13 |
From: Francois B <mrs...@us...> - 2006-10-10 23:50:58
|
Update of /cvsroot/openneo/openneo/apps/lang In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11855 Modified Files: english.lang Log Message: updated strings Index: english.lang =================================================================== RCS file: /cvsroot/openneo/openneo/apps/lang/english.lang,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** english.lang 11 Nov 2005 03:39:37 -0000 1.26 --- english.lang 10 Oct 2006 23:50:54 -0000 1.27 *************** *** 257,263 **** new: ! id: LANG_ID3_ALBUM ! desc: in wps ! eng: "[Album]" new: --- 257,263 ---- new: ! id: LANG_ALBUM ! desc: ! eng: "Album" new: *************** *** 1146,1147 **** --- 1146,1157 ---- eng: "Comments" new: + + id: LANG_YEAR + desc: the word 'year' + eng: "Year" + new: + + id: LANG_REPLAYGAIN + desc: + eng: "ReplayGain" + new: \ No newline at end of file |
From: Francois B <mrs...@us...> - 2006-10-10 23:49:35
|
Update of /cvsroot/openneo/openneo/firmware/export In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11431 Removed Files: mp3data.h Log Message: no message --- mp3data.h DELETED --- |
From: Francois B <mrs...@us...> - 2006-10-10 23:49:15
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11399 Removed Files: mp3data.c Log Message: no message --- mp3data.c DELETED --- |
From: Francois B <mrs...@us...> - 2006-10-10 23:47:59
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10664 Added Files: metadata.c Log Message: get free buffer size from metadata struct --- NEW FILE: metadata.c --- /*************************************************************************** * * Open Neo * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #include "metadata.h" #include <string.h> int meta_get_used_buffer_size( const struct meta_data *meta ) { int i; short max_offset = 0; short* off_array = (short*)meta; //find largest offset for( i=0; i< 9; ++i ) { if( off_array[i] > max_offset ) max_offset = off_array[i]; } return (max_offset + strlen(meta->buffer + max_offset) + 1); } |
From: Francois B <mrs...@us...> - 2006-10-10 23:47:15
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10648 Modified Files: id3.c Log Message: Fixed id3 parsing bug Index: id3.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/id3.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** id3.c 6 Dec 2005 00:47:21 -0000 1.9 --- id3.c 10 Oct 2006 23:47:13 -0000 1.10 *************** *** 51,71 **** #include "debug.h" #include "atoi.h" - #include "id3.h" - #include "mp3data.h" #include "system.h" ! static const char* id3_ver_array[] __attribute__ ((section (".rodata"))); ! static const char* id3_ver_array[] = { ! NULL, ! "1.0", ! "1.1", ! "2.2", ! "2.3", ! "2.4" ! }; ! ! static const char* genres[] __attribute__ ((section (".rodata"))); ! static const char* genres[] = { "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", --- 51,59 ---- #include "debug.h" #include "atoi.h" #include "id3.h" #include "system.h" ! //static const unsigned char* genres[] __attribute__ ((section (".rodata"))); ! static const unsigned char* genres[] = { "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", *************** *** 93,96 **** --- 81,92 ---- }; + enum { + ID3_VER_1_0 = 1, + ID3_VER_1_1, + ID3_VER_2_2, + ID3_VER_2_3, + ID3_VER_2_4 + }; + #define UNSYNC(b0,b1,b2,b3) (((b0 & 0x7F) << (3*7)) | \ ((b1 & 0x7F) << (2*7)) | \ *************** *** 98,106 **** ((b3 & 0x7F) << (0*7))) - #define BYTES2INT(b0,b1,b2,b3) (((b0 & 0xFF) << (3*8)) | \ - ((b1 & 0xFF) << (2*8)) | \ - ((b2 & 0xFF) << (1*8)) | \ - ((b3 & 0xFF) << (0*8))) - /* HOW TO ADD ADDITIONAL ID3 VERSION 2 TAGS --- 94,97 ---- *************** *** 160,164 **** }; ! static unsigned char* decode_text( int encoding, unsigned char* string, int *len ); static bool global_ff_found; --- 151,155 ---- }; ! static int decode_text( int encoding, const unsigned char *encoded, int encoded_len, unsigned char *decoded, int max_decoded ); static bool global_ff_found; *************** *** 242,282 **** }; ! ! static int parse_text( int version,unsigned char *frame_data, int data_length, unsigned char *buffer, int buffer_size ) ! { ! int return_length = 0; ! int string_length; ! const unsigned char *start; ! int data_to_copy_length; ! ! if( version >= ID3_VER_2_3 ) { ! ! if( data_length == 1 ) ! return 0; ! ! string_length = data_length - 1; ! start = &frame_data[1]; ! ! if( *frame_data != 0x00 ) ! start = decode_text( *frame_data, start, &string_length); ! } ! else { ! string_length = data_length; ! start = frame_data; ! } ! ! data_to_copy_length = MIN( buffer_size - 1, string_length ); ! ! if( data_to_copy_length > 0 ) { ! strncpy( buffer, start, data_to_copy_length ); ! buffer[data_to_copy_length] = 0; ! ! //msg_error( buffer ); ! ! strtrim( buffer, " " ); ! return_length = strlen(buffer) + 1; ! } ! ! return return_length; } --- 233,240 ---- }; ! static int parse_text( int version, unsigned char *frame_data, int data_length, unsigned char *buffer, int buffer_size ) ! { ! (void)version; ! return decode_text( frame_data[0], &frame_data[1], data_length - 1, buffer, buffer_size ); } *************** *** 338,342 **** //Make sure the value is null terminated buffer[bytes_to_copy] = 0; ! return (bytes_to_copy + 1); } --- 296,300 ---- //Make sure the value is null terminated buffer[bytes_to_copy] = 0; ! return bytes_to_copy; } *************** *** 344,486 **** } ! static int parse_comments( int version, unsigned char *frame_data, int frame_data_length, unsigned char *buffer, int buffer_length ) { - int return_length = 0; - int data_to_copy_length = 0; unsigned char *start; ! int desc_length; int string_length = 0; (void)version; ! if( *frame_data == 0x00 ) { //Ansi ! desc_length = strlen(&frame_data[4]); ! start = frame_data + 5 + desc_length; ! string_length = frame_data_length - desc_length - 5; } else { //Unicode ! if( &frame_data[4] != 0x00 && &frame_data[5] != 0x00 ) { ! int desc_length = frame_data_length - 4; ! //Skip the description ! start = decode_text( *frame_data, &frame_data[4], &desc_length); ! string_length = frame_data_length - 4 - desc_length; ! start = decode_text( *frame_data, &frame_data + 4 + desc_length, &string_length); ! } ! else { //No description ! ! string_length = frame_data_length - 6; ! start = decode_text( *frame_data, &frame_data[6], &string_length); ! } } ! data_to_copy_length = MIN( buffer_length - 1, string_length ); ! ! if( (data_to_copy_length > 0 ) && *start ) { ! strncpy( buffer, start, data_to_copy_length ); ! buffer[data_to_copy_length] = 0; ! return_length = data_to_copy_length + 1; } ! return return_length; } ! static struct tag_resolver taglist[] = { ! { "TPE1", 4, offsetof(struct id3_info, artist_offset), NULL }, ! { "TP1", 3, offsetof(struct id3_info, artist_offset), NULL }, ! { "TCOM", 4, offsetof(struct id3_info, composer_offset), NULL }, ! { "TIT2", 4, offsetof(struct id3_info, title_offset), NULL }, ! { "TT2", 3, offsetof(struct id3_info, title_offset), NULL }, ! { "TALB", 4, offsetof(struct id3_info, album_offset), NULL }, ! { "TAL", 3, offsetof(struct id3_info, album_offset), NULL }, ! { "TRK", 3, offsetof(struct id3_info, track_offset), NULL }, ! { "TRCK", 4, offsetof(struct id3_info, track_offset), NULL }, ! { "TDRC", 4, offsetof(struct id3_info, year_offset), NULL }, ! { "TYER", 4, offsetof(struct id3_info, year_offset), NULL }, ! { "TYE", 3, offsetof(struct id3_info, year_offset), NULL }, ! { "TCON", 4, offsetof(struct id3_info, genre_offset), parse_genre }, ! { "TCO", 3, offsetof(struct id3_info, genre_offset), parse_genre }, ! { "TPE2", 4, offsetof(struct id3_info, band_offset), NULL }, ! { "COMM", 4, offsetof(struct id3_info, comment_offset), parse_comments } }; #define TAGLIST_SIZE ((int)(sizeof(taglist) / sizeof(taglist[0]))) ! ! /* ! * Calculates the length (in milliseconds) of an MP3 file. ! * ! * Modified to only use integers. ! * ! * Arguments: file - the file to calculate the length upon ! * entry - the entry to update with the length ! * ! * Returns: the song length in milliseconds, ! * 0 means that it couldn't be calculated ! */ ! /* static int getsonglength(int fd, struct mp3entry *entry) */ ! /* { */ ! /* unsigned int filetime = 0; */ ! /* struct mp3info info; */ ! /* int bytecount; */ ! ! /* int start = lseek( fd, 0, SEEK_CUR); */ ! ! /* bytecount = get_mp3file_info(fd, &info); */ ! ! /* DEBUGF("Space between ID3V2 tag and first audio frame: 0x%x bytes\n", */ ! /* bytecount); */ ! ! /* if(bytecount < 0) */ ! /* return -1; */ ! ! /* bytecount += start; */ ! ! /* entry->bitrate = info.bitrate; */ ! /* entry->frequency = info.frequency; */ ! /* entry->version = info.version; */ ! /* entry->layer = info.layer; */ ! ! /* /* If the file time hasn't been established, this may be a fixed */ ! /* rate MP3, so just use the default formula */ ! ! /* filetime = info.file_time; */ ! ! /* if(filetime == 0) */ ! /* { */ ! /* /* */ ! /* * Now song length is */ ! /* * ((filesize)/(bytes per frame))*(time per frame) */ ! /* */ ! /* filetime = entry->filesize/info.frame_size*info.frame_time; */ ! /* } */ ! ! /* entry->tpf = info.frame_time; */ ! /* entry->bpf = info.frame_size; */ ! ! /* entry->vbr = info.is_vbr; */ ! ! /* entry->vbr_header_pos = info.vbr_header_pos; */ ! ! /* /* Update the seek point for the first playable frame */ ! /* entry->first_frame_offset = bytecount; */ ! /* DEBUGF("First frame is at %x\n", entry->first_frame_offset); */ ! ! /* return filetime; */ ! /* } */ ! ! ! const char* id3_version( unsigned int version ) ! { ! if( version < (sizeof(id3_ver_array)/sizeof(char*)) ) ! return id3_ver_array[version]; ! return NULL; ! } ! ! int id3_parse_v1( int fd, struct id3_info *id3 ) { char field_buffer[32]; --- 302,393 ---- } ! static int parse_comments( int version, unsigned char *frame_data, int frame_data_length, unsigned char *buffer, int buffer_length ) { unsigned char *start; ! int desc_len; int string_length = 0; + int encoding = frame_data[0]; (void)version; ! if( encoding == 0x00 || encoding == 0x03 ) { //ISO-8859-1 or UTF-8 ! desc_len = strlen( &frame_data[4] ) + 1; ! start = frame_data + 4 + desc_len; ! string_length = frame_data_length - desc_len - 4; } else { //Unicode ! //Calculate the "Short content description" length ! short* ptr = (short*)&frame_data[4]; ! desc_len = 2; ! while( *ptr ) ! desc_len+=2; ! ! //we Skip it ! start = &frame_data[4] + desc_len; ! string_length = frame_data_length - desc_len - 4; ! } ! return decode_text( encoding, start, string_length, buffer, buffer_length ); ! } ! static int parse_custom_text( int version, unsigned char *frame_data, int frame_data_length, unsigned char *buffer, int buffer_length ) ! { ! unsigned char *start; ! int desc_len; ! int string_length = 0; ! int encoding = frame_data[0]; ! (void)version; ! ! if( encoding == 0x00 || encoding == 0x03 ) { //ISO-8859-1 or UTF-8 ! ! desc_len = strlen( &frame_data[1] ) + 1; ! start = frame_data + desc_len + 1; ! string_length = frame_data_length - desc_len - 1; } + else { //Unicode ! short* ptr = (short*)&frame_data[1]; ! ! //Calculate the "description" length ! desc_len = 2; ! ! while( *ptr ) ! desc_len+=2; ! ! //Skip the description ! start = &frame_data[1] + desc_len; ! string_length = frame_data_length - desc_len - 1; } ! return decode_text( encoding, start, string_length, buffer, buffer_length); } ! static const struct tag_resolver taglist[] = { ! { "TPE1", 4, offsetof(struct meta_data, artist_offset), parse_text }, ! { "TCOM", 4, offsetof(struct meta_data, composer_offset), parse_text }, ! { "TIT2", 4, offsetof(struct meta_data, title_offset), parse_text }, ! { "TALB", 4, offsetof(struct meta_data, album_offset), parse_text }, ! { "TRCK", 4, offsetof(struct meta_data, track_offset), parse_text }, ! { "TDRC", 4, offsetof(struct meta_data, year_offset), parse_text }, ! { "TYER", 4, offsetof(struct meta_data, year_offset), parse_text }, ! { "TCON", 4, offsetof(struct meta_data, genre_offset), parse_genre }, ! { "TPE2", 4, offsetof(struct meta_data, band_offset), parse_text }, ! { "COMM", 4, offsetof(struct meta_data, comment_offset), parse_comments }, ! { "TXXX", 4, (size_t)(-1), parse_custom_text }, ! { "TAL", 3, offsetof(struct meta_data, album_offset), parse_text }, ! { "TP1", 3, offsetof(struct meta_data, artist_offset), parse_text }, ! { "TT2", 3, offsetof(struct meta_data, title_offset), parse_text }, ! { "TRK", 3, offsetof(struct meta_data, track_offset), parse_text }, ! { "TYE", 3, offsetof(struct meta_data, year_offset), parse_text }, ! { "TCO", 3, offsetof(struct meta_data, genre_offset), parse_genre }, ! { "COM", 3, offsetof(struct meta_data, comment_offset), parse_comments } }; #define TAGLIST_SIZE ((int)(sizeof(taglist) / sizeof(taglist[0]))) ! int id3_parse_v1( int fd, struct meta_data *meta ) { char field_buffer[32]; *************** *** 492,495 **** --- 399,403 ---- int nb_bytes; int start_offet; + int version; if( read(fd, buffer, 128) != 128 ) *************** *** 501,511 **** //Figure out the version if( buffer[125] == 0 && buffer[126] != 0 ) ! id3->version = ID3_VER_1_1; else ! id3->version = ID3_VER_1_0; for( i=0; i< 5; i++ ) { ! memset(field_buffer,0,sizeof(field_buffer)); switch( i ) { --- 409,419 ---- //Figure out the version if( buffer[125] == 0 && buffer[126] != 0 ) ! version = ID3_VER_1_1; else ! version = ID3_VER_1_0; for( i=0; i< 5; i++ ) { ! memset( field_buffer, 0, sizeof(field_buffer) ); switch( i ) { *************** *** 513,541 **** start_offet = 3; nb_bytes = 30; ! tag_offset = &id3->title_offset; break; case 1: start_offet = 33; nb_bytes = 30; ! tag_offset = &id3->artist_offset; break; case 2: start_offet = 63; nb_bytes = 30; ! tag_offset = &id3->album_offset; break; case 3: start_offet = 93; nb_bytes = 4; ! tag_offset = &id3->year_offset; break; case 4: start_offet = 97; ! if( id3->version == ID3_VER_1_0 ) nb_bytes = 30; else nb_bytes = 28; ! tag_offset = &id3->comment_offset; break; } --- 421,451 ---- start_offet = 3; nb_bytes = 30; ! tag_offset = &meta->title_offset; break; case 1: start_offet = 33; nb_bytes = 30; ! tag_offset = &meta->artist_offset; break; case 2: start_offet = 63; nb_bytes = 30; ! tag_offset = &meta->album_offset; break; case 3: start_offet = 93; nb_bytes = 4; ! tag_offset = &meta->year_offset; break; case 4: start_offet = 97; ! if( version == ID3_VER_1_0 ) nb_bytes = 30; else nb_bytes = 28; ! tag_offset = &meta->comment_offset; break; + default: + continue; } *************** *** 546,550 **** if(field_len) { ! memcpy( &id3->buffer[cur_offset], field_buffer, field_len + 1); *tag_offset = cur_offset; cur_offset += (field_len + 1); --- 456,460 ---- if(field_len) { ! memcpy( &meta->buffer[cur_offset], field_buffer, field_len + 1); *tag_offset = cur_offset; cur_offset += (field_len + 1); *************** *** 553,561 **** //Check for a track ! if( id3->version == ID3_VER_1_1 && buffer[126] ) { ! field_len = snprintf( &id3->buffer[cur_offset], ID3_BUFFER_SIZE - cur_offset, "%d", (int)buffer[126] ); ! id3->buffer[cur_offset+field_len] = 0; ! id3->track_offset = cur_offset; cur_offset += (field_len + 1); } --- 463,471 ---- //Check for a track ! if( version == ID3_VER_1_1 && buffer[126] ) { ! field_len = snprintf( &meta->buffer[cur_offset], METADATA_BUFFER_SIZE - cur_offset, "%d", (int)buffer[126] ); ! meta->buffer[cur_offset+field_len] = 0; ! meta->track_offset = cur_offset; cur_offset += (field_len + 1); } *************** *** 563,568 **** //Grab the genre from the genre table if( (unsigned int)buffer[127] < sizeof(genres)/sizeof(char*)) { ! strcpy( &id3->buffer[cur_offset], genres[ (unsigned int)buffer[127] ] ); ! id3->genre_offset = cur_offset; } --- 473,478 ---- //Grab the genre from the genre table if( (unsigned int)buffer[127] < sizeof(genres)/sizeof(char*)) { ! strcpy( &meta->buffer[cur_offset], genres[ (unsigned int)buffer[127] ] ); ! meta->genre_offset = cur_offset; } *************** *** 570,577 **** } ! int id3_parse_v2( int fd, struct id3_info *id3 ) { ! char tmp_buffer[128]; ! char parsed_buffer[128]; int minframesize; int size; --- 480,486 ---- } ! int id3_parse_v2( int fd, struct meta_data *meta ) { ! unsigned char tmp_buffer[128]; int minframesize; int size; *************** *** 579,586 **** char header[10]; char tmp[4]; ! char *buffer = id3->buffer; int bufferpos = 1; int bytesread = 0; ! int buffersize = sizeof((*id3).buffer); unsigned char global_flags; int flags; --- 488,495 ---- char header[10]; char tmp[4]; ! unsigned char *buffer = meta->buffer; int bufferpos = 1; int bytesread = 0; ! int buffersize = METADATA_BUFFER_SIZE; unsigned char global_flags; int flags; *************** *** 591,594 **** --- 500,504 ---- int i; int rc; + int version; // Read the ID3 tag header *************** *** 601,615 **** switch(header[3]) { case 2: ! id3->version = ID3_VER_2_2; minframesize = 8; break; case 3: ! id3->version = ID3_VER_2_3; minframesize = 11; break; case 4: ! id3->version = ID3_VER_2_4; minframesize = 11; break; --- 511,525 ---- switch(header[3]) { case 2: ! version = ID3_VER_2_2; minframesize = 8; break; case 3: ! version = ID3_VER_2_3; minframesize = 11; break; case 4: ! version = ID3_VER_2_4; minframesize = 11; break; *************** *** 623,627 **** /* Skip the extended header if it is present */ ! if(id3->version >= ID3_VER_2_4 && (global_flags & 0x40) ) { //Read extended header size --- 533,537 ---- /* Skip the extended header if it is present */ ! if(version >= ID3_VER_2_4 && (global_flags & 0x40) ) { //Read extended header size *************** *** 648,654 **** /* Read frame header and check length */ ! if(id3->version >= ID3_VER_2_3) { ! if(global_unsynch && id3->version <= ID3_VER_2_3) rc = read_unsynched(fd, header, 10); else --- 558,564 ---- /* Read frame header and check length */ ! if(version >= ID3_VER_2_3) { ! if(global_unsynch && version <= ID3_VER_2_3) rc = read_unsynched(fd, header, 10); else *************** *** 662,666 **** flags = BYTES2INT(0, 0, header[8], header[9]); ! if (id3->version >= ID3_VER_2_4) { framelen = UNSYNC(header[4], header[5], header[6], header[7]); --- 572,576 ---- flags = BYTES2INT(0, 0, header[8], header[9]); ! if (version >= ID3_VER_2_4) { framelen = UNSYNC(header[4], header[5], header[6], header[7]); *************** *** 673,677 **** } } ! else { // id3->version < ID3_VER_2_3 if(6 != read(fd, header, 6)) --- 583,587 ---- } } ! else { // version < ID3_VER_2_3 if(6 != read(fd, header, 6)) *************** *** 742,751 **** for (i=0; i<TAGLIST_SIZE; i++) { ! struct tag_resolver* tr = &taglist[i]; ! short* ptag_offset = (short*) ((char*)id3 + tr->offset); int bytes_to_read; int len; ! if( !(*ptag_offset) && !memcmp( header, tr->tag, tr->tag_length ) ) { bytes_to_read = MIN( (int)sizeof(tmp_buffer) - 1, framelen); --- 652,662 ---- for (i=0; i<TAGLIST_SIZE; i++) { ! ! const struct tag_resolver* tr = &taglist[i]; ! short* ptag_offset = 0; int bytes_to_read; int len; ! if( !memcmp( header, tr->tag, tr->tag_length ) ) { bytes_to_read = MIN( (int)sizeof(tmp_buffer) - 1, framelen); *************** *** 754,758 **** /* found a tag matching one in tagList, and not yet filled */ ! if(global_unsynch && id3->version <= ID3_VER_2_3) bytesread = read_unsynched(fd, tmp_buffer, bytes_to_read); else --- 665,669 ---- /* found a tag matching one in tagList, and not yet filled */ ! if(global_unsynch && version <= ID3_VER_2_3) bytesread = read_unsynched(fd, tmp_buffer, bytes_to_read); else *************** *** 769,787 **** //Unsynch the string we just read ! if(unsynch || (global_unsynch && id3->version >= ID3_VER_2_4)) bytesread = unsynchronize_frame(tmp_buffer, bytesread); - - if( tr->ppFunc ) - len = tr->ppFunc(id3->version, tmp_buffer, bytesread, buffer + bufferpos, buffersize - bufferpos ); - else if( tr->tag[0] == 'T' ) - len = parse_text(id3->version, tmp_buffer, bytesread, buffer + bufferpos, buffersize - bufferpos ); - else - len = 0; ! if( len ) { ! //msg_error( "%s\n%s|", tr->tag, buffer + bufferpos ); ! *ptag_offset = bufferpos; ! bufferpos += len; //len includes the null char } break; --- 680,746 ---- //Unsynch the string we just read ! if(unsynch || (global_unsynch && version >= ID3_VER_2_4)) bytesread = unsynchronize_frame(tmp_buffer, bytesread); ! len = 0; ! ! if( tr->offset != (size_t)(-1) ) { ! ! ptag_offset = (short*) ((char*)meta + tr->offset); ! ! len = tr->ppFunc(version, tmp_buffer, bytesread, buffer + bufferpos, buffersize - bufferpos ); ! if( len ) { ! len++; ! *ptag_offset = bufferpos; ! ! // msg_error( "%s\n%s", tr->tag, buffer + bufferpos ); ! } ! } ! else { //Non string tag ! ! int desc_len; ! int frav; ! int intv; ! unsigned char desc_text[24]; ! ! //Parse the Description ! desc_len = decode_text( tmp_buffer[0], &tmp_buffer[1], bytesread - 1, desc_text, 24 ); ! ! if( desc_len > 0 ) { ! ! if( strcmp( desc_text, "replaygain_track_gain" ) == 0 ) { ! ! len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); ! ! if( len > 0 ) { ! intv = atof( desc_text, &frav ); ! meta->rg_track_gain = intv * 10000; ! meta->rg_track_gain += (frav * 1000); ! } ! } ! else if( strcmp( desc_text, "replaygain_track_peak" ) == 0 ) { ! ! len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); ! ! if( len > 0 ) { ! intv = atof( desc_text, &frav ); ! meta->rg_track_peak = intv * 10000; ! meta->rg_track_peak += (frav * 1000); ! } ! } ! else if( strcmp( desc_text, "replaygain_album_gain" ) == 0 ) { ! ! len = tr->ppFunc( version, tmp_buffer, bytesread, desc_text, 24 ); ! ! if( len > 0 ) { ! intv = atof( desc_text, &frav ); ! meta->rg_album_gain = intv * 10000; ! meta->rg_album_gain += (frav * 1000); ! } ! } ! } } + + bufferpos += len; //len includes the null char break; *************** *** 790,799 **** if( i == TAGLIST_SIZE ) { /* no tag in tagList was found, or it was a repeat. skip it using the total size */ ! if(global_unsynch && id3->version <= ID3_VER_2_3) { skip_unsynched(fd, totframelen); ! } else { if(data_length_ind) totframelen = data_length_ind; --- 749,760 ---- if( i == TAGLIST_SIZE ) { + /* no tag in tagList was found, or it was a repeat. skip it using the total size */ ! if(global_unsynch && version <= ID3_VER_2_3) skip_unsynched(fd, totframelen); ! else { ! if(data_length_ind) totframelen = data_length_ind; *************** *** 805,875 **** } } ! ! return 0; } ! unsigned char* decode_text( int encoding, unsigned char* string, int *byte_len ) { int tmp; bool le = false; int i; - unsigned char *str = string; - char *outstr = string; bool bom = false; ! int outlen; ! ! if( encoding != 0x01 && encoding != 0x02 ) ! return string; ! ! /* Unicode with or without BOM */ ! ! tmp = BYTES2INT(0, 0, str[0], str[1]); ! ! /* Now check if there is a BOM (zero-width non-breaking space, 0xfeff) ! and if it is in little or big endian format */ ! if(tmp == 0xfffe) { /* Little endian? */ ! bom = true; ! le = true; ! str += 2; ! (*byte_len)-=2; ! } ! ! if(tmp == 0xfeff) { /* Big endian? */ ! bom = true; ! str += 2; ! (*byte_len)-=2; ! } ! ! /* If there is no BOM (which is a specification violation), ! let's try to guess it. If one of the bytes is 0x00, it is ! probably the most significant one. */ ! ! if (!bom) { ! if (str[1]==0) ! le=true; } ! i = 0; ! ! outlen = *byte_len/2; ! ! do { ! if(le) { ! if(str[1]) ! outstr[i++] = '.'; ! else ! outstr[i++] = str[0]; ! } else { ! if(str[0]) ! outstr[i++] = '.'; ! else ! outstr[i++] = str[1]; } ! str += 2; ! } while((str[0] || str[1]) && (i < outlen)); ! ! *byte_len = i; ! outstr[i]=0; //terminate the string ! return string; } --- 766,852 ---- } } ! ! return 0; } ! /* If needed, converts unicode string to ISO and trims spaces before and after, ! The input and output buffers can overlap */ ! int decode_text( int encoding, const unsigned char *encoded, int encoded_len, unsigned char *decoded, int max_decoded ) { int tmp; bool le = false; int i; bool bom = false; ! ! if( encoding != 0x01 && encoding != 0x02 ) { ! ! int len = MIN( max_decoded-1, encoded_len ); ! ! //ansi or UTF-8, copy only characters that can be displayed ! while( *encoded && --len ) { ! ! if( isalnum(*encoded) ) ! *decoded++ = *encoded; ! ! encoded++; ! } ! *decoded = 0; } + else { ! /* Unicode with or without BOM */ ! tmp = BYTES2INT(0, 0, encoded[0], encoded[1]); ! ! /* Now check if there is a BOM (zero-width non-breaking space, 0xfeff) ! and if it is in little or big endian format */ ! if(tmp == 0xfffe) { /* Little endian? */ ! bom = true; ! le = true; ! encoded += 2; } ! ! if(tmp == 0xfeff) { /* Big endian? */ ! bom = true; ! encoded += 2; ! } ! ! /* If there is no BOM (which is a specification violation), ! let's try to guess it. If one of the bytes is 0x00, it is ! probably the most significant one. */ ! ! if (!bom) { ! if (encoded[1]==0) ! le=true; ! } ! ! i = 0; ! ! if( le ) { ! ! while( (encoded[0] || encoded[1]) && i < max_decoded ) { ! if(encoded[1]) ! decoded[i++] = '.'; ! else ! decoded[i++] = encoded[0]; ! ! encoded +=2; ! } ! } ! else { ! ! while( (encoded[0] || encoded[1]) && i < max_decoded ) { ! if(encoded[0]) ! decoded[i++] = '.'; ! else ! decoded[i++] = encoded[1]; ! ! encoded +=2; ! } ! } ! ! decoded[i]=0; //terminate the string ! } ! strtrim( decoded, " " ); ! return strlen(decoded); } |
From: Francois B <mrs...@us...> - 2006-10-10 23:46:50
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10274 Modified Files: audio.c Log Message: More precise log function Index: audio.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/audio.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** audio.c 22 Oct 2004 23:47:08 -0000 1.12 --- audio.c 10 Oct 2006 23:46:48 -0000 1.13 *************** *** 43,55 **** struct audio_settings { ! char volume; // [0,100] ! char balance; // [-18,18] ! char bass; // [-15dB, 15dB] ! char treble; // [-15dB, 15dB] ! char channels; // [0,8] ! char dac_mode; // [0,2] ! bool reversed; // 1 or 0 ! char pitch; // [-10,30] ! bool muted; }; --- 43,57 ---- struct audio_settings { ! char volume; // [0,100] ! char balance; // [-18,18] ! char bass; // [-15dB, 15dB] ! char treble; // [-15dB, 15dB] ! char channels; // [0,8] ! char dac_mode; // [0,2] ! bool reversed; // 1 or 0 ! char pitch; // [-10,30] ! bool muted; ! ! int added_gain; // dB x 100 }; *************** *** 178,181 **** --- 180,184 ---- current_audio.balance = balance; current_audio.muted = false; + current_audio.added_gain = 0; audio_set( AUDIO_PITCH, pitch ); //Sets the 44kHz PLL Offset *************** *** 191,206 **** /* I * 100 = (0x80000*100 - H*100 ) / 0x80000 */ // intensity range is [0,100] ! // boost is in dB ! static unsigned long mas_intensity2reg( int intensity, int boost ) { ! int r1 = 524288 * 100; ! int result = intensity * 524288; ! if( intensity == 0 ) ! return 0; ! result -= r1; ! result /= -100; ! return ((result & 0xfffff ) | 0x00080000); //Value is always negative } --- 194,240 ---- /* I * 100 = (0x80000*100 - H*100 ) / 0x80000 */ // intensity range is [0,100] ! ! static unsigned long mas_intensity2reg( int intensity ) { ! int r1 = 0x80000 * 100; ! int result; ! if( intensity == 0 ) ! return 0; ! ! result = intensity * 0x80000; ! ! result -= r1; ! result /= -100; ! return ((result & 0xfffff ) | 0x00080000); //Value is always negative ! } ! static unsigned long mas_db2reg( int db ) ! { ! return 0; ! } ! ! /* Converts a precentage to the corresponding dB value ! Ex: 95% -> -0.445 dB -> returns 44 ! ! Returns (db x 100) ! */ ! static int mas_intensity2db( int intensity ) ! { ! int tdb; ! ! tdb = logbase10( intensity ); ! tdb = tdb / 5; ! ! return tdb; ! } ! ! /* input is dB x 10 */ ! static int mas_tendb2reg( int dbx10 ) ! { ! int reg = 0x80000; ! ! ! return 0; } *************** *** 210,213 **** --- 244,254 ---- } + /* gain = dB x 100 */ + void audio_set_extra_gain( int gain ) + { + current_audio.added_gain = gain; + gain2device(); + } + void audio_set( int setting, int value ) { *************** *** 262,266 **** //Dac is used as an amp ! // Anything over 0x32 produces distortion in the sound dac_volume( 0x32 , 0x32, false ); } --- 303,307 ---- //Dac is used as an amp ! //Anything over 0x32 produces distortion in the sound dac_volume( 0x32 , 0x32, false ); } *************** *** 321,325 **** } ! //Apply changes gain2device(); } --- 362,366 ---- } ! //Apply volume change gain2device(); } *************** *** 388,431 **** } ! unsigned char tenthdb2reg(int db) { ! int val; ! ! /* For more details see page 7 of DAC manual */ ! if(db < -540) ! val = (db + 780) / 30; ! else ! val = (db + 660) / 15; ! ! return (unsigned char)val; } ! ! // intensity range is [0,100] ! // We convert the intensity to a value in tenths of dB ! // Then this value is converted to a DAC acceptable value ! // The boost value is in dB ! static unsigned char dac_intensity2reg( int intensity, int boost ) { ! int ratio, tenthdb; ! ! if( intensity == 0 ) ! return 0; ! ! //The dac can output 8 times the input [0 -> 800%] ! //We limit this to 6x ! ratio = intensity * 60; ! tenthdb = log10( ratio ); ! tenthdb = tenthdb / 50; ! ! //Add the boost value ! tenthdb += boost*10; ! ! //clip value to what the DAC can handle ! if( tenthdb < -750 ) ! tenthdb = -750; ! if( tenthdb > 180 ) ! tenthdb = 180; ! ! return tenthdb2reg( tenthdb ); } --- 429,473 ---- } ! // intensity range is [0,100] ! // We convert the intensity to a value in dB x 100 ! // The boost value is in dB x 1 ! static int dac_intensity2db( int intensity, int boost ) { ! int ratio; ! int tdb; // dB x 100; ! ! if( intensity == 0 ) ! return -7500; //-75 dB ! ! //The dac can output 8 times the input [0 -> 800%] ! //We limit this to 6x ! ratio = intensity * 6; ! tdb = logbase10( ratio ); ! tdb = tdb / 5; ! ! //Add the boost value ! tdb += boost*100; ! ! //clip value to what the DAC can handle ! if( tdb < -7500 ) ! tdb = -7500; ! else if( tdb > 1800 ) ! tdb = 1800; ! ! return tdb; } ! ! /* db is scaled by 100*/ ! static unsigned char dac_db2reg( int db ) { ! int val; ! ! /* For more details see page 7 of DAC manual */ ! if(db < -5400) ! val = (db + 7800) / 300; ! else ! val = (db + 6600) / 150; ! ! return (unsigned char)val; } *************** *** 437,441 **** int sub; int boost; ! //Prefactor for Bass and/or Treble boost = MAX((int)current_audio.bass, (int)current_audio.treble); --- 479,484 ---- int sub; int boost; ! int db; //db x 100 ! //Prefactor for Bass and/or Treble boost = MAX((int)current_audio.bass, (int)current_audio.treble); *************** *** 469,544 **** if( current_audio.dac_mode == AUDIO_MODE_ANALOG ){ ! // Calculate DAC 6 bit values ! if( left != right ){ ! dac_l = dac_intensity2reg( left, boost ); ! dac_r = dac_intensity2reg( right, boost ); ! } ! else ! dac_l = dac_r = dac_intensity2reg( left, boost ); ! //Because the DAC Line out -> RCA plugs are wired wrong, we need to switch the volume channels ! dac_volume( dac_r, dac_l, false); } else { // MAS Values ! ! switch( current_audio.channels ) { ! ! case AUDIO_STEREO_NARROW: ! mas_ll = mas_intensity2reg( (left*3)/4,0 ); //75% ! mas_lr = mas_intensity2reg( left/4,0 ); //25% ! mas_rl = mas_intensity2reg( right/4,0 ); ! mas_rr = mas_intensity2reg( (right*3)/4,0 ); ! break; ! ! case AUDIO_STEREO_WIDE: ! mas_ll = mas_intensity2reg( left,0 ); ! mas_lr = mas_intensity2reg( left/2,0 ); ! mas_rl = mas_intensity2reg( right/2,0 ); ! mas_rr = mas_intensity2reg( right,0 ); ! break; ! /* ! case AUDIO_KARAOKE: ! mas_ll = mas_intensity2reg( left ) + 1; ! mas_lr = 0x100000 - mas_intensity2reg( left ); ! mas_rl = 0x100000 - mas_intensity2reg( right ); ! mas_rr = mas_intensity2reg( right ) + 1; ! break; ! */ ! case AUDIO_MONO: ! mas_ll = mas_intensity2reg( left/2,0 ); ! mas_lr = mas_ll; ! mas_rl = mas_intensity2reg( right/2,0 ); ! mas_rr = mas_rl; ! break; ! case AUDIO_MONO_LEFT: ! mas_ll = mas_intensity2reg( left,0 ); ! mas_lr = mas_ll; ! mas_rl = 0; ! mas_rr = 0; ! break; ! ! case AUDIO_MONO_RIGHT: ! mas_ll = 0; ! mas_lr = 0; ! mas_rl = mas_intensity2reg( right,0 ); ! mas_rr = mas_rl; ! break; ! case AUDIO_STEREO: ! default: ! mas_ll = mas_intensity2reg( left,0 ); // L ! mas_lr = 0; ! mas_rl = 0; ! mas_rr = mas_intensity2reg( right,0 ); // R ! break; ! } ! ! mas_writemem( MAS_BANK_D1, 0x7f8, &mas_ll, 1 ); /* LL */ ! mas_writemem( MAS_BANK_D1, 0x7f9, &mas_lr, 1 ); /* LR */ ! mas_writemem( MAS_BANK_D1, 0x7fa, &mas_rl, 1 ); /* RL */ ! mas_writemem( MAS_BANK_D1, 0x7fb, &mas_rr, 1 ); /* RR */ } } --- 512,598 ---- if( current_audio.dac_mode == AUDIO_MODE_ANALOG ){ + + // Calculate DAC 6 bit values + if( left != right ){ ! db = dac_intensity2db( left, boost ) + current_audio.added_gain; ! dac_l = dac_db2reg( db ); ! db = dac_intensity2db( right, boost ) + current_audio.added_gain; ! dac_r = dac_db2reg( db ); ! } ! else { ! db = dac_intensity2db( current_audio.volume, boost ) + current_audio.added_gain; ! dac_l = dac_r = dac_db2reg( db ); ! } ! //Because the DAC Line out -> RCA plugs are wired wrong, we need to switch the volume channels ! dac_volume( dac_r, dac_l, false); } else { // MAS Values ! ! db = logbase10( left ) / 5; ! db += current_audio.added_gain; ! //Convert dB back to a percentage or ratio value ! int i = rlogbase10( db * 5 ) / 100; ! switch( current_audio.channels ) { ! ! case AUDIO_STEREO_NARROW: ! mas_ll = mas_intensity2reg( (left*3)/4 ); //75% ! mas_lr = mas_intensity2reg( left/4 ); //25% ! mas_rl = mas_intensity2reg( right/4 ); ! mas_rr = mas_intensity2reg( (right*3)/4 ); ! break; ! ! case AUDIO_STEREO_WIDE: ! mas_ll = mas_intensity2reg( left ); ! mas_lr = mas_intensity2reg( left/2 ); ! mas_rl = mas_intensity2reg( right/2 ); ! mas_rr = mas_intensity2reg( right ); ! break; ! /* ! case AUDIO_KARAOKE: ! mas_ll = mas_intensity2reg( left ) + 1; ! mas_lr = 0x100000 - mas_intensity2reg( left ); ! mas_rl = 0x100000 - mas_intensity2reg( right ); ! mas_rr = mas_intensity2reg( right ) + 1; ! break; ! */ ! case AUDIO_MONO: ! mas_ll = mas_intensity2reg( left/2 ); ! mas_lr = mas_ll; ! mas_rl = mas_intensity2reg( right/2 ); ! mas_rr = mas_rl; ! break; ! ! case AUDIO_MONO_LEFT: ! mas_ll = mas_intensity2reg( left ); ! mas_lr = mas_ll; ! mas_rl = 0; ! mas_rr = 0; ! break; ! ! case AUDIO_MONO_RIGHT: ! mas_ll = 0; ! mas_lr = 0; ! mas_rl = mas_intensity2reg( right ); ! mas_rr = mas_rl; ! break; ! ! case AUDIO_STEREO: ! default: ! mas_ll = mas_intensity2reg( left ); // L ! mas_lr = 0; ! mas_rl = 0; ! mas_rr = mas_intensity2reg( right ); // R ! break; ! } ! ! mas_writemem( MAS_BANK_D1, 0x7f8, &mas_ll, 1 ); /* LL */ ! mas_writemem( MAS_BANK_D1, 0x7f9, &mas_lr, 1 ); /* LR */ ! mas_writemem( MAS_BANK_D1, 0x7fa, &mas_rl, 1 ); /* RL */ ! mas_writemem( MAS_BANK_D1, 0x7fb, &mas_rr, 1 ); /* RR */ } } |
From: Francois B <mrs...@us...> - 2006-10-10 23:46:39
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10250 Modified Files: mp3.c Log Message: Added replaygain support Index: mp3.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/mp3.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mp3.c 8 Feb 2006 01:24:58 -0000 1.6 --- mp3.c 10 Oct 2006 23:46:37 -0000 1.7 *************** *** 37,42 **** */ ! /* tagResolver and associated code copyright 2003 Thomas Paul Diffenbach ! */ #include <stdio.h> --- 37,41 ---- */ ! /* tagResolver and associated code copyright 2003 Thomas Paul Diffenbach*/ #include <stdio.h> *************** *** 52,56 **** #include "id3.h" - #include "mp3data.h" #include "system.h" --- 51,54 ---- *************** *** 72,79 **** #define MPEG_CHANNEL_MONO 0x000000c0 ! #define BYTES2INT(b0,b1,b2,b3) (((b0 & 0xFF) << (3*8)) | \ ! ((b1 & 0xFF) << (2*8)) | \ ! ((b2 & 0xFF) << (1*8)) | \ ! ((b3 & 0xFF) << (0*8))) --- 70,77 ---- #define MPEG_CHANNEL_MONO 0x000000c0 ! /* Xing header information */ ! #define VBR_FRAMES_FLAG 0x01 ! #define VBR_BYTES_FLAG 0x02 ! #define VBR_TOC_FLAG 0x04 *************** *** 180,186 **** const unsigned short frequencies[3][4] = { ! {44100, 48000, 32000, 0}, /* MPEG Version 1 */ ! {22050, 24000, 16000, 0}, /* MPEG version 2 */ ! {11025, 12000, 8000, 0} /* MPEG version 2.5 */ }; --- 178,184 ---- const unsigned short frequencies[3][4] = { ! {44100, 48000, 32000, 1}, /* MPEG Version 1 */ ! {22050, 24000, 16000, 1}, /* MPEG version 2 */ ! {11025, 12000, 8000, 1} /* MPEG version 2.5 */ }; *************** *** 321,336 **** DEBUGF("Xing/Info header\n"); ! ! /* Parse the Info */ ! ! //Grap the number of frames if(vbrheader[7] & VBR_FRAMES_FLAG) mpeg->frame_count = BYTES2INT(vbrheader[8], vbrheader[9],vbrheader[10], vbrheader[11]); ! //Grap the number of bytes - our frame size if(vbrheader[7] & VBR_BYTES_FLAG) mpeg->data_size = BYTES2INT(vbrheader[12], vbrheader[13],vbrheader[14], vbrheader[15]) - frame_length; ! ! // Check for a CBR Method if( (vbrheader[129] & 0x0f ) == 1 ) bitrate = 2; //cbr --- 319,332 ---- DEBUGF("Xing/Info header\n"); ! ! //Grab the number of frames if(vbrheader[7] & VBR_FRAMES_FLAG) mpeg->frame_count = BYTES2INT(vbrheader[8], vbrheader[9],vbrheader[10], vbrheader[11]); ! //Grab the number of bytes - our frame size if(vbrheader[7] & VBR_BYTES_FLAG) mpeg->data_size = BYTES2INT(vbrheader[12], vbrheader[13],vbrheader[14], vbrheader[15]) - frame_length; ! ! // Check for CBR Method if( (vbrheader[129] & 0x0f ) == 1 ) bitrate = 2; //cbr *************** *** 433,450 **** /* Id3 parsing is optionnal */ ! int mp3_parse( const char* path, struct mpeg_info *mpeg, struct id3_info *id3 ) { int ret; int fd; char buf[4]; ! int endbytes = 0; fd = fopen( path, O_RDONLY); if(fd < 0) return -1; ! ! if(id3) { ! memset(id3,0,sizeof(struct id3_info)); //Read the first 4 bytes --- 429,450 ---- /* Id3 parsing is optionnal */ ! int mp3_parse( const char* path, struct mpeg_info *mpeg, struct meta_data *meta ) { int ret; int fd; char buf[4]; ! int postdatabytes; ! int data_start; ! bool id3v1 = false; fd = fopen( path, O_RDONLY); if(fd < 0) return -1; ! ! postdatabytes = 0; ! ! if(meta) { ! memset(meta,0,sizeof(struct meta_data)); //Read the first 4 bytes *************** *** 458,471 **** if( buf[0] == 'I' && buf[1] == 'D' && buf[2] == '3') { ! //We found an id3v2 block ! id3_parse_v2(fd,id3); ! } } ! int pos = lseek(fd, 0, SEEK_CUR); ! ! //We need to check for an ID3V1 block before parsing the mpeg info ! lseek(fd, -128, SEEK_END); --- 458,470 ---- if( buf[0] == 'I' && buf[1] == 'D' && buf[2] == '3') { ! //We found an id3v2 block ! id3_parse_v2(fd,meta); ! } } + + data_start = lseek( fd, 0, SEEK_CUR ); ! //Check for an ID3V1 block lseek(fd, -128, SEEK_END); *************** *** 473,497 **** if( buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G' ) { ! ! endbytes += 128; ! ! if( id3 && id3->version == 0 ) { ! lseek( fd, -4, SEEK_CUR); ! id3_parse_v1(fd,id3); ! } ! } } ! //Check for APE tag at the end of the file (before the ID3V1 tags) ! lseek(fd, (int)(-32 - endbytes), SEEK_END); ! ! endbytes += mp3_get_ape_length(fd); //Put cursor at the start of data ! lseek(fd, pos, SEEK_SET); //Parse the mpeg info ! ret = mpeg_parse(fd,mpeg, endbytes); if( ret ) { msg_error( path ); --- 472,498 ---- if( buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G' ) { ! ! id3v1 = true; ! postdatabytes += 128; ! } } + //Check for APE taga located before the ID3V1 block + lseek( fd, -(postdatabytes + 32), SEEK_END ); + + //Parse / skip the APE tags + postdatabytes += ape_parse_from_end( fd, mpeg, meta ); ! //Parse id3v1 tags if needed ! if( id3v1 && meta && meta->title_offset == 0 ) { ! lseek( fd, -128, SEEK_END ); ! id3_parse_v1(fd,meta); ! } //Put cursor at the start of data ! lseek(fd, data_start, SEEK_SET); //Parse the mpeg info ! ret = mpeg_parse(fd,mpeg, postdatabytes); if( ret ) { msg_error( path ); |
From: Francois B <mrs...@us...> - 2006-10-10 23:46:21
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10232 Modified Files: mpeg.c Log Message: id3 info renamed to metadata info + code cleanup Index: mpeg.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/mpeg.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mpeg.c 28 Apr 2006 00:58:28 -0000 1.26 --- mpeg.c 10 Oct 2006 23:46:19 -0000 1.27 *************** *** 44,48 **** #include "thread.h" #include "errno.h" - #include "mp3data.h" #include "buffer.h" #include "audio.h" --- 44,47 ---- *************** *** 111,115 **** static unsigned int current_track_counter = 0; ! static unsigned int last_track_counter = 0; static struct mpeg_play_info cur_info; --- 110,114 ---- static unsigned int current_track_counter = 0; ! //static unsigned int last_track_counter = 0; static struct mpeg_play_info cur_info; *************** *** 277,280 **** --- 276,281 ---- static bool mpeg_stop_done; + #ifdef DEBUG + void mas_debug(void) { *************** *** 312,318 **** } - - - #ifdef DEBUG static void dbg_timer_start(void) { --- 313,316 ---- *************** *** 441,448 **** /* Start DMA if it is inactive and the DEMAND pin is high, this means the MAS needs another DMA chunk of data */ ! if(!dma_on && MAS_DEMAND) { ! if(!(SCR0 & 0x80)) ! start_dma(); ! } id3tags[tag_read_idx]->id3.elapsed += (current_tick - last_dma_tick) * 1000 / HZ; --- 439,444 ---- /* Start DMA if it is inactive and the DEMAND pin is high, this means the MAS needs another DMA chunk of data */ ! if(!dma_on && MAS_DEMAND) ! start_dma(); id3tags[tag_read_idx]->id3.elapsed += (current_tick - last_dma_tick) * 1000 / HZ; *************** *** 592,596 **** strcpy( t->id3.path, filename ); ! if( mp3_parse(filename, &t->id3.mpeg, &t->id3.id3 ) ) { DEBUGF("Bad mp3\n"); return -1; --- 588,592 ---- strcpy( t->id3.path, filename ); ! if( mp3_parse(filename, &t->id3.mpeg, &t->id3.meta ) ) { DEBUGF("Bad mp3\n"); return -1; *************** *** 819,828 **** } - static const unsigned char empty_id3_header[] = - { - 'I', 'D', '3', 0x04, 0x00, 0x00, - 0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */ - }; - static void mpeg_thread(void) { --- 815,818 ---- *************** *** 1420,1424 **** { /* Don't read passed the mpeg data */ ! amount_to_read = MIN( id3tags[tag_read_idx]->id3.mpeg.first_frame_offset + id3tags[tag_read_idx]->id3.mpeg.data_size - lseek(mpeg_file, 0, SEEK_CUR), amount_to_read); //DEBUGF("R\n"); --- 1410,1414 ---- { /* Don't read passed the mpeg data */ ! amount_to_read = MIN( id3tags[tag_read_idx]->id3.mpeg.first_frame_offset + id3tags[tag_read_idx]->id3.mpeg.data_size - lseek(mpeg_file, 0, SEEK_CUR), (unsigned int)amount_to_read); //DEBUGF("R\n"); *************** *** 1701,1704 **** --- 1691,1696 ---- void mpeg_init() { + dma_on = false; + /* Mute the MAS */ mas_writereg( MAS_REG_MUTE, 1 ); |
From: Francois B <mrs...@us...> - 2006-10-10 23:45:41
|
Update of /cvsroot/openneo/openneo/firmware In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9855 Added Files: ape.c Log Message: Added APE tag parsing --- NEW FILE: ape.c --- /*************************************************************************** * * Open Neo * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ //#include "ape.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <stddef.h> #include <ctype.h> #include "debug.h" #include "system.h" #include "metadata.h" #include "file.h" #include "buffer.h" #include "id3.h" struct ape_key_tag { const unsigned char* key; size_t offset; int (*parser)( const unsigned char *value, int value_length, unsigned char* result, size_t maxresult ); }; int parse_ape_date( const unsigned char *value, int value_length, unsigned char* result, size_t maxresult ) { (void)value_length; int len = MIN( 4,maxresult-1 ); strncpy( result, value, len ); result[len] = 0; return len; } int parse_ape_float( const unsigned char *value ) { int val; int frav; val = atof( value, &frav ); val = val * 10000; val += (frav * 1000); return val; } static struct ape_key_tag taglist[] = { { "Title", offsetof(struct meta_data, title_offset), NULL }, { "Artist", offsetof(struct meta_data, artist_offset), NULL }, { "Album", offsetof(struct meta_data, album_offset), NULL }, { "Composer", offsetof(struct meta_data, composer_offset), NULL }, { "Comment", offsetof(struct meta_data, comment_offset), NULL }, { "Track", offsetof(struct meta_data, track_offset), NULL }, { "Year", offsetof(struct meta_data, year_offset), parse_ape_date }, { "Genre", offsetof(struct meta_data, genre_offset), NULL } }; #define TAGLIST_SIZE ((int)(sizeof(taglist) / sizeof(taglist[0]))) #define APE_FLAG_HAS_HEADER 0x80000000 #define APE_FLAG_HAS_FOOTER 0x40000000 #define APE_FLAG_IS_HEADER 0x20000000 /* Returns the total length of the APE block or 0 */ int ape_parse_from_end( int fd, struct mpeg_info *mpeg, struct meta_data *meta ) { unsigned char buffer[600]; unsigned char *out_buffer; unsigned int total_size, size; unsigned int item_count; unsigned int flags; int prevpos, i; int value_len; int bytesread; int key_len; short* p_meta_offset; prevpos = lseek( fd, 0, SEEK_CUR ); //read the footer if( read( fd, buffer, 32 ) != 32 ) { lseek( fd, prevpos, SEEK_SET ); return 0; } if( memcmp( buffer, "APETAGEX", 8 ) ) { lseek( fd, prevpos, SEEK_SET ); return 0; } flags = BYTES2INT( buffer[23], buffer[22],buffer[21],buffer[20]); //Total size excluding the header (if present) total_size = size = BYTES2INT( buffer[15], buffer[14],buffer[13],buffer[12]); if( flags & APE_FLAG_HAS_HEADER ) total_size += 32; //We might not need to parse the values if we already parsed id3v2 tags if( !meta || meta->buffer[1] != 0 ) return total_size; lseek( fd, -size, SEEK_CUR ); item_count = BYTES2INT( buffer[19], buffer[18],buffer[17],buffer[16] ); // msg_error( "items: %i", item_count ); out_buffer = &meta->buffer[1]; while( item_count-- ) { //Make sure to read everything except the key value bytesread = read( fd, buffer, 600 ); if( bytesread <= 9 ) break; value_len = BYTES2INT( buffer[3], buffer[2],buffer[1],buffer[0]); flags = BYTES2INT( buffer[7], buffer[6],buffer[5],buffer[4]); key_len = strlen( &buffer[8] ); //Parse key if( strcasecmp( &buffer[8], "replaygain_track_gain" ) == 0 && !meta->rg_track_gain ) meta->rg_track_gain = parse_ape_float( buffer + 9 + key_len ); else if( strcasecmp( &buffer[8], "replaygain_track_peak" ) == 0 && !meta->rg_track_peak ) meta->rg_track_peak = parse_ape_float( buffer + 9 + key_len ); else if( strcasecmp( &buffer[8], "replaygain_album_gain" ) == 0 && !meta->rg_album_gain ) meta->rg_album_gain = parse_ape_float( buffer + 9 + key_len ); else if( strcasecmp( &buffer[8], "replaygain_album_peak" ) == 0 && !meta->rg_album_peak ) meta->rg_album_peak = parse_ape_float( buffer + 9 + key_len ); else { for( i=0; i< TAGLIST_SIZE; ++i ) { if( strcasecmp( taglist[i].key, &buffer[8]) == 0 ) { p_meta_offset = (short*) ((char*)meta + taglist[i].offset); *p_meta_offset = (size_t)out_buffer - (size_t)meta->buffer; if( taglist[i].parser ) { int len = taglist[i].parser( buffer + 9 + key_len, value_len, out_buffer, METADATA_BUFFER_SIZE - ((size_t)out_buffer - (size_t)meta->buffer) ); out_buffer += (len + 1); } else { //default text tag memcpy( out_buffer, buffer + 9 + key_len, value_len ); out_buffer[value_len] = 0; out_buffer += (value_len + 1); } } } } lseek( fd, -bytesread + (9 + key_len + value_len) , SEEK_CUR ); } return total_size; } |
From: Francois B <mrs...@us...> - 2006-10-10 23:45:01
|
Update of /cvsroot/openneo/openneo/firmware/include In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9447 Modified Files: stdlib.h Log Message: atof function Index: stdlib.h =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/include/stdlib.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** stdlib.h 29 Oct 2003 14:12:27 -0000 1.1.1.1 --- stdlib.h 10 Oct 2006 23:44:59 -0000 1.2 *************** *** 34,37 **** --- 34,39 ---- int rand(void); + int atof( const unsigned char *str, unsigned int *fractional ); + #define abs(x) ((x)>0?(x):-(x)) |
From: Francois B <mrs...@us...> - 2006-10-10 23:44:50
|
Update of /cvsroot/openneo/openneo/firmware/include In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9430 Modified Files: log.h Log Message: More precise log function Index: log.h =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/include/log.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** log.h 20 Jan 2004 05:11:24 -0000 1.1 --- log.h 10 Oct 2006 23:44:48 -0000 1.2 *************** *** 17,28 **** /* long log10( long ) ! Input: Value in thousands ! Output: Value in ten of thousands */ ! long log10( long thousands_value ); /* long revlog10( long ) Input: Value in tens of thousands ! Output: Value in thousands */ ! long revlog10( long tenthousands_log ); #endif --- 17,28 ---- /* long log10( long ) ! Input: Value x 100 ! Output: Value x 10000 */ ! int logbase10( int ratiox100 ); /* long revlog10( long ) Input: Value in tens of thousands ! Output: Value x 100 */ ! int rlogbase10( int logx10000 ); #endif |
From: Francois B <mrs...@us...> - 2006-10-10 23:44:22
|
Update of /cvsroot/openneo/openneo/firmware/common In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9401 Added Files: atof.c Log Message: atof function --- NEW FILE: atof.c --- /*************************************************************************** * * Open Neo * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #include "ctype.h" int atof( const unsigned char *str, unsigned int *fractional ) { int integer = 0; int sign = 1; *fractional = 0; while( isspace(*str) ) str++; if( '-' == *str ) { sign = -1; str++; } else if( '+' == *str ) str++; while( '0' == *str ) str++; while( isdigit(*str) ) { integer = (integer * 10) + (*str - '0'); str++; } if( *str == '.' ) { str++; while( isdigit(*str) ) { *fractional = (*fractional * 10) + (*str - '0'); str++; } } return integer * sign; } |
From: Francois B <mrs...@us...> - 2006-10-10 23:43:55
|
Update of /cvsroot/openneo/openneo/firmware/export In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9015 Added Files: metadata.h Log Message: Added replaygain support --- NEW FILE: metadata.h --- /*************************************************************************** * * Open Neo * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #ifndef _METADATA_H_ #define _METADATA_H_ #define METADATA_BUFFER_SIZE 288 #define BYTES2INT(b0,b1,b2,b3) (((b0 & 0xFF) << (3*8)) | \ ((b1 & 0xFF) << (2*8)) | \ ((b2 & 0xFF) << (1*8)) | \ ((b3 & 0xFF) << (0*8))) struct meta_data { short title_offset; short artist_offset; short album_offset; short genre_offset; short track_offset; short year_offset; short composer_offset; short band_offset; short comment_offset; /* Shared buffer to store all these strings. We keep the first byte at zero. So values with zero offsets will point to an empty string. */ char buffer[METADATA_BUFFER_SIZE]; int rg_track_gain; // dB x 10000; int rg_track_peak; int rg_album_gain; // dB x 10000; int rg_album_peak; }; int meta_get_used_buffer_size( const struct meta_data *meta ); /* Macros to easily retrieve string values */ #define METADATA_GET_TITLE(data) (const unsigned char*)(data.buffer + data.title_offset) #define METADATA_GET_ALBUM(data) (const unsigned char*)(data.buffer + data.album_offset) #define METADATA_GET_ARTIST(data) (const unsigned char*)(data.buffer + data.artist_offset) #define METADATA_GET_GENRE(data) (const unsigned char*)(data.buffer + data.genre_offset) #define METADATA_GET_TRACK(data) (const unsigned char*)(data.buffer + data.track_offset) #define METADATA_GET_YEAR(data) (const unsigned char*)(data.buffer + data.year_offset) #define METADATA_GET_COMPOSER(data) (const unsigned char*)(data.buffer + data.composer_offset) #define METADATA_GET_BAND(data) (const unsigned char*)(data.buffer + data.band_offset) #define METADATA_GET_COMMENT(data) (const unsigned char*)(data.buffer + data.comment_offset) #endif |
From: Francois B <mrs...@us...> - 2006-10-10 23:41:43
|
Update of /cvsroot/openneo/openneo/firmware/export In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8217 Modified Files: id3.h Log Message: Added replaygain support Index: id3.h =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/export/id3.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** id3.h 28 Apr 2006 00:59:35 -0000 1.9 --- id3.h 10 Oct 2006 23:41:41 -0000 1.10 *************** *** 35,77 **** #include <stdbool.h> #include "file.h" ! ! enum { ! ID3_VER_1_0 = 1, ! ID3_VER_1_1, ! ID3_VER_2_2, ! ID3_VER_2_3, ! ID3_VER_2_4 ! }; ! ! #define ID3_BUFFER_SIZE 284 ! ! struct id3_info { ! short version; //ID3 version ! short title_offset; ! short artist_offset; ! short album_offset; ! short genre_offset; ! short track_offset; ! short year_offset; ! short composer_offset; ! short band_offset; ! short comment_offset; ! ! /* Buffer to store all these strings. ! We keep the first byte at zero. So values with zero offsets ! will point to an empty string. */ ! ! char buffer[ID3_BUFFER_SIZE]; ! }; ! ! #define ID3_GET_TITLE(id3) (id3.title_offset?id3.buffer + id3.title_offset:NULL) ! #define ID3_GET_ALBUM(id3) (id3.album_offset?id3.buffer + id3.album_offset:NULL) ! #define ID3_GET_ARTIST(id3) (id3.artist_offset?id3.buffer + id3.artist_offset:NULL) ! #define ID3_GET_GENRE(id3) (id3.genre_offset?id3.buffer + id3.genre_offset:NULL) ! #define ID3_GET_TRACK(id3) (id3.track_offset?id3.buffer + id3.track_offset:NULL) ! #define ID3_GET_YEAR(id3) (id3.year_offset?id3.buffer + id3.year_offset:NULL) ! #define ID3_GET_COMPOSER(id3) (id3.composer_offset?id3.buffer + id3.composer_offset:NULL) ! #define ID3_GET_BAND(id3) (id3.band_offset?id3.buffer + id3.band_offset:NULL) ! #define ID3_GET_COMMENT(id3) (const char*)(id3.comment_offset?&id3.buffer[id3.comment_offset]:NULL) struct mpeg_info { --- 35,39 ---- #include <stdbool.h> #include "file.h" ! #include "metadata.h" struct mpeg_info { *************** *** 92,96 **** char path[MAX_PATH]; ! struct id3_info id3; struct mpeg_info mpeg; --- 54,58 ---- char path[MAX_PATH]; ! struct meta_data meta; struct mpeg_info mpeg; *************** *** 108,117 **** /* In both fonctions the file cursor has to be set prior to the call */ ! int id3_parse_v1( int fd, struct id3_info *id3 ); ! int id3_parse_v2( int fd, struct id3_info *id3 ); /* Parses an mp3 file */ ! int mp3_parse( const char* path, struct mpeg_info *mpeg, struct id3_info *id3 ); - const char* id3_version( unsigned int version ); #endif --- 70,78 ---- /* In both fonctions the file cursor has to be set prior to the call */ ! int id3_parse_v1( int fd, struct meta_data *meta ); ! int id3_parse_v2( int fd, struct meta_data *meta ); /* Parses an mp3 file */ ! int mp3_parse( const char* path, struct mpeg_info *mpeg, struct meta_data *meta ); #endif |
From: Francois B <mrs...@us...> - 2006-10-10 23:41:20
|
Update of /cvsroot/openneo/openneo/firmware/export In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8185 Modified Files: audio.h Log Message: Added replaygain support Index: audio.h =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/export/audio.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** audio.h 15 Oct 2004 03:08:04 -0000 1.5 --- audio.h 10 Oct 2006 23:41:18 -0000 1.6 *************** *** 57,60 **** --- 57,61 ---- void audio_set(int setting, int value ); bool audio_is_muted(void); + void audio_set_extra_gain( int db ); #endif |
From: Francois B <mrs...@us...> - 2006-10-10 23:40:58
|
Update of /cvsroot/openneo/openneo/firmware/common In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7813 Modified Files: log.c Log Message: More precise log function Index: log.c =================================================================== RCS file: /cvsroot/openneo/openneo/firmware/common/log.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** log.c 23 Aug 2004 02:59:53 -0000 1.3 --- log.c 10 Oct 2006 23:40:56 -0000 1.4 *************** *** 14,214 **** * $Id: log.c ****************************************************************************/ - #include <stdbool.h> ! #define LOG_ARRAYSIZE 90 ! /* Main look-up table for log function ! ! Value = 10000 * Log( 10 + x*10 ) where x >= 1.0 and x < 10 ! Values below 1.0 are going to have a negative log. They are calculated ! by using the inverse value. ! Functions below are not realy optimized but hey they work... ! */ ! static const long log10_10000[90] = { ! ! 0, //1.0 ! 414, //1.1 ! 792, //1.2 ! 1139, //1.3 ! 1461, //1.4 ! 1761, //1.5 ! 2041, //1.6 ! 2304, //1.7 ! 2552, //1.8 ! 2788, //1.9 ! 3010, //2.0 ! 3222, //2.1 ! 3424, //2.2 ! 3617, //2.3 ! 3802, //2.4 ! 3979, //2.5 ! 4150, //2.6 ! 4314, //2.5 ! 4472, //2.8 ! 4624, //2.9 ! 4771, //3.0 ! 4914, //3.1 ! 5051, //3.2 ! 5185, //3.3 ! 5315, //3.4 ! 5441, //3.5 ! 5563, //3.6 ! 5682, //3.7 ! 5798, //3.8 ! 5911, //3.9 ! 6021, //4.0 ! 6128, //4.1 ! 6232, //4.2 ! 6335, //4.3 ! 6434, //4.4 ! 6532, //4.5 ! 6628, //4.6 ! 6721, //4.7 ! 6812, //4.8 ! 6902, //4.9 ! 6990, //5.0 ! 7076, //5.1 ! 7160, //5.2 ! 7243, //5.3 ! 7324, //5.4 ! 7404, //5.5 ! 7482, //5.6 ! 7559, //5.7 ! 7634, //5.8 ! 7709, //5.9 ! 7782, //6.0 ! 7853, //6.1 ! 7924, //6.2 ! 7993, //6.3 ! 8062, //6.4 ! 8129, //6.5 ! 8195, //6.6 ! 8261, //6.7 ! 8325, //6.8 ! 8388, //6.9 ! 8451, //7.0 ! 8513, //7.1 ! 8573, //7.2 ! 8633, //7.3 ! 8692, //7.4 ! 8751, //7.5 ! 8808, //7.6 ! 8865, //7.7 ! 8921, //7.8 ! 8976, //7.9 ! 9031, //8.0 ! 9085, //8.1 ! 9138, //8.2 ! 9191, //8.3 ! 9243, //8.4 ! 9294, //8.5 ! 9345, //8.6 ! 9395, //8.7 ! 9445, //8.8 ! 9494, //8.9 ! 9542, //9.0 ! 9590, //9.1 ! 9638, //9.2 ! 9685, //9.3 ! 9731, //9.4 ! 9777, //9.5 ! 9823, //9.6 ! 9868, //9.7 ! 9912, //9.8 ! 9956 //9.9 ! }; ! /* Input is in thousands, output is in ten of thousands*/ ! long log10( long input ) ! { ! long value = 0; ! long result = 0; ! int index = 0; ! long m = 0; ! bool neg = false; ! if( input < 1000 ){ // ]0,1.0[ = Negative result log ! neg = true; ! value = 1000000 / input; //flip value ! } ! else ! value = input; ! ! //Round up to first decimal ! value /= 100; ! //Count the number of tens ! while( value > 100 ){ ! m++; ! value /= 10; ! } ! ! //Array begins at log(1) ! index = value - 10; ! //Clip values ! if( index < 0 ) ! index = 0; ! else if(index > (LOG_ARRAYSIZE-1) ){ ! index = 0; ! m++; ! } ! ! result = log10_10000[index]; ! result = result + (m * 10000); ! ! if( neg ) ! result = result * (-1); ! return result; ! } ! /* Reverse of the above function */ ! /* ! long revlog10( long log ) { ! long result; ! bool neg = false; ! long m = 0; ! long value; ! int index; ! ! if( log < 0 ){ ! neg = true; ! log = log * (-1); ! } ! ! //Count the number of tens ! while( log >= 10000 ){ ! m++; ! log -= 10000; ! } ! ! value = log; ! ! //Find the closest value ! for( index=0; index<LOG_ARRAYSIZE; index++ ){ ! if( value < log10_10000[index]) ! break; ! } ! index--; ! ! //Clip index ! if( index < 0 ) ! index = 0; ! result = index + 10; ! result *= 100; ! if( m ) ! result *= m*10; - if( neg ) - result = 1000000 / result; - - return result; - } */ --- 14,338 ---- * $Id: log.c ****************************************************************************/ #include <stdbool.h> ! /* Log Base 10 Notes: ! - Every zero at the end of the number adds 1 to the log ! So log(20) = 1 + log(2) = 1.3010 ! - Values between 0 and 1.0 are calculted as follow: ! result = log( 1/n ) * -1 where (0 < n < 1.0) ! */ ! static const short log_table1[] = { ! 0, //1.00 ! 43, //1.01 ! 86, //1.02 ! 128, //1.03 ! 170, //1.04 ! 212, //1.05 ! 253, //1.06 ! 294, //1.07 ! 334, //1.08 ! 374, //1.09 ! 414, //1.10 ! 453, //1.11 ! 492, //1.12 ! 531, //1.13 ! 569, //1.14 ! 607, //1.15 ! 645, //1.16 ! 682, //1.17 ! 719, //1.18 ! 755 //1.19 ! }; ! static const short log_table2[] = { ! 792, //1.20 ! 864, //1.22 ! 934, //1.24 ! 1004, //1.26 ! 1072, //1.28 ! 1139, //1.30 ! 1206, //1.32 ! 1271, //1.34 ! 1335, //1.36 ! 1398, //1.38 ! 1461, //1.40 ! 1523, //1.42 ! 1584, //1.44 ! 1643, //1.46 ! 1703, //1.48 ! 1760, //1.50 ! 1818, //1.52 ! 1875, //1.54 ! 1931, //1.56 ! 1987, //1.58 ! 2041, //1.60 ! 2095, //1.62 ! 2148, //1.64 ! 2201, //1.66 ! 2253, //1.68 ! 2304, //1.70 ! 2355, //1.72 ! 2405, //1.74 ! 2455, //1.76 ! 2504, //1.78 ! 2553, //1.80 ! 2600, //1.82 ! 2648, //1.84 ! 2695, //1.86 ! 2742, //1.88 ! 2788, //1.90 ! 2833, //1.92 ! 2878, //1.94 ! 2922, //1.96 ! 2967 //1.98 ! }; ! static const short log_table3[] = { ! 3010, //2.00 ! 3118, //2.05 ! 3222, //2.10 ! 3324, //2.15 ! 3424, //2.20 ! 3521, //2.25 ! 3617, //2.30 ! 3710, //2.35 ! 3802, //2.40 ! 3891, //2.45 ! 3979, //2.50 ! 4065, //2.55 ! 4150, //2.60 ! 4232, //2.65 ! 4314, //2.70 ! 4393, //2.75 ! 4472, //2.80 ! 4548, //2.85 ! 4624, //2.90 ! 4698, //2.95 ! 4771, //3.00 ! 4843, //3.05 ! 4914, //3.10 ! 4983, //3.15 ! 5051, //3.20 ! 5119, //3.25 ! 5185, //3.30 ! 5250, //3.35 ! 5315, //3.40 ! 5378, //3.45 ! 5441, //3.50 ! 5502, //3.55 ! 5563, //3.60 ! 5623, //3.65 ! 5682, //3.70 ! 5740, //3.75 ! 5798, //3.80 ! 5855, //3.85 ! 5911, //3.90 ! 5969 //3.95 ! }; ! static const short log_table4[] = { ! 6021, //4.0 ! 6128, //4.1 ! 6232, //4.2 ! 6335, //4.3 ! 6434, //4.4 ! 6532, //4.5 ! 6628, //4.6 ! 6721, //4.7 ! 6812, //4.8 ! 6902, //4.9 ! 6990, //5.0 ! 7076, //5.1 ! 7160, //5.2 ! 7243, //5.3 ! 7324, //5.4 ! 7404, //5.5 ! 7482, //5.6 ! 7559, //5.7 ! 7634, //5.8 ! 7709, //5.9 ! 7782, //6.0 ! 7853, //6.1 ! 7924, //6.2 ! 7993, //6.3 ! 8062, //6.4 ! 8129, //6.5 ! 8195, //6.6 ! 8261, //6.7 ! 8325, //6.8 ! 8388, //6.9 ! 8451, //7.0 ! 8513, //7.1 ! 8573, //7.2 ! 8633, //7.3 ! 8692, //7.4 ! 8751, //7.5 ! 8808, //7.6 ! 8865, //7.7 ! 8921, //7.8 ! 8976, //7.9 ! 9031, //8.0 ! 9085, //8.1 ! 9138, //8.2 ! 9191, //8.3 ! 9243, //8.4 ! 9294, //8.5 ! 9345, //8.6 ! 9395, //8.7 ! 9445, //8.8 ! 9494, //8.9 ! 9542, //9.0 ! 9590, //9.1 ! 9638, //9.2 ! 9685, //9.3 ! 9731, //9.4 ! 9777, //9.5 ! 9823, //9.6 ! 9868, //9.7 ! 9912, //9.8 ! 9956, //9.9 ! 10000 //10.0 ! }; ! /* Input = Ratio x 100, ! Output = Log x 10000 */ ! int logbase10( int input ) { ! int value = 0; ! int result = 0; ! int index = 0; ! int m = 0; ! bool neg = false; ! if( input == 0 ) ! return 0; ! ! if( input < 100 ){ // (0 < ratio < 1.0) = Negative result log ! neg = true; ! value = 10000 / input; // 1/value ! } ! else ! value = input; ! ! //Count the number of tens ! while( value > 1000 ){ ! m++; ! value /= 10; ! } ! ! if( value >= 100 && value < 120 ) { ! index = value - 100; ! result = (int)log_table1[index]; ! } ! else if( value >= 120 && value < 200 ) { ! index = (value - 120) / 2; ! result = (int)log_table2[index]; ! } ! else if( value >= 200 && value < 400 ) { ! index = (value - 200) / 5; ! result = (int)log_table3[index]; ! } ! else { ! index = (value - 400 ) / 10; ! result = (int)log_table4[index]; ! } ! ! result = result + (m * 10000); ! ! if( neg ) ! result = result * (-1); ! ! return result; ! } ! /* Reverse of the above function ! ! log = log value x 10000 */ + int rlogbase10( int log ) + { + int result = 0; + int m = 0; + int value; + int index; + bool neg = false; + + if( log < 0 ){ + neg = true; + log = log * (-1); + } + + //Count the number of tens + while( log >= 10000 ){ + m++; + log -= 10000; + } + + value = log; + + if( value >= log_table4[0] ) { + + //Find the closest value + for( index=0; index< sizeof(log_table4)/sizeof(short); index++ ){ + if( value < log_table4[index]) + break; + } + + index--; + result = index * 10; + result += 400; + } + else if( value >= log_table3[0] ) { + + //Find the closest value + for( index=0; index< sizeof(log_table3)/sizeof(short); index++ ){ + if( value < log_table3[index]) + break; + } + + index--; + result = index * 5; + result += 200; + } + else if( value >= log_table2[0] ) { + + + //Find the closest value + for( index=0; index< sizeof(log_table2)/sizeof(short); index++ ){ + if( value < log_table2[index]) + break; + } + + index--; + result = index * 2; + result += 100; + + } + else if( value >= log_table1[0] ) { + + + //Find the closest value + for( index=0; index< sizeof(log_table1)/sizeof(short); index++ ){ + if( value < log_table1[index]) + break; + } + + index--; + result = index + 100; + } + + while(m--) + result *= 10; + + if( neg ) + result = 10000 / result; + + return result; + } + |
From: Francois B <mrs...@us...> - 2006-10-10 23:40:37
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7801 Modified Files: volume.c Log Message: More precise log function Index: volume.c =================================================================== RCS file: /cvsroot/openneo/openneo/apps/volume.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** volume.c 26 Jun 2005 21:47:57 -0000 1.12 --- volume.c 10 Oct 2006 23:40:35 -0000 1.13 *************** *** 52,56 **** if( global_settings.volume_mode == AUDIO_MODE_ANALOG ){ if( global_settings.volume > 0 ){ ! value = log10( global_settings.volume * 60 ); value /= 500; } --- 52,56 ---- if( global_settings.volume_mode == AUDIO_MODE_ANALOG ){ if( global_settings.volume > 0 ){ ! value = logbase10( global_settings.volume * 6 ); value /= 500; } *************** *** 60,64 **** else{ if( global_settings.volume > 0 ){ ! value = log10( global_settings.volume * 10 ); value /= 500; } --- 60,64 ---- else{ if( global_settings.volume > 0 ){ ! value = logbase10( global_settings.volume ); value /= 500; } |
From: Francois B <mrs...@us...> - 2006-10-10 23:40:06
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7391 Modified Files: wps-display.c Log Message: id3 info renamed to metadata info Index: wps-display.c =================================================================== RCS file: /cvsroot/openneo/openneo/apps/wps-display.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** wps-display.c 12 Jun 2006 01:14:57 -0000 1.35 --- wps-display.c 10 Oct 2006 23:40:02 -0000 1.36 *************** *** 298,302 **** * Returns the tag. NULL indicates the tag wasn't available. */ ! static char* get_tag(struct mp3entry* id3, char* tag, int max_length, char* buf, int buf_size,unsigned int* flags) { *flags = 0; --- 298,302 ---- * Returns the tag. NULL indicates the tag wasn't available. */ ! static const unsigned char* get_tag(struct mp3entry* id3, char* tag, int max_length, char* buf, int buf_size,unsigned int* flags) { *flags = 0; *************** *** 313,344 **** switch (tag[1]) { case 't': /* ID3 Title */ ! return ID3_GET_TITLE(id3->id3); case 'a': /* ID3 Artist */ ! return ID3_GET_ARTIST(id3->id3); case 'b': /* ID3 Band */ ! return ID3_GET_BAND(id3->id3); case 'c': /* ID3 Composer */ ! return ID3_GET_COMPOSER(id3->id3); case 'n': /* ID3 Track Number */ ! return ID3_GET_TRACK(id3->id3); case 'd': /* ID3 Album/Disc */ ! return ID3_GET_ALBUM(id3->id3); case 'y': /* year */ ! return ID3_GET_YEAR(id3->id3); case 'g': /* genre */ ! return ID3_GET_GENRE(id3->id3); ! ! case 'v': /* id3 version */ ! return id3_version(id3->id3.version); ! case 'm': /* id3 Comment */ ! return ID3_GET_COMMENT(id3->id3); } break; --- 313,341 ---- switch (tag[1]) { case 't': /* ID3 Title */ ! return METADATA_GET_TITLE(id3->meta); case 'a': /* ID3 Artist */ ! return METADATA_GET_ARTIST(id3->meta); case 'b': /* ID3 Band */ ! return METADATA_GET_BAND(id3->meta); case 'c': /* ID3 Composer */ ! return METADATA_GET_COMPOSER(id3->meta); case 'n': /* ID3 Track Number */ ! return METADATA_GET_TRACK(id3->meta); case 'd': /* ID3 Album/Disc */ ! return METADATA_GET_ALBUM(id3->meta); case 'y': /* year */ ! return METADATA_GET_YEAR(id3->meta); case 'g': /* genre */ ! return METADATA_GET_GENRE(id3->meta); ! case 'm': /* id3 Comment */ ! return METADATA_GET_COMMENT(id3->meta); } break; *************** *** 781,785 **** /* No value, so skip to else part */ ! if ((!value) || (!strlen(value))) fmt = skip_conditional(fmt, true); --- 778,782 ---- /* No value, so skip to else part */ ! if( !value || !strlen(value) ) fmt = skip_conditional(fmt, true); |
From: Francois B <mrs...@us...> - 2006-10-10 23:39:35
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7366 Modified Files: VERSION Log Message: bumped version Index: VERSION =================================================================== RCS file: /cvsroot/openneo/openneo/apps/VERSION,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VERSION 12 Jun 2006 01:13:50 -0000 1.4 --- VERSION 10 Oct 2006 23:39:32 -0000 1.5 *************** *** 1 **** ! 2.1 beta 11 --- 1 ---- ! 2.1 beta 12 |
From: Francois B <mrs...@us...> - 2006-10-10 23:39:14
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7346 Modified Files: song_info.c Log Message: id3 info renamed to metadata info Index: song_info.c =================================================================== RCS file: /cvsroot/openneo/openneo/apps/song_info.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** song_info.c 8 Feb 2006 01:34:45 -0000 1.9 --- song_info.c 10 Oct 2006 23:39:12 -0000 1.10 *************** *** 20,24 **** #include "units.h" #include "lcd.h" ! #include "id3.h" #include "flags.h" #include "dj.h" --- 20,24 ---- #include "units.h" #include "lcd.h" ! #include "metadata.h" #include "flags.h" #include "dj.h" *************** *** 53,82 **** lcd_puts_nopad( 0, 0, str(LANG_ID3_TITLE) ); ! if( ID3_GET_TITLE(id3->id3) ) ! lcd_puts_scroll( 0, 1, ID3_GET_TITLE(id3->id3) ); lcd_puts_nopad( 0, 2, str(LANG_ID3_ARTIST) ); ! if( ID3_GET_ARTIST(id3->id3) ) ! lcd_puts_scroll( 0, 3, ID3_GET_ARTIST(id3->id3) ); break; case 2: ! lcd_puts_nopad( 0, 0, str(LANG_ID3_ALBUM) ); ! if( ID3_GET_ALBUM(id3->id3) ) ! lcd_puts_scroll( 0, 1, ID3_GET_ALBUM(id3->id3) ); ! lcd_puts_nopad( 0, 2, str(LANG_ID3_GENRE) ); ! if( ID3_GET_GENRE(id3->id3) ) ! lcd_puts_scroll( 0, 3, ID3_GET_GENRE(id3->id3) ); break; case 3: ! display_field_value( 0, str(LANG_TRACK), ID3_GET_TRACK(id3->id3)?ID3_GET_TRACK(id3->id3):"" ); ! display_field_value( 1, "Year", ID3_GET_YEAR(id3->id3)?ID3_GET_YEAR(id3->id3):"" ); ! ! snprintf(scroll_text,sizeof(scroll_text), "%d/%d", dj_get_playing_index()+1, dj_playlist_count()); ! display_field_value( 2, str(LANG_PLAYLIST), scroll_text ); ! ! display_field_value( 3, "ID3", id3->id3.version?id3_version(id3->id3.version):"" ); break; --- 53,74 ---- lcd_puts_nopad( 0, 0, str(LANG_ID3_TITLE) ); ! lcd_puts_scroll( 0, 1, METADATA_GET_TITLE(id3->meta) ); lcd_puts_nopad( 0, 2, str(LANG_ID3_ARTIST) ); ! lcd_puts_scroll( 0, 3, METADATA_GET_ARTIST(id3->meta) ); break; case 2: ! lcd_format( 0, 0, 20, 0, "[%s]", str(LANG_ALBUM) ); ! lcd_puts_scroll( 0, 1, METADATA_GET_ALBUM(id3->meta) ); ! lcd_puts_nopad( 0, 2, str(LANG_ID3_GENRE) ); ! lcd_puts_scroll( 0, 3, METADATA_GET_GENRE(id3->meta) ); break; case 3: ! display_field_value( 0, str(LANG_TRACK), METADATA_GET_TRACK(id3->meta) ); ! display_field_value( 1, str(LANG_YEAR), METADATA_GET_YEAR(id3->meta) ); ! break; *************** *** 85,99 **** format_time( scroll_text,sizeof(scroll_text), id3->mpeg.length, ':' ); display_field_value( 0, "Length", scroll_text ); ! ! snprintf(scroll_text,sizeof(scroll_text), "%d %s%s", id3->mpeg.bitrate, units_table[UNITS_KBPS], id3->mpeg.vbr?" VBR":""); ! display_field_value( 1, "Bitrate", scroll_text ); ! ! snprintf(scroll_text,sizeof(scroll_text), "%d %s", id3->mpeg.frequency, units_table[UNITS_HZ]); ! display_field_value( 2, "Freq", scroll_text ); ! ! snprintf(scroll_text,sizeof(scroll_text), "%d.%d %s", id3->mpeg.filesize >> 10, (id3->mpeg.filesize - ( (id3->mpeg.filesize >> 10) << 10 )) / 100, units_table[UNITS_KB]); ! display_field_value( 3, "Size", scroll_text ); ! break; ! case 5: lcd_puts_nopad(0, 0, str(LANG_ID3_PATH)); --- 77,91 ---- format_time( scroll_text,sizeof(scroll_text), id3->mpeg.length, ':' ); display_field_value( 0, "Length", scroll_text ); ! ! snprintf(scroll_text,sizeof(scroll_text), "%d %s%s", id3->mpeg.bitrate, units_table[UNITS_KBPS], id3->mpeg.vbr?" VBR":""); ! display_field_value( 1, "Bitrate", scroll_text ); ! ! snprintf(scroll_text,sizeof(scroll_text), "%d %s", id3->mpeg.frequency, units_table[UNITS_HZ]); ! display_field_value( 2, "Freq", scroll_text ); ! ! snprintf(scroll_text,sizeof(scroll_text), "%d.%d %s", id3->mpeg.filesize >> 10, (id3->mpeg.filesize - ( (id3->mpeg.filesize >> 10) << 10 )) / 100, units_table[UNITS_KB]); ! display_field_value( 3, "Size", scroll_text ); ! break; ! case 5: lcd_puts_nopad(0, 0, str(LANG_ID3_PATH)); *************** *** 101,106 **** lcd_format( 0, 2, 20, 0, "[%s]", str(LANG_COMMENTS) ); ! value = ID3_GET_COMMENT(id3->id3); ! lcd_puts_scroll(0, 3, value?value:"" ); break; } --- 93,97 ---- lcd_format( 0, 2, 20, 0, "[%s]", str(LANG_COMMENTS) ); ! lcd_puts_scroll(0, 3, METADATA_GET_COMMENT(id3->meta) ); break; } |
From: Francois B <mrs...@us...> - 2006-10-10 23:38:34
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6961 Modified Files: softkeys.c softkeys.h Log Message: changed signed char to unsigned char Index: softkeys.h =================================================================== RCS file: /cvsroot/openneo/openneo/apps/softkeys.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** softkeys.h 28 Apr 2006 01:03:49 -0000 1.9 --- softkeys.h 10 Oct 2006 23:38:32 -0000 1.10 *************** *** 45,49 **** unsigned int softkeys_get( int section, int button ); ! int softkeys_load( const char* filename, bool verbal ); void softkeys_reset( void ); unsigned int softkeys_get_volume_buttons(int section); --- 45,49 ---- unsigned int softkeys_get( int section, int button ); ! int softkeys_load( const unsigned char* filename, bool verbal ); void softkeys_reset( void ); unsigned int softkeys_get_volume_buttons(int section); Index: softkeys.c =================================================================== RCS file: /cvsroot/openneo/openneo/apps/softkeys.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** softkeys.c 12 Jun 2006 01:13:40 -0000 1.14 --- softkeys.c 10 Oct 2006 23:38:32 -0000 1.15 *************** *** 289,293 **** } ! int softkeys_load( const char* filename, bool verbal ) { int fd; --- 289,293 ---- } ! int softkeys_load( const unsigned char* filename, bool verbal ) { int fd; *************** *** 303,307 **** if( fd < 0 ) return -1; ! while(1) { --- 303,307 ---- if( fd < 0 ) return -1; ! while(1) { |