From: <ny...@us...> - 2007-02-23 08:43:33
|
Revision: 389 http://svn.sourceforge.net/pmplib/?rev=389&view=rev Author: nyaochi Date: 2007-02-23 00:43:34 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Added is_vbr flag to pmp_music_record_t. Modified Paths: -------------- trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/pmp_ipod/ipod.c Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-23 08:43:34 UTC (rev 389) @@ -380,6 +380,12 @@ uint32_t codec_version; /** + * VBR flag. + * e.g., 1 for MP3 VBR files. + */ + uint8_t is_vbr; + + /** * Track number. * e.g., 1 */ Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 08:43:34 UTC (rev 389) @@ -54,6 +54,8 @@ int frame_size; /**< size of the frame in bytes */ int samples_per_frame; /**< number of audio samples in the frame */ + int is_vbr; /**< true if VBR. */ + /* From Xing VBR header for VBR files, From file size for CBR files. */ int number_of_frames; /**< number of frames */ int data_size; /**< data size. */ @@ -248,9 +250,11 @@ double bitrate = header->data_size * 8.0 / duration; header->duration = (int)duration; header->bitrate = (int)bitrate; + header->is_vbr = 1; } else { double duration = (double)header->samples_per_frame * header->number_of_frames / header->sample_rate; header->duration = (int)duration; + header->is_vbr = 0; } /* Exit with success. */ @@ -488,6 +492,7 @@ info->codec_version = 205; break; } + info->is_vbr = mp3header.is_vbr; } id3_file_close(id3file); /* This will call fclose(fp); */ Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 08:43:34 UTC (rev 389) @@ -118,7 +118,8 @@ info->codec = PMPCODEC_VORBIS; info->codec_version = 1; - + info->is_vbr = 1; /* Most Ogg Vorbis files are encoded in VBR. */ + // Clear the decoders buffers, also closes fp. ov_clear(&vf); Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-23 08:43:34 UTC (rev 389) @@ -261,6 +261,7 @@ if (ret == 0) { info->codec = PMPCODEC_WAV; info->codec_version = 1; + info->is_vbr = 0; } return ret; } Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-23 08:43:34 UTC (rev 389) @@ -515,6 +515,7 @@ if (ret == 0) { info->codec = PMPCODEC_WMA; info->codec_version = 1; /* Set 1 for now. */ + info->is_vbr = 1; /* Set 1 for now. */ } return ret; } Modified: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 08:43:34 UTC (rev 389) @@ -156,10 +156,14 @@ switch (rec->codec) { case PMPCODEC_MPEGLAYER3: mhit_data->filetype = 0x4D503320; + mhit_data->type1 = rec->is_vbr ? 0x01 : 0x00; + mhit_data->type2 = rec->is_vbr ? 0x01 : 0x00; break; + default: + mhit_data->type1 = 0x01; + mhit_data->type2 = 0x01; + break; } - mhit_data->type1 = 0x01; - mhit_data->type2 = 0x01; mhit_data->compilation = 0; mhit_data->rating = 0; mhit_data->last_modified = rec->ts_update; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |