From: <ny...@us...> - 2007-01-07 18:12:54
|
Revision: 248 http://svn.sourceforge.net/pmplib/?rev=248&view=rev Author: nyaochi Date: 2007-01-07 10:12:54 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Moved pmp_t::is_supported_codec() and pmp_t::is_supported_ext() functions to pmp_music_t. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-01-07 17:56:29 UTC (rev 247) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-01-07 18:12:54 UTC (rev 248) @@ -55,10 +55,10 @@ static int found_music_file(void *instance, const ucs2char_t* found_path, const ucs2char_t* found_file) { enumerate_dat_t* ed = (enumerate_dat_t*)instance; - pmp_t* pmp = ed->pmp; + pmp_music_t* pmp_music = ed->pmp->music; easypmp_filelist_t* fl = ed->fl; - if (pmp->is_supported_ext(pmp, found_file)) { + if (pmp_music->is_supported_ext(pmp_music, found_file)) { // Supported music file. easypmp_filename_t* new_filename = NULL; Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-07 17:56:29 UTC (rev 247) +++ trunk/pmplib/include/pmp.h 2007-01-07 18:12:54 UTC (rev 248) @@ -42,16 +42,6 @@ struct tag_pmp_playlist_t; typedef struct tag_pmp_playlist_t pmp_playlist_t; /** - * Interface IDs. - */ -enum { - PMPIID_NONE = 0, - PMPIID_MUSIC, - PMPIID_TUNER, - PMPIID_PHOTO, -}; - -/** * Open flags. */ enum { @@ -155,9 +145,6 @@ result_t (*close)(pmp_t* pmp, uint32_t flag); result_t (*create_instance_pl)(pmp_t* pmp, pmp_playlist_t** pmppl); - - int (*is_supported_codec)(pmp_t* pmp, uint32_t codec); - int (*is_supported_ext)(pmp_t* pmp, const ucs2char_t* filename); }; typedef void pmpdb_readwrite_progress_t(void *instance, uint32_t size, uint32_t total); @@ -170,6 +157,9 @@ result_t (*get)(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); result_t (*dump)(pmp_music_t* pmpdb, FILE *fp, int level); + + int (*is_supported_codec)(pmp_music_t* pmpdb, uint32_t codec); + int (*is_supported_ext)(pmp_music_t* pmpdb, const ucs2char_t* filename); }; struct tag_pmp_playlist_t { Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 17:56:29 UTC (rev 247) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 18:12:54 UTC (rev 248) @@ -119,8 +119,6 @@ static result_t pmp_close(pmp_t* pmp, uint32_t flag); static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb); static result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl); -static result_t pmp_is_supported_codec(pmp_t* pmp, uint32_t codec); -static result_t pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename); static uint32_t pmpdb_release(pmp_music_t* pmpdb); static result_t pmpdb_read(pmp_music_t* pmpdb); @@ -128,6 +126,8 @@ static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records); static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); static result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level); +static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec); +static int pmpdb_is_supported_ext(pmp_music_t* pmpdb, const ucs2char_t* filename); static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl); static uint32_t pmppl_release(pmp_playlist_t* pmppl); @@ -332,8 +332,6 @@ pmp->open = pmp_open; pmp->close = pmp_close; pmp->create_instance_pl = pmp_create_instance_pl; - pmp->is_supported_codec = pmp_is_supported_codec; - pmp->is_supported_ext = pmp_is_supported_ext; pmp->add_ref(pmp); // Allocate the internal variables. @@ -432,6 +430,8 @@ pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; + pmpdb->is_supported_codec = pmpdb_is_supported_codec; + pmpdb->is_supported_ext = pmpdb_is_supported_ext; pmpdbi = calloc(1, sizeof(pmpdb_internal_t)); if (!pmpdbi) { @@ -482,20 +482,9 @@ -static int pmp_is_supported_codec(pmp_t* pmp, uint32_t codec) -{ - return ip2db_is_supported_codec(codec); -} -static int pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename) -{ - return ip2db_is_supported_ext(filename); -} - - - static uint32_t pmpdb_release(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; @@ -543,9 +532,20 @@ } } +static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec) +{ + return ip2db_is_supported_codec(codec); +} +static int pmpdb_is_supported_ext(pmp_music_t* pmpdb, const ucs2char_t* filename) +{ + return ip2db_is_supported_ext(filename); +} + + + static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { return interlocked_increment(&pmppl->ref_count); Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 17:56:29 UTC (rev 247) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 18:12:54 UTC (rev 248) @@ -115,8 +115,6 @@ static result_t pmp_close(pmp_t* pmp, uint32_t flag); static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb); static result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl); -static result_t pmp_is_supported_codec(pmp_t* pmp, uint32_t codec); -static result_t pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename); static uint32_t pmpdb_release(pmp_music_t* pmpdb); static result_t pmpdb_read(pmp_music_t* pmpdb); @@ -124,6 +122,8 @@ static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records); static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); static result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level); +static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec); +static int pmpdb_is_supported_ext(pmp_music_t* pmpdb, const ucs2char_t* filename); static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl); static uint32_t pmppl_release(pmp_playlist_t* pmppl); @@ -343,8 +343,6 @@ pmp->open = pmp_open; pmp->close = pmp_close; pmp->create_instance_pl = pmp_create_instance_pl; - pmp->is_supported_codec = pmp_is_supported_codec; - pmp->is_supported_ext = pmp_is_supported_ext; pmp->add_ref(pmp); // Allocate the internal variables. @@ -443,6 +441,8 @@ pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; + pmpdb->is_supported_codec = pmpdb_is_supported_codec; + pmpdb->is_supported_ext = pmpdb_is_supported_ext; pmpdbi = calloc(1, sizeof(pmpdb_internal_t)); if (!pmpdbi) { @@ -492,32 +492,8 @@ -static int pmp_is_supported_codec(pmp_t* pmp, uint32_t codec) -{ - return ( - (codec == PMPCODEC_MPEGLAYER3) || - (codec == PMPCODEC_WMA) || - (codec == PMPCODEC_VORBIS) - ) ? 1 : 0; -} -static int pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename) -{ - static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; - static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; - static const ucs2char_t ucs2cs_ogg[] = {'.','o','g','g',0}; - return ( - filepath_hasext(filename, ucs2cs_mp3) || - filepath_hasext(filename, ucs2cs_wma) || - filepath_hasext(filename, ucs2cs_ogg) - ) ? 1 : 0; -} - - - - - static uint32_t pmpdb_release(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; @@ -671,9 +647,32 @@ } } +static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec) +{ + return ( + (codec == PMPCODEC_MPEGLAYER3) || + (codec == PMPCODEC_WMA) || + (codec == PMPCODEC_VORBIS) + ) ? 1 : 0; +} +static int pmpdb_is_supported_ext(pmp_music_t* pmpdb, const ucs2char_t* filename) +{ + static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; + static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; + static const ucs2char_t ucs2cs_ogg[] = {'.','o','g','g',0}; + return ( + filepath_hasext(filename, ucs2cs_mp3) || + filepath_hasext(filename, ucs2cs_wma) || + filepath_hasext(filename, ucs2cs_ogg) + ) ? 1 : 0; +} + + + + static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { return interlocked_increment(&pmppl->ref_count); Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 17:56:29 UTC (rev 247) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 18:12:54 UTC (rev 248) @@ -91,8 +91,6 @@ static result_t pmp_close(pmp_t* pmp, uint32_t flag); static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb); static result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl); -static result_t pmp_is_supported_codec(pmp_t* pmp, uint32_t codec); -static result_t pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename); static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb); static uint32_t pmpdb_release(pmp_music_t* pmpdb); @@ -101,6 +99,8 @@ static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records); static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); static result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level); +static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec); +static int pmpdb_is_supported_ext(pmp_music_t* pmpdb, const ucs2char_t* filename); static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl); static uint32_t pmppl_release(pmp_playlist_t* pmppl); @@ -175,8 +175,6 @@ pmp->open = pmp_open; pmp->close = pmp_close; pmp->create_instance_pl = pmp_create_instance_pl; - pmp->is_supported_codec = pmp_is_supported_codec; - pmp->is_supported_ext = pmp_is_supported_ext; pmp->add_ref(pmp); // Allocate the internal variables. @@ -275,31 +273,6 @@ return 0; } -static int pmp_is_supported_codec(pmp_t* pmp, uint32_t codec) -{ - return ( - (codec == PMPCODEC_MPEGLAYER3) || - (codec == PMPCODEC_VORBIS) || - (codec == PMPCODEC_WMA) || - (codec == PMPCODEC_WAV) - ) ? 1 : 0; -} - -static int pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename) -{ - static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; - static const ucs2char_t ucs2cs_ogg[] = {'.','o','g','g',0}; - static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; - static const ucs2char_t ucs2cs_wav[] = {'.','w','a','v',0}; - - return ( - filepath_hasext(filename, ucs2cs_mp3) || - filepath_hasext(filename, ucs2cs_ogg) || - filepath_hasext(filename, ucs2cs_wma) || - filepath_hasext(filename, ucs2cs_wav) - ) ? 1 : 0; -} - static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) { pmp_music_t* pmpdb = NULL; @@ -317,6 +290,8 @@ pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; + pmpdb->is_supported_codec = pmpdb_is_supported_codec; + pmpdb->is_supported_ext = pmpdb_is_supported_ext; // Allocate and initialize an internal object (irivnavi_t). irivnavi = (irivnavi_t*)calloc(1, sizeof(irivnavi_t)); @@ -484,7 +459,7 @@ // Count the number of valid entries. n = 0; for (i = 0;i < num_records;++i) { - if (pmp_is_supported_codec(pmpdb->pmp, records[i].codec)) { + if (pmpdb_is_supported_codec(pmpdb, records[i].codec)) { ++n; } } @@ -500,7 +475,7 @@ record_t* dst = &db->records[j]; // Skip unsupported codec. - if (!pmp_is_supported_codec(pmpdb->pmp, src->codec)) { + if (!pmpdb_is_supported_codec(pmpdb, src->codec)) { continue; } @@ -591,10 +566,35 @@ return 0; } +static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec) +{ + return ( + (codec == PMPCODEC_MPEGLAYER3) || + (codec == PMPCODEC_VORBIS) || + (codec == PMPCODEC_WMA) || + (codec == PMPCODEC_WAV) + ) ? 1 : 0; +} +static int pmpdb_is_supported_ext(pmp_music_t* pmpdb, const ucs2char_t* filename) +{ + static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; + static const ucs2char_t ucs2cs_ogg[] = {'.','o','g','g',0}; + static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; + static const ucs2char_t ucs2cs_wav[] = {'.','w','a','v',0}; + return ( + filepath_hasext(filename, ucs2cs_mp3) || + filepath_hasext(filename, ucs2cs_ogg) || + filepath_hasext(filename, ucs2cs_wma) || + filepath_hasext(filename, ucs2cs_wav) + ) ? 1 : 0; +} + + + static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { return interlocked_increment(&pmppl->ref_count); Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 17:56:29 UTC (rev 247) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 18:12:54 UTC (rev 248) @@ -222,8 +222,6 @@ static result_t pmp_close(pmp_t* pmp, uint32_t flag); static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb); static result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl); -static result_t pmp_is_supported_codec(pmp_t* pmp, uint32_t codec); -static result_t pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename); static uint32_t pmpdb_release(pmp_music_t* pmpdb); static result_t pmpdb_read(pmp_music_t* pmpdb); @@ -231,6 +229,8 @@ static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records); static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); static result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level); +static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec); +static int pmpdb_is_supported_ext(pmp_music_t* pmpdb, const ucs2char_t* filename); static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl); static uint32_t pmppl_release(pmp_playlist_t* pmppl); @@ -389,8 +389,6 @@ pmp->create_instance_pl = pmp_create_instance_pl; pmp->open = pmp_open; pmp->close = pmp_close; - pmp->is_supported_codec = pmp_is_supported_codec; - pmp->is_supported_ext = pmp_is_supported_ext; pmp->add_ref(pmp); // Allocate the internal variables. @@ -489,6 +487,8 @@ pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; + pmpdb->is_supported_codec = pmpdb_is_supported_codec; + pmpdb->is_supported_ext = pmpdb_is_supported_ext; pmpdbi = calloc(1, sizeof(pmpdb_internal_t)); if (!pmpdbi) { @@ -527,20 +527,9 @@ } -static int pmp_is_supported_codec(pmp_t* pmp, uint32_t codec) -{ - return pp1db_is_supported_codec(codec); -} -static int pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename) -{ - return pp1db_is_supported_ext(filename); -} - - - static uint32_t pmpdb_release(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; @@ -584,9 +573,18 @@ return pp1db_repr(&pmpdbi->pp1db, fp, level); } +static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec) +{ + return pp1db_is_supported_codec(codec); +} +static int pmpdb_is_supported_ext(pmp_music_t* pmpdb, const ucs2char_t* filename) +{ + return pp1db_is_supported_ext(filename); +} + static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { return interlocked_increment(&pmppl->ref_count); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |