You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(56) |
Jul
(101) |
Aug
(14) |
Sep
|
Oct
(1) |
Nov
|
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(66) |
Feb
(106) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(10) |
Oct
(7) |
Nov
|
Dec
|
2008 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ny...@us...> - 2007-01-07 19:36:24
|
Revision: 250 http://svn.sourceforge.net/pmplib/?rev=250&view=rev Author: nyaochi Date: 2007-01-07 11:36:24 -0800 (Sun, 07 Jan 2007) Log Message: ----------- - Removed pmphelp.h. The definitions of pmphelp_* are moved to pmp.h as pmplib_* - Added some comments in pmp.h Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/device.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/frontend/easypmp/win32gui/maindlg.h trunk/pmplib/frontend/easypmp/win32gui/preference.h trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp/Makefile.am trunk/pmplib/lib/pmp/pmp.c trunk/pmplib/lib/pmp/pmp.vcproj trunk/pmplib/lib/pmp/pmp_win32.c 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 Removed Paths: ------------- trunk/pmplib/include/pmphelp.h Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-07 19:36:24 UTC (rev 250) @@ -32,7 +32,6 @@ #include <ucs2char.h> #include <filepath.h> #include <pmp.h> -#include <pmphelp.h> #include "util.h" @@ -75,18 +74,18 @@ static void enumerate_devid_callback(void *instance, const char *devid) { - pmphelp_t *pmphelp = (pmphelp_t*)instance; + pmplib_t *pmphelp = (pmplib_t*)instance; pmp_t* pmp = NULL; ucs2char_t ucs2cs_empty[] = {0}; - pmphelp_create(pmphelp, &pmp, ucs2cs_empty, devid); + pmplib_create(pmphelp, &pmp, ucs2cs_empty, devid); device_show_information(pmp, stdout); fprintf(stderr, "\n"); pmp->release(pmp); } -void device_enumerate(pmphelp_t* pmphelp) +void device_enumerate(pmplib_t* pmphelp) { - pmphelp_enumerate_devid(pmphelp, enumerate_devid_callback, pmphelp); + pmplib_enumerate_devid(pmphelp, enumerate_devid_callback, pmphelp); } /** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-07 19:36:24 UTC (rev 250) @@ -41,7 +41,6 @@ #include <filepath.h> #include <gmi.h> #include <pmp.h> -#include <pmphelp.h> #include <easypmp.h> #include "option.h" @@ -63,7 +62,7 @@ int database_dump(pmp_t* pmp, FILE *fpo, int level); void device_show_information(pmp_t* pmp, FILE *fpe); -void device_enumerate(pmphelp_t* pmphelp); +void device_enumerate(pmplib_t* pmphelp); int easypmp_progress_num_str( @@ -207,7 +206,7 @@ int ret = 0; int used_args = 0; char *mbs = NULL; - pmphelp_t* pmphelp = NULL; + pmplib_t* pmphelp = NULL; pmp_t* pmp = NULL; easypmp_filelist_t musics, playlists; pmp_music_record_t* records = NULL; @@ -272,7 +271,7 @@ } // Initialize PMP helper library. - pmphelp_init(&pmphelp); + pmplib_init(&pmphelp); // Show the list of supported devices and exit. if (opt.verb & MODE_LIST_DEVICES) { @@ -319,7 +318,7 @@ } // Create a PMP instance. - ret = pmphelp_create(pmphelp, &pmp, opt.path_to_root, opt.model); + ret = pmplib_create(pmphelp, &pmp, opt.path_to_root, opt.model); if (!pmp) { fprintf(fpe, "Failed to find a player (%d)\n", ret); ret = 1; @@ -397,7 +396,7 @@ pmp->close(pmp, 0); pmp->release(pmp); - pmphelp_finish(pmphelp); + pmplib_finish(pmphelp); option_finish(&opt); return ret; @@ -408,7 +407,7 @@ pmp = NULL; } if (pmphelp) { - pmphelp_finish(pmphelp); + pmplib_finish(pmphelp); pmphelp = NULL; } option_finish(&opt); Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-01-07 19:36:24 UTC (rev 250) @@ -44,7 +44,6 @@ #include <filepath.h> #include <gmi.h> #include <pmp.h> -#include <pmphelp.h> #ifdef HAVE_GETOPT_H #include <getopt.h> Modified: trunk/pmplib/frontend/easypmp/win32gui/maindlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-01-07 19:36:24 UTC (rev 250) @@ -45,7 +45,7 @@ int m_autorun; int m_configure_only; CString m_strIniFile; - pmphelp_t* m_pmphelp; + pmplib_t* m_pmphelp; CMainDlg() : m_autorun(0), m_configure_only(0), m_pmphelp(NULL) { @@ -148,7 +148,7 @@ } // Initialize PMP helper library. - pmphelp_init(&m_pmphelp); + pmplib_init(&m_pmphelp); // Delayed call of OnInitialize(). PostMessage(WM_APP, 0, 0); Modified: trunk/pmplib/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-01-07 19:36:24 UTC (rev 250) @@ -97,7 +97,7 @@ } } - UINT Persist(LPCTSTR szSettingFile, BOOL storing, pmphelp_t* pmphelp) + UINT Persist(LPCTSTR szSettingFile, BOOL storing, pmplib_t* pmphelp) { UINT ret = 0; @@ -218,7 +218,7 @@ } public: - BOOL SetPlayerLocation(pmphelp_t* pmphelp, LPCTSTR szLocation) + BOOL SetPlayerLocation(pmplib_t* pmphelp, LPCTSTR szLocation) { result_t res = 0; pmp_t* pmp = NULL; @@ -228,7 +228,7 @@ strPlayerIdentifier = _T(""); strPlayerDescription = _T(""); - res = pmphelp_create(pmphelp, &pmp, T2CUCS(szLocation), NULL); + res = pmplib_create(pmphelp, &pmp, T2CUCS(szLocation), NULL); if (res == 0 && pmp) { setPlayerInformation(pmp); pmp->release(pmp); @@ -239,7 +239,7 @@ } } - int findPlayerLocation(pmphelp_t* pmphelp) + int findPlayerLocation(pmplib_t* pmphelp) { result_t res = 0; pmp_t* pmp = NULL; @@ -320,10 +320,10 @@ } public: - int EnumerateDeviceIDs(pmphelp_t* pmphelp, CSimpleArray<CString>& strPlayerIDs) + int EnumerateDeviceIDs(pmplib_t* pmphelp, CSimpleArray<CString>& strPlayerIDs) { strPlayerIDs.RemoveAll(); - pmphelp_enumerate_devid(pmphelp, enumerate_devid_callback, &strPlayerIDs); + pmplib_enumerate_devid(pmphelp, enumerate_devid_callback, &strPlayerIDs); return 0; } Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-01-07 19:36:24 UTC (rev 250) @@ -36,12 +36,12 @@ CImageList m_images; CEdit m_ctrlEditLog; int m_autorun; - pmphelp_t* m_pmphelp; + pmplib_t* m_pmphelp; CString m_strLogFile; CProgressBarCtrlWithCaption m_ctrlProgress; - CProcessingDlg(pmphelp_t* pmphelp, CEasyPMPSetting& preference, int autorun) + CProcessingDlg(pmplib_t* pmphelp, CEasyPMPSetting& preference, int autorun) : m_bCancel(FALSE), m_pmphelp(pmphelp), m_preference(preference), m_autorun(autorun) { } @@ -325,7 +325,7 @@ // Create a PMP instance. pmp_t* pmp = NULL; - pmphelp_create(m_pmphelp, &pmp, opt.path_to_root, opt.model); + pmplib_create(m_pmphelp, &pmp, opt.path_to_root, opt.model); if (!pmp) { //fprintf(fpe, "Failed to find a player\n"); return 1; Modified: trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-01-07 19:36:24 UTC (rev 250) @@ -31,7 +31,6 @@ #include <filepath.h> #include <gmi.h> #include <pmp.h> -#include <pmphelp.h> #include <easypmp.h> #include "ejectdevice.h" Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/include/pmp.h 2007-01-07 19:36:24 UTC (rev 250) @@ -42,16 +42,6 @@ struct tag_pmp_playlist_t; typedef struct tag_pmp_playlist_t pmp_playlist_t; /** - * Open flags. - */ -enum { - PMPOF_MUSIC_DB_READ = 0x0001, - PMPOF_MUSIC_DB_WRITE = 0x0002, - PMPOF_MUSIC_PL_READ = 0x0004, - PMPOF_MUSIC_PL_WRITE = 0x0008, -}; - -/** * Error codes. */ enum { @@ -72,13 +62,43 @@ PMPPLE_WRITE, }; +/** + * Open flags for portable media device. + * Specify one or more flags to pmp_t::open() member function. + */ +enum { + /** + * Read access to the music database. + * The member function pmp_t::open() will read the music database. + */ + PMPOF_MUSIC_DB_READ = 0x0001, + /** + * Write access to the music database. + * The member function pmp_t::close() will write the music database. + */ + PMPOF_MUSIC_DB_WRITE = 0x0002, + /** + * Read access to the music playlists. + * The member function pmp_t::open() will read the music playlists. + */ + PMPOF_MUSIC_PL_READ = 0x0004, + /** + * Write access to the music playlists. + * The member function pmp_t::close() will write the music playlists. + */ + PMPOF_MUSIC_PL_WRITE = 0x0008, +}; + +/** + * Fourcc representation of codecs. + */ #define PMPFOURCC(a, b, c, d) \ ((uint32_t)(a) << 24 | (uint32_t)(b) << 16 | (uint32_t)(c) << 8 | (uint32_t)(d)) -#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','1','3') -#define PMPCODEC_WMA PMPFOURCC('W','M','A',' ') -#define PMPCODEC_VORBIS PMPFOURCC('O','V','1',' ') -#define PMPCODEC_WAV PMPFOURCC('W','A','V','E') +#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','1','3') /**< MPEG Audio Layer III */ +#define PMPCODEC_WMA PMPFOURCC('W','M','A',' ') /**< Windows Media Audio */ +#define PMPCODEC_VORBIS PMPFOURCC('O','V','1',' ') /**< Ogg Vorbis */ +#define PMPCODEC_WAV PMPFOURCC('W','A','V','E') /**< Microsoft Riff WAVE */ enum { PMPPEF_NONE = 0x0000, @@ -106,14 +126,57 @@ ucs2char_t playlist_ext[MAX_PATH]; } pmp_environment_t; + + +/** + * The root interface for a portable media device. + */ struct tag_pmp_t { + /** + * Pointer for the internal use. + * This member variable is reserved for the internal use of the + * library. Do not modify the value. + */ + void* instance; + + /** + * Reference counter. + * This member variable is reserved for the library to manage the + * reference counter. Do not modify the value directly. Call + * member functions add_ref() and release() to increase and + * decrease the reference counter. + */ uint32_t ref_count; - void* instance; + + /** + * Open flags. + * This member variable is reserved for the library to store the + * flags specified in open() function. Do not modify the value. + */ + uint32_t flag; + + /** + * Portable media device environment. + */ pmp_environment_t env; + + /** + * The pointer to pmp_music_t interface. + */ pmp_music_t* music; - uint32_t flag; + /** + * Increment the reference counter. + * @param pmp Ths pointer to the pmp_t instance. + */ uint32_t (*add_ref)(pmp_t* pmp); + + /** + * Decrement the reference counter. + * If the reference counter becomes zero after this decrement, + * this function will destroy the pmp_t instance. + * @param pmp Ths pointer to the pmp_t instance. + */ uint32_t (*release)(pmp_t* pmp); result_t (*open)(pmp_t* pmp, uint32_t flag); @@ -180,8 +243,22 @@ PMPAPI void pmp_record_init(pmp_music_record_t* record); PMPAPI void pmp_record_finish(pmp_music_record_t* record); PMPAPI result_t pmp_record_copy(pmp_music_record_t* dst, const pmp_music_record_t* src); +PMPAPI uint32_t pmp_interlocked_increment(uint32_t* count); +PMPAPI uint32_t pmp_interlocked_decrement(uint32_t* count); +struct tag_pmplib_t; typedef struct tag_pmplib_t pmplib_t; +PMPAPI result_t pmplib_init(pmplib_t** ptr_pmplib); + +PMPAPI result_t pmplib_finish(pmplib_t* pmplib); + +PMPAPI result_t pmplib_create(pmplib_t* pmplib, pmp_t** pmp, const ucs2char_t* path_to_device, const char *id); + +PMPAPI result_t pmplib_enumerate_devid(pmplib_t* pmplib, pmp_enumerate_devid_callback_t callback, void *instance); + +PMPAPI void pmplib_copy_environment(pmp_environment_t* dst, const pmp_environment_t* src); + + #ifdef __cplusplus } #endif/*__cplusplus*/ Deleted: trunk/pmplib/include/pmphelp.h =================================================================== --- trunk/pmplib/include/pmphelp.h 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/include/pmphelp.h 2007-01-07 19:36:24 UTC (rev 250) @@ -1,62 +0,0 @@ -#ifndef __PMPHELPER_H__ -#define __PMPHELPER_H__ - -#ifdef PMP_EXPORTS -#define PMPHELPERAPI __declspec(dllexport) -#else -#define PMPHELPERAPI -#endif - -#ifdef __cplusplus -extern "C" { -#endif/*__cplusplus*/ - -typedef void pmphelp_t; - -PMPHELPERAPI uint32_t interlocked_increment(uint32_t* count); -PMPHELPERAPI uint32_t interlocked_decrement(uint32_t* count); - - -PMPHELPERAPI -result_t -pmphelp_init( - pmphelp_t** ptr_pmphelp - ); - -PMPHELPERAPI -result_t -pmphelp_finish( - pmphelp_t* pmphelp - ); - -PMPHELPERAPI -result_t -pmphelp_create( - pmphelp_t* pmphelp, - pmp_t** pmp, - const ucs2char_t* path_to_device, - const char *id - ); - -PMPHELPERAPI -result_t -pmphelp_enumerate_devid( - pmphelp_t* pmphelp, - pmp_enumerate_devid_callback_t callback, - void *instance - ); - -PMPHELPERAPI -void -pmphelp_copy_environment( - pmp_environment_t* dst, - const pmp_environment_t* src - ); - - - -#ifdef __cplusplus -} -#endif/*__cplusplus*/ - -#endif/*__PMPHELPER_H__*/ Modified: trunk/pmplib/lib/pmp/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp/Makefile.am 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/lib/pmp/Makefile.am 2007-01-07 19:36:24 UTC (rev 250) @@ -4,7 +4,6 @@ libpmp_la_SOURCES = \ ../../include/pmp.h \ - ../../include/pmphelp.h \ pmp.c \ pmp_posix.c Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/lib/pmp/pmp.c 2007-01-07 19:36:24 UTC (rev 250) @@ -63,7 +63,7 @@ return 0; } -void pmphelp_copy_environment(pmp_environment_t* dst, const pmp_environment_t* src) +void pmplib_copy_environment(pmp_environment_t* dst, const pmp_environment_t* src) { memcpy(dst, src, sizeof(*src)); } Modified: trunk/pmplib/lib/pmp/pmp.vcproj =================================================================== --- trunk/pmplib/lib/pmp/pmp.vcproj 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/lib/pmp/pmp.vcproj 2007-01-07 19:36:24 UTC (rev 250) @@ -199,10 +199,6 @@ RelativePath="..\..\include\pmp.h" > </File> - <File - RelativePath="..\..\include\pmphelp.h" - > - </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Modified: trunk/pmplib/lib/pmp/pmp_win32.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_win32.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/lib/pmp/pmp_win32.c 2007-01-07 19:36:24 UTC (rev 250) @@ -33,36 +33,35 @@ #include <filepath.h> #include <pmp.h> -#include <pmphelp.h> -typedef struct { +struct tag_pmplib_t { uint32_t num_plugins; HMODULE* plugins; -} pmphelp_win32_t; +}; -uint32_t interlocked_increment(uint32_t* count) +uint32_t pmp_interlocked_increment(uint32_t* count) { return (uint32_t)InterlockedIncrement((LONG*)count); } -uint32_t interlocked_decrement(uint32_t* count) +uint32_t pmp_interlocked_decrement(uint32_t* count) { return (uint32_t)InterlockedDecrement((LONG*)count); } -result_t pmphelp_init(pmphelp_t** ptr_pmphelp) +result_t pmplib_init(pmplib_t** ptr_pmplib) { - pmphelp_win32_t* pmphelp = NULL; + pmplib_t* pmplib = NULL; HANDLE hFile = INVALID_HANDLE_VALUE; WIN32_FIND_DATAW data; ucs2char_t szPath[MAX_PATH]; ucs2char_t szPattern[MAX_PATH]; static const ucs2char_t ucs2cs_pattern[] = {'p','m','p','_','*','.','d','l','l',0}; - pmphelp = calloc(1, sizeof(pmphelp_win32_t)); - pmphelp->num_plugins = 0; - pmphelp->plugins = NULL; + pmplib = calloc(1, sizeof(pmplib_t)); + pmplib->num_plugins = 0; + pmplib->plugins = NULL; GetModuleFileNameW(NULL, szPath, MAX_PATH); filepath_remove_filespec(szPath); @@ -79,36 +78,34 @@ ucs2cpy(szFilename, szPath); ucs2cat(szFilename, data.cFileName); - pmphelp->plugins = realloc(pmphelp->plugins, sizeof(HMODULE) * (pmphelp->num_plugins+1)); - pmphelp->plugins[pmphelp->num_plugins] = LoadLibraryW(szFilename); - ++pmphelp->num_plugins; + pmplib->plugins = realloc(pmplib->plugins, sizeof(HMODULE) * (pmplib->num_plugins+1)); + pmplib->plugins[pmplib->num_plugins] = LoadLibraryW(szFilename); + ++pmplib->num_plugins; } } while (FindNextFileW(hFile, &data)); FindClose(hFile); } - *ptr_pmphelp = pmphelp; + *ptr_pmplib = pmplib; return 0; } -result_t pmphelp_finish(pmphelp_t* pmphelp) +result_t pmplib_finish(pmplib_t* pmplib) { - pmphelp_win32_t* pmphelpw32 = (pmphelp_win32_t*)pmphelp; uint32_t i; - for (i = 0;i < pmphelpw32->num_plugins;++i) { - FreeLibrary(pmphelpw32->plugins[i]); + for (i = 0;i < pmplib->num_plugins;++i) { + FreeLibrary(pmplib->plugins[i]); } - free(pmphelpw32->plugins); - free(pmphelpw32); + free(pmplib->plugins); + free(pmplib); return 0; } -result_t pmphelp_enumerate_devid(pmphelp_t* pmphelp, pmp_enumerate_devid_callback_t callback, void *instance) +result_t pmplib_enumerate_devid(pmplib_t* pmplib, pmp_enumerate_devid_callback_t callback, void *instance) { - pmphelp_win32_t* pmphelpw32 = (pmphelp_win32_t*)pmphelp; uint32_t i; - for (i = 0;i < pmphelpw32->num_plugins;++i) { - pmp_enumerate_devid_t func = (pmp_enumerate_devid_t)GetProcAddress(pmphelpw32->plugins[i], "pmp_enumerate_devid"); + for (i = 0;i < pmplib->num_plugins;++i) { + pmp_enumerate_devid_t func = (pmp_enumerate_devid_t)GetProcAddress(pmplib->plugins[i], "pmp_enumerate_devid"); if (func) { func(callback, instance); } @@ -116,14 +113,13 @@ return 0; } -result_t pmphelp_create(pmphelp_t* pmphelp, pmp_t** pmp, const ucs2char_t* path_to_device, const char *id) +result_t pmplib_create(pmplib_t* pmplib, pmp_t** pmp, const ucs2char_t* path_to_device, const char *id) { - pmphelp_win32_t* pmphelpw32 = (pmphelp_win32_t*)pmphelp; uint32_t i; result_t ret = PMP_DEVICENOTFOUND; - for (i = 0;i < pmphelpw32->num_plugins;++i) { - pmp_create_t func = (pmp_create_t)GetProcAddress(pmphelpw32->plugins[i], "pmp_create"); + for (i = 0;i < pmplib->num_plugins;++i) { + pmp_create_t func = (pmp_create_t)GetProcAddress(pmplib->plugins[i], "pmp_create"); if (func) { ret = func(pmp, path_to_device, id); if (ret != PMP_DEVICENOTFOUND) { Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 19:36:24 UTC (rev 250) @@ -34,7 +34,6 @@ #include <ucs2char.h> #include <filepath.h> #include <pmp.h> -#include <pmphelp.h> #include "ip2db.h" @@ -374,12 +373,12 @@ static uint32_t pmp_add_ref(pmp_t* pmp) { - return interlocked_increment(&pmp->ref_count); + return pmp_interlocked_increment(&pmp->ref_count); } static uint32_t pmp_release(pmp_t* pmp) { - uint32_t count = interlocked_decrement(&pmp->ref_count); + uint32_t count = pmp_interlocked_decrement(&pmp->ref_count); if (count == 0) { pmpdb_release(pmp->music); free(pmp->instance); @@ -548,12 +547,12 @@ static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { - return interlocked_increment(&pmppl->ref_count); + return pmp_interlocked_increment(&pmppl->ref_count); } static uint32_t pmppl_release(pmp_playlist_t* pmppl) { - uint32_t count = interlocked_decrement(&pmppl->ref_count); + uint32_t count = pmp_interlocked_decrement(&pmppl->ref_count); if (count == 0) { pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; free(pmppl->instance); Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 19:36:24 UTC (rev 250) @@ -34,7 +34,6 @@ #include <ucs2char.h> #include <filepath.h> #include <pmp.h> -#include <pmphelp.h> #include "ip3db.h" #include "util.h" @@ -385,12 +384,12 @@ static uint32_t pmp_add_ref(pmp_t* pmp) { - return interlocked_increment(&pmp->ref_count); + return pmp_interlocked_increment(&pmp->ref_count); } static uint32_t pmp_release(pmp_t* pmp) { - uint32_t count = interlocked_decrement(&pmp->ref_count); + uint32_t count = pmp_interlocked_decrement(&pmp->ref_count); if (count == 0) { pmpdb_release(pmp->music); free(pmp->instance); @@ -675,12 +674,12 @@ static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { - return interlocked_increment(&pmppl->ref_count); + return pmp_interlocked_increment(&pmppl->ref_count); } static uint32_t pmppl_release(pmp_playlist_t* pmppl) { - uint32_t count = interlocked_decrement(&pmppl->ref_count); + uint32_t count = pmp_interlocked_decrement(&pmppl->ref_count); if (count == 0) { pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; free(pmppl->instance); Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 19:36:24 UTC (rev 250) @@ -36,7 +36,6 @@ #include <ucs2char.h> #include <filepath.h> #include <pmp.h> -#include <pmphelp.h> #include "irivnavi.h" @@ -234,12 +233,12 @@ static uint32_t pmp_add_ref(pmp_t* pmp) { - return interlocked_increment(&pmp->ref_count); + return pmp_interlocked_increment(&pmp->ref_count); } static uint32_t pmp_release(pmp_t* pmp) { - uint32_t count = interlocked_decrement(&pmp->ref_count); + uint32_t count = pmp_interlocked_decrement(&pmp->ref_count); if (count == 0) { pmpdb_release(pmp->music); free(pmp); @@ -597,12 +596,12 @@ static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { - return interlocked_increment(&pmppl->ref_count); + return pmp_interlocked_increment(&pmppl->ref_count); } static uint32_t pmppl_release(pmp_playlist_t* pmppl) { - uint32_t count = interlocked_decrement(&pmppl->ref_count); + uint32_t count = pmp_interlocked_decrement(&pmppl->ref_count); if (count == 0) { free(pmppl); } Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 18:19:50 UTC (rev 249) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 19:36:24 UTC (rev 250) @@ -34,7 +34,6 @@ #include <ucs2char.h> #include <filepath.h> #include <pmp.h> -#include <pmphelp.h> #include "pp1db.h" #include "hdr_template.h" @@ -431,12 +430,12 @@ static uint32_t pmp_add_ref(pmp_t* pmp) { - return interlocked_increment(&pmp->ref_count); + return pmp_interlocked_increment(&pmp->ref_count); } static uint32_t pmp_release(pmp_t* pmp) { - uint32_t count = interlocked_decrement(&pmp->ref_count); + uint32_t count = pmp_interlocked_decrement(&pmp->ref_count); if (count == 0) { pmpdb_release(pmp->music); free(pmp->instance); @@ -587,12 +586,12 @@ static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { - return interlocked_increment(&pmppl->ref_count); + return pmp_interlocked_increment(&pmppl->ref_count); } static uint32_t pmppl_release(pmp_playlist_t* pmppl) { - uint32_t count = interlocked_decrement(&pmppl->ref_count); + uint32_t count = pmp_interlocked_decrement(&pmppl->ref_count); if (count == 0) { free(pmppl); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-07 18:20:09
|
Revision: 249 http://svn.sourceforge.net/pmplib/?rev=249&view=rev Author: nyaochi Date: 2007-01-07 10:19:50 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Rename pmp_record_t to pmp_music_record_t Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h trunk/pmplib/include/gmi.h trunk/pmplib/include/playlist.h trunk/pmplib/include/pmp.h trunk/pmplib/lib/playlist/jspl.c trunk/pmplib/lib/playlist/playlist.c trunk/pmplib/lib/pmp/pmp.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.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/model_iriver_h10.c trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.h Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-01-07 18:19:50 UTC (rev 249) @@ -57,13 +57,13 @@ static int comp_filename(const void *_x, const void *_y) { - const pmp_record_t *x = (const pmp_record_t*)_x; - const pmp_record_t *y = (const pmp_record_t*)_y; + const pmp_music_record_t *x = (const pmp_music_record_t*)_x; + const pmp_music_record_t *y = (const pmp_music_record_t*)_y; return COMP_STR(x->filename, y->filename); } static int find_mediafile( - pmp_record_t* records, + pmp_music_record_t* records, int num_records, const ucs2char_t* filename, int *begin, @@ -102,7 +102,7 @@ const easypmp_filelist_t* fl, pmp_t* pmp, const option_t* opt, - pmp_record_t** ptr_records, + pmp_music_record_t** ptr_records, uint32_t* ptr_num_records, easypmp_progress_t progress, void *instance @@ -112,8 +112,8 @@ uint32_t i; result_t res = 0; pmp_music_t* pmpdb = pmp->music; - pmp_record_t* records = NULL; - pmp_record_t* old_records = NULL; + pmp_music_record_t* records = NULL; + pmp_music_record_t* old_records = NULL; uint32_t num_old_records = 0, num_obtained = 0; uint32_t ts_import = get_current_time(); @@ -142,7 +142,7 @@ } // Allocate an array for the records. - old_records = malloc(sizeof(pmp_record_t) * num_old_records); + old_records = malloc(sizeof(pmp_music_record_t) * num_old_records); if (!old_records) { result = EASYPMPE_INSUFFICIENT_MEMORY; goto error_exit; @@ -156,7 +156,7 @@ } // Sort the records for binary search. - qsort(old_records, num_old_records, sizeof(pmp_record_t), comp_filename); + qsort(old_records, num_old_records, sizeof(pmp_music_record_t), comp_filename); } else { if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_SKIPPED, 0, 0, NULL) != 0) { result = EASYPMPE_CANCEL; @@ -167,7 +167,7 @@ /* * Allocate an array for the new records. */ - records = calloc(fl->num_elements, sizeof(pmp_record_t)); + records = calloc(fl->num_elements, sizeof(pmp_music_record_t)); if (!records) { result = EASYPMPE_INSUFFICIENT_MEMORY; goto error_exit; @@ -184,7 +184,7 @@ for (i = 0;i < fl->num_elements;++i) { int is_skipping = 0; easypmp_filename_t* target = &fl->elements[i]; - pmp_record_t* record = &records[i]; + pmp_music_record_t* record = &records[i]; ucs2char_t filename[MAX_PATH]; uint32_t timestamp = 0; Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-01-07 18:19:50 UTC (rev 249) @@ -144,7 +144,7 @@ const easypmp_filelist_t* fl, pmp_t* pmp, const option_t* opt, - pmp_record_t** ptr_records, + pmp_music_record_t** ptr_records, uint32_t* ptr_num_records, easypmp_progress_t progress, void *instance @@ -162,7 +162,7 @@ const easypmp_filelist_t* musics, pmp_t* pmp, const option_t* opt, - pmp_record_t* records, + pmp_music_record_t* records, uint32_t num_records, easypmp_progress_t progress, void *instance Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-07 18:19:50 UTC (rev 249) @@ -68,7 +68,7 @@ const easypmp_filelist_t* musics, pmp_t* pmp, const option_t* opt, - pmp_record_t* records, + pmp_music_record_t* records, uint32_t num_records, easypmp_progress_t progress, void *instance Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-07 18:19:50 UTC (rev 249) @@ -210,7 +210,7 @@ pmphelp_t* pmphelp = NULL; pmp_t* pmp = NULL; easypmp_filelist_t musics, playlists; - pmp_record_t* records = NULL; + pmp_music_record_t* records = NULL; uint32_t num_records = 0; uint32_t openflag = 0; FILE *fpi = stdin, *fpo = stdout, *fpe = stderr; Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-01-07 18:19:50 UTC (rev 249) @@ -240,7 +240,7 @@ CString str; USES_CONVERSION; int result = 0; - pmp_record_t* records = NULL; + pmp_music_record_t* records = NULL; uint32_t num_records = 0; static int media_info_sources[] = { GMIF_TAG, Modified: trunk/pmplib/include/gmi.h =================================================================== --- trunk/pmplib/include/gmi.h 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/include/gmi.h 2007-01-07 18:19:50 UTC (rev 249) @@ -54,7 +54,7 @@ GMIF_PARSEMASK = 0x00FF0000, }; -#define media_info_t pmp_record_t +#define media_info_t pmp_music_record_t #define gmi_finish pmp_record_finish GMIAPI int gmi_get( Modified: trunk/pmplib/include/playlist.h =================================================================== --- trunk/pmplib/include/playlist.h 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/include/playlist.h 2007-01-07 18:19:50 UTC (rev 249) @@ -110,7 +110,7 @@ playlists_t* pls, const ucs2char_t* filename, const ucs2char_t* path_to_include, - pmp_record_t* records, + pmp_music_record_t* records, int num_records, playlist_callback_t callback, void *instance Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/include/pmp.h 2007-01-07 18:19:50 UTC (rev 249) @@ -106,10 +106,28 @@ ucs2char_t playlist_ext[MAX_PATH]; } pmp_environment_t; +struct tag_pmp_t { + uint32_t ref_count; + void* instance; + pmp_environment_t env; + pmp_music_t* music; + uint32_t flag; + + uint32_t (*add_ref)(pmp_t* pmp); + uint32_t (*release)(pmp_t* pmp); + + result_t (*open)(pmp_t* pmp, uint32_t flag); + result_t (*close)(pmp_t* pmp, uint32_t flag); + + result_t (*create_instance_pl)(pmp_t* pmp, pmp_playlist_t** pmppl); +}; + +typedef void pmpdb_readwrite_progress_t(void *instance, uint32_t size, uint32_t total); + /** * Structure of media record. */ -struct tag_pmp_record_t { +struct tag_pmp_music_record_t { ucs2char_t *filename; /**< Filename. */ ucs2char_t *title; /**< Track title. */ ucs2char_t *artist; /**< Artist name. */ @@ -129,32 +147,14 @@ uint32_t ts_playback; /**< Date/time of recent playback of the track. */ uint32_t ts_import; /**< Date/time when the track was imported. */ }; -typedef struct tag_pmp_record_t pmp_record_t; +typedef struct tag_pmp_music_record_t pmp_music_record_t; -struct tag_pmp_t { - uint32_t ref_count; - void* instance; - pmp_environment_t env; - pmp_music_t* music; - uint32_t flag; - - uint32_t (*add_ref)(pmp_t* pmp); - uint32_t (*release)(pmp_t* pmp); - - result_t (*open)(pmp_t* pmp, uint32_t flag); - result_t (*close)(pmp_t* pmp, uint32_t flag); - - result_t (*create_instance_pl)(pmp_t* pmp, pmp_playlist_t** pmppl); -}; - -typedef void pmpdb_readwrite_progress_t(void *instance, uint32_t size, uint32_t total); - struct tag_pmp_music_t { void* instance; pmp_t* pmp; - result_t (*set)(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records); - result_t (*get)(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); + result_t (*set)(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records); + result_t (*get)(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records); result_t (*dump)(pmp_music_t* pmpdb, FILE *fp, int level); @@ -177,9 +177,9 @@ typedef void (*pmp_enumerate_devid_callback_t)(void *instance, const char *devid); typedef result_t (*pmp_enumerate_devid_t)(pmp_enumerate_devid_callback_t callback, void *instance); -PMPAPI void pmp_record_init(pmp_record_t* record); -PMPAPI void pmp_record_finish(pmp_record_t* record); -PMPAPI result_t pmp_record_copy(pmp_record_t* dst, const pmp_record_t* src); +PMPAPI void pmp_record_init(pmp_music_record_t* record); +PMPAPI void pmp_record_finish(pmp_music_record_t* record); +PMPAPI result_t pmp_record_copy(pmp_music_record_t* dst, const pmp_music_record_t* src); #ifdef __cplusplus Modified: trunk/pmplib/lib/playlist/jspl.c =================================================================== --- trunk/pmplib/lib/playlist/jspl.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/playlist/jspl.c 2007-01-07 18:19:50 UTC (rev 249) @@ -306,7 +306,7 @@ return 0; } -static int jspl_set(jspl_t* jspl, const pmp_record_t* records, int num_records) +static int jspl_set(jspl_t* jspl, const pmp_music_record_t* records, int num_records) { int i; @@ -330,7 +330,7 @@ jspl->records = (JSObject**)calloc(num_records, sizeof(JSObject*)); for (i = 0;i < num_records;++i) { - const pmp_record_t* record = &records[i]; + const pmp_music_record_t* record = &records[i]; JSObject* obj = NULL; jsval jsval_obj; @@ -550,7 +550,7 @@ playlists_t* pls, const ucs2char_t *filename, const ucs2char_t *path_to_include, - pmp_record_t* records, + pmp_music_record_t* records, int num_records, playlist_callback_t callback, void *instance Modified: trunk/pmplib/lib/playlist/playlist.c =================================================================== --- trunk/pmplib/lib/playlist/playlist.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/playlist/playlist.c 2007-01-07 18:19:50 UTC (rev 249) @@ -53,7 +53,7 @@ playlists_t* pls, const ucs2char_t *filename, const ucs2char_t *path_to_include, - pmp_record_t* records, + pmp_music_record_t* records, int num_records, playlist_callback_t callback, void *instance @@ -78,7 +78,7 @@ playlists_t* pls, const ucs2char_t* filename, const ucs2char_t* path_to_include, - pmp_record_t* records, + pmp_music_record_t* records, int num_records, playlist_callback_t callback, void *instance Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp/pmp.c 2007-01-07 18:19:50 UTC (rev 249) @@ -34,13 +34,13 @@ #include <ucs2char.h> #include <pmp.h> -void pmp_record_init(pmp_record_t* record) +void pmp_record_init(pmp_music_record_t* record) { memset(record, 0, sizeof(*record)); } -void pmp_record_finish(pmp_record_t* record) +void pmp_record_finish(pmp_music_record_t* record) { ucs2free(record->filename); ucs2free(record->title); @@ -51,7 +51,7 @@ pmp_record_init(record); } -result_t pmp_record_copy(pmp_record_t* dst, const pmp_record_t* src) +result_t pmp_record_copy(pmp_music_record_t* dst, const pmp_music_record_t* src) { memcpy(dst, src, sizeof(*src)); dst->filename = src->filename ? ucs2dup(src->filename) : NULL; Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-01-07 18:19:50 UTC (rev 249) @@ -158,7 +158,7 @@ } -result_t ip2db_set(ip2db_t* db, const pmp_record_t* records, uint32_t num_records, const ucs2char_t* path_to_root) +result_t ip2db_set(ip2db_t* db, const pmp_music_record_t* records, uint32_t num_records, const ucs2char_t* path_to_root) { result_t ret = 0; uint32_t i, j, n = 0; @@ -178,9 +178,9 @@ return PMPDBE_OUTOFMEMORY; } - // Convert records from pmp_record_t to ip2db_record_t. + // Convert records from pmp_music_record_t to ip2db_record_t. for (i = 0, j = 0;i < num_records;++i) { - const pmp_record_t* src = &records[i]; + const pmp_music_record_t* src = &records[i]; ip2db_record_t* dst = &ip2db_records[j]; if (!ip2db_is_supported_codec(src->codec)) { @@ -244,7 +244,7 @@ return ret; } -result_t ip2db_get(ip2db_t* db, pmp_record_t* records, uint32_t* num_records, const ucs2char_t* path_to_root) +result_t ip2db_get(ip2db_t* db, pmp_music_record_t* records, uint32_t* num_records, const ucs2char_t* path_to_root) { uint32_t i = 0, j = 0, n = ip2db_get_num_record(db); @@ -262,7 +262,7 @@ size_t length = 0; ucs2char_t tmp[128]; ip2db_record_t src; - pmp_record_t* dst = &records[j]; + pmp_music_record_t* dst = &records[j]; pmp_record_init(dst); Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.h 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.h 2007-01-07 18:19:50 UTC (rev 249) @@ -252,8 +252,8 @@ result_t ip2db_write(ip2db_t* db, const ucs2char_t* dat_filename, const ucs2char_t* idx_filename); int ip2db_is_supported_codec(uint32_t codec); int ip2db_is_supported_ext(const ucs2char_t* filename); -result_t ip2db_set(ip2db_t* db, const pmp_record_t* records, uint32_t num_records, const ucs2char_t* path_to_root); -result_t ip2db_get(ip2db_t* db, pmp_record_t* records, uint32_t* num_records, const ucs2char_t* path_to_root); +result_t ip2db_set(ip2db_t* db, const pmp_music_record_t* records, uint32_t num_records, const ucs2char_t* path_to_root); +result_t ip2db_get(ip2db_t* db, pmp_music_record_t* records, uint32_t* num_records, const ucs2char_t* path_to_root); uint32_t ip2db_get_num_record(ip2db_t* db); void ip2db_set_num_record(ip2db_t* db, uint32_t value); uint32_t ip2db_get_num_pages(ip2db_t* db); Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 18:19:50 UTC (rev 249) @@ -123,8 +123,8 @@ static uint32_t pmpdb_release(pmp_music_t* pmpdb); static result_t pmpdb_read(pmp_music_t* pmpdb); static result_t pmpdb_write(pmp_music_t* pmpdb); -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_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records); +static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_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); @@ -508,14 +508,14 @@ return ip2db_write(&pmpdbi->ip2db, pmpi->env.dat_filename, pmpi->env.idx_filename); } -static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return ip2db_set(&pmpdbi->ip2db, records, num_records, pmpi->env.path_to_root); } -static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records) +static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 18:19:50 UTC (rev 249) @@ -119,8 +119,8 @@ static uint32_t pmpdb_release(pmp_music_t* pmpdb); static result_t pmpdb_read(pmp_music_t* pmpdb); static result_t pmpdb_write(pmp_music_t* pmpdb); -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_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records); +static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_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); @@ -537,7 +537,7 @@ return (path + length); } -static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records) { int i; pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; @@ -545,7 +545,7 @@ ip3db_music_record_t* array = (ip3db_music_record_t*)malloc(sizeof(ip3db_music_record_t) * num_records); for (i = 0;i < num_records;++i) { - const pmp_record_t* src = &records[i]; + const pmp_music_record_t* src = &records[i]; ip3db_variant_t* dst = array[i]; ip3db_record_init(&pmpdbi->ip3db, &array[i]); @@ -582,7 +582,7 @@ return 0; } -static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records) +static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; @@ -597,7 +597,7 @@ for (i = 0;i < n;++i) { const ip3db_variant_t* src = (const ip3db_variant_t*)ip3db_get_record(db, i); - pmp_record_t* dst = &records[i]; + pmp_music_record_t* dst = &records[i]; size_t length = 0; pmp_record_init(dst); Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 18:19:50 UTC (rev 249) @@ -96,8 +96,8 @@ static uint32_t pmpdb_release(pmp_music_t* pmpdb); static result_t pmpdb_read(pmp_music_t* pmpdb); static result_t pmpdb_write(pmp_music_t* pmpdb); -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_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records); +static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_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); @@ -444,7 +444,7 @@ return ret; } -result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records) { irivnavi_t* db = (irivnavi_t*)pmpdb->instance; result_t ret = 0; @@ -469,9 +469,9 @@ return PMPDBE_OUTOFMEMORY; } - // Convert records from pmp_record_t to ip2db_record_t. + // Convert records from pmp_music_record_t to ip2db_record_t. for (i = 0, j = 0;i < num_records;++i) { - const pmp_record_t* src = &records[i]; + const pmp_music_record_t* src = &records[i]; record_t* dst = &db->records[j]; // Skip unsupported codec. @@ -496,7 +496,7 @@ return 0; } -static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records) +static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records) { irivnavi_t* db = (irivnavi_t*)pmpdb->instance; result_t ret = 0; @@ -521,7 +521,7 @@ size_t length = 0; ucs2char_t* tmp = NULL; const record_t* src = &db->records[i]; - pmp_record_t* dst = &records[j]; + pmp_music_record_t* dst = &records[j]; pmp_record_init(dst); Modified: trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-01-07 18:19:50 UTC (rev 249) @@ -92,7 +92,7 @@ fprints(fp, " unknown7: %s\n", record->fields[PP1DB_DATFIELD_UNKNOWN7].value.str); } -int iriver_h10_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) +int iriver_h10_dat_set(dat_t* dst, const pmp_music_record_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_unknown[] = {0}; static const ucs2char_t ucs2cs_empty[] = {0}; @@ -129,7 +129,7 @@ return 0; } -int iriver_h10_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) +int iriver_h10_dat_get(pmp_music_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-01-07 18:19:50 UTC (rev 249) @@ -78,7 +78,7 @@ fprints(fp, " composer: %s\n", record->fields[PP1DB_DATFIELD_COMPOSER].value.str); } -int medion_mdjuke220_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) +int medion_mdjuke220_dat_set(dat_t* dst, const pmp_music_record_t* src, const ucs2char_t* path_to_root) { ucs2char_t duration[128]; static const ucs2char_t ucs2cs_unknown[] = {'0',0}; @@ -112,7 +112,7 @@ return 0; } -int medion_mdjuke220_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) +int medion_mdjuke220_dat_get(pmp_music_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-01-07 18:19:50 UTC (rev 249) @@ -67,7 +67,7 @@ fprints(fp, " composer: %s\n", record->fields[PP1DB_DATFIELD_COMPOSER].value.str); } -int medion_mdjuke440_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) +int medion_mdjuke440_dat_set(dat_t* dst, const pmp_music_record_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_unknown[] = {'0',0}; @@ -91,7 +91,7 @@ return 0; } -int medion_mdjuke440_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) +int medion_mdjuke440_dat_get(pmp_music_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; Modified: trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-01-07 18:19:50 UTC (rev 249) @@ -82,7 +82,7 @@ fprintf(fp, " unknown9: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN9].value.dword); } -static int philips_hdd6320_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) +static int philips_hdd6320_dat_set(dat_t* dst, const pmp_music_record_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_unknown[] = {0}; static const ucs2char_t ucs2cs_empty[] = {0}; @@ -113,7 +113,7 @@ return 0; } -static int philips_hdd6320_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) +static int philips_hdd6320_dat_get(pmp_music_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; Modified: trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-01-07 18:19:50 UTC (rev 249) @@ -84,7 +84,7 @@ fprints(fp, " unknown7: %s\n", record->fields[PP1DB_DATFIELD_UNKNOWN7].value.str); } -static int samsung_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) +static int samsung_dat_set(dat_t* dst, const pmp_music_record_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_unknown[] = {0}; static const ucs2char_t ucs2cs_empty[] = {0}; @@ -117,7 +117,7 @@ return 0; } -static int samsung_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) +static int samsung_dat_get(pmp_music_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; Modified: trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-01-07 18:19:50 UTC (rev 249) @@ -97,7 +97,7 @@ fprintf(fp, " unknown15: %d\n", record->fields[PP1DB_DATFIELD_UNKNOWN15].value.dword); } -int sirius_s50_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) +int sirius_s50_dat_set(dat_t* dst, const pmp_music_record_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_unknown[] = {0}; static const ucs2char_t ucs2cs_empty[] = {0}; @@ -136,7 +136,7 @@ return 0; } -int sirius_s50_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) +int sirius_s50_dat_get(pmp_music_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 18:19:50 UTC (rev 249) @@ -226,8 +226,8 @@ static uint32_t pmpdb_release(pmp_music_t* pmpdb); static result_t pmpdb_read(pmp_music_t* pmpdb); static result_t pmpdb_write(pmp_music_t* pmpdb); -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_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records); +static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_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); @@ -553,14 +553,14 @@ return pp1db_write(&pmpdbi->pp1db, pmpi->env.hdr_filename); } -static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return pp1db_set(&pmpdbi->pp1db, records, num_records, pmpi->env.path_to_root); } -static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records) +static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-01-07 18:19:50 UTC (rev 249) @@ -48,8 +48,8 @@ #endif void dat_h10_repr(const dat_t* record, FILE *fp); -int dat_h10_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root); -int dat_h10_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root); +int dat_h10_set(dat_t* dst, const pmp_music_record_t* src, const ucs2char_t* path_to_root); +int dat_h10_get(pmp_music_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root); void pp1db_init(pp1db_t* db, hdr_init_t hdrinit) @@ -433,7 +433,7 @@ } -result_t pp1db_set(pp1db_t* db, const pmp_record_t* records, uint32_t num_records, ucs2char_t* path_to_root) +result_t pp1db_set(pp1db_t* db, const pmp_music_record_t* records, uint32_t num_records, ucs2char_t* path_to_root) { uint32_t i, j, n = 0; sort_item_t* si = NULL; @@ -458,9 +458,9 @@ return PMP_INSUFFICIENTMEMORY; } - // Convert records from pmp_record_t to ip2db_record_t. + // Convert records from pmp_music_record_t to ip2db_record_t. for (i = 0, j = 0;i < num_records;++i) { - const pmp_record_t* src = &records[i]; + const pmp_music_record_t* src = &records[i]; dat_t* dst = &db->dat[j]; // Skip invalid entries. @@ -530,7 +530,7 @@ return 0; } -result_t pp1db_get(pp1db_t* db, pmp_record_t* records, uint32_t* num_records, ucs2char_t* path_to_root) +result_t pp1db_get(pp1db_t* db, pmp_music_record_t* records, uint32_t* num_records, ucs2char_t* path_to_root) { uint32_t i = 0, j = 0, n = 0; @@ -558,7 +558,7 @@ for (i = 0, j = 0;i < db->hdr->num_dat_entries;++i) { const dat_t* src = &db->dat[i]; - pmp_record_t* dst = &records[j]; + pmp_music_record_t* dst = &records[j]; pmp_record_init(dst); db->hdr->param.proc_dat_get(dst, src, path_to_root); Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.h =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.h 2007-01-07 18:12:54 UTC (rev 248) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.h 2007-01-07 18:19:50 UTC (rev 249) @@ -69,8 +69,8 @@ } field_descriptor_t; typedef void (*dat_repr_t)(const dat_t* record, FILE *fp); -typedef int (*dat_set_t)(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root); -typedef int (*dat_get_t)(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root); +typedef int (*dat_set_t)(dat_t* dst, const pmp_music_record_t* src, const ucs2char_t* path_to_root); +typedef int (*dat_get_t)(pmp_music_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root); typedef struct { size_t size; @@ -164,8 +164,8 @@ result_t pp1db_repr(pp1db_t* db, FILE *fp, int level); int pp1db_is_supported_ext(const ucs2char_t* filename); int pp1db_is_supported_codec(uint32_t codec); -result_t pp1db_set(pp1db_t* db, const pmp_record_t* records, uint32_t num_records, ucs2char_t* path_to_root); -result_t pp1db_get(pp1db_t* db, pmp_record_t* records, uint32_t* num_records, ucs2char_t* path_to_root); +result_t pp1db_set(pp1db_t* db, const pmp_music_record_t* records, uint32_t num_records, ucs2char_t* path_to_root); +result_t pp1db_get(pp1db_t* db, pmp_music_record_t* records, uint32_t* num_records, ucs2char_t* path_to_root); #endif/*__PP1DB_H__*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <ny...@us...> - 2007-01-07 17:56:29
|
Revision: 247 http://svn.sourceforge.net/pmplib/?rev=247&view=rev Author: nyaochi Date: 2007-01-07 09:56:29 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Removed pmp_t::create_db_instance(). Modified Paths: -------------- 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/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-07 17:40:24 UTC (rev 246) +++ trunk/pmplib/include/pmp.h 2007-01-07 17:56:29 UTC (rev 247) @@ -154,7 +154,6 @@ result_t (*open)(pmp_t* pmp, uint32_t flag); result_t (*close)(pmp_t* pmp, uint32_t flag); - result_t (*create_instance_db)(pmp_t* pmp, pmp_music_t** pmpdb); result_t (*create_instance_pl)(pmp_t* pmp, pmp_playlist_t** pmppl); int (*is_supported_codec)(pmp_t* pmp, uint32_t codec); Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 17:40:24 UTC (rev 246) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 17:56:29 UTC (rev 247) @@ -331,7 +331,6 @@ pmp->release = pmp_release; pmp->open = pmp_open; pmp->close = pmp_close; - pmp->create_instance_db = pmp_create_instance_db; pmp->create_instance_pl = pmp_create_instance_pl; pmp->is_supported_codec = pmp_is_supported_codec; pmp->is_supported_ext = pmp_is_supported_ext; Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 17:40:24 UTC (rev 246) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 17:56:29 UTC (rev 247) @@ -342,7 +342,6 @@ pmp->release = pmp_release; pmp->open = pmp_open; pmp->close = pmp_close; - pmp->create_instance_db = pmp_create_instance_db; pmp->create_instance_pl = pmp_create_instance_pl; pmp->is_supported_codec = pmp_is_supported_codec; pmp->is_supported_ext = pmp_is_supported_ext; Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 17:40:24 UTC (rev 246) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 17:56:29 UTC (rev 247) @@ -174,7 +174,6 @@ pmp->release = pmp_release; pmp->open = pmp_open; pmp->close = pmp_close; - pmp->create_instance_db = pmp_create_instance_db; pmp->create_instance_pl = pmp_create_instance_pl; pmp->is_supported_codec = pmp_is_supported_codec; pmp->is_supported_ext = pmp_is_supported_ext; Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 17:40:24 UTC (rev 246) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 17:56:29 UTC (rev 247) @@ -386,7 +386,6 @@ // Set methods. pmp->add_ref = pmp_add_ref; pmp->release = pmp_release; - pmp->create_instance_db = pmp_create_instance_db; pmp->create_instance_pl = pmp_create_instance_pl; pmp->open = pmp_open; pmp->close = pmp_close; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-07 17:40:23
|
Revision: 246 http://svn.sourceforge.net/pmplib/?rev=246&view=rev Author: nyaochi Date: 2007-01-07 09:40:24 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Removed pmp_music_t::add_ref() and pmp_music_t::release() as pmp_music_t now sticks to pmp_t as pmp_t::music. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.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_irivnavi/pmp_irivnavi.vcproj trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-01-07 17:31:09 UTC (rev 245) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-01-07 17:40:24 UTC (rev 246) @@ -297,13 +297,11 @@ int database_dump(pmp_t* pmp, FILE *fp, int level) { - pmp_music_t* pmpdb = NULL; - pmp->create_instance_db(pmp, &pmpdb); + pmp_music_t* pmpdb = pmp->music; if (!pmpdb) { return 1; } pmpdb->dump(pmpdb, fp, level); - pmpdb->release(pmpdb); return 0; } Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-07 17:31:09 UTC (rev 245) +++ trunk/pmplib/include/pmp.h 2007-01-07 17:40:24 UTC (rev 246) @@ -165,12 +165,8 @@ struct tag_pmp_music_t { void* instance; - uint32_t ref_count; pmp_t* pmp; - uint32_t (*add_ref)(pmp_music_t* pmpdb); - uint32_t (*release)(pmp_music_t* pmpdb); - result_t (*set)(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records); result_t (*get)(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 17:31:09 UTC (rev 245) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 17:40:24 UTC (rev 246) @@ -122,7 +122,6 @@ 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); static result_t pmpdb_read(pmp_music_t* pmpdb); static result_t pmpdb_write(pmp_music_t* pmpdb); @@ -431,8 +430,6 @@ return PMPDBE_OUTOFMEMORY; } - pmpdb->add_ref = pmpdb_add_ref; - pmpdb->release = pmpdb_release; pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; @@ -447,7 +444,6 @@ pmpdb->pmp = pmp; pmpdb->instance = pmpdbi; - pmpdb->add_ref(pmpdb); *ptr_pmpdb = pmpdb; return 0; } @@ -501,21 +497,13 @@ -static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb) -{ - return interlocked_increment(&pmpdb->ref_count); -} - static uint32_t pmpdb_release(pmp_music_t* pmpdb) { - uint32_t count = interlocked_decrement(&pmpdb->ref_count); - if (count == 0) { - pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; - ip2db_finish(&pmpdbi->ip2db); - free(pmpdb->instance); - free(pmpdb); - } - return count; + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + ip2db_finish(&pmpdbi->ip2db); + free(pmpdb->instance); + free(pmpdb); + return 0; } static result_t pmpdb_read(pmp_music_t* pmpdb) Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 17:31:09 UTC (rev 245) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 17:40:24 UTC (rev 246) @@ -118,7 +118,6 @@ 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); static result_t pmpdb_read(pmp_music_t* pmpdb); static result_t pmpdb_write(pmp_music_t* pmpdb); @@ -442,8 +441,6 @@ return PMPDBE_OUTOFMEMORY; } - pmpdb->add_ref = pmpdb_add_ref; - pmpdb->release = pmpdb_release; pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; @@ -458,7 +455,6 @@ pmpdb->pmp = pmp; pmpdb->instance = pmpdbi; - pmpdb->add_ref(pmpdb); *ptr_pmpdb = pmpdb; return 0; } @@ -491,7 +487,6 @@ pmppl->pmp = pmp; pmppl->instance = pmppli; - pmppl->add_ref(pmppl); *ptr_pmppl = pmppl; return 0; } @@ -524,21 +519,13 @@ -static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb) -{ - return interlocked_increment(&pmpdb->ref_count); -} - static uint32_t pmpdb_release(pmp_music_t* pmpdb) { - uint32_t count = interlocked_decrement(&pmpdb->ref_count); - if (count == 0) { - pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; - ip3db_finish(&pmpdbi->ip3db); - free(pmpdb->instance); - free(pmpdb); - } - return count; + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + ip3db_finish(&pmpdbi->ip3db); + free(pmpdb->instance); + free(pmpdb); + return 0; } static result_t pmpdb_read(pmp_music_t* pmpdb) Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 17:31:09 UTC (rev 245) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 17:40:24 UTC (rev 246) @@ -315,8 +315,6 @@ } // Set member methods. - pmpdb->add_ref = pmpdb_add_ref; - pmpdb->release = pmpdb_release; pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; @@ -333,7 +331,6 @@ pmpdb->pmp = pmp; pmpdb->instance = irivnavi; - pmpdb->add_ref(pmpdb); *ptr_pmpdb = pmpdb; return 0; } @@ -361,23 +358,15 @@ return 0; } -static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb) -{ - return interlocked_increment(&pmpdb->ref_count); -} - static uint32_t pmpdb_release(pmp_music_t* pmpdb) { - uint32_t count = interlocked_decrement(&pmpdb->ref_count); - if (count == 0) { - irivnavi_t* db = (irivnavi_t*)pmpdb->instance; - if (db) { - irivnavi_finish(db); - free(db); - } - free(pmpdb); + irivnavi_t* db = (irivnavi_t*)pmpdb->instance; + if (db) { + irivnavi_finish(db); + free(db); } - return count; + free(pmpdb); + return 0; } result_t pmpdb_read(pmp_music_t* pmpdb) Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj 2007-01-07 17:31:09 UTC (rev 245) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj 2007-01-07 17:40:24 UTC (rev 246) @@ -186,6 +186,10 @@ > </File> <File + RelativePath=".\irivnavi.h" + > + </File> + <File RelativePath=".\playlist.c" > </File> @@ -204,10 +208,6 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File - RelativePath=".\irivnavi.h" - > - </File> - <File RelativePath=".\serialize.h" > </File> Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 17:31:09 UTC (rev 245) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 17:40:24 UTC (rev 246) @@ -225,7 +225,6 @@ 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); static result_t pmpdb_read(pmp_music_t* pmpdb); static result_t pmpdb_write(pmp_music_t* pmpdb); @@ -488,8 +487,6 @@ return PMPDBE_OUTOFMEMORY; } - pmpdb->add_ref = pmpdb_add_ref; - pmpdb->release = pmpdb_release; pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; @@ -503,7 +500,6 @@ pmpdb->pmp = pmp; pmpdb->instance = pmpdbi; - pmpdb->add_ref(pmpdb); *ptr_pmpdb = pmpdb; return 0; } @@ -546,21 +542,13 @@ -static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb) -{ - return interlocked_increment(&pmpdb->ref_count); -} - static uint32_t pmpdb_release(pmp_music_t* pmpdb) { - uint32_t count = interlocked_decrement(&pmpdb->ref_count); - if (count == 0) { - pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; - pp1db_finish(&pmpdbi->pp1db); - free(pmpdb->instance); - free(pmpdb); - } - return count; + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pp1db_finish(&pmpdbi->pp1db); + free(pmpdb->instance); + free(pmpdb); + return 0; } static result_t pmpdb_read(pmp_music_t* pmpdb) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-07 17:31:11
|
Revision: 245 http://svn.sourceforge.net/pmplib/?rev=245&view=rev Author: nyaochi Date: 2007-01-07 09:31:09 -0800 (Sun, 07 Jan 2007) Log Message: ----------- - Removed pmp_music_t::read() and pmp_music_t::write() member functions. - Introduced pmp_t::open() and pmp_t::close() member functions instead. Please don't use the SVN version for the time being. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/cui/main.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/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-01-07 15:17:10 UTC (rev 244) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-01-07 17:31:09 UTC (rev 245) @@ -111,7 +111,7 @@ int result = 0; uint32_t i; result_t res = 0; - pmp_music_t* pmpdb = NULL; + pmp_music_t* pmpdb = pmp->music; pmp_record_t* records = NULL; pmp_record_t* old_records = NULL; uint32_t num_old_records = 0, num_obtained = 0; @@ -125,8 +125,38 @@ * Read the existing database for update processing mode. */ if (opt->verb & MODE_DATABASE_UPDATE) { - // - easypmp_database_read(pmp, opt, &old_records, &num_old_records, progress, instance); + /* + * Read the existing database for update processing mode. + */ + // Start reading a database. + if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_START, 0, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + + // Obtain the number of records in the database. + res = pmpdb->get(pmpdb, NULL, &num_old_records); + if (res != 0) { + result = MAKE_PMP_ERROR(res); + goto error_exit; + } + + // Allocate an array for the records. + old_records = malloc(sizeof(pmp_record_t) * num_old_records); + if (!old_records) { + result = EASYPMPE_INSUFFICIENT_MEMORY; + goto error_exit; + } + + // Obtain the records from the database. + res = pmpdb->get(pmpdb, old_records, &num_old_records); + if (res != 0) { + result = MAKE_PMP_ERROR(res); + goto error_exit; + } + + // Sort the records for binary search. + qsort(old_records, num_old_records, sizeof(pmp_record_t), comp_filename); } else { if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_SKIPPED, 0, 0, NULL) != 0) { result = EASYPMPE_CANCEL; @@ -135,15 +165,6 @@ } /* - * Create a database engine for database construction. - */ - res = pmp->create_instance_db(pmp, &pmpdb); - if (!pmpdb) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - /* * Allocate an array for the new records. */ records = calloc(fl->num_elements, sizeof(pmp_record_t)); @@ -235,11 +256,6 @@ result = EASYPMPE_CANCEL; goto error_exit; } - res = pmpdb->write(pmpdb); - if (res != 0) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } if (progress(instance, EASYPMPDBP_WRITE | EASYPMPSP_END, 0, 0, NULL) != 0) { result = EASYPMPE_CANCEL; goto error_exit; @@ -274,108 +290,11 @@ } } - /* - * Release the database engine. - */ - if (pmpdb) { - pmpdb->release(pmpdb); - pmpdb = NULL; - } return result; } -int -easypmp_database_read( - pmp_t* pmp, - const option_t* opt, - pmp_record_t** ptr_records, - uint32_t* ptr_num_records, - easypmp_progress_t progress, - void *instance -) -{ - int result = 0; - result_t res = 0; - pmp_music_t* pmpdb = NULL; - - /* - * Read the existing database for update processing mode. - */ - // Create a database engine. - res = pmp->create_instance_db(pmp, &pmpdb); - if (!pmpdb) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - // Start reading a database. - if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_START, 0, 0, NULL) != 0) { - result = EASYPMPE_CANCEL; - goto error_exit; - } - - // Read the existing database. - res = pmpdb->read(pmpdb); - if (res != 0) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - // Obtain the number of records in the database. - res = pmpdb->get(pmpdb, NULL, ptr_num_records); - if (res != 0) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - // Allocate an array for the records. - (*ptr_records) = malloc(sizeof(pmp_record_t) * (*ptr_num_records)); - if (!(*ptr_records)) { - result = EASYPMPE_INSUFFICIENT_MEMORY; - goto error_exit; - } - - // Obtain the records from the database. - res = pmpdb->get(pmpdb, *ptr_records, ptr_num_records); - if (res != 0) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - // Sort the records for binary search. - qsort(*ptr_records, *ptr_num_records, sizeof(pmp_record_t), comp_filename); - - // Release the database instance. - if (pmpdb) { - pmpdb->release(pmpdb); - pmpdb = NULL; - } - - if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_END, *ptr_num_records, 0, NULL) != 0) { - result = EASYPMPE_CANCEL; - goto error_exit; - } - - return result; - -error_exit: - /* - * Free allocated memory. - */ - if ((*ptr_records)) { - uint32_t i; - for (i = 0;i < *ptr_num_records;++i) { - pmp_record_finish(&((*ptr_records)[i])); - } - free((*ptr_records)); - } - return result; -} - - - int database_dump(pmp_t* pmp, FILE *fp, int level) { pmp_music_t* pmpdb = NULL; @@ -383,7 +302,6 @@ if (!pmpdb) { return 1; } - pmpdb->read(pmpdb); pmpdb->dump(pmpdb, fp, level); pmpdb->release(pmpdb); return 0; Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-01-07 15:17:10 UTC (rev 244) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-01-07 17:31:09 UTC (rev 245) @@ -151,16 +151,6 @@ ); int -easypmp_database_read( - pmp_t* pmp, - const option_t* opt, - pmp_record_t** ptr_records, - uint32_t* ptr_num_records, - easypmp_progress_t progress, - void *instance -); - -int easypmp_set_strip_words( option_t* opt, const ucs2char_t* str Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-07 15:17:10 UTC (rev 244) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-07 17:31:09 UTC (rev 245) @@ -212,6 +212,7 @@ easypmp_filelist_t musics, playlists; pmp_record_t* records = NULL; uint32_t num_records = 0; + uint32_t openflag = 0; FILE *fpi = stdin, *fpo = stdout, *fpe = stderr; option_t opt; @@ -325,6 +326,20 @@ goto exit_main; } + // Open flag. + if (opt.verb & MODE_DATABASE) { + if (opt.verb & MODE_DATABASE_UPDATE) { + openflag |= PMPOF_MUSIC_DB_READ; + } + openflag |= PMPOF_MUSIC_DB_WRITE; + } + if (opt.verb & MODE_DATABASE_REPR) { + openflag |= PMPOF_MUSIC_DB_READ; + } + + // Open the PMP. + ret = pmp->open(pmp, openflag); + // Show player information. device_show_information(pmp, fpo); fprintf(fpo, "\n"); @@ -353,10 +368,12 @@ easypmp_database(&musics, pmp, &opt, &records, &num_records, easypmp_progress, NULL); } if (opt.verb & MODE_PLAYLIST) { + /* // Read the database for JSPL. if ((opt.verb & MODE_PLAYLIST_JSPL) && (!records)) { easypmp_database_read(pmp, &opt, &records, &num_records, easypmp_progress, NULL); } + */ #ifndef HAVE_JSAPI_H if(opt.verb & MODE_PLAYLIST_JSPL) { fprintf(fpe, "Warning: Ignoring -j/--jspl option. This version of easypmp\n"); @@ -378,6 +395,7 @@ free(records); } + pmp->close(pmp, 0); pmp->release(pmp); pmphelp_finish(pmphelp); option_finish(&opt); Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-07 15:17:10 UTC (rev 244) +++ trunk/pmplib/include/pmp.h 2007-01-07 17:31:09 UTC (rev 245) @@ -42,6 +42,26 @@ 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 { + PMPOF_MUSIC_DB_READ = 0x0001, + PMPOF_MUSIC_DB_WRITE = 0x0002, + PMPOF_MUSIC_PL_READ = 0x0004, + PMPOF_MUSIC_PL_WRITE = 0x0008, +}; + +/** * Error codes. */ enum { @@ -83,11 +103,11 @@ } pmp_pathenv_t; typedef struct { - char id[128]; - char name[128]; - char mode[128]; - char language[128]; - char version[128]; + char id[128]; /**< Device identifier. */ + char name[128]; /**< Device name. */ + char mode[128]; /**< Firmware mode. */ + char language[128]; /**< Firmware language. */ + char version[128]; /**< Firmware version. */ pmp_pathenv_t path_to_root; /**< Path to the root directory */ pmp_pathenv_t path_to_music; /**< Path to the music files */ @@ -125,10 +145,15 @@ uint32_t ref_count; void* instance; pmp_environment_t env; + pmp_music_t* music; + uint32_t flag; uint32_t (*add_ref)(pmp_t* pmp); uint32_t (*release)(pmp_t* pmp); + result_t (*open)(pmp_t* pmp, uint32_t flag); + result_t (*close)(pmp_t* pmp, uint32_t flag); + result_t (*create_instance_db)(pmp_t* pmp, pmp_music_t** pmpdb); result_t (*create_instance_pl)(pmp_t* pmp, pmp_playlist_t** pmppl); @@ -146,9 +171,6 @@ uint32_t (*add_ref)(pmp_music_t* pmpdb); uint32_t (*release)(pmp_music_t* pmpdb); - result_t (*read)(pmp_music_t* pmpdb); - result_t (*write)(pmp_music_t* pmpdb); - result_t (*set)(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records); result_t (*get)(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 15:17:10 UTC (rev 244) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 17:31:09 UTC (rev 245) @@ -115,6 +115,8 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); +static result_t pmp_open(pmp_t* pmp, uint32_t flag); +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); @@ -328,15 +330,18 @@ pmp->add_ref = pmp_add_ref; pmp->release = pmp_release; + pmp->open = pmp_open; + pmp->close = pmp_close; pmp->create_instance_db = pmp_create_instance_db; 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. pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); if (!pmpi) { - free(pmp); + pmp_release(pmp); return PMPDBE_OUTOFMEMORY; } pmp->instance = pmpi; @@ -359,8 +364,14 @@ ucs2cpy(pmpenv->path_to_playlist.path, pmpi->env.path_to_playlist); ucs2cpy(pmpenv->playlist_ext, pmpi->env.playlist_ext); + // Create music instance. + ret = pmp_create_instance_db(pmp, &pmp->music); + if (ret != 0) { + pmp_release(pmp); + return ret; + } + // Prepare - pmp->add_ref(pmp); *ptr_pmp = pmp; return 0; } @@ -374,12 +385,39 @@ { uint32_t count = interlocked_decrement(&pmp->ref_count); if (count == 0) { + pmpdb_release(pmp->music); free(pmp->instance); free(pmp); } return count; } +static result_t pmp_open(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + pmp->flag = flag; + + if (pmp->flag & PMPOF_MUSIC_DB_READ) { + ret = pmpdb_read(pmp->music); + if (ret != 0) { + return ret; + } + } + return 0; +} + +static result_t pmp_close(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + if (pmp->flag & PMPOF_MUSIC_DB_WRITE) { + ret = pmpdb_write(pmp->music); + if (ret != 0) { + return ret; + } + } + return 0; +} + static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) { pmp_music_t* pmpdb = NULL; @@ -395,8 +433,6 @@ pmpdb->add_ref = pmpdb_add_ref; pmpdb->release = pmpdb_release; - pmpdb->read = pmpdb_read; - pmpdb->write = pmpdb_write; pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 15:17:10 UTC (rev 244) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 17:31:09 UTC (rev 245) @@ -111,6 +111,8 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); +static result_t pmp_open(pmp_t* pmp, uint32_t flag); +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); @@ -339,10 +341,13 @@ pmp->add_ref = pmp_add_ref; pmp->release = pmp_release; + pmp->open = pmp_open; + pmp->close = pmp_close; pmp->create_instance_db = pmp_create_instance_db; 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. pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); @@ -370,8 +375,14 @@ ucs2cpy(pmpenv->path_to_playlist.path, pmpi->env.path_to_playlist); ucs2cpy(pmpenv->playlist_ext, pmpi->env.playlist_ext); + // Create music instance. + ret = pmp_create_instance_db(pmp, &pmp->music); + if (ret != 0) { + pmp_release(pmp); + return ret; + } + // Prepare - pmp->add_ref(pmp); *ptr_pmp = pmp; return 0; } @@ -385,12 +396,39 @@ { uint32_t count = interlocked_decrement(&pmp->ref_count); if (count == 0) { + pmpdb_release(pmp->music); free(pmp->instance); free(pmp); } return count; } +static result_t pmp_open(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + pmp->flag = flag; + + if (pmp->flag & PMPOF_MUSIC_DB_READ) { + ret = pmpdb_read(pmp->music); + if (ret != 0) { + return ret; + } + } + return 0; +} + +static result_t pmp_close(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + if (pmp->flag & PMPOF_MUSIC_DB_WRITE) { + ret = pmpdb_write(pmp->music); + if (ret != 0) { + return ret; + } + } + return 0; +} + static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) { pmp_music_t* pmpdb = NULL; @@ -406,8 +444,6 @@ pmpdb->add_ref = pmpdb_add_ref; pmpdb->release = pmpdb_release; - pmpdb->read = pmpdb_read; - pmpdb->write = pmpdb_write; pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 15:17:10 UTC (rev 244) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 17:31:09 UTC (rev 245) @@ -24,14 +24,14 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif/*HAVE_CONFIG_H*/ + +#include <os.h> #ifdef HAVE_STRING_H #include <string.h> #endif/*HAVE_STRING_H*/ #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif/*HAVE_STDLIB_H*/ - -#include <os.h> #include <stddef.h> #include <ucs2char.h> #include <filepath.h> @@ -87,6 +87,8 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); +static result_t pmp_open(pmp_t* pmp, uint32_t flag); +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); @@ -104,7 +106,7 @@ static uint32_t pmppl_release(pmp_playlist_t* pmppl); static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); -int exists_sysfile(const ucs2char_t* path_to_device, const ucs2char_t* sysfilename) +static int exists_sysfile(const ucs2char_t* path_to_device, const ucs2char_t* sysfilename) { ucs2char_t filename[MAX_PATH]; @@ -133,6 +135,7 @@ // Check the model of the player. if (id && *id) { + // A device identifier is specified. if (strcmp(id, MODELID_H100) == 0) { model = MODEL_IRIVER_H100; } @@ -140,6 +143,7 @@ model = MODEL_IRIVER_H300; } } else { + // Try automatic device recognition. if (exists_sysfile(path_to_device, ucs2cs_h100_sys)) { model = MODEL_IRIVER_H100; } @@ -168,15 +172,18 @@ // Set member methods. pmp->add_ref = pmp_add_ref; pmp->release = pmp_release; + pmp->open = pmp_open; + pmp->close = pmp_close; pmp->create_instance_db = pmp_create_instance_db; 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. pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); if (!pmpi) { - free(pmp); + pmp_release(pmp); return PMPDBE_OUTOFMEMORY; } pmp->instance = pmpi; @@ -216,7 +223,14 @@ ucs2cpy(pmpenv->path_to_playlist.path, pmpi->env.path_to_playlist); ucs2cpy(pmpenv->playlist_ext, pmpi->env.playlist_ext); - pmp->add_ref(pmp); + // Create music instance. + ret = pmp_create_instance_db(pmp, &pmp->music); + if (ret != 0) { + pmp_release(pmp); + return ret; + } + + // Return this instance to the caller. *ptr_pmp = pmp; return 0; } @@ -230,11 +244,38 @@ { uint32_t count = interlocked_decrement(&pmp->ref_count); if (count == 0) { + pmpdb_release(pmp->music); free(pmp); } return count; } +static result_t pmp_open(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + pmp->flag = flag; + + if (pmp->flag & PMPOF_MUSIC_DB_READ) { + ret = pmpdb_read(pmp->music); + if (ret != 0) { + return ret; + } + } + return 0; +} + +static result_t pmp_close(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + if (pmp->flag & PMPOF_MUSIC_DB_WRITE) { + ret = pmpdb_write(pmp->music); + if (ret != 0) { + return ret; + } + } + return 0; +} + static int pmp_is_supported_codec(pmp_t* pmp, uint32_t codec) { return ( @@ -276,8 +317,6 @@ // Set member methods. pmpdb->add_ref = pmpdb_add_ref; pmpdb->release = pmpdb_release; - pmpdb->read = pmpdb_read; - pmpdb->write = pmpdb_write; pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 15:17:10 UTC (rev 244) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 17:31:09 UTC (rev 245) @@ -24,13 +24,13 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif/*HAVE_CONFIG_H*/ -#ifdef HAVE_STRING_H -#include <string.h> -#endif/*HAVE_STRING_H*/ #include <os.h> #include <stdio.h> #include <stdlib.h> +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ #include <ucs2char.h> #include <filepath.h> #include <pmp.h> @@ -218,6 +218,8 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); +static result_t pmp_open(pmp_t* pmp, uint32_t flag); +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); @@ -387,13 +389,16 @@ pmp->release = pmp_release; pmp->create_instance_db = pmp_create_instance_db; 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. pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); if (!pmpi) { - free(pmp); + pmp_release(pmp); return PMPDBE_OUTOFMEMORY; } pmp->instance = pmpi; @@ -416,8 +421,14 @@ ucs2cpy(pmpenv->path_to_playlist.path, pmpi->env.path_to_playlist); ucs2cpy(pmpenv->playlist_ext, pmpi->env.playlist_ext); + // Create music instance. + ret = pmp_create_instance_db(pmp, &pmp->music); + if (ret != 0) { + pmp_release(pmp); + return ret; + } + // Prepare - pmp->add_ref(pmp); *ptr_pmp = pmp; return 0; } @@ -431,12 +442,39 @@ { uint32_t count = interlocked_decrement(&pmp->ref_count); if (count == 0) { + pmpdb_release(pmp->music); free(pmp->instance); free(pmp); } return count; } +static result_t pmp_open(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + pmp->flag = flag; + + if (pmp->flag & PMPOF_MUSIC_DB_READ) { + ret = pmpdb_read(pmp->music); + if (ret != 0) { + return ret; + } + } + return 0; +} + +static result_t pmp_close(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + if (pmp->flag & PMPOF_MUSIC_DB_WRITE) { + ret = pmpdb_write(pmp->music); + if (ret != 0) { + return ret; + } + } + return 0; +} + static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) { pmp_music_t* pmpdb = NULL; @@ -452,8 +490,6 @@ pmpdb->add_ref = pmpdb_add_ref; pmpdb->release = pmpdb_release; - pmpdb->read = pmpdb_read; - pmpdb->write = pmpdb_write; pmpdb->set = pmpdb_set; pmpdb->get = pmpdb_get; pmpdb->dump = pmpdb_dump; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-07 15:17:10
|
Revision: 244 http://svn.sourceforge.net/pmplib/?rev=244&view=rev Author: nyaochi Date: 2007-01-07 07:17:10 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Beginning of API restructuring. - pmpdb_t -> pmp_music_t - pmppl_t -> pmp_playlist_t (this will be merged to pmp_music_t later though) Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/playlist.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/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-01-07 14:40:25 UTC (rev 243) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-01-07 15:17:10 UTC (rev 244) @@ -111,7 +111,7 @@ int result = 0; uint32_t i; result_t res = 0; - pmpdb_t* pmpdb = NULL; + pmp_music_t* pmpdb = NULL; pmp_record_t* records = NULL; pmp_record_t* old_records = NULL; uint32_t num_old_records = 0, num_obtained = 0; @@ -298,7 +298,7 @@ { int result = 0; result_t res = 0; - pmpdb_t* pmpdb = NULL; + pmp_music_t* pmpdb = NULL; /* * Read the existing database for update processing mode. @@ -378,7 +378,7 @@ int database_dump(pmp_t* pmp, FILE *fp, int level) { - pmpdb_t* pmpdb = NULL; + pmp_music_t* pmpdb = NULL; pmp->create_instance_db(pmp, &pmpdb); if (!pmpdb) { return 1; Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-07 14:40:25 UTC (rev 243) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-07 15:17:10 UTC (rev 244) @@ -77,7 +77,7 @@ int result = 0; int i, j, num_succeeded = 0; char *mbs = NULL; - pmppl_t* pmppl = NULL; + pmp_playlist_t* pmppl = NULL; playlist_mediafile_t* mediafiles = NULL; result_t res = 0; callback_data_t cd; Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-07 14:40:25 UTC (rev 243) +++ trunk/pmplib/include/pmp.h 2007-01-07 15:17:10 UTC (rev 244) @@ -37,9 +37,9 @@ /* * Forward structure declarations. */ -struct tag_pmp_t; typedef struct tag_pmp_t pmp_t; -struct tag_pmpdb_t; typedef struct tag_pmpdb_t pmpdb_t; -struct tag_pmppl_t; typedef struct tag_pmppl_t pmppl_t; +struct tag_pmp_t; typedef struct tag_pmp_t pmp_t; +struct tag_pmp_music_t; typedef struct tag_pmp_music_t pmp_music_t; +struct tag_pmp_playlist_t; typedef struct tag_pmp_playlist_t pmp_playlist_t; /** * Error codes. @@ -129,8 +129,8 @@ uint32_t (*add_ref)(pmp_t* pmp); uint32_t (*release)(pmp_t* pmp); - result_t (*create_instance_db)(pmp_t* pmp, pmpdb_t** pmpdb); - result_t (*create_instance_pl)(pmp_t* pmp, pmppl_t** pmppl); + result_t (*create_instance_db)(pmp_t* pmp, pmp_music_t** pmpdb); + 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); @@ -138,32 +138,32 @@ typedef void pmpdb_readwrite_progress_t(void *instance, uint32_t size, uint32_t total); -struct tag_pmpdb_t { +struct tag_pmp_music_t { void* instance; uint32_t ref_count; pmp_t* pmp; - uint32_t (*add_ref)(pmpdb_t* pmpdb); - uint32_t (*release)(pmpdb_t* pmpdb); + uint32_t (*add_ref)(pmp_music_t* pmpdb); + uint32_t (*release)(pmp_music_t* pmpdb); - result_t (*read)(pmpdb_t* pmpdb); - result_t (*write)(pmpdb_t* pmpdb); + result_t (*read)(pmp_music_t* pmpdb); + result_t (*write)(pmp_music_t* pmpdb); - result_t (*set)(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records); - result_t (*get)(pmpdb_t* pmpdb, pmp_record_t* records, uint32_t* num_records); + result_t (*set)(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records); + result_t (*get)(pmp_music_t* pmpdb, pmp_record_t* records, uint32_t* num_records); - result_t (*dump)(pmpdb_t* pmpdb, FILE *fp, int level); + result_t (*dump)(pmp_music_t* pmpdb, FILE *fp, int level); }; -struct tag_pmppl_t { +struct tag_pmp_playlist_t { void* instance; uint32_t ref_count; pmp_t* pmp; - uint32_t (*add_ref)(pmppl_t* pmppl); - uint32_t (*release)(pmppl_t* pmppl); + uint32_t (*add_ref)(pmp_playlist_t* pmppl); + uint32_t (*release)(pmp_playlist_t* pmppl); - result_t (*write)(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t * const files[], uint32_t num_files); + result_t (*write)(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t * const files[], uint32_t num_files); }; typedef result_t (*pmp_create_t)(pmp_t** pmp, const ucs2char_t* path_to_device, const char *devid); Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 14:40:25 UTC (rev 243) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-07 15:17:10 UTC (rev 244) @@ -115,22 +115,22 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); -static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb); -static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl); +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(pmpdb_t* pmpdb); -static uint32_t pmpdb_release(pmpdb_t* pmpdb); -static result_t pmpdb_read(pmpdb_t* pmpdb); -static result_t pmpdb_write(pmpdb_t* pmpdb); -static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records); -static result_t pmpdb_get(pmpdb_t* pmpdb, pmp_record_t* records, uint32_t* num_records); -static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level); +static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb); +static uint32_t pmpdb_release(pmp_music_t* pmpdb); +static result_t pmpdb_read(pmp_music_t* pmpdb); +static result_t pmpdb_write(pmp_music_t* pmpdb); +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 uint32_t pmppl_add_ref(pmppl_t* pmppl); -static uint32_t pmppl_release(pmppl_t* pmppl); -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); +static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl); +static uint32_t pmppl_release(pmp_playlist_t* pmppl); +static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); static void set_environment( @@ -380,15 +380,15 @@ return count; } -static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb) +static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) { - pmpdb_t* pmpdb = NULL; + pmp_music_t* pmpdb = NULL; pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; pmpdb_internal_t* pmpdbi = NULL; *ptr_pmpdb = 0; - pmpdb = calloc(1, sizeof(pmpdb_t)); + pmpdb = calloc(1, sizeof(pmp_music_t)); if (!pmpdb) { return PMPDBE_OUTOFMEMORY; } @@ -416,15 +416,15 @@ return 0; } -static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl) +static result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl) { pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; - pmppl_t* pmppl = NULL; + pmp_playlist_t* pmppl = NULL; pmppl_internal_t* pmppli = NULL; *ptr_pmppl = 0; - pmppl = calloc(1, sizeof(pmppl_t)); + pmppl = calloc(1, sizeof(pmp_playlist_t)); if (!pmppl) { return PMPDBE_OUTOFMEMORY; } @@ -465,12 +465,12 @@ -static uint32_t pmpdb_add_ref(pmpdb_t* pmpdb) +static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb) { return interlocked_increment(&pmpdb->ref_count); } -static uint32_t pmpdb_release(pmpdb_t* pmpdb) +static uint32_t pmpdb_release(pmp_music_t* pmpdb) { uint32_t count = interlocked_decrement(&pmpdb->ref_count); if (count == 0) { @@ -482,35 +482,35 @@ return count; } -static result_t pmpdb_read(pmpdb_t* pmpdb) +static result_t pmpdb_read(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return ip2db_read(&pmpdbi->ip2db, pmpi->env.dat_filename, pmpi->env.idx_filename); } -static result_t pmpdb_write(pmpdb_t* pmpdb) +static result_t pmpdb_write(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return ip2db_write(&pmpdbi->ip2db, pmpi->env.dat_filename, pmpi->env.idx_filename); } -static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return ip2db_set(&pmpdbi->ip2db, records, num_records, pmpi->env.path_to_root); } -static result_t pmpdb_get(pmpdb_t* pmpdb, 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) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return ip2db_get(&pmpdbi->ip2db, records, num_records, pmpi->env.path_to_root); } -static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level) +static result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; if (level > 0) { @@ -523,12 +523,12 @@ -static uint32_t pmppl_add_ref(pmppl_t* pmppl) +static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { return interlocked_increment(&pmppl->ref_count); } -static uint32_t pmppl_release(pmppl_t* pmppl) +static uint32_t pmppl_release(pmp_playlist_t* pmppl) { uint32_t count = interlocked_decrement(&pmppl->ref_count); if (count == 0) { @@ -539,7 +539,7 @@ return count; } -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) +static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) { pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmppl->pmp->instance; Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 14:40:25 UTC (rev 243) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-07 15:17:10 UTC (rev 244) @@ -111,22 +111,22 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); -static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb); -static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl); +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(pmpdb_t* pmpdb); -static uint32_t pmpdb_release(pmpdb_t* pmpdb); -static result_t pmpdb_read(pmpdb_t* pmpdb); -static result_t pmpdb_write(pmpdb_t* pmpdb); -static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records); -static result_t pmpdb_get(pmpdb_t* pmpdb, pmp_record_t* records, uint32_t* num_records); -static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level); +static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb); +static uint32_t pmpdb_release(pmp_music_t* pmpdb); +static result_t pmpdb_read(pmp_music_t* pmpdb); +static result_t pmpdb_write(pmp_music_t* pmpdb); +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 uint32_t pmppl_add_ref(pmppl_t* pmppl); -static uint32_t pmppl_release(pmppl_t* pmppl); -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); +static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl); +static uint32_t pmppl_release(pmp_playlist_t* pmppl); +static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); static void set_environment( @@ -391,15 +391,15 @@ return count; } -static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb) +static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) { - pmpdb_t* pmpdb = NULL; + pmp_music_t* pmpdb = NULL; pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; pmpdb_internal_t* pmpdbi = NULL; *ptr_pmpdb = 0; - pmpdb = calloc(1, sizeof(pmpdb_t)); + pmpdb = calloc(1, sizeof(pmp_music_t)); if (!pmpdb) { return PMPDBE_OUTOFMEMORY; } @@ -427,15 +427,15 @@ return 0; } -static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl) +static result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl) { pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; - pmppl_t* pmppl = NULL; + pmp_playlist_t* pmppl = NULL; pmppl_internal_t* pmppli = NULL; *ptr_pmppl = 0; - pmppl = calloc(1, sizeof(pmppl_t)); + pmppl = calloc(1, sizeof(pmp_playlist_t)); if (!pmppl) { return PMPDBE_OUTOFMEMORY; } @@ -488,12 +488,12 @@ -static uint32_t pmpdb_add_ref(pmpdb_t* pmpdb) +static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb) { return interlocked_increment(&pmpdb->ref_count); } -static uint32_t pmpdb_release(pmpdb_t* pmpdb) +static uint32_t pmpdb_release(pmp_music_t* pmpdb) { uint32_t count = interlocked_decrement(&pmpdb->ref_count); if (count == 0) { @@ -505,7 +505,7 @@ return count; } -static result_t pmpdb_read(pmpdb_t* pmpdb) +static result_t pmpdb_read(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; @@ -517,7 +517,7 @@ ); } -static result_t pmpdb_write(pmpdb_t* pmpdb) +static result_t pmpdb_write(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; @@ -539,7 +539,7 @@ return (path + length); } -static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records) { int i; pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; @@ -584,7 +584,7 @@ return 0; } -static result_t pmpdb_get(pmpdb_t* pmpdb, 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) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; @@ -638,7 +638,7 @@ return 0; } -static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level) +static result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; if (level > 0) { @@ -652,12 +652,12 @@ -static uint32_t pmppl_add_ref(pmppl_t* pmppl) +static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { return interlocked_increment(&pmppl->ref_count); } -static uint32_t pmppl_release(pmppl_t* pmppl) +static uint32_t pmppl_release(pmp_playlist_t* pmppl) { uint32_t count = interlocked_decrement(&pmppl->ref_count); if (count == 0) { @@ -668,7 +668,7 @@ return count; } -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) +static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) { pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmppl->pmp->instance; Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 14:40:25 UTC (rev 243) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-07 15:17:10 UTC (rev 244) @@ -87,22 +87,22 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); -static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb); -static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl); +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(pmpdb_t* pmpdb); -static uint32_t pmpdb_release(pmpdb_t* pmpdb); -static result_t pmpdb_read(pmpdb_t* pmpdb); -static result_t pmpdb_write(pmpdb_t* pmpdb); -static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records); -static result_t pmpdb_get(pmpdb_t* pmpdb, pmp_record_t* records, uint32_t* num_records); -static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level); +static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb); +static uint32_t pmpdb_release(pmp_music_t* pmpdb); +static result_t pmpdb_read(pmp_music_t* pmpdb); +static result_t pmpdb_write(pmp_music_t* pmpdb); +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 uint32_t pmppl_add_ref(pmppl_t* pmppl); -static uint32_t pmppl_release(pmppl_t* pmppl); -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); +static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl); +static uint32_t pmppl_release(pmp_playlist_t* pmppl); +static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); int exists_sysfile(const ucs2char_t* path_to_device, const ucs2char_t* sysfilename) { @@ -260,15 +260,15 @@ ) ? 1 : 0; } -static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb) +static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) { - pmpdb_t* pmpdb = NULL; + pmp_music_t* pmpdb = NULL; irivnavi_t* irivnavi = NULL; *ptr_pmpdb = 0; // Allocate a PMPDB instance. - pmpdb = (pmpdb_t*)calloc(1, sizeof(pmpdb_t)); + pmpdb = (pmp_music_t*)calloc(1, sizeof(pmp_music_t)); if (!pmpdb) { return PMPDBE_OUTOFMEMORY; } @@ -299,14 +299,14 @@ return 0; } -result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl) +result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl) { pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; - pmppl_t* pmppl = NULL; + pmp_playlist_t* pmppl = NULL; *ptr_pmppl = 0; - pmppl = (pmppl_t*)calloc(1, sizeof(pmppl_t)); + pmppl = (pmp_playlist_t*)calloc(1, sizeof(pmp_playlist_t)); if (!pmppl) { return PMPDBE_OUTOFMEMORY; } @@ -322,12 +322,12 @@ return 0; } -static uint32_t pmpdb_add_ref(pmpdb_t* pmpdb) +static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb) { return interlocked_increment(&pmpdb->ref_count); } -static uint32_t pmpdb_release(pmpdb_t* pmpdb) +static uint32_t pmpdb_release(pmp_music_t* pmpdb) { uint32_t count = interlocked_decrement(&pmpdb->ref_count); if (count == 0) { @@ -341,7 +341,7 @@ return count; } -result_t pmpdb_read(pmpdb_t* pmpdb) +result_t pmpdb_read(pmp_music_t* pmpdb) { irivnavi_t* db = (irivnavi_t*)pmpdb->instance; result_t ret = 0; @@ -396,7 +396,7 @@ return ret; } -result_t pmpdb_write(pmpdb_t* pmpdb) +result_t pmpdb_write(pmp_music_t* pmpdb) { irivnavi_t* db = (irivnavi_t*)pmpdb->instance; result_t ret = 0; @@ -442,7 +442,7 @@ return ret; } -result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records) { irivnavi_t* db = (irivnavi_t*)pmpdb->instance; result_t ret = 0; @@ -494,7 +494,7 @@ return 0; } -static result_t pmpdb_get(pmpdb_t* pmpdb, 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) { irivnavi_t* db = (irivnavi_t*)pmpdb->instance; result_t ret = 0; @@ -557,7 +557,7 @@ -result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level) +result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level) { irivnavi_t* db = (irivnavi_t*)pmpdb->instance; irivnavi_repr(db, fp, level); @@ -568,12 +568,12 @@ -static uint32_t pmppl_add_ref(pmppl_t* pmppl) +static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { return interlocked_increment(&pmppl->ref_count); } -static uint32_t pmppl_release(pmppl_t* pmppl) +static uint32_t pmppl_release(pmp_playlist_t* pmppl) { uint32_t count = interlocked_decrement(&pmppl->ref_count); if (count == 0) { @@ -582,7 +582,7 @@ return count; } -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) +static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) { pmp_internal_t* pmpi = (pmp_internal_t*)pmppl->pmp->instance; if (playlist_write(filename, files, num_files, pmpi->env.path_to_root) != 0) { Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 14:40:25 UTC (rev 243) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-07 15:17:10 UTC (rev 244) @@ -218,22 +218,22 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); -static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb); -static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl); +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(pmpdb_t* pmpdb); -static uint32_t pmpdb_release(pmpdb_t* pmpdb); -static result_t pmpdb_read(pmpdb_t* pmpdb); -static result_t pmpdb_write(pmpdb_t* pmpdb); -static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records); -static result_t pmpdb_get(pmpdb_t* pmpdb, pmp_record_t* records, uint32_t* num_records); -static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level); +static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb); +static uint32_t pmpdb_release(pmp_music_t* pmpdb); +static result_t pmpdb_read(pmp_music_t* pmpdb); +static result_t pmpdb_write(pmp_music_t* pmpdb); +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 uint32_t pmppl_add_ref(pmppl_t* pmppl); -static uint32_t pmppl_release(pmppl_t* pmppl); -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); +static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl); +static uint32_t pmppl_release(pmp_playlist_t* pmppl); +static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files); @@ -437,15 +437,15 @@ return count; } -static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb) +static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) { - pmpdb_t* pmpdb = NULL; + pmp_music_t* pmpdb = NULL; pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; pmpdb_internal_t* pmpdbi = NULL; *ptr_pmpdb = 0; - pmpdb = calloc(1, sizeof(pmpdb_t)); + pmpdb = calloc(1, sizeof(pmp_music_t)); if (!pmpdb) { return PMPDBE_OUTOFMEMORY; } @@ -472,14 +472,14 @@ return 0; } -static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl) +static result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl) { pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; - pmppl_t* pmppl = NULL; + pmp_playlist_t* pmppl = NULL; *ptr_pmppl = 0; - pmppl = calloc(1, sizeof(pmppl_t)); + pmppl = calloc(1, sizeof(pmp_playlist_t)); if (!pmppl) { return PMPDBE_OUTOFMEMORY; } @@ -510,12 +510,12 @@ -static uint32_t pmpdb_add_ref(pmpdb_t* pmpdb) +static uint32_t pmpdb_add_ref(pmp_music_t* pmpdb) { return interlocked_increment(&pmpdb->ref_count); } -static uint32_t pmpdb_release(pmpdb_t* pmpdb) +static uint32_t pmpdb_release(pmp_music_t* pmpdb) { uint32_t count = interlocked_decrement(&pmpdb->ref_count); if (count == 0) { @@ -527,35 +527,35 @@ return count; } -static result_t pmpdb_read(pmpdb_t* pmpdb) +static result_t pmpdb_read(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return pp1db_read(&pmpdbi->pp1db, pmpi->env.hdr_filename); } -static result_t pmpdb_write(pmpdb_t* pmpdb) +static result_t pmpdb_write(pmp_music_t* pmpdb) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return pp1db_write(&pmpdbi->pp1db, pmpi->env.hdr_filename); } -static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records) +static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_record_t* records, uint32_t num_records) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return pp1db_set(&pmpdbi->pp1db, records, num_records, pmpi->env.path_to_root); } -static result_t pmpdb_get(pmpdb_t* pmpdb, 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) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; return pp1db_get(&pmpdbi->pp1db, records, num_records, pmpi->env.path_to_root); } -static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level) +static result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; return pp1db_repr(&pmpdbi->pp1db, fp, level); @@ -564,12 +564,12 @@ -static uint32_t pmppl_add_ref(pmppl_t* pmppl) +static uint32_t pmppl_add_ref(pmp_playlist_t* pmppl) { return interlocked_increment(&pmppl->ref_count); } -static uint32_t pmppl_release(pmppl_t* pmppl) +static uint32_t pmppl_release(pmp_playlist_t* pmppl) { uint32_t count = interlocked_decrement(&pmppl->ref_count); if (count == 0) { @@ -578,7 +578,7 @@ return count; } -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) +static result_t pmppl_write(pmp_playlist_t* pmppl, const ucs2char_t* filename, ucs2char_t* const files[], uint32_t num_files) { pmp_internal_t* pmpi = (pmp_internal_t*)pmppl->pmp->instance; if (playlist_write(filename, files, num_files, pmpi->env.path_to_root) != 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-07 14:40:28
|
Revision: 243 http://svn.sourceforge.net/pmplib/?rev=243&view=rev Author: nyaochi Date: 2007-01-07 06:40:25 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Oops, forgot to commit the web pages for 0.13. Modified Paths: -------------- trunk/webpage/index.xml trunk/webpage/news.xml Modified: trunk/webpage/index.xml =================================================================== --- trunk/webpage/index.xml 2007-01-06 22:53:25 UTC (rev 242) +++ trunk/webpage/index.xml 2007-01-07 14:40:25 UTC (rev 243) @@ -20,6 +20,7 @@ <li>iRiver H10 MTP (with emergency connect mode)</li> <li>iRiver H10Jr. UMS</li> <li>iRiver U10 UMS</li> +<li>iRiver E10 UMS</li> <li>MEDION MDJuke220</li> <li>MEDION MDJuke440</li> <li>Samsung YH-820</li> Modified: trunk/webpage/news.xml =================================================================== --- trunk/webpage/news.xml 2007-01-06 22:53:25 UTC (rev 242) +++ trunk/webpage/news.xml 2007-01-07 14:40:25 UTC (rev 243) @@ -12,6 +12,50 @@ <news> +<ni caption="PMPlib Forum is reopened" date="2007-01-05"> +<p> +I set up <a href="http://nyaochi.sakura.ne.jp/pmplib/">PMPlib Forum</a> at my private server since I could not install the forum in the sf.net server due to the tight security. +Let us share the information about PMPlib and portable media players in the forum. +I apologize those who posted messages at <a href="http://sourceforge.net/forum/?group_id=157298">the forum in sourceforge.net</a>. +I didn't reply to some messages. +</p> +<p> +The forum also takes over <a href="http://easyh10.sourceforge.net/forum/">EasyH10 Forum</a>. +You can the same user name and password if you have an account for the EasyH10 Forum. +</p> +</ni> + +<ni caption="PMPlib (EasyPMP) version 0.13 released" date="2007-01-05"> +<p> +After the short break of the project (mostly because Nyaochi was busy), we are pleased to announce PMPlib 0.13. +</p> +<ul> +<li>[Common] <b>New database reader/writer for iriver E10 (pmp_iriverplus3)</b>. This is based on <a href="http://nyaochi.sakura.ne.jp/pmplib/index.php?topic=197.0">the reverse engineering effort</a> done by Nyaochi with the help of hullbr3ach. Playlist conversion for iriver E10 <b>is not implemented</b> yet due to some implementation problems (we need to revise the core API). The playlist conversion is planned in the next release.</li> +<li>[CUI] Fit long progress reports in a line (done by Sucknblow).</li> +<li>[Win32] Changed the Win32 compiler to Microsoft Visual Studio 2005. If you got an error message reporting missing runtime DLLs, please install <a href="http://www.microsoft.com/downloads/thankyou.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee">Microsoft Visual C++ 2005 Redistributable Package (x86)</a>.</li> +<li>[Web] Launch the new PMPlib forum.</li> +</ul> +<p> +The database format of iriver E10 was completely new to us. +It is totally different from the 1st (H100/H300), 2nd (H10), and 3rd (H10Jr/U10) generation of media database employed in iriver players. +The 4th generation database consists of multiple binary search trees (probably AVL trees) so that the player can implement various navigation paths (e.g., Artist->Album->TrackNumber, Title, Genre->Album->TrackNumber, etc) efficiently. +A node in a binary search tree stores: the node value (BYTE, WORD, DWORD, or UCS-2 string); a linear-linked list pointing to records; and links to left and right children. +</p> +<p> +Although the database reader/writer worked fine on my experiments, there might be some problems as it is not based on a specification but the analysis. +Should you have a problem with a database generated by this program, please report the problem in the forum. +You can recover from the error with iriver plus 2 or 3 in the following steps. +</p> +<ol> +<li>Delete three database files in your player, "/path-to-e10/System/db.dat", "/path-to-e10/System/db.dic", "/path-to-e10/System/db.idx". You need to enter the folder name (e.g., "E:\System") directly to the address bar of Explorer since the folder is hidden.</li> +<li>Delete local database files of iriver plus 2 or 3, "/path-to-iriverplus/plus2_0.db" and "/path-to-iriverplus/plus2_0.bak", e.g., "C:\Program Files\iriver\iriver plus 3\plus2_0.db" and "C:\Program Files\iriver\iriver plus 3\plus2_0.bak".</li> +<li>Run iriver plus 2 or 3. This will rebuild the database automatically. If not, choose the menu item, "Tools"->"Portable Device"->"Database Update".</li> +</ol> +<p> +Enjoy your music life with E10 and EasyPMP! +</p> +</ni> + <ni caption="PMPlib (EasyPMP) version 0.12 released" date="2006-08-01"> <p> We are pleased to announce that PMPlib 0.12 was released with numerous changes and bug-fixes. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2007-01-06 22:53:25
|
Revision: 242 http://svn.sourceforge.net/pmplib/?rev=242&view=rev Author: sucknblow Date: 2007-01-06 14:53:25 -0800 (Sat, 06 Jan 2007) Log Message: ----------- Update SVN URL in tagging script Modified Paths: -------------- trunk/scripts/release/make_tag Modified: trunk/scripts/release/make_tag =================================================================== --- trunk/scripts/release/make_tag 2007-01-06 22:52:10 UTC (rev 241) +++ trunk/scripts/release/make_tag 2007-01-06 22:53:25 UTC (rev 242) @@ -31,7 +31,7 @@ fi TAGDIR=tagging.$$ -svn co -N https://svn.sourceforge.net/svnroot/pmplib/ $TAGDIR +svn co -N https://pmplib.svn.sourceforge.net/svnroot/pmplib/ $TAGDIR cd $TAGDIR svn up -N {trunk,tags} svn up -N tags/pmplib This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2007-01-06 22:52:10
|
Revision: 241 http://svn.sourceforge.net/pmplib/?rev=241&view=rev Author: sucknblow Date: 2007-01-06 14:52:10 -0800 (Sat, 06 Jan 2007) Log Message: ----------- Tag for PMPlib 0.13 alpha. Modified Paths: -------------- tags/pmplib/0.13/pmplib/frontend/easypmp/cui/console_win32.c Added Paths: ----------- tags/pmplib/0.13/ tags/pmplib/0.13/debian/ tags/pmplib/0.13/pmplib/ Removed Paths: ------------- tags/pmplib/0.13/pmplib/debian/ Copied: tags/pmplib/0.13/debian (from rev 240, trunk/pmplib/debian) Copied: tags/pmplib/0.13/pmplib (from rev 240, trunk/pmplib) Modified: tags/pmplib/0.13/pmplib/frontend/easypmp/cui/console_win32.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-01-04 19:29:09 UTC (rev 240) +++ tags/pmplib/0.13/pmplib/frontend/easypmp/cui/console_win32.c 2007-01-06 22:52:10 UTC (rev 241) @@ -20,7 +20,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include <config.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-04 19:29:09
|
Revision: 240 http://svn.sourceforge.net/pmplib/?rev=240&view=rev Author: nyaochi Date: 2007-01-04 11:29:09 -0800 (Thu, 04 Jan 2007) Log Message: ----------- Some stuffs that were not included in PMPlib 0.13 alpha release. Modified Paths: -------------- trunk/pmplib/ChangeLog trunk/pmplib/README trunk/pmplib/configure.in Modified: trunk/pmplib/ChangeLog =================================================================== --- trunk/pmplib/ChangeLog 2007-01-04 03:55:02 UTC (rev 239) +++ trunk/pmplib/ChangeLog 2007-01-04 19:29:09 UTC (rev 240) @@ -1,6 +1,13 @@ ChangeLog file for pmplib + + Changes in 0.13 (2007-01-04) +- New database reader/writer for iriver E10 (pmp_iriverplus3). +- Playlist conversion for iriver E10 is planned in the upcoming release. +- Fit long progress reports in a line. +- Launch the new PMPlib forum. + Changes in 0.12 (2006-08-01) - Command line options for easypmp have changed (now easier to type). - Easypmp now has a manual page. Modified: trunk/pmplib/README =================================================================== --- trunk/pmplib/README 2007-01-04 03:55:02 UTC (rev 239) +++ trunk/pmplib/README 2007-01-04 19:29:09 UTC (rev 240) @@ -1,5 +1,5 @@ PMPLib - Version 0.12 + Version 0.13 http://pmplib.sourceforge.net/ * STRUCTURE Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-01-04 03:55:02 UTC (rev 239) +++ trunk/pmplib/configure.in 2007-01-04 19:29:09 UTC (rev 240) @@ -27,7 +27,7 @@ dnl ------------------------------------------------------------------ dnl Initialization for automake dnl ------------------------------------------------------------------ -AM_INIT_AUTOMAKE(pmplib, 0.12) +AM_INIT_AUTOMAKE(pmplib, 0.13) AC_CONFIG_HEADERS(config.h) AM_MAINTAINER_MODE AM_C_PROTOTYPES This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-04 03:55:02
|
Revision: 239 http://svn.sourceforge.net/pmplib/?rev=239&view=rev Author: nyaochi Date: 2007-01-03 19:55:02 -0800 (Wed, 03 Jan 2007) Log Message: ----------- Release for PMPlib version 0.13 alpha. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-04 03:27:01 UTC (rev 238) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-04 03:55:02 UTC (rev 239) @@ -58,8 +58,8 @@ */ #define APPLICATION_S "EasyPMP [CUI]" -#define VERSION_S "0.13 alpha 1" -#define COPYRIGHT_S "Copyright (c) 2005-2006 Nyaochi" +#define VERSION_S "0.13 alpha" +#define COPYRIGHT_S "Copyright (c) 2005-2007 Nyaochi" int database_dump(pmp_t* pmp, FILE *fpo, int level); void device_show_information(pmp_t* pmp, FILE *fpe); Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-01-04 03:27:01 UTC (rev 238) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-01-04 03:55:02 UTC (rev 239) @@ -70,12 +70,6 @@ "\0" END -//3 TEXTINCLUDE -//BEGIN -// "CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST ""res\\\\easypmp_win32gui.exe.manifest""\r\n" -// "\0" -//END - #endif // APSTUDIO_INVOKED @@ -192,8 +186,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,13,1,2 - PRODUCTVERSION 0,13,1,2 + FILEVERSION 0,13,0,2 + PRODUCTVERSION 0,13,0,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -209,12 +203,12 @@ BLOCK "040904b0" BEGIN VALUE "FileDescription", "EasyPMP [Win32 GUI] application" - VALUE "FileVersion", "0, 13, 1, 2" + VALUE "FileVersion", "0, 13, 0, 2" VALUE "InternalName", "easypmp_win32gui" - VALUE "LegalCopyright", "Copyright 2005-2006 Nyaochi" + VALUE "LegalCopyright", "Copyright 2005-2007 Nyaochi" VALUE "OriginalFilename", "easypmp_win32gui.exe" VALUE "ProductName", "EasyPMP [Win32 GUI]" - VALUE "ProductVersion", "0, 13, 1, 2" + VALUE "ProductVersion", "0, 13, 0, 2" END END BLOCK "VarFileInfo" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-04 03:27:01
|
Revision: 238 http://svn.sourceforge.net/pmplib/?rev=238&view=rev Author: nyaochi Date: 2007-01-03 19:27:01 -0800 (Wed, 03 Jan 2007) Log Message: ----------- Fixed the compatibility problem for manifest files with MSVC2005. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc Removed Paths: ------------- trunk/pmplib/frontend/easypmp/win32gui/res/easypmp_win32gui.exe.manifest Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-01-04 03:10:35 UTC (rev 237) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-01-04 03:27:01 UTC (rev 238) @@ -70,11 +70,11 @@ "\0" END -3 TEXTINCLUDE -BEGIN - "CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST ""res\\\\easypmp_win32gui.exe.manifest""\r\n" - "\0" -END +//3 TEXTINCLUDE +//BEGIN +// "CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST ""res\\\\easypmp_win32gui.exe.manifest""\r\n" +// "\0" +//END #endif // APSTUDIO_INVOKED @@ -322,7 +322,7 @@ // // Generated from the TEXTINCLUDE 3 resource. // -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\easypmp_win32gui.exe.manifest" +//CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\easypmp_win32gui.exe.manifest" ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED Deleted: trunk/pmplib/frontend/easypmp/win32gui/res/easypmp_win32gui.exe.manifest =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/res/easypmp_win32gui.exe.manifest 2007-01-04 03:10:35 UTC (rev 237) +++ trunk/pmplib/frontend/easypmp/win32gui/res/easypmp_win32gui.exe.manifest 2007-01-04 03:27:01 UTC (rev 238) @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> -<assemblyIdentity - version="1.0.0.0" - processorArchitecture="x86" - name="easypmp_win32gui" - type="win32" -/> -<description> - easypmp_win32gui Application -</description> -<dependency> - <dependentAssembly> - <assemblyIdentity - type="win32" - name="Microsoft.Windows.Common-Controls" - version="6.0.0.0" - processorArchitecture="x86" - publicKeyToken="6595b64144ccf1df" - language="*" - /> - </dependentAssembly> -</dependency> -</assembly> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-04 03:10:34
|
Revision: 237 http://svn.sourceforge.net/pmplib/?rev=237&view=rev Author: nyaochi Date: 2007-01-03 19:10:35 -0800 (Wed, 03 Jan 2007) Log Message: ----------- Implemented fputucs2c() for Win32. Modified Paths: -------------- trunk/pmplib/lib/ucs2/ucs2char_win32.c Modified: trunk/pmplib/lib/ucs2/ucs2char_win32.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-01-04 02:54:06 UTC (rev 236) +++ trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-01-04 03:10:35 UTC (rev 237) @@ -105,6 +105,11 @@ } +ucs2char_t fputucs2c(ucs2char_t c, FILE *fp) +{ + return (ucs2char_t)fputwc((wchar_t)c, fp); +} + FILE *ucs2fopen(const ucs2char_t *filename, const char *mode) { FILE *fp = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-04 02:54:07
|
Revision: 236 http://svn.sourceforge.net/pmplib/?rev=236&view=rev Author: nyaochi Date: 2007-01-03 18:54:06 -0800 (Wed, 03 Jan 2007) Log Message: ----------- Use wcwidth() to calculate the print length: some unicode characters (e.g., CJK) require two columns to print them in a console buffer. Print dotts (...) when the message is truncated to the console width. This revision passed a test with long Japanese filenames. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/console_posix.c trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/include/ucs2char.h trunk/pmplib/lib/ucs2/ucs2char_iconv.c Modified: trunk/pmplib/frontend/easypmp/cui/console_posix.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-01-04 01:39:08 UTC (rev 235) +++ trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-01-04 02:54:06 UTC (rev 236) @@ -183,33 +183,32 @@ */ int console_println(FILE *fp, const ucs2char_t* line, int min_width) { - int length = ucs2len(line); - const ucs2char_t* line_to_print; + const int margin = 5; - /* Check if writing to a terminal. */ - int writing_to_tty = is_tty(fp); + if (is_tty(fp)) { + int x = 0, width = 0; + const ucs2char_t* p = line; - if(!writing_to_tty) { - /* Write the whole line to the file, add \n. */ + while (*p) { + wchar_t c = (wchar_t)*p; + + if (window_width <= x + margin) { + int ndotts = MIN(3, window_width - x); + while (ndotts-- > 0) fputc('.', fp); + break; + } else { + /* I don't understand why fputwc(c, fp); doesn't work... */ + fputucs2c(*p, fp); + } + p++; + x += wcwidth(c); + } + fputc('\r', fp); + return (int)(p - line); + } else { fprints(fp, "%s\n", line); - return length; - } else if (length <= window_width) { - /* There's enough room to show the whole line. */ - fprints(fp, "%s\r", line); - return length; + return ucs2len(line); } - else { - /* Length of the longest string we might display: */ - const int max_trunc_length = MAX(window_width,min_width); - - /* Length of string we actually will display: */ - const size_t trunc_length = MIN(max_trunc_length, length); - - ucs2char_t *truncated_line = ucs2calloc(sizeof(ucs2char_t) * (trunc_length+1)); - ucs2ncpy(truncated_line, line, trunc_length); - fprints(fp, "%s\r", truncated_line); - return trunc_length; - } } Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-01-04 01:39:08 UTC (rev 235) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-01-04 02:54:06 UTC (rev 236) @@ -78,7 +78,7 @@ *p++ = ' '; ucs2cpy(p, msg); - console_clearln(fp); + //console_clearln(fp); console_println(fp, str, 0); return 0; } Modified: trunk/pmplib/include/ucs2char.h =================================================================== --- trunk/pmplib/include/ucs2char.h 2007-01-04 01:39:08 UTC (rev 235) +++ trunk/pmplib/include/ucs2char.h 2007-01-04 02:54:06 UTC (rev 236) @@ -123,6 +123,7 @@ UCS2API int ucs2stat_is_dir(const ucs2char_t *filename); UCS2API int ucs2stat_is_exist(const ucs2char_t *filename); +UCS2API ucs2char_t fputucs2c(ucs2char_t c, FILE *fp); UCS2API FILE *ucs2fopen(const ucs2char_t *filename, const char *mode); /** @} */ Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-01-04 01:39:08 UTC (rev 235) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-01-04 02:54:06 UTC (rev 236) @@ -165,7 +165,7 @@ { char buff[1024]; sprintf(buff, "%d", value); - mbstoucs2(string, 1024, buff, sizeof(buff)); + mbstoucs2(string, 1024, buff, strlen(buff)+1); return string; } @@ -241,6 +241,17 @@ } } +ucs2char_t fputucs2c(ucs2char_t c, FILE *fp) +{ + ucs2char_t ucs2str[2] = {c, 0}; + size_t mbs_size = ucs2tombs(NULL, 0, ucs2str, ucs2len(ucs2str)) + 1; + char* mbs = (char *)alloca(mbs_size * sizeof(char)); + if (mbs) { + ucs2tombs(mbs, mbs_size, ucs2str, ucs2len(ucs2str)+1); + fputs(mbs, fp); + } +} + FILE *ucs2fopen(const ucs2char_t *filename, const char *mode) { FILE *fp = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-04 01:39:09
|
Revision: 235 http://svn.sourceforge.net/pmplib/?rev=235&view=rev Author: nyaochi Date: 2007-01-03 17:39:08 -0800 (Wed, 03 Jan 2007) Log Message: ----------- Changed the specification of console_println() for Win32: this function must be called when the console cursor is at the beginning of lines. This change is due to the difficulty of obtaining the cursor position in POSIX environment. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/util.c Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-03 14:49:09 UTC (rev 234) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-04 01:39:08 UTC (rev 235) @@ -45,6 +45,7 @@ #include <easypmp.h> #include "option.h" +#include "console.h" #include "util.h" #ifdef _WIN32 Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-01-03 14:49:09 UTC (rev 234) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-01-04 01:39:08 UTC (rev 235) @@ -43,6 +43,7 @@ #include <stdlib.h> #include <ucs2char.h> +#include "util.h" #include "console.h" /** @@ -65,9 +66,20 @@ display_line is used to truncate the line in this way. */ + ucs2char_t *str = alloca(sizeof(ucs2char_t) * (ucs2len(msg) + 32)); + ucs2char_t *p = str; + + /* sprintf(str, " %u: %S", n, msg); */ + *p++ = ' '; + *p++ = ' '; + itoucs2((int)n, p, 10); + p = str + ucs2len(str); + *p++ = ':'; + *p++ = ' '; + ucs2cpy(p, msg); + console_clearln(fp); - fprintf(fp, " %u: ", n); - console_println(fp, msg, 0); + console_println(fp, str, 0); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-03 15:07:33
|
Revision: 234 http://svn.sourceforge.net/pmplib/?rev=234&view=rev Author: nyaochi Date: 2007-01-03 06:49:09 -0800 (Wed, 03 Jan 2007) Log Message: ----------- Revised configure.in to check isatty(). Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/console_posix.c Modified: trunk/pmplib/frontend/easypmp/cui/console_posix.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-01-03 14:48:39 UTC (rev 233) +++ trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-01-03 14:49:09 UTC (rev 234) @@ -34,19 +34,21 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif/*HAVE_CONFIG_H*/ -#ifdef HAVE_STRING_H -#include <string.h> -#endif/*HAVE_STRING_H*/ #include <os.h> #include <stdio.h> #include <stdlib.h> #include <ucs2char.h> +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif/*HAVE_UNISTD_H*/ + #include "console.h" -#define HAVE_TTY - #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -128,7 +130,7 @@ */ int console_init() { -#ifdef HAVE_TTY +#ifdef HAVE_ISATTY int i; for(i = 0; i <= POSSIBLE_TTYS; ++i) fd_is_tty[i] = isatty(i); @@ -137,7 +139,7 @@ signal(SIGWINCH,window_size_changed); window_size_changed(0); #endif/*CAN_GET_WIN_SIZE*/ -#endif/*HAVE_TTY*/ +#endif/*HAVE_ISATTY*/ return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-03 14:48:40
|
Revision: 233 http://svn.sourceforge.net/pmplib/?rev=233&view=rev Author: nyaochi Date: 2007-01-03 06:48:39 -0800 (Wed, 03 Jan 2007) Log Message: ----------- Revised configure.in to check isatty(). Modified Paths: -------------- trunk/pmplib/configure.in Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-01-03 13:38:48 UTC (rev 232) +++ trunk/pmplib/configure.in 2007-01-03 14:48:39 UTC (rev 233) @@ -141,7 +141,7 @@ AC_FUNC_ALLOCA AC_FUNC_MEMCMP AC_FUNC_VPRINTF -AC_CHECK_FUNCS(getcwd mktime strdup strerror strtol strtoul) +AC_CHECK_FUNCS(getcwd mktime strdup strerror strtol strtoul isatty) dnl Check for math library AC_CHECK_LIB(m, rand) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-03 13:38:48
|
Revision: 232 http://svn.sourceforge.net/pmplib/?rev=232&view=rev Author: nyaochi Date: 2007-01-03 05:38:48 -0800 (Wed, 03 Jan 2007) Log Message: ----------- Make console_posix.c work. More test needed. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/Makefile.am trunk/pmplib/frontend/easypmp/cui/console_posix.c trunk/pmplib/frontend/easypmp/cui/main.c Modified: trunk/pmplib/frontend/easypmp/cui/Makefile.am =================================================================== --- trunk/pmplib/frontend/easypmp/cui/Makefile.am 2007-01-03 10:49:31 UTC (rev 231) +++ trunk/pmplib/frontend/easypmp/cui/Makefile.am 2007-01-03 13:38:48 UTC (rev 232) @@ -20,6 +20,8 @@ $(getopt) \ util.c \ util.h \ + console_posix.c \ + console.h \ main.c easypmp_CPPFLAGS = -I$(srcdir)/../common Modified: trunk/pmplib/frontend/easypmp/cui/console_posix.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-01-03 10:49:31 UTC (rev 231) +++ trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-01-03 13:38:48 UTC (rev 232) @@ -1,7 +1,7 @@ /* * Miscellaneous utilities. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2006 Martin Ellis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,6 +45,8 @@ #include "console.h" +#define HAVE_TTY + #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -95,7 +97,7 @@ * * @param unused */ -void window_size_changed(int unused) +static void window_size_changed(int unused) { static struct winsize wsize; if (ioctl(1, TIOCGWINSZ, &wsize) != -1) { @@ -109,12 +111,22 @@ #endif/*CAN_GET_WIN_SIZE*/ +static int is_tty(FILE *fp) +{ + int fd = fileno(fp); + if (0 < fd && fd <= POSSIBLE_TTYS && fd_is_tty[fd]) { + return 1; + } else { + return 0; + } +} + /** * Determines whether stdin, stdout and stderr are associated with a * TTY, and update fd_is_tty accordingly. Also sets up * window_size_changed as a signal handler. */ -void display_init() +int console_init() { #ifdef HAVE_TTY int i; @@ -126,6 +138,7 @@ window_size_changed(0); #endif/*CAN_GET_WIN_SIZE*/ #endif/*HAVE_TTY*/ + return 0; } /** @@ -136,14 +149,19 @@ * This is followed by a carriage return character, to return the * cursor to the start of the line. */ -void clear_line(FILE *fp) +int console_clearln(FILE *fp) { - /* fmt needs 4 chars (%, -, s, \r) + - room for window_width as string (max. 65535) + - null terminator */ - char fmt[10]; - sprintf(fmt, "%%-%us\r", window_width); - fprintf(fp, fmt, ""); + if (is_tty(fp)) { + /* fmt needs 4 chars (%, -, s, \r) + + room for window_width as string (max. 65535) + + null terminator */ + char fmt[10]; + sprintf(fmt, "%%-%us\r", window_width); + fprintf(fp, fmt, ""); + return 0; + } else { + return 1; + } } /** @@ -161,28 +179,22 @@ * @param line the UCS-2 encoded string to display * @param min_width minimum number of characters to print */ -void display_line(FILE *fp, const ucs2char_t* const line, - unsigned int min_width) +int console_println(FILE *fp, const ucs2char_t* line, int min_width) { - unsigned int length = ucs2len(line); + int length = ucs2len(line); const ucs2char_t* line_to_print; - int writing_to_tty; - /* Check if writing to a terminal. If so, clear the current line. */ - int fd = fileno(fp); - if (0 < fd && fd <= POSSIBLE_TTYS && fd_is_tty[fd]) { - clear_line(fp); - writing_to_tty = 1; - } else { - writing_to_tty = 0; - } + /* Check if writing to a terminal. */ + int writing_to_tty = is_tty(fp); if(!writing_to_tty) { /* Write the whole line to the file, add \n. */ - fprints(fp, "%s\r\n", line); + fprints(fp, "%s\n", line); + return length; } else if (length <= window_width) { /* There's enough room to show the whole line. */ fprints(fp, "%s\r", line); + return length; } else { /* Length of the longest string we might display: */ @@ -194,6 +206,7 @@ ucs2char_t *truncated_line = ucs2calloc(sizeof(ucs2char_t) * (trunc_length+1)); ucs2ncpy(truncated_line, line, trunc_length); fprints(fp, "%s\r", truncated_line); + return trunc_length; } } Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-03 10:49:31 UTC (rev 231) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-03 13:38:48 UTC (rev 232) @@ -113,7 +113,7 @@ easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); break; case EASYPMPDBP_GMI|EASYPMPSP_END: - clear_line(fpo); + console_clearln(fpo); fprintf(fpo, " %d files were imported\n", param_int); fprintf(fpo, "\n"); break; @@ -329,11 +329,11 @@ fprintf(fpo, "\n"); memset(&musics, 0, sizeof(musics)); - display_init(); + console_init(); if ((opt.verb & MODE_DATABASE) || ((opt.verb & MODE_PLAYLIST) && (opt.verb & MODE_PLAYLIST_FIND))) { fprintf(fpo, "Enumerating music files\n"); easypmp_enumerate_music(&musics, pmp, &opt, easypmp_enumerate_progress, NULL); - clear_line(fpo); + console_clearln(fpo); fprintf(fpo, " %d music files were found\n", musics.num_elements); fprintf(fpo, "\n"); } @@ -342,7 +342,7 @@ if (opt.verb & MODE_PLAYLIST) { fprintf(fpe, "Enumerating playlist files\n"); easypmp_enumerate_playlist(&playlists, pmp, &opt, easypmp_enumerate_progress, NULL); - clear_line(fpo); + console_clearln(fpo); fprintf(fpo, " %d music files were found\n", playlists.num_elements); fprintf(fpo, "\n"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-03 10:49:34
|
Revision: 231 http://svn.sourceforge.net/pmplib/?rev=231&view=rev Author: nyaochi Date: 2007-01-03 02:49:31 -0800 (Wed, 03 Jan 2007) Log Message: ----------- - Moved Martin's TTY management code to console_posix.c (untested). - Implemented the similar console routine for Win32 (console_win32.c). Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj trunk/pmplib/frontend/easypmp/cui/util.c Added Paths: ----------- trunk/pmplib/frontend/easypmp/cui/console.h trunk/pmplib/frontend/easypmp/cui/console_posix.c trunk/pmplib/frontend/easypmp/cui/console_win32.c Added: trunk/pmplib/frontend/easypmp/cui/console.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console.h (rev 0) +++ trunk/pmplib/frontend/easypmp/cui/console.h 2007-01-03 10:49:31 UTC (rev 231) @@ -0,0 +1,39 @@ +/* + * Console manupulator. + * + * Copyright (c) 2006 Nyaochi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit + * http://www.gnu.org/copyleft/gpl.html . + * + */ + +/* $Id$ */ + +#ifndef __CONSOLE_H__ +#define __CONSOLE_H__ + +/** + * \addtogroup cui + * @{ + */ + +int console_init(); +int console_clearln(FILE *fp); +int console_println(FILE *fp, const ucs2char_t* line, int min_width); + +/** @} */ + +#endif/*__CONSOLE_H__*/ Property changes on: trunk/pmplib/frontend/easypmp/cui/console.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/frontend/easypmp/cui/console_posix.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_posix.c (rev 0) +++ trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-01-03 10:49:31 UTC (rev 231) @@ -0,0 +1,201 @@ +/* + * Miscellaneous utilities. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit + * http://www.gnu.org/copyleft/gpl.html . + * + */ + +/* $Id$ */ + +/** + * @file + * Utility functions for the easypmp command line program (mostly + * display related). + * + * @addtogroup cui + * @{ + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> + +#include "console.h" + +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +#if CAN_GET_WIN_SIZE +#include <sys/ioctl.h> +#include <signal.h> +#endif/*CAN_GET_WIN_SIZE*/ + +#include "util.h" + +#if CAN_GET_WIN_SIZE +/** + * The number of characters that can be printed on a single line, + * without causing a line wrap. Since the right-most column is + * required for the cursor, this is one less than the actual terminal + * width. + * + * Defaults to 79 on systems where we can't tell the width of the + * terminal. + */ +static volatile unsigned short int window_width; +#else +static const unsigned short int window_width = 79; +#endif + +/** + * The minimum width of the terminal we're willing to entertain. If + * the terminal gets narrower than this width, we treat it as this + * width. Note that it must be at least 2 to allow for one character + * and the cursor. +*/ +static const int min_term_width = 6; + + +#define POSSIBLE_TTYS 2 +/** + * Flags to indicate whether stdin, stdout, and stderr are attached to + * a terminal. These are used to determine whether we should check + * the width of some progress lines before printing them. Initialised + * in display_init. + */ +static int fd_is_tty[POSSIBLE_TTYS+1]; + +#if CAN_GET_WIN_SIZE + +/** + * Handler for the "terminal window changed size" signal. + * + * @param unused + */ +void window_size_changed(int unused) +{ + static struct winsize wsize; + if (ioctl(1, TIOCGWINSZ, &wsize) != -1) { + if (wsize.ws_col > min_term_width) { + window_width = wsize.ws_col - 1; + } else { + window_width = min_term_width; + } + } +} + +#endif/*CAN_GET_WIN_SIZE*/ + +/** + * Determines whether stdin, stdout and stderr are associated with a + * TTY, and update fd_is_tty accordingly. Also sets up + * window_size_changed as a signal handler. + */ +void display_init() +{ +#ifdef HAVE_TTY + int i; + for(i = 0; i <= POSSIBLE_TTYS; ++i) + fd_is_tty[i] = isatty(i); + +#if CAN_GET_WIN_SIZE + signal(SIGWINCH,window_size_changed); + window_size_changed(0); +#endif/*CAN_GET_WIN_SIZE*/ +#endif/*HAVE_TTY*/ +} + +/** + * Deletes all text on the current line by overwriting it with spaces. + * + * A 'blank line' is written to a given file pointer, @p fp. That is, + * a number of spaces equal to the current window width is written. + * This is followed by a carriage return character, to return the + * cursor to the start of the line. +*/ +void clear_line(FILE *fp) +{ + /* fmt needs 4 chars (%, -, s, \r) + + room for window_width as string (max. 65535) + + null terminator */ + char fmt[10]; + sprintf(fmt, "%%-%us\r", window_width); + fprintf(fp, fmt, ""); +} + +/** + * Displays a UCS-2 string truncated for the terminal width. + * + * Displays as much of a UCS-2 encoded string as will fit on a single + * line in the terminal, and returning the cursor to the start of the + * line. If the terminal is less that the given minimum width, that + * minimum number of characters is displayed anyway, even if it means + * the text will wrap onto the next line. + * + * If @p fp isn't associated with a terminal, just print the whole line. + * + * @param fp FILE* to print on + * @param line the UCS-2 encoded string to display + * @param min_width minimum number of characters to print + */ +void display_line(FILE *fp, const ucs2char_t* const line, + unsigned int min_width) +{ + unsigned int length = ucs2len(line); + const ucs2char_t* line_to_print; + + int writing_to_tty; + /* Check if writing to a terminal. If so, clear the current line. */ + int fd = fileno(fp); + if (0 < fd && fd <= POSSIBLE_TTYS && fd_is_tty[fd]) { + clear_line(fp); + writing_to_tty = 1; + } else { + writing_to_tty = 0; + } + + if(!writing_to_tty) { + /* Write the whole line to the file, add \n. */ + fprints(fp, "%s\r\n", line); + } else if (length <= window_width) { + /* There's enough room to show the whole line. */ + fprints(fp, "%s\r", line); + } + else { + /* Length of the longest string we might display: */ + const int max_trunc_length = MAX(window_width,min_width); + + /* Length of string we actually will display: */ + const size_t trunc_length = MIN(max_trunc_length, length); + + ucs2char_t *truncated_line = ucs2calloc(sizeof(ucs2char_t) * (trunc_length+1)); + ucs2ncpy(truncated_line, line, trunc_length); + fprints(fp, "%s\r", truncated_line); + } +} + + +/** @} */ Property changes on: trunk/pmplib/frontend/easypmp/cui/console_posix.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/frontend/easypmp/cui/console_win32.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_win32.c (rev 0) +++ trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-01-03 10:49:31 UTC (rev 231) @@ -0,0 +1,109 @@ +/* + * Console manupulator for Win32 API. + * + * Copyright (c) 2006 Nyaochi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit + * http://www.gnu.org/copyleft/gpl.html . + * + */ + +/* $Id:$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <io.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> + +#include <windows.h> + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +static HANDLE get_handle(FILE *fp) +{ + return (HANDLE)_get_osfhandle(_fileno(fp)); +} + +int console_init() +{ + return 0; +} + +int console_clearln(FILE *fp) +{ + HANDLE hOutput = (HANDLE)_get_osfhandle(_fileno(fp)); + CONSOLE_SCREEN_BUFFER_INFO csbi; + + memset(&csbi, 0, sizeof(csbi)); + if (GetConsoleScreenBufferInfo(hOutput, &csbi)) { + /* The output is a console buffer. */ + DWORD num_written = 0; + csbi.dwCursorPosition.X = csbi.srWindow.Left; + FillConsoleOutputCharacterA( + hOutput, + ' ', + csbi.srWindow.Right - csbi.srWindow.Left + 1, + csbi.dwCursorPosition, + &num_written + ); + SetConsoleCursorPosition(hOutput, csbi.dwCursorPosition); + return 0; + } else { + /* Does nothing for non-console buffer (e.g., redirected file) */ + return 1; + } +} + +int console_println(FILE *fp, const ucs2char_t* line, int min_width) +{ + const int margin = 5; + HANDLE hOutput = (HANDLE)_get_osfhandle(_fileno(fp)); + CONSOLE_SCREEN_BUFFER_INFO csbi; + + memset(&csbi, 0, sizeof(csbi)); + if (GetConsoleScreenBufferInfo(hOutput, &csbi)) { + int x = 0, width = 0; + const ucs2char_t* p = line; + + while (*p) { + memset(&csbi, 0, sizeof(csbi)); + GetConsoleScreenBufferInfo(hOutput, &csbi); + + x = (int)csbi.dwCursorPosition.X; + width = (int)(csbi.srWindow.Right - csbi.srWindow.Left) + 1; + if (width <= x + margin) { + int ndotts = MIN(3, width - x); + while (ndotts-- > 0) fputc('.', fp); + break; + } else { + fputwc((wchar_t)*p, fp); + } + p++; + } + fputc('\r', fp); + return (int)(p - line); + } else { + fprintf(fp, "%S\n", line); + return ucs2len(line); + } +} + + +/** @} */ Property changes on: trunk/pmplib/frontend/easypmp/cui/console_win32.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj 2006-12-31 07:38:06 UTC (rev 230) +++ trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj 2007-01-03 10:49:31 UTC (rev 231) @@ -180,6 +180,10 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File + RelativePath=".\console_win32.c" + > + </File> + <File RelativePath=".\device.c" > </File> @@ -210,6 +214,10 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File + RelativePath=".\console.h" + > + </File> + <File RelativePath=".\getopt.h" > </File> Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-12-31 07:38:06 UTC (rev 230) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-01-03 10:49:31 UTC (rev 231) @@ -43,159 +43,9 @@ #include <stdlib.h> #include <ucs2char.h> -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#include "console.h" -#if CAN_GET_WIN_SIZE -#include <sys/ioctl.h> -#include <signal.h> -#endif/*CAN_GET_WIN_SIZE*/ - -#include "util.h" - -#if CAN_GET_WIN_SIZE /** - * The number of characters that can be printed on a single line, - * without causing a line wrap. Since the right-most column is - * required for the cursor, this is one less than the actual terminal - * width. - * - * Defaults to 79 on systems where we can't tell the width of the - * terminal. - */ -static volatile unsigned short int window_width; -#else -static const unsigned short int window_width = 79; -#endif - -/** - * The minimum width of the terminal we're willing to entertain. If - * the terminal gets narrower than this width, we treat it as this - * width. Note that it must be at least 2 to allow for one character - * and the cursor. -*/ -static const int min_term_width = 6; - - -#define POSSIBLE_TTYS 2 -/** - * Flags to indicate whether stdin, stdout, and stderr are attached to - * a terminal. These are used to determine whether we should check - * the width of some progress lines before printing them. Initialised - * in display_init. - */ -static int fd_is_tty[POSSIBLE_TTYS+1]; - -#if CAN_GET_WIN_SIZE - -/** - * Handler for the "terminal window changed size" signal. - * - * @param unused - */ -void window_size_changed(int unused) -{ - static struct winsize wsize; - if (ioctl(1, TIOCGWINSZ, &wsize) != -1) { - if (wsize.ws_col > min_term_width) { - window_width = wsize.ws_col - 1; - } else { - window_width = min_term_width; - } - } -} - -#endif/*CAN_GET_WIN_SIZE*/ - -/** - * Determines whether stdin, stdout and stderr are associated with a - * TTY, and update fd_is_tty accordingly. Also sets up - * window_size_changed as a signal handler. - */ -void display_init() -{ -#ifdef HAVE_TTY - int i; - for(i = 0; i <= POSSIBLE_TTYS; ++i) - fd_is_tty[i] = isatty(i); - -#if CAN_GET_WIN_SIZE - signal(SIGWINCH,window_size_changed); - window_size_changed(0); -#endif/*CAN_GET_WIN_SIZE*/ -#endif/*HAVE_TTY*/ -} - -/** - * Deletes all text on the current line by overwriting it with spaces. - * - * A 'blank line' is written to a given file pointer, @p fp. That is, - * a number of spaces equal to the current window width is written. - * This is followed by a carriage return character, to return the - * cursor to the start of the line. -*/ -void clear_line(FILE *fp) -{ - /* fmt needs 4 chars (%, -, s, \r) + - room for window_width as string (max. 65535) + - null terminator */ - char fmt[10]; - sprintf(fmt, "%%-%us\r", window_width); - fprintf(fp, fmt, ""); -} - -/** - * Displays a UCS-2 string truncated for the terminal width. - * - * Displays as much of a UCS-2 encoded string as will fit on a single - * line in the terminal, and returning the cursor to the start of the - * line. If the terminal is less that the given minimum width, that - * minimum number of characters is displayed anyway, even if it means - * the text will wrap onto the next line. - * - * If @p fp isn't associated with a terminal, just print the whole line. - * - * @param fp FILE* to print on - * @param line the UCS-2 encoded string to display - * @param min_width minimum number of characters to print - */ -void display_line(FILE *fp, const ucs2char_t* const line, - unsigned int min_width) -{ - unsigned int length = ucs2len(line); - const ucs2char_t* line_to_print; - - int writing_to_tty; - /* Check if writing to a terminal. If so, clear the current line. */ - int fd = fileno(fp); - if (0 < fd && fd <= POSSIBLE_TTYS && fd_is_tty[fd]) { - clear_line(fp); - writing_to_tty = 1; - } else { - writing_to_tty = 0; - } - - if(!writing_to_tty) { - /* Write the whole line to the file, add \n. */ - fprints(fp, "%s\r\n", line); - } else if (length <= window_width) { - /* There's enough room to show the whole line. */ - fprints(fp, "%s\r", line); - } - else { - /* Length of the longest string we might display: */ - const int max_trunc_length = MAX(window_width,min_width); - - /* Length of string we actually will display: */ - const size_t trunc_length = MIN(max_trunc_length, length); - - ucs2char_t *truncated_line = ucs2calloc(sizeof(ucs2char_t) * (trunc_length+1)); - ucs2ncpy(truncated_line, line, trunc_length); - fprints(fp, "%s\r", truncated_line); - } -} - -/** * Generic display method for progress messages consisting of a * number and a string. * @@ -215,24 +65,9 @@ display_line is used to truncate the line in this way. */ - - // Numeric part, plus associated punctuation - const int prefix_length = 16; - char *fmt = alloca(sizeof(char) * prefix_length + 1); - - ucs2char_t *line = alloca(sizeof(ucs2char_t) * (ucs2len(msg) + prefix_length + 1)); - ucs2char_t *fmt_ucs2; - - // Build the numeric part... - sprintf(fmt, " %u: ", n); - fmt_ucs2 = mbsdupucs2(fmt); - if (fmt_ucs2) { - ucs2cpy(line, fmt_ucs2); - // ... and append the message. - ucs2cat(line, msg); - display_line(fp, line, strlen(fmt)); - ucs2free(fmt_ucs2); - } + console_clearln(fp); + fprintf(fp, " %u: ", n); + console_println(fp, msg, 0); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-31 07:38:08
|
Revision: 230 http://svn.sourceforge.net/pmplib/?rev=230&view=rev Author: nyaochi Date: 2006-12-30 23:38:06 -0800 (Sat, 30 Dec 2006) Log Message: ----------- - Database update for iriver E10. - Playlist conversion for iriver E10. Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/dat.h trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj trunk/pmplib/lib/pmp_iriverplus3/util.c trunk/pmplib/lib/pmp_iriverplus3/util.h Added Paths: ----------- trunk/pmplib/lib/pmp_iriverplus3/playlist.c Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-29 15:59:14 UTC (rev 229) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-31 07:38:06 UTC (rev 230) @@ -47,6 +47,7 @@ #include "dat.h" #define PAGESIZE 0x00020000 +#define COMP(a, b) ((a)>(b))-((a)<(b)) typedef struct { uint32_t size; @@ -55,6 +56,11 @@ uint32_t next_page; } page_header_t; +struct tag_sort_index_t { + const void* base; + int index; +}; + static void dat_entry_init(dat_entry_t* entry, const dic_table_t* dic_list) { memset(entry, 0, sizeof(*entry)); @@ -292,9 +298,75 @@ +static int comp_object_uid(const void *__x, const void *__y) +{ + const sort_index_t* _x = (const sort_index_t*)__x; + const sort_index_t* _y = (const sort_index_t*)__y; + const dat_list_t* _xb = (const dat_list_t*)_x->base; + const dat_list_t* _yb = (const dat_list_t*)_y->base; + const ip3db_variant_t* x = _xb->entries[_x->index].fields; + const ip3db_variant_t* y = _yb->entries[_y->index].fields; + return COMP(x[IP3DBF_OBJECTS_UID].value.dword, y[IP3DBF_OBJECTS_UID].value.dword); +} + +static sort_index_t* dat_uidmap_create(dat_list_t* list) +{ + int i; + sort_index_t* si = (sort_index_t*)malloc(sizeof(sort_index_t) * list->num_entries); + + if (si) { + /* Sort UIDs. */ + for (i = 0;i < list->num_entries;++i) { + si[i].base = list; + si[i].index = i; + } + qsort(si, list->num_entries, sizeof(si[0]), comp_object_uid); + } + return si; +} + +static void dat_uidmap_finish(sort_index_t* si) +{ + free(si); +} + +static int dat_uidmap_get(sort_index_t* si, dat_list_t* list, uint32_t uid) +{ + int low = 0, high = list->num_entries-1; + + /* Binary search. */ + while (low <= high) { + int middle = (low + high) / 2; + int comp = COMP(uid, list->entries[si[middle].index].fields[IP3DBF_OBJECTS_UID].value.dword); + if (comp == 0) { + /* Found */ + return si[middle].index; + } else if (comp < 0) { + high = middle - 1; + } else { + low = middle + 1; + } + } + return -1; +} + +static ucs2char_t* ucs2append(const ucs2char_t* x, const ucs2char_t* y) +{ + ucs2char_t* ret = NULL; + size_t length = 0; + length += x ? ucs2len(x) : 0; + length += y ? ucs2len(y) : 0; + ret = ucs2calloc(sizeof(ucs2char_t) * (length+1)); + if (x) ucs2cat(ret, x); + if (y) ucs2cat(ret, y); + return ret; +} + + + dat_t* dat_new() { - dat_t* dat = (dat_t*)malloc(sizeof(dat_t)); + dat_t* dat = (dat_t*)calloc(1, sizeof(dat_t)); if (dat) { dat_list_init(&dat->objects); dat_list_init(&dat->musics); @@ -311,6 +383,7 @@ int dat_read(dat_t* dat, const dic_t* dic, FILE *fpi) { + uint32_t i = 0; page_header_t ph; long buffer_size = 0; uint8_t* buffer = NULL; @@ -330,6 +403,10 @@ dat_list_read(&dat->objects, &ph, &dic->objects, buffer, PAGESIZE * (ph.next_page - 1)); } + /* Construct Object UID -> dat->objects[i] mapping table. */ + dat_uidmap_finish(dat->objects_uidmap); + dat->objects_uidmap = dat_uidmap_create(&dat->objects); + /* Clear Music records. */ dat_list_finish(&dat->musics); @@ -339,6 +416,48 @@ dat_list_read(&dat->musics, &ph, &dic->music, buffer, PAGESIZE * (ph.next_page - 1)); } + /* Set filename and pathname fields. */ + for (i = 0;i < dat->musics.num_entries;++i) { + dat_entry_t* entry = &dat->musics.entries[i]; + int index = dat_uidmap_get(dat->objects_uidmap, &dat->objects, entry->fields[IP3DBF_MUSIC_UID].value.dword); + if (0 <= index) { + static const ucs2char_t ucs2cs_root[] = {'/',0}; + ucs2char_t* pathname = NULL; + ucs2char_t* tmp = NULL; + size_t length = 0; + + /* Set the filename. */ + ip3db_variant_set_str( + &entry->fields[IP3DBF_MUSIC_FILENAME], + dat->objects.entries[index].fields[IP3DBF_OBJECTS_OBJECTNAME].value.str + ); + + /* Obtain the pathname by tracing parent UIDs. */ + for (;;) { + uint32_t parent_uid = dat->objects.entries[index].fields[IP3DBF_OBJECTS_PARENTUID].value.dword; + if (parent_uid == 0xFFFFFFFF) { + break; + } + index = dat_uidmap_get(dat->objects_uidmap, &dat->objects, parent_uid); + if (index < 0) { + break; + } + tmp = ucs2append( + dat->objects.entries[index].fields[IP3DBF_OBJECTS_OBJECTNAME].value.str, + pathname + ); + ucs2free(pathname); + pathname = tmp; + } + + tmp = ucs2append(ucs2cs_root, pathname); + ucs2free(pathname); + pathname = tmp; + ip3db_variant_set_str(&entry->fields[IP3DBF_MUSIC_FILEPATH], pathname); + ucs2free(pathname); + } + } + free(buffer); return 0; } @@ -484,17 +603,14 @@ -typedef struct { - const ip3db_music_record_t* base; - int index; -} sort_index_t; - static int comp_pathname(const void *__x, const void *__y) { const sort_index_t* _x = (const sort_index_t*)__x; const sort_index_t* _y = (const sort_index_t*)__y; - const ip3db_variant_t* x = _x->base[_x->index]; - const ip3db_variant_t* y = _y->base[_y->index]; + const ip3db_music_record_t* _xb = (const ip3db_music_record_t*)_x->base; + const ip3db_music_record_t* _yb = (const ip3db_music_record_t*)_y->base; + const ip3db_variant_t* x = _xb[_x->index]; + const ip3db_variant_t* y = _yb[_y->index]; int ret = ucs2cmp(x[IP3DBF_MUSIC_FILEPATH].value.str, y[IP3DBF_MUSIC_FILEPATH].value.str); if (ret == 0) { return ucs2cmp(x[IP3DBF_MUSIC_FILENAME].value.str, y[IP3DBF_MUSIC_FILENAME].value.str); @@ -554,6 +670,7 @@ /* Clear all entries. */ dat_list_finish(dato); dat_list_finish(datm); + dat_uidmap_finish(dat->objects_uidmap); /* Append an entry for the root directory. */ entry = dat_list_expand(dato); @@ -638,4 +755,6 @@ } dircache_finish(&dc); + + dat->objects_uidmap = dat_uidmap_create(&dat->objects); } Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-29 15:59:14 UTC (rev 229) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-31 07:38:06 UTC (rev 230) @@ -35,9 +35,12 @@ dat_entry_t* entries; } dat_list_t; +struct tag_sort_index_t; typedef struct tag_sort_index_t sort_index_t; + struct tag_dat_t { dat_list_t objects; dat_list_t musics; + sort_index_t* objects_uidmap; }; dat_t* dat_new(); Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-29 15:59:14 UTC (rev 229) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-31 07:38:06 UTC (rev 230) @@ -220,6 +220,16 @@ return 0; } +int ip3db_num_records(ip3db_t* db) +{ + return (int)db->dat->musics.num_entries; +} + +ip3db_music_record_t* ip3db_get_record(ip3db_t* db, int i) +{ + return (ip3db_music_record_t*)db->dat->musics.entries[i].fields; +} + void ip3db_record_init(ip3db_t* db, ip3db_music_record_t* record) { int i; Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-29 15:59:14 UTC (rev 229) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-31 07:38:06 UTC (rev 230) @@ -181,7 +181,16 @@ result_t ip3db_read(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn); result_t ip3db_write(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn); result_t ip3db_set(ip3db_t* db, const ip3db_music_record_t* records, int num_records); +int ip3db_num_records(ip3db_t* db); +ip3db_music_record_t* ip3db_get_record(ip3db_t* db, int i); result_t ip3db_dump(ip3db_t* db, FILE *fpo); +int ip3db_playlist_write( + ip3db_t* db, + const ucs2char_t *filename, + ucs2char_t* const mediafiles[], + int num_mediafiles, + const ucs2char_t *path_to_root + ); void ip3db_record_init(ip3db_t* db, ip3db_music_record_t* record); Added: trunk/pmplib/lib/pmp_iriverplus3/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/playlist.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/playlist.c 2006-12-31 07:38:06 UTC (rev 230) @@ -0,0 +1,120 @@ +/* + * Playlist reader/writer for iriver E10. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> +#include <filepath.h> + +#include "serialize.h" +#include "util.h" +#include "ip3db.h" +#include "dat.h" + +static uint32_t findfile(ip3db_t* db, const ucs2char_t *filename, const ucs2char_t *path_to_root) +{ + int i; + const ucs2char_t *filepart = filepath_skippath(filename); + const ucs2char_t *pathfile = filepath_skipdrive(filename, path_to_root); + ucs2char_t *pathname = alloca(sizeof(ucs2char_t) * (ucs2len(pathfile) + 1)); + + ucs2cpy(pathname, pathfile); + filepath_remove_filespec(pathname); + filepath_addslash(pathname); + filepath_slash(pathname); + + for (i = 0;i < db->dat->musics.num_entries;++i) { + dat_entry_t* entry = &db->dat->musics.entries[i]; + if (ucs2icmp(entry->fields[IP3DBF_MUSIC_FILENAME].value.str, filepart) == 0 && + ucs2icmp(entry->fields[IP3DBF_MUSIC_FILEPATH].value.str, pathname) == 0) { + return entry->fields[IP3DBF_MUSIC_UID].value.dword; + } + } + return 0; +} + +int ip3db_playlist_write( + ip3db_t* db, + const ucs2char_t *filename, + ucs2char_t* const mediafiles[], + int num_mediafiles, + const ucs2char_t *path_to_root + ) +{ + int i; + FILE *fp = NULL; + uint32_t* uids = NULL; + uint32_t num_uids = 0; + + for (i = 0;i < num_mediafiles;i++) { + if (mediafiles[i][0]) { + uint32_t uid = 0; + ucs2char_t mediafile[MAX_PATH]; + ucs2cpy(mediafile, mediafiles[i]); + + uid = findfile(db, mediafile, path_to_root); + if (uid <= 0) { + goto error_exit; + } + + uids = realloc(uids, sizeof(uint32_t) * (num_uids+1)); + if (!uids) { + goto error_exit; + } + uids[num_uids++] = uid; + } + } + + fp = ucs2fopen(filename, "wb"); + if (fp) { + size_t size = sizeof(uint32_t) + sizeof(uint32_t) * num_uids; + uint8_t* buffer = (uint8_t*)malloc(size); + uint8_t* p = buffer; + + if (!buffer) { + goto error_exit; + } + + p += serialize_uint32le(p, &num_uids, 1); + for (i = 0;i < (int)num_uids;++i) { + p += serialize_uint32le(p, &uids[i], 1); + } + fwrite(buffer, 1, size, fp); + free(buffer); + fclose(fp); + } else { + return -1; + } + + free(uids); + return 0; + +error_exit: + free(uids); + return -1; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/playlist.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2006-12-29 15:59:14 UTC (rev 229) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2006-12-31 07:38:06 UTC (rev 230) @@ -37,6 +37,7 @@ #include <pmphelp.h> #include "ip3db.h" +#include "util.h" #ifdef PMP_IRIVERPLUS3_EXPORTS #define PMPIRIVERPLUS3API __declspec(dllexport) @@ -62,8 +63,8 @@ static const ip3model_descriptor_t g_model_descriptions[] = { { - "iriver_e10_ums_1.04", "E10 UMS", "UM", - "1.04", "1.04", + "iriver_e10_ums_1.00-1.04", "E10 UMS", "UM", + "1.00", "1.04", "System\\E10.SYS", "System\\db.dat", "System\\db.dic", "System\\db.idx", "", "Playlists\\", ".plp", @@ -433,7 +434,30 @@ pmppl_internal_t* pmppli = NULL; *ptr_pmppl = 0; - return PMP_NOTIMPLIMENTED; + + pmppl = calloc(1, sizeof(pmppl_t)); + if (!pmppl) { + return PMPDBE_OUTOFMEMORY; + } + + pmppl->add_ref = pmppl_add_ref; + pmppl->release = pmppl_release; + pmppl->write = pmppl_write; + + pmppli = calloc(1, sizeof(pmppl_internal_t)); + if (!pmppli) { + free(pmppl); + return PMPDBE_OUTOFMEMORY; + } + ip3db_init(&pmppli->ip3db); + ip3db_read(&pmppli->ip3db, pmpi->env.dat_filename, pmpi->env.dic_filename, pmpi->env.idx_filename); + + pmppl->pmp = pmp; + pmppl->instance = pmppli; + + pmppl->add_ref(pmppl); + *ptr_pmppl = pmppl; + return 0; } @@ -515,38 +539,22 @@ return (path + length); } -static int _filepath_slash(ucs2char_t* path) -{ - while (*path) { - if (*path == 0x005C) { - *path = 0x002F; - } - path++; - } - return 0; -} - static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records) { int i; pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; - ucs2char_t *path_to_root = alloca(sizeof(ucs2char_t) * (ucs2len(pmpi->env.path_to_root)+1)); - ip3db_music_record_t* array = (ip3db_music_record_t*)malloc(sizeof(ip3db_music_record_t) * num_records); - ucs2cpy(path_to_root, pmpi->env.path_to_root); - _filepath_removeslash(path_to_root); - for (i = 0;i < num_records;++i) { const pmp_record_t* src = &records[i]; ip3db_variant_t* dst = array[i]; ip3db_record_init(&pmpdbi->ip3db, &array[i]); - ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], src->filename + ucs2len(path_to_root)); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], filepath_skipdrive(src->filename, pmpi->env.path_to_root)); filepath_remove_filespec(dst[IP3DBF_MUSIC_FILEPATH].value.str); filepath_addslash(dst[IP3DBF_MUSIC_FILEPATH].value.str); - _filepath_slash(dst[IP3DBF_MUSIC_FILEPATH].value.str); + filepath_slash(dst[IP3DBF_MUSIC_FILEPATH].value.str); ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILENAME], filepath_skippath(src->filename)); ip3db_variant_set_str(&dst[IP3DBF_MUSIC_ARTIST], src->artist); ip3db_variant_set_str(&dst[IP3DBF_MUSIC_ALBUM], src->album); @@ -567,21 +575,67 @@ } ip3db_variant_set_word(&dst[IP3DBF_MUSIC_TRACKNUMBER], (uint16_t)src->track_number); ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_BITRATE], src->bitrate); + ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_CLUSA], src->ts_update); ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_UID], (uint32_t)i+1); } ip3db_set(&pmpdbi->ip3db, array, num_records); free(array); return 0; - //return ip2db_set(&pmpdbi->ip2db, records, num_records, pmpi->env.path_to_root); -} + } static result_t pmpdb_get(pmpdb_t* pmpdb, pmp_record_t* records, uint32_t* num_records) { pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; - return PMP_NOTIMPLIMENTED; - //return ip2db_get(&pmpdbi->ip2db, records, num_records, pmpi->env.path_to_root); + ucs2char_t *path_to_root = alloca(sizeof(ucs2char_t) * (ucs2len(pmpi->env.path_to_root)+1)); + ip3db_t* db = &pmpdbi->ip3db; + int i, n = ip3db_num_records(db); + + if (!records) { + *num_records = (uint32_t)n; + return 0; + } + + for (i = 0;i < n;++i) { + const ip3db_variant_t* src = (const ip3db_variant_t*)ip3db_get_record(db, i); + pmp_record_t* dst = &records[i]; + size_t length = 0; + + pmp_record_init(dst); + + length = ucs2len(pmpi->env.path_to_root); + length += ucs2len(src[IP3DBF_MUSIC_FILEPATH].value.str); + length += ucs2len(src[IP3DBF_MUSIC_FILENAME].value.str); + dst->filename = (ucs2char_t*)ucs2malloc(sizeof(ucs2char_t) * (length+1)); + ucs2cpy(dst->filename, pmpi->env.path_to_root); + ucs2cat(dst->filename, src[IP3DBF_MUSIC_FILEPATH].value.str+1); + ucs2cat(dst->filename, src[IP3DBF_MUSIC_FILENAME].value.str); + filepath_backslash(dst->filename); + + dst->title = ucs2dup(src[IP3DBF_MUSIC_TITLE].value.str); + dst->artist = ucs2dup(src[IP3DBF_MUSIC_ARTIST].value.str); + dst->album = ucs2dup(src[IP3DBF_MUSIC_ALBUM].value.str); + dst->genre = ucs2dup(src[IP3DBF_MUSIC_GENRE].value.str); + dst->date = ucs2dup(src[IP3DBF_MUSIC_ORGRELEASEDATE].value.str); + switch (src[IP3DBF_MUSIC_FILEFORMAT].value.word) { + case 0: + dst->codec = PMPCODEC_MPEGLAYER3; + break; + case 3: + dst->codec = PMPCODEC_VORBIS; + break; + case 5: + dst->codec = PMPCODEC_WMA; + break; + } + dst->track_number = src[IP3DBF_MUSIC_TRACKNUMBER].value.word; + dst->bitrate = src[IP3DBF_MUSIC_BITRATE].value.dword; + dst->duration = src[IP3DBF_MUSIC_DURATION].value.dword; + dst->ts_update = src[IP3DBF_MUSIC_CLUSA].value.dword; + dst->rating = src[IP3DBF_MUSIC_RATING].value.word; + } + return 0; } static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level) @@ -618,11 +672,8 @@ { pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmppl->pmp->instance; - return PMP_NOTIMPLIMENTED; - /* - if (ip2db_playlist_write(&pmppli->ip2db, filename, files, num_files, pmpi->env.path_to_root) != 0) { + if (ip3db_playlist_write(&pmppli->ip3db, filename, files, num_files, pmpi->env.path_to_root) != 0) { return PMPPLE_WRITE; } return 0; - */ } Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2006-12-29 15:59:14 UTC (rev 229) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2006-12-31 07:38:06 UTC (rev 230) @@ -193,6 +193,10 @@ > </File> <File + RelativePath=".\playlist.c" + > + </File> + <File RelativePath=".\pmp_iriverplus3.c" > </File> Modified: trunk/pmplib/lib/pmp_iriverplus3/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.c 2006-12-29 15:59:14 UTC (rev 229) +++ trunk/pmplib/lib/pmp_iriverplus3/util.c 2006-12-31 07:38:06 UTC (rev 230) @@ -148,3 +148,24 @@ *ptr_size = size; return 0; } + +void filepath_slash(ucs2char_t* path) +{ + while (*path) { + if (*path == 0x005C) { + *path = 0x002F; + } + path++; + } +} + +void filepath_backslash(ucs2char_t* path) +{ + while (*path) { + if (*path == 0x002F) { + *path = 0x005C; + } + path++; + } +} + Modified: trunk/pmplib/lib/pmp_iriverplus3/util.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.h 2006-12-29 15:59:14 UTC (rev 229) +++ trunk/pmplib/lib/pmp_iriverplus3/util.h 2006-12-31 07:38:06 UTC (rev 230) @@ -35,4 +35,7 @@ int fread_all(FILE *fp, uint8_t** ptr_buffer, long* ptr_size); +void filepath_slash(ucs2char_t* path); +void filepath_backslash(ucs2char_t* path); + #endif/*__IP3DB_UTIL_H__*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-29 15:59:14
|
Revision: 229 http://svn.sourceforge.net/pmplib/?rev=229&view=rev Author: nyaochi Date: 2006-12-29 07:59:14 -0800 (Fri, 29 Dec 2006) Log Message: ----------- Bump the version number to 0.13 alpha 1 Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2006-12-29 07:04:13 UTC (rev 228) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2006-12-29 15:59:14 UTC (rev 229) @@ -57,7 +57,7 @@ */ #define APPLICATION_S "EasyPMP [CUI]" -#define VERSION_S "0.12 alpha" +#define VERSION_S "0.13 alpha 1" #define COPYRIGHT_S "Copyright (c) 2005-2006 Nyaochi" int database_dump(pmp_t* pmp, FILE *fpo, int level); Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2006-12-29 07:04:13 UTC (rev 228) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2006-12-29 15:59:14 UTC (rev 229) @@ -92,47 +92,30 @@ DEFPUSHBUTTON "OK",IDOK,144,222,48,12 PUSHBUTTON "Cancel",IDCANCEL,204,222,48,12 GROUPBOX "Media database",IDC_STATIC,12,12,240,48 - CONTROL "&None",IDC_RADIO_DATABASE,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,24,24,72,8 - CONTROL "&Update",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,96,24, - 72,8 - CONTROL "&Rebuild",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,168,24, - 72,8 - LTEXT "Source of media information (&z):",IDC_STATIC,24,42,108, - 12 - COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,42,102,36, - CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "&None",IDC_RADIO_DATABASE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,24,72,8 + CONTROL "&Update",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,96,24,72,8 + CONTROL "&Rebuild",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,168,24,72,8 + LTEXT "Source of media information (&z):",IDC_STATIC,24,42,108,12 + COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,42,102,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,72 - CONTROL "N&one",IDC_RADIO_PLAYLIST,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,24,78,72,8 - CONTROL "&Update",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,96,78, - 72,8 - CONTROL "Re&convert",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,168, - 78,72,8 + CONTROL "N&one",IDC_RADIO_PLAYLIST,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,78,72,8 + CONTROL "&Update",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,96,78,72,8 + CONTROL "Re&convert",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,168,78,72,8 LTEXT "Playlist folder(s):",IDC_STATIC,24,96,72,8 - CONTROL "&Music",IDC_CHECK_PL_MUSIC,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,96,96,72,8 - CONTROL "&Playlist",IDC_CHECK_PL_PLAYLIST,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,168,96,72,8 + CONTROL "&Music",IDC_CHECK_PL_MUSIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,96,72,8 + CONTROL "&Playlist",IDC_CHECK_PL_PLAYLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,96,72,8 LTEXT "Conversion option:",IDC_STATIC,24,108,72,8 - CONTROL "&Find missing",IDC_CHECK_PL_FIND,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,96,108,72,8 - CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,168,108,72,8 - CONTROL "Use &JavaScript playlist",IDC_CHECK_PL_JSPL,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,96,120,144,8 + CONTROL "&Find missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,108,72,8 + CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,108,72,8 + CONTROL "Use &JavaScript playlist",IDC_CHECK_PL_JSPL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,120,144,8 GROUPBOX "Portable Player Device",IDC_STATIC,12,144,240,72 LTEXT "&Location:",IDC_STATIC,24,156,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,156,42,36,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,168,156,66,12 + COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,156,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,156,66,12 LTEXT "&Identifier:",IDC_STATIC,24,174,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_ID,78,174,162,36,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_COMBO_DEVICE_ID,78,174,162,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Description:",IDC_STATIC,24,192,42,12,SS_CENTERIMAGE - LTEXT "\x83X\x83^\x83e\x83B\x83b\x83N",IDC_STATIC_PLAYER_DESCRIPTION,78,192,162, - 12,0,WS_EX_CLIENTEDGE + LTEXT "?X?^?e?B?b?N",IDC_STATIC_PLAYER_DESCRIPTION,78,192,162,12,0,WS_EX_CLIENTEDGE CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,222,120,12 END @@ -144,15 +127,11 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,144,222,48,12,NOT WS_VISIBLE PUSHBUTTON "Cancel",IDCANCEL,204,222,48,12 - CONTROL "",IDC_LIST_PROGRESS,"SysListView32",LVS_REPORT | - LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | - WS_BORDER,12,12,240,84 - EDITTEXT IDC_EDIT_LOG,12,96,240,120,ES_MULTILINE | ES_AUTOHSCROLL | - ES_READONLY | WS_VSCROLL | WS_HSCROLL + CONTROL "",IDC_LIST_PROGRESS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER,12,12,240,84 + EDITTEXT IDC_EDIT_LOG,12,96,240,120,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,222,120,12 - CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,144,222,48,12 + CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,222,48,12 END @@ -213,8 +192,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,12,0,2 - PRODUCTVERSION 0,12,0,2 + FILEVERSION 0,13,1,2 + PRODUCTVERSION 0,13,1,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -230,12 +209,12 @@ BLOCK "040904b0" BEGIN VALUE "FileDescription", "EasyPMP [Win32 GUI] application" - VALUE "FileVersion", "0, 12, 0, 2" + VALUE "FileVersion", "0, 13, 1, 2" VALUE "InternalName", "easypmp_win32gui" VALUE "LegalCopyright", "Copyright 2005-2006 Nyaochi" VALUE "OriginalFilename", "easypmp_win32gui.exe" VALUE "ProductName", "EasyPMP [Win32 GUI]" - VALUE "ProductVersion", "0, 12, 0, 2" + VALUE "ProductVersion", "0, 13, 1, 2" END END BLOCK "VarFileInfo" @@ -343,7 +322,7 @@ // // Generated from the TEXTINCLUDE 3 resource. // -//CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\easypmp_win32gui.exe.manifest" +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\easypmp_win32gui.exe.manifest" ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-29 07:04:12
|
Revision: 228 http://svn.sourceforge.net/pmplib/?rev=228&view=rev Author: nyaochi Date: 2006-12-28 23:04:13 -0800 (Thu, 28 Dec 2006) Log Message: ----------- Small fix to build pmp_iriverplus3 with gcc Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/dat.h trunk/pmplib/lib/pmp_iriverplus3/dic.h trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/idx.h Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-29 06:51:31 UTC (rev 227) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-29 07:04:13 UTC (rev 228) @@ -39,7 +39,6 @@ dat_list_t objects; dat_list_t musics; }; -typedef struct tag_dat_t dat_t; dat_t* dat_new(); void dat_finish(dat_t* dat); Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-29 06:51:31 UTC (rev 227) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-29 07:04:13 UTC (rev 228) @@ -59,7 +59,6 @@ uint8_t* buffer; long size; }; -typedef struct tag_dic_t dic_t; dic_t* dic_new(); void dic_finish(dic_t* dic); Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-29 06:51:31 UTC (rev 227) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-29 07:04:13 UTC (rev 228) @@ -85,7 +85,6 @@ uint32_t size; uint32_t offset; }; -typedef struct tag_avl_t avl_t; typedef int (*avl_comp_t)(avl_t* avl, uint32_t x, uint32_t y); Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.h 2006-12-29 06:51:31 UTC (rev 227) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.h 2006-12-29 07:04:13 UTC (rev 228) @@ -29,7 +29,6 @@ struct tag_idx_t { avl_t* avl; }; -typedef struct tag_idx_t idx_t; idx_t *idx_new(); void idx_finish(idx_t* idx); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-29 06:51:31
|
Revision: 227 http://svn.sourceforge.net/pmplib/?rev=227&view=rev Author: nyaochi Date: 2006-12-28 22:51:31 -0800 (Thu, 28 Dec 2006) Log Message: ----------- Build pmp_iriverplus3 on POSIX. Modified Paths: -------------- trunk/pmplib/configure.in trunk/pmplib/lib/pmp/pmp_posix.c Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2006-12-29 06:32:12 UTC (rev 226) +++ trunk/pmplib/configure.in 2006-12-29 06:51:31 UTC (rev 227) @@ -228,7 +228,7 @@ dnl ------------------------------------------------------------------ dnl Output the configure results. dnl ------------------------------------------------------------------ -AC_CONFIG_FILES(Makefile m4/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/gmi/Makefile lib/pmp/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile) +AC_CONFIG_FILES(Makefile m4/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/gmi/Makefile lib/pmp/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile) if test -n "$JS_CFLAGS" ; then AC_DEFINE([HAVE_JSAPI_H], 1, [Define if you have the jsapi.h header]) Modified: trunk/pmplib/lib/pmp/pmp_posix.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_posix.c 2006-12-29 06:32:12 UTC (rev 226) +++ trunk/pmplib/lib/pmp/pmp_posix.c 2006-12-29 06:51:31 UTC (rev 227) @@ -83,6 +83,15 @@ fprintf(stderr, "FAILED: iriverplus2\n"); } + inst = lt_dlopenext("iriverplus3"); + if (inst) { + pmphelp->num_plugins++; + pmphelp->plugins = (lt_dlhandle*)realloc(pmphelp->plugins, sizeof(lt_dlhandle) * pmphelp->num_plugins); + pmphelp->plugins[pmphelp->num_plugins-1] = inst; + } else { + fprintf(stderr, "FAILED: iriverplus3\n"); + } + inst = lt_dlopenext("irivnavi"); if (inst) { pmphelp->num_plugins++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-29 06:32:12
|
Revision: 226 http://svn.sourceforge.net/pmplib/?rev=226&view=rev Author: nyaochi Date: 2006-12-28 22:32:12 -0800 (Thu, 28 Dec 2006) Log Message: ----------- Added make staff for pmp_iriverplus3. Modified Paths: -------------- trunk/pmplib/Makefile.am Added Paths: ----------- trunk/pmplib/lib/pmp_iriverplus3/Makefile.am Modified: trunk/pmplib/Makefile.am =================================================================== --- trunk/pmplib/Makefile.am 2006-12-29 06:27:47 UTC (rev 225) +++ trunk/pmplib/Makefile.am 2006-12-29 06:32:12 UTC (rev 226) @@ -1,6 +1,6 @@ # $Id$ -SUBDIRS = m4 libltdl lib/ucs2 lib/filepath lib/gmi lib/playlist lib/pmp lib/pmp_irivnavi lib/pmp_portalplayer1 lib/pmp_iriverplus2 frontend/easypmp/cui +SUBDIRS = m4 libltdl lib/ucs2 lib/filepath lib/gmi lib/playlist lib/pmp lib/pmp_irivnavi lib/pmp_portalplayer1 lib/pmp_iriverplus2 lib/pmp_iriverplus3 frontend/easypmp/cui docdir = $(prefix)/share/doc/@PACKAGE@ doc_DATA = README INSTALL COPYING AUTHORS ChangeLog Added: trunk/pmplib/lib/pmp_iriverplus3/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/Makefile.am (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/Makefile.am 2006-12-29 06:32:12 UTC (rev 226) @@ -0,0 +1,32 @@ +# $Id$ + +pmpdir=$(libdir)/@PACKAGE@ +pmp_LTLIBRARIES = iriverplus3.la + +iriverplus3_la_SOURCES = \ + ../../include/pmp.h \ + dat.h \ + dat.c \ + dic.h \ + dic.c \ + idx.h \ + idx.c \ + ip3db.h \ + ip3db.c \ + serialize.h \ + serialize.c \ + util.h \ + util.c \ + pmp_iriverplus3.c + +iriverplus3_la_LDFLAGS = \ + -no-undefined -module -avoid-version \ + -export-symbols $(top_srcdir)/lib/pmp/pmp_plugin.sym + +iriverplus3_la_LIBADD = \ + $(top_builddir)/lib/ucs2/libpmpucs2.la \ + $(top_builddir)/lib/filepath/libpmpfilepath.la \ + $(top_builddir)/lib/pmp/libpmp.la + +AM_CFLAGS = @CFLAGS@ +INCLUDES = @INCLUDES@ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/Makefile.am ___________________________________________________________________ Name: svn:keywords + Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |