From: <suc...@us...> - 2006-08-05 22:50:39
|
Revision: 179 Author: sucknblow Date: 2006-08-05 15:50:29 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=179&view=rev Log Message: ----------- * Detect width of the terminal. * Avoid printing many blank lines when displaying progress on terminals of width < 80. * Truncate long track names to the width of the terminal. * Clear the line properly for files with very long names. * Introduces easypmp_progress_num_str, for progress messages with both a number and a string. * Dump the whole line to the output if the output is not associated with a tty. * Use stdout rather than stderr for a few more things. Modified Paths: -------------- trunk/pmplib/configure.in trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/frontend/easypmp/cui/util.h Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2006-08-02 21:33:07 UTC (rev 178) +++ trunk/pmplib/configure.in 2006-08-05 22:50:29 UTC (rev 179) @@ -65,7 +65,8 @@ dnl Checks for header files. dnl ------------------------------------------------------------------ AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h unistd.h stdint.h getopt.h) +AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h unistd.h \ + stdint.h getopt.h signal.h sys/ioctl.h) dnl ------------------------------------------------------------------ @@ -186,6 +187,26 @@ dnl Check for libsmjs (SpiderMonkey JavaScript engine) AC_PATH_SPIDERMONKEY +dnl ------------------------------------------------------------------ +dnl Check whether we can detect the terminal window size +dnl (Already checked for signal.h, sys/ioctl.h) +dnl ------------------------------------------------------------------ +if test "$ac_cv_header_signal_h" = "yes" -a \ + "$ac_cv_header_sys_ioctl_h" = "yes" ; then +AC_MSG_CHECKING([whether terminal window size can be detected]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include <signal.h> +#include <sys/ioctl.h>]],[[ +struct winsize wsize; +signal(SIGWINCH, 0); +ioctl(0, TIOCGWINSZ, &wsize);]]) + ], + [AC_DEFINE([CAN_GET_WIN_SIZE],1,[Define to 1 if you can set a signal + handler for SIGWINCH, and use the TIOCGWINSZ ioctl.]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no, assuming width of 80.])]) +fi dnl ------------------------------------------------------------------ dnl Export variables Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2006-08-02 21:33:07 UTC (rev 178) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2006-08-05 22:50:29 UTC (rev 179) @@ -59,22 +59,25 @@ void device_show_information(pmp_t* pmp, FILE *fpe); void device_enumerate(pmphelp_t* pmphelp); +int +easypmp_progress_num_str( + FILE *fp, + size_t n, + const ucs2char_t* msg); + static int easypmp_enumerate_progress( void *instance, const ucs2char_t* path, const ucs2char_t* file, - size_t n - ) + size_t n) { - FILE *fpe = stderr; - - clear_line(fpe); - fprintf(fpe, " %d: ", n); - fprints(fpe, "%s\r", file); + FILE *fpe = stdout; + easypmp_progress_num_str(fpe, n, file); return 0; } + static int easypmp_progress( void *instance, @@ -91,39 +94,37 @@ case EASYPMPDBP_START: break; case EASYPMPDBP_READ|EASYPMPSP_START: - fprintf(fpe, "Reading database\n"); + fprintf(fpo, "Reading database\n"); break; case EASYPMPDBP_READ|EASYPMPSP_PROGRESS: break; case EASYPMPDBP_READ|EASYPMPSP_END: - fprintf(fpe, "\n"); + fprintf(fpo, "\n"); break; case EASYPMPDBP_GMI|EASYPMPSP_START: - fprintf(fpe, "Obtaining media information from %d files\n", param_int); + fprintf(fpo, "Obtaining media information from %d files\n", param_int); break; case EASYPMPDBP_GMI|EASYPMPSP_PROGRESS: - clear_line(fpe); - fprintf(fpe, " %d: ", param_int+1); - fprints(fpe, "%s\r", filepath_skippath(param_str)); + easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); break; case EASYPMPDBP_GMI|EASYPMPSP_END: - clear_line(fpe); - fprintf(fpe, " %d files were imported\n", param_int); - fprintf(fpe, "\n"); + clear_line(fpo); + fprintf(fpo, " %d files were imported\n", param_int); + fprintf(fpo, "\n"); break; case EASYPMPDBP_UPDATE|EASYPMPSP_START: - fprintf(fpe, "Updating database\n"); + fprintf(fpo, "Updating database\n"); break; case EASYPMPDBP_UPDATE|EASYPMPSP_END: - fprintf(fpe, "\n"); + fprintf(fpo, "\n"); break; case EASYPMPDBP_WRITE|EASYPMPSP_START: - fprintf(fpe, "Writing database\n"); + fprintf(fpo, "Writing database\n"); break; case EASYPMPDBP_WRITE|EASYPMPSP_PROGRESS: break; case EASYPMPDBP_WRITE|EASYPMPSP_END: - fprintf(fpe, "\n"); + fprintf(fpo, "\n"); break; case EASYPMPDBP_END: break; @@ -131,12 +132,10 @@ case EASYPMPPLP_START: break; case EASYPMPPLP_CONVERT|EASYPMPSP_START: - fprintf(fpe, "Converting playlists\n"); + fprintf(fpo, "Converting playlists\n"); break; case EASYPMPPLP_CONVERT|EASYPMPSP_PROGRESS: - clear_line(fpe); - fprintf(fpe, " %d: ", param_int+1); - fprints(fpe, "%s\r", filepath_skippath(param_str)); + easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); break; case EASYPMPPLP_CONVERT|EASYPMPSP_WARN_PLAYLIST: fprintf(fpe, "\n"); @@ -150,6 +149,7 @@ fprints(fpe, " %s\n", param_str); break; case EASYPMPPLP_CONVERT|EASYPMPSP_JSPL_ERROR: + fprintf(fpe, "\n"); fprints(fpe, " JSPL(ERROR): %s\n", param_str); break; case EASYPMPPLP_CONVERT|EASYPMPSP_JSPL_ERROR_POS: @@ -162,7 +162,7 @@ fprints(fpo, " JSPL: %s\n", param_str); break; case EASYPMPPLP_CONVERT|EASYPMPSP_END: - fprintf(fpe, "\n"); + fprintf(fpo, "\n"); break; case EASYPMPPLP_END: break; @@ -215,8 +215,8 @@ option_init(&opt); // Show copyright information. - fprintf(fpe, APPLICATION_S " " VERSION_S " " COPYRIGHT_S "\n"); - fprintf(fpe, "\n"); + fprintf(fpo, APPLICATION_S " " VERSION_S " " COPYRIGHT_S "\n"); + fprintf(fpo, "\n"); // Parse the command-line arguments. used_args = option_parse(&opt, argc, argv, fpe); @@ -320,25 +320,26 @@ } // Show player information. - device_show_information(pmp, fpe); - fprintf(fpe, "\n"); + device_show_information(pmp, fpo); + fprintf(fpo, "\n"); memset(&musics, 0, sizeof(musics)); + display_init(); if ((opt.verb & MODE_DATABASE) || ((opt.verb & MODE_PLAYLIST) && (opt.verb & MODE_PLAYLIST_FIND))) { - fprintf(fpe, "Enumerating music files\n"); + fprintf(fpo, "Enumerating music files\n"); easypmp_enumerate_music(&musics, pmp, &opt, easypmp_enumerate_progress, NULL); - clear_line(fpe); - fprintf(fpe, " %d music files were found\n", musics.num_elements); - fprintf(fpe, "\n"); + clear_line(fpo); + fprintf(fpo, " %d music files were found\n", musics.num_elements); + fprintf(fpo, "\n"); } memset(&playlists, 0, sizeof(playlists)); if (opt.verb & MODE_PLAYLIST) { fprintf(fpe, "Enumerating playlist files\n"); easypmp_enumerate_playlist(&playlists, pmp, &opt, easypmp_enumerate_progress, NULL); - clear_line(fpe); - fprintf(fpe, " %d music files were found\n", playlists.num_elements); - fprintf(fpe, "\n"); + clear_line(fpo); + fprintf(fpo, " %d music files were found\n", playlists.num_elements); + fprintf(fpo, "\n"); } // Execute jobs. Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-02 21:33:07 UTC (rev 178) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-05 22:50:29 UTC (rev 179) @@ -30,17 +30,189 @@ #endif/*HAVE_STRING_H*/ #include <os.h> +#include <systems.h> #include <stdio.h> #include <stdlib.h> #include <ucs2char.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; + + +/* + 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. + */ +#define POSSIBLE_TTYS 2 +static int fd_is_tty[POSSIBLE_TTYS+1]; + +#if CAN_GET_WIN_SIZE +/* + Hander for the "terminal window changed size" signal. +*/ +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*/ + +void display_init() +{ +#if CAN_GET_WIN_SIZE + int i; + for(i = 0; i <= 2; ++i) + fd_is_tty[i] = isatty(i); + + signal(SIGWINCH,window_size_changed); + window_size_changed(0); +#endif/*CAN_GET_WIN_SIZE*/ +} + +/* + Delete all text on the current line by overwriting it with spaces, + and write a \r to return the cursor to the start of the line. +*/ void clear_line(FILE *fp) { - fprintf(fp, "%-79.79s\r", ""); + /* 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, ""); } + +/* + Display 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, display + that minimum number of characters anyway, even if it means the text + will wrap onto the next line. + + If fp isn't associated with a terminal, just print the whole line. + + fp - FILE* to print on + line - the UCS-2 encoded string to display + min-width - minimum number of characters to print + */ +void display_line(FILE *fp, const ucs2char_t* const line, unsigned int min_width) +{ + 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 = TRUE; + } else { + writing_to_tty = FALSE; + } + + unsigned int length = ucs2len(line); + const ucs2char_t* line_to_print; + + 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[trunc_length+1]; + truncated_line[trunc_length]=0; + 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. + + n - number to be shown in the numeric part + msg - message + */ +int +easypmp_progress_num_str( + FILE *fp, + size_t n, + const ucs2char_t* msg + ) +{ + /* + A terminal must be of a certain width in order to usefully + show progress when enumerating/reading media files. + Specifically, it needs to be wide enough to display the + number of files read. + + display_line is used to trucate the line in this way. + */ + + // Numeric part, plus associated punctuation + const int prefix_length = 16; + char fmt[prefix_length + 1]; + + ucs2char_t line[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); + } + return 0; +} + void fprints(FILE *fp, const char *format, const ucs2char_t* value) { fprints_fixed(fp, format, value, ucs2len(value)); @@ -58,3 +230,11 @@ ucs2free(mbs); } } + +/* + * Local Variables: + * indent-tabs-mode: t + * tab-width: 8 + * c-basic-offset: 8 + * End: + */ Modified: trunk/pmplib/frontend/easypmp/cui/util.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.h 2006-08-02 21:33:07 UTC (rev 178) +++ trunk/pmplib/frontend/easypmp/cui/util.h 2006-08-05 22:50:29 UTC (rev 179) @@ -25,6 +25,8 @@ #ifndef __UTIL_H__ #define __UTIL_H__ +void display_init(); + void clear_line(FILE *fp); void fprints(FILE *fp, const char *format, const ucs2char_t* value); void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, size_t length); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-10-18 21:47:14
|
Revision: 190 http://svn.sourceforge.net/pmplib/?rev=190&view=rev Author: sucknblow Date: 2006-10-18 14:47:05 -0700 (Wed, 18 Oct 2006) Log Message: ----------- Build on latest Debian. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/lib/filepath/Makefile.am trunk/pmplib/lib/filepath/rel2abs.h Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-22 19:05:46 UTC (rev 189) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-10-18 21:47:05 UTC (rev 190) @@ -39,11 +39,13 @@ #endif/*HAVE_STRING_H*/ #include <os.h> -#include <systems.h> #include <stdio.h> #include <stdlib.h> #include <ucs2char.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> @@ -163,9 +165,9 @@ int fd = fileno(fp); if (0 < fd && fd <= POSSIBLE_TTYS && fd_is_tty[fd]) { clear_line(fp); - writing_to_tty = TRUE; + writing_to_tty = 1; } else { - writing_to_tty = FALSE; + writing_to_tty = 0; } unsigned int length = ucs2len(line); Modified: trunk/pmplib/lib/filepath/Makefile.am =================================================================== --- trunk/pmplib/lib/filepath/Makefile.am 2006-08-22 19:05:46 UTC (rev 189) +++ trunk/pmplib/lib/filepath/Makefile.am 2006-10-18 21:47:05 UTC (rev 190) @@ -5,6 +5,7 @@ libpmpfilepath_la_SOURCES = \ ../../include/filepath.h \ filepath_posix.c \ + rel2abs.h \ rel2abs.c libpmpfilepath_la_LDFLAGS = \ Modified: trunk/pmplib/lib/filepath/rel2abs.h =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.h 2006-08-22 19:05:46 UTC (rev 189) +++ trunk/pmplib/lib/filepath/rel2abs.h 2006-10-18 21:47:05 UTC (rev 190) @@ -25,12 +25,14 @@ #ifndef __REL2ABS_H__ #define __REL2ABS_H__ +#include <ucs2char.h> + /** * \addtogroup filepath * @{ */ -ucs2char_t *rel2abs(const ucs2char_t *path, +ucs2char_t* rel2abs(const ucs2char_t *path, const ucs2char_t *base, ucs2char_t *ucs2char_t, size_t size); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-24 01:35:06
|
Revision: 192 http://svn.sourceforge.net/pmplib/?rev=192&view=rev Author: nyaochi Date: 2006-12-23 17:35:06 -0800 (Sat, 23 Dec 2006) Log Message: ----------- Upgrade the Win32 build system to MS Visual Studio 2005. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj trunk/pmplib/lib/filepath/filepath.vcproj trunk/pmplib/lib/gmi/gmi.vcproj trunk/pmplib/lib/playlist/playlist.vcproj trunk/pmplib/lib/pmp/pmp.vcproj trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.vcproj trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.vcproj trunk/pmplib/lib/ucs2/ucs2.vcproj trunk/pmplib/pmp.sln Modified: trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,110 +1,174 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="easypmp_cui" ProjectGUID="{FA1F30D4-6100-4379-8506-6CFE023B0AE7}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="1" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include,..\common" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/easypmp_cui.exe" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/easypmp_cui.pdb" SubSystem="1" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="1" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include,..\common" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="4" + RuntimeLibrary="0" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/easypmp_cui.exe" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -113,59 +177,75 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\device.c"> + RelativePath=".\device.c" + > </File> <File - RelativePath=".\getopt.c"> + RelativePath=".\getopt.c" + > </File> <File - RelativePath=".\getopt1.c"> + RelativePath=".\getopt1.c" + > </File> <File - RelativePath=".\main.c"> + RelativePath=".\main.c" + > </File> <File - RelativePath=".\option.c"> + RelativePath=".\option.c" + > </File> <File - RelativePath=".\util.c"> + RelativePath=".\util.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath=".\getopt.h"> + RelativePath=".\getopt.h" + > </File> <File - RelativePath=".\option.h"> + RelativePath=".\option.h" + > </File> <File - RelativePath=".\util.h"> + RelativePath=".\util.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> <Filter Name="common" - Filter=""> + > <File - RelativePath="..\common\database.c"> + RelativePath="..\common\database.c" + > </File> <File - RelativePath="..\common\easypmp.h"> + RelativePath="..\common\easypmp.h" + > </File> <File - RelativePath="..\common\enumerate.c"> + RelativePath="..\common\enumerate.c" + > </File> <File - RelativePath="..\common\playlist.c"> + RelativePath="..\common\playlist.c" + > </File> </Filter> </Files> Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,130 +1,194 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="easypmp_win32gui" - ProjectGUID="{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}"> + ProjectGUID="{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="1" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="1"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="false" + TargetEnvironment="1" + GenerateStublessProxies="true" + TypeLibraryName="$(IntDir)/easypmp_win32gui.tlb" + HeaderFileName="easypmp_win32gui.h" + DLLDataFileName="" + InterfaceIdentifierFileName="easypmp_win32gui_i.c" + ProxyFileName="easypmp_win32gui_p.c" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include,..\common" PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;_DEBUG;USE_PCH" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - DebugInformationFormat="4"/> + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1033" + AdditionalIncludeDirectories="$(IntDir)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies="version.lib imagehlp.lib" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool" - PreprocessorDefinitions="_DEBUG" - MkTypLibCompatible="FALSE" - TargetEnvironment="1" - GenerateStublessProxies="TRUE" - TypeLibraryName="$(IntDir)/easypmp_win32gui.tlb" - HeaderFileName="easypmp_win32gui.h" - DLLDataFileName="" - InterfaceIdentifierFileName="easypmp_win32gui_i.c" - ProxyFileName="easypmp_win32gui_p.c"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="1" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="1"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="1" + > <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="$(SolutionDir)include,..\common" - PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG;USE_PCH" - ExceptionHandling="FALSE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="0"/> + Name="VCPreBuildEventTool" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCCustomBuildTool" + /> <Tool - Name="VCLinkerTool" - AdditionalDependencies="version.lib imagehlp.lib" - LinkIncremental="1" - SubSystem="2" - TargetMachine="1"/> + Name="VCXMLDataGeneratorTool" + /> <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool Name="VCMIDLTool" PreprocessorDefinitions="NDEBUG" - MkTypLibCompatible="FALSE" + MkTypLibCompatible="false" TargetEnvironment="1" - GenerateStublessProxies="TRUE" + GenerateStublessProxies="true" TypeLibraryName="$(IntDir)/easypmp_win32gui.tlb" HeaderFileName="easypmp_win32gui.h" DLLDataFileName="" InterfaceIdentifierFileName="easypmp_win32gui_i.c" - ProxyFileName="easypmp_win32gui_p.c"/> + ProxyFileName="easypmp_win32gui_p.c" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="$(SolutionDir)include,..\common" + PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG;USE_PCH" + ExceptionHandling="0" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="0" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool - Name="VCPreLinkEventTool"/> - <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" - AdditionalIncludeDirectories="$(IntDir)"/> + AdditionalIncludeDirectories="$(IntDir)" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCPreLinkEventTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCLinkerTool" + AdditionalDependencies="version.lib imagehlp.lib" + LinkIncremental="1" + SubSystem="2" + TargetMachine="1" + /> <Tool - Name="VCWebDeploymentTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCManagedWrapperGeneratorTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -132,98 +196,144 @@ <Files> <Filter Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm" + > <File - RelativePath=".\ejectdevice_win32.c"> + RelativePath=".\ejectdevice_win32.c" + > </File> <File - RelativePath=".\stdafx.cpp"> + RelativePath=".\stdafx.cpp" + > <FileConfiguration - Name="Debug|Win32"> + Name="Debug|Win32" + > <Tool Name="VCCLCompilerTool" - UsePrecompiledHeader="1"/> + UsePrecompiledHeader="1" + /> </FileConfiguration> <FileConfiguration - Name="Release|Win32"> + Name="Release|Win32" + > <Tool Name="VCCLCompilerTool" - UsePrecompiledHeader="1"/> + UsePrecompiledHeader="1" + /> </FileConfiguration> </File> <File - RelativePath=".\winmain.cpp"> + RelativePath=".\winmain.cpp" + > </File> </Filter> <Filter Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc"> + Filter="h;hpp;hxx;hm;inl;inc" + > <File - RelativePath=".\ejectdevice.h"> + RelativePath=".\ejectdevice.h" + > </File> <File - RelativePath=".\maindlg.h"> + RelativePath=".\maindlg.h" + > </File> <File - RelativePath=".\preference.h"> + RelativePath=".\preference.h" + > </File> <File - RelativePath=".\processingdlg.h"> + RelativePath=".\processingdlg.h" + > </File> <File - RelativePath=".\progress_with_caption.h"> + RelativePath=".\progress_with_caption.h" + > </File> <File - RelativePath=".\resource.h"> + RelativePath=".\resource.h" + > </File> <File - RelativePath=".\stdafx.h"> + RelativePath=".\stdafx.h" + > </File> </Filter> <Filter Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest"> + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest" + > <File - RelativePath=".\res\checkmark.ico"> + RelativePath=".\res\checkmark.ico" + > </File> <File - RelativePath=".\res\easypmp_win32gui.exe.manifest"> + RelativePath=".\res\easypmp_win32gui.exe.manifest" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> </File> <File - RelativePath=".\res\easypmp_win32gui.ico"> + RelativePath=".\res\easypmp_win32gui.ico" + > </File> <File - RelativePath=".\easypmp_win32gui.rc"> + RelativePath=".\easypmp_win32gui.rc" + > </File> <File - RelativePath=".\res\icon1.ico"> + RelativePath=".\res\icon1.ico" + > </File> <File - RelativePath=".\res\processing.ico"> + RelativePath=".\res\processing.ico" + > </File> <File - RelativePath=".\res\queuing.ico"> + RelativePath=".\res\queuing.ico" + > </File> </Filter> <Filter - Name="common"> + Name="common" + > <File - RelativePath="..\common\database.c"> + RelativePath="..\common\database.c" + > </File> <File - RelativePath="..\common\easypmp.h"> + RelativePath="..\common\easypmp.h" + > </File> <File - RelativePath="..\common\enumerate.c"> + RelativePath="..\common\enumerate.c" + > </File> <File - RelativePath="..\common\playlist.c"> + RelativePath="..\common\playlist.c" + > </File> </Filter> </Files> <Globals> <Global Name="RESOURCE_FILE" - Value="easypmp_win32gui.rc"/> + Value="easypmp_win32gui.rc" + /> </Globals> </VisualStudioProject> Modified: trunk/pmplib/lib/filepath/filepath.vcproj =================================================================== --- trunk/pmplib/lib/filepath/filepath.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/filepath/filepath.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,112 +1,176 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="filepath" ProjectGUID="{AA8DA82B-C209-4ABE-ABA1-22352962426D}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FILEPATH_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/filepath.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/filepath.pdb" SubSystem="2" ImportLibrary="$(OutDir)/filepath.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FILEPATH_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/filepath.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/filepath.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -115,23 +179,28 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\filepath_win32.c"> + RelativePath=".\filepath_win32.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath="..\..\include\filepath.h"> + RelativePath="..\..\include\filepath.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/gmi/gmi.vcproj =================================================================== --- trunk/pmplib/lib/gmi/gmi.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/gmi/gmi.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,114 +1,178 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="gmi" ProjectGUID="{3575EFC2-9051-467A-BEB4-E71E2F8664D7}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include,contrib,contrib\id3tag" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GMI_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies=".\contrib\id3tag\win32\libid3tagd.lib .\contrib\id3tag\win32\zlibd.lib .\contrib\ogg\win32\ogg_static_d.lib .\contrib\vorbis\win32\vorbisfile_static_d.lib" OutputFile="$(OutDir)/gmi.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/gmi.pdb" SubSystem="2" ImportLibrary="$(OutDir)/gmi.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include,contrib,contrib\id3tag" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GMI_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies=".\contrib\id3tag\win32\libid3tag.lib .\contrib\id3tag\win32\zlib.lib .\contrib\ogg\win32\ogg_static.lib .\contrib\vorbis\win32\vorbisfile_static.lib" OutputFile="$(OutDir)/gmi.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/gmi.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -117,35 +181,44 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\gmi.c"> + RelativePath=".\gmi.c" + > </File> <File - RelativePath=".\gmi_mp3.c"> + RelativePath=".\gmi_mp3.c" + > </File> <File - RelativePath=".\gmi_vorbis.c"> + RelativePath=".\gmi_vorbis.c" + > </File> <File - RelativePath=".\gmi_wav.c"> + RelativePath=".\gmi_wav.c" + > </File> <File - RelativePath=".\gmi_wma.c"> + RelativePath=".\gmi_wma.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath="..\..\include\gmi.h"> + RelativePath="..\..\include\gmi.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/playlist/playlist.vcproj =================================================================== --- trunk/pmplib/lib/playlist/playlist.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/playlist/playlist.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,114 +1,178 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="playlist" ProjectGUID="{3419FA86-F518-4D3B-94C6-B05436439102}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include,.\contrib\js" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLAYLIST_EXPORTS;XP_WIN;HAVE_JSAPI_H" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies=".\contrib\js\win32\js32d.lib" OutputFile="$(OutDir)/playlist.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/playlist.pdb" SubSystem="2" ImportLibrary="$(OutDir)/playlist.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include,.\contrib\js" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLAYLIST_EXPORTS;XP_WIN;HAVE_JSAPI_H" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" AdditionalDependencies=".\contrib\js\win32\js32.lib" OutputFile="$(OutDir)/playlist.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/playlist.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -117,32 +181,40 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\jspl.c"> + RelativePath=".\jspl.c" + > </File> <File - RelativePath=".\playlist.c"> + RelativePath=".\playlist.c" + > </File> <File - RelativePath=".\rw_m3u.c"> + RelativePath=".\rw_m3u.c" + > </File> <File - RelativePath=".\rw_pls.c"> + RelativePath=".\rw_pls.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath="..\..\include\playlist.h"> + RelativePath="..\..\include\playlist.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/pmp/pmp.vcproj =================================================================== --- trunk/pmplib/lib/pmp/pmp.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/pmp/pmp.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,112 +1,176 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="pmp" ProjectGUID="{8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PMP_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/pmp.pdb" SubSystem="2" ImportLibrary="$(OutDir)/pmp.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PMP_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/pmp.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -115,29 +179,36 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\pmp.c"> + RelativePath=".\pmp.c" + > </File> <File - RelativePath=".\pmp_win32.c"> + RelativePath=".\pmp_win32.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath="..\..\include\pmp.h"> + RelativePath="..\..\include\pmp.h" + > </File> <File - RelativePath="..\..\include\pmphelp.h"> + RelativePath="..\..\include\pmphelp.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,112 +1,176 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="pmp_iriverplus2" ProjectGUID="{E393575C-6B10-43BD-B2C0-63C5040A49F7}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PMP_IRIVERPLUS2_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp_iriverplus2.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/pmp_iriverplus2.pdb" SubSystem="2" ImportLibrary="$(OutDir)/pmp_iriverplus2.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PMP_IRIVERPLUS2_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp_iriverplus2.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/pmp_iriverplus2.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -115,68 +179,88 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\dat.c"> + RelativePath=".\dat.c" + > </File> <File - RelativePath=".\idx.c"> + RelativePath=".\idx.c" + > </File> <File - RelativePath=".\idx_descriptor.c"> + RelativePath=".\idx_descriptor.c" + > </File> <File - RelativePath=".\idx_exports.c"> + RelativePath=".\idx_exports.c" + > </File> <File - RelativePath=".\idx_header.c"> + RelativePath=".\idx_header.c" + > </File> <File - RelativePath=".\idx_leaf.c"> + RelativePath=".\idx_leaf.c" + > </File> <File - RelativePath=".\idx_node.c"> + RelativePath=".\idx_node.c" + > </File> <File - RelativePath=".\ip2db.c"> + RelativePath=".\ip2db.c" + > </File> <File - RelativePath=".\ip2db_dat.c"> + RelativePath=".\ip2db_dat.c" + > </File> <File - RelativePath=".\ip2db_idx.c"> + RelativePath=".\ip2db_idx.c" + > </File> <File - RelativePath=".\playlist.c"> + RelativePath=".\playlist.c" + > </File> <File - RelativePath=".\pmp_iriverplus2.c"> + RelativePath=".\pmp_iriverplus2.c" + > </File> <File - RelativePath=".\serialize.c"> + RelativePath=".\serialize.c" + > </File> <File - RelativePath=".\util.c"> + RelativePath=".\util.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath=".\ip2db.h"> + RelativePath=".\ip2db.h" + > </File> <File - RelativePath=".\serialize.h"> + RelativePath=".\serialize.h" + > </File> <File - RelativePath=".\util.h"> + RelativePath=".\util.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj 2006-12-16 02:49:11 UTC (rev 191) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.vcproj 2006-12-24 01:35:06 UTC (rev 192) @@ -1,112 +1,176 @@ <?xml version="1.0" encoding="shift_jis"?> <VisualStudioProject ProjectType="Visual C++" - Version="7.10" + Version="8.00" Name="pmp_irivnavi" ProjectGUID="{2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1}" - Keyword="Win32Proj"> + Keyword="Win32Proj" + > <Platforms> <Platform - Name="Win32"/> + Name="Win32" + /> </Platforms> + <ToolFiles> + </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="Debug" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PMP_IRIVNAVI_EXPORTS" - MinimalRebuild="TRUE" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp_irivnavi.dll" LinkIncremental="2" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)/pmp_irivnavi.pdb" SubSystem="2" ImportLibrary="$(OutDir)/pmp_irivnavi.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)release" IntermediateDirectory="Release" ConfigurationType="2" - CharacterSet="2"> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(SolutionDir)include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PMP_IRIVNAVI_EXPORTS" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> <Tool - Name="VCCustomBuildTool"/> + Name="VCManagedResourceCompilerTool" + /> <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/pmp_irivnavi.dll" LinkIncremental="1" - GenerateDebugInformation="TRUE" + GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/pmp_irivnavi.lib" - TargetMachine="1"/> + TargetMachine="1" + /> <Tool - Name="VCMIDLTool"/> + Name="VCALinkTool" + /> <Tool - Name="VCPostBuildEventTool"/> + Name="VCManifestTool" + /> <Tool - Name="VCPreBuildEventTool"/> + Name="VCXDCMakeTool" + /> <Tool - Name="VCPreLinkEventTool"/> + Name="VCBscMakeTool" + /> <Tool - Name="VCResourceCompilerTool"/> + Name="VCFxCopTool" + /> <Tool - Name="VCWebServiceProxyGeneratorTool"/> + Name="VCAppVerifierTool" + /> <Tool - Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool" + /> <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + Name="VCPostBuildEventTool" + /> </Configuration> </Configurations> <References> @@ -115,35 +179,44 @@ <Filter Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > <File - RelativePath=".\irivnavi.c"> + RelativePath=".\irivnavi.c" + > </File> <File - RelativePath=".\playlist.c"> + RelativePath=".\playlist.c" + > </File> <File - RelativePath=".\pmp_irivnavi.c"> + RelativePath=".\pmp_irivnavi.c" + > </File> <File - RelativePath=".\serialize.c"> + RelativePath=".\serialize.c" + > </File> </Filter> <Filter Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > <File - RelativePath=".\irivnavi.h"> + RelativePath=".\irivnavi.h" + > </File> <File - RelativePath=".\serialize.h"> + RelativePath=".\serialize.h" + > </File> </Filter> <Filter Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > </Filter> </Files> <Globals> Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.vcproj =================================================================== ... [truncated message content] |
From: <ny...@us...> - 2006-12-24 02:42:41
|
Revision: 194 http://svn.sourceforge.net/pmplib/?rev=194&view=rev Author: nyaochi Date: 2006-12-23 18:42:41 -0800 (Sat, 23 Dec 2006) Log Message: ----------- - Initial attempt to support iriver E10 (and possibly S10/S7) - Directory lib/pmp_iriverplus3 was added - The database structure was mostly figured out - PMPlib interface follows later - No POSIX support until database writer is ready Modified Paths: -------------- trunk/pmplib/pmp.sln Added Paths: ----------- trunk/pmplib/lib/pmp_iriverplus3/ trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/dat.h trunk/pmplib/lib/pmp_iriverplus3/dic.c trunk/pmplib/lib/pmp_iriverplus3/dic.h trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/idx.h trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj trunk/pmplib/lib/pmp_iriverplus3/serialize.c trunk/pmplib/lib/pmp_iriverplus3/serialize.h trunk/pmplib/lib/pmp_iriverplus3/util.c trunk/pmplib/lib/pmp_iriverplus3/util.h Added: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,318 @@ +/* + * Low-level library for db.dat. + * + * Copyright (c) 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:$ */ + +/* +Brief summary of db.dat structure: +- 0x00000000-0x0001FFFF: object (path name) chunk +- 0x00020000-0x0003FFFF: music (media information) chunk +- Each chunk has a 16-bytes header at the beginning +- Each chunk has an array of offsets to actual entries at the end (backward) +- Field names in db.dat seem to be defined in db.dic (Music and Objects) +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <ucs2char.h> + +#include "serialize.h" +#include "util.h" +#include "dat.h" + +static void dat_object_finish(dat_object_t* entry) +{ + ucs2free(entry->object_name); + ucs2free(entry->name); +} + +static void dat_objects_init(dat_objects_t* objects) +{ + memset(objects, 0, sizeof(dat_objects_t)); +} + +static void dat_objects_finish(dat_objects_t* objects) +{ + uint32_t i; + for (i = 0;i < objects->num_entries;++i) { + dat_object_finish(&objects->entries[i]); + } + free(objects->entries); + free(objects->offsets); + dat_objects_init(objects); +} + +static size_t dat_objects_serialize(uint8_t* buffer, dat_objects_t* objects, int is_storing) +{ + uint32_t i; + uint8_t *p = buffer; + uint8_t *q = buffer + 0x00020000 - sizeof(uint32_t); + + p += serialize_uint32be(p, &objects->size, is_storing); + p += serialize_uint32be(p, &objects->num_entries, is_storing); + p += serialize_uint32be(p, &objects->unknown1, is_storing); + p += serialize_uint32be(p, &objects->unknown2, is_storing); + + if (!is_storing) { + free(objects->entries); + free(objects->offsets); + objects->entries = (dat_object_t*)calloc(objects->num_entries, sizeof(dat_object_t)); + objects->offsets = (uint32_t*)calloc(objects->num_entries, sizeof(uint32_t)); + } + + for (i = 0;i < objects->num_entries;++i) { + dat_object_t* entry = &objects->entries[i]; + + /* Read an element in the offset table. */ + q -= serialize_uint32be(q, &objects->offsets[i], is_storing); + + /* Read an entry. */ + p += serialize_uint32be(p, &entry->uid, is_storing); + p += serialize_uint32be(p, &entry->parent_uid, is_storing); + p += serialize_uint8(p, &entry->properties, is_storing); + p += serialize_uint16be(p, &entry->filetype, is_storing); + if (is_storing) { + p += (serialize_ucs2be_string_var(p, entry->object_name, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->name, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &entry->object_name) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->name) + 1) * sizeof(ucs2char_t); + } + p += serialize_uint32be(p, &entry->filesize, is_storing); + p += serialize_uint32be(p, &entry->datecrea, is_storing); + p += serialize_uint32be(p, &entry->rawid, is_storing); + p += serialize_uint32be(p, &entry->puoid1, is_storing); + p += serialize_uint32be(p, &entry->puoid2, is_storing); + } + + return (size_t)(p - buffer); +} + +static void dat_objects_dump(FILE *fp, dat_objects_t* objects) +{ + uint32_t i; + + fprintf(fp, "OBJECTS {\n"); + fprintf(fp, " size: 0x%08X\n", objects->size); + fprintf(fp, " num_entries: %d\n", objects->num_entries); + fprintf(fp, " unknown1: 0x%08X\n", objects->unknown1); + fprintf(fp, " unknown2: 0x%08X\n", objects->unknown2); + + for (i = 0;i < objects->num_entries;++i) { + dat_object_t* entry = &objects->entries[i]; + fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, objects->offsets[i]); + fprintf(fp, " uid: %d\n", entry->uid); + fprintf(fp, " parent_uid: %d\n", entry->parent_uid); + fprintf(fp, " properties: 0x%02X\n", entry->properties); + fprintf(fp, " filetype: 0x%04X\n", entry->filetype); + fprints(fp, " object_name: %s\n", entry->object_name); + fprints(fp, " name: %s\n", entry->name); + fprintf(fp, " filesize: %d\n", entry->filesize); + fprintf(fp, " datecrea: %d\n", entry->datecrea); + fprintf(fp, " rawid: %d\n", entry->rawid); + fprintf(fp, " puoid1: %d\n", entry->puoid1); + fprintf(fp, " puoid2: %d\n", entry->puoid2); + fprintf(fp, " }\n"); + } + fprintf(fp, "}\n"); +} + + + +static void dat_music_finish(dat_music_t* entry) +{ + ucs2free(entry->artist); + ucs2free(entry->album); + ucs2free(entry->genre); + ucs2free(entry->title); + ucs2free(entry->filepath); + ucs2free(entry->filename); + ucs2free(entry->release); + ucs2free(entry->album_artist); +} + +static void dat_musics_init(dat_musics_t* musics) +{ + memset(musics, 0, sizeof(dat_musics_t)); +} + +static void dat_musics_finish(dat_musics_t* musics) +{ + uint32_t i; + for (i = 0;i < musics->num_entries;++i) { + dat_music_finish(&musics->entries[i]); + } + free(musics->entries); + free(musics->offsets); + dat_musics_init(musics); +} + +static size_t dat_musics_serialize(uint8_t* buffer, dat_musics_t* musics, int is_storing) +{ + uint32_t i; + uint8_t *p = buffer; + uint8_t *q = buffer + 0x00020000 - sizeof(uint32_t); + + p += serialize_uint32be(p, &musics->size, is_storing); + p += serialize_uint32be(p, &musics->num_entries, is_storing); + p += serialize_uint32be(p, &musics->unknown1, is_storing); + p += serialize_uint32be(p, &musics->unknown2, is_storing); + + if (!is_storing) { + free(musics->entries); + free(musics->offsets); + musics->entries = (dat_music_t*)calloc(musics->num_entries, sizeof(dat_music_t)); + musics->offsets = (uint32_t*)calloc(musics->num_entries, sizeof(uint32_t)); + } + + for (i = 0;i < musics->num_entries;++i) { + dat_music_t* entry = &musics->entries[i]; + + /* Read an element in the offset table. */ + q -= serialize_uint32be(q, &musics->offsets[i], is_storing); + + /* Read an entry. */ + if (is_storing) { + p += (serialize_ucs2be_string_var(p, entry->artist, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->album, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->genre, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->title, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->filepath, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->filename, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &entry->artist) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->album) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->genre) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->title) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->filepath) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->filename) + 1) * sizeof(ucs2char_t); + } + p += serialize_uint32be(p, &entry->duration, is_storing); + p += serialize_uint16be(p, &entry->rating, is_storing); + p += serialize_uint32be(p, &entry->use_count, is_storing); + p += serialize_uint16be(p, &entry->format, is_storing); + p += serialize_uint16be(p, &entry->tracknumber, is_storing); + p += serialize_uint8(p, &entry->drm, is_storing); + p += serialize_uint8(p, &entry->lyric, is_storing); + p += serialize_uint8(p, &entry->purchase, is_storing); + p += serialize_uint16be(p, &entry->protection, is_storing); + p += serialize_uint32be(p, &entry->samplerate, is_storing); + p += serialize_uint32be(p, &entry->bitrate, is_storing); + p += serialize_uint8(p, &entry->changed_flag, is_storing); + p += serialize_uint32be(p, &entry->codec, is_storing); + p += serialize_uint32be(p, &entry->clusm, is_storing); + p += serialize_uint32be(p, &entry->clusa, is_storing); + p += serialize_uint32be(p, &entry->albumart_pos, is_storing); + if (is_storing) { + p += (serialize_ucs2be_string_var(p, entry->release, is_storing) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var(p, entry->album_artist, is_storing) + 1) * sizeof(ucs2char_t); + } else { + p += (serialize_ucs2be_string_var_alloc(p, &entry->release) + 1) * sizeof(ucs2char_t); + p += (serialize_ucs2be_string_var_alloc(p, &entry->album_artist) + 1) * sizeof(ucs2char_t); + } + p += serialize_uint32be(p, &entry->object_uid, is_storing); + p += serialize_uint32be(p, &entry->ratingtime, is_storing); + } + + return (size_t)(p - buffer); +} + +static void dat_musics_dump(FILE *fp, dat_musics_t* musics) +{ + uint32_t i; + + fprintf(fp, "MUSICS {\n"); + fprintf(fp, " size: 0x%08X\n", musics->size); + fprintf(fp, " num_entries: %d\n", musics->num_entries); + fprintf(fp, " unknown1: 0x%08X\n", musics->unknown1); + fprintf(fp, " unknown2: 0x%08X\n", musics->unknown2); + + for (i = 0;i < musics->num_entries;++i) { + dat_music_t* entry = &musics->entries[i]; + + fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, musics->offsets[i]); + fprints(fp, " artist: %s\n", entry->artist); + fprints(fp, " album: %s\n", entry->album); + fprints(fp, " genre: %s\n", entry->genre); + fprints(fp, " title: %s\n", entry->title); + fprints(fp, " filepath: %s\n", entry->filepath); + fprints(fp, " filename: %s\n", entry->filename); + fprintf(fp, " duration: %d\n", entry->duration); + fprintf(fp, " rating: %d\n", entry->rating); + fprintf(fp, " use_count: %d\n", entry->use_count); + fprintf(fp, " format: 0x%04X\n", entry->format); + fprintf(fp, " tracknumber: %d\n", entry->tracknumber); + fprintf(fp, " drm: 0x%02X\n", entry->drm); + fprintf(fp, " lyric: 0x%02X\n", entry->lyric); + fprintf(fp, " purchase: 0x%02X\n", entry->purchase); + fprintf(fp, " protection: 0x%04X\n", entry->protection); + fprintf(fp, " samplerate: %d\n", entry->samplerate); + fprintf(fp, " bitrate: %d\n", entry->bitrate); + fprintf(fp, " changed_flag: 0x%02X\n", entry->changed_flag); + fprintf(fp, " codec: 0x%08X\n", entry->codec); + fprintf(fp, " clusm: 0x%08X\n", entry->clusm); + fprintf(fp, " clusa: 0x%08X\n", entry->clusa); + fprintf(fp, " albumart_pos: 0x%08X\n", entry->albumart_pos); + fprints(fp, " release: %s\n", entry->release); + fprints(fp, " album_artist: %s\n", entry->album_artist); + fprintf(fp, " object_uid: %d\n", entry->object_uid); + fprintf(fp, " ratingtime: %d\n", entry->ratingtime); + fprintf(fp, " }\n"); + } + fprintf(fp, "}\n"); +} + +dat_t* dat_new() +{ + dat_t* dat = (dat_t*)malloc(sizeof(dat_t)); + if (dat) { + dat_objects_init(&dat->objects); + dat_musics_init(&dat->musics); + } + return dat; +} + +void dat_finish(dat_t* dat) +{ + dat_objects_finish(&dat->objects); + dat_musics_finish(&dat->musics); + free(dat); +} + +size_t dat_serialize(uint8_t* buffer, dat_t* dat, int is_storing) +{ + dat_objects_serialize(buffer, &dat->objects, is_storing); + dat_musics_serialize(buffer + 0x00020000, &dat->musics, is_storing); + return 0; +} + +void dat_dump(FILE *fp, dat_t* dat) +{ + fprintf(fp, "===== db.dat =====\n"); + dat_objects_dump(fp, &dat->objects); + dat_musics_dump(fp, &dat->musics); +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dat.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,99 @@ +/* + * Low-level library for db.dat. + * + * Copyright (c) 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:$ */ + +#ifndef __IP3DB_DAT_H__ +#define __IP3DB_DAT_H__ + +typedef struct { + uint32_t uid; + uint32_t parent_uid; + uint8_t properties; + uint16_t filetype; + ucs2char_t* object_name; + ucs2char_t* name; + uint32_t filesize; + uint32_t datecrea; + uint32_t rawid; + uint32_t puoid1; + uint32_t puoid2; +} dat_object_t; + +typedef struct { + uint32_t size; + uint32_t num_entries; + uint32_t unknown1; + uint32_t unknown2; + dat_object_t* entries; + uint32_t* offsets; +} dat_objects_t; + +typedef struct { + ucs2char_t* artist; + ucs2char_t* album; + ucs2char_t* genre; + ucs2char_t* title; + ucs2char_t* filepath; + ucs2char_t* filename; + uint32_t duration; + uint16_t rating; + uint32_t use_count; + uint16_t format; + uint16_t tracknumber; + uint8_t drm; + uint8_t lyric; + uint8_t purchase; + uint16_t protection; + uint32_t samplerate; + uint32_t bitrate; + uint8_t changed_flag; + uint32_t codec; + uint32_t clusm; + uint32_t clusa; + uint32_t albumart_pos; + ucs2char_t* release; + ucs2char_t* album_artist; + uint32_t object_uid; + uint32_t ratingtime; +} dat_music_t; + +typedef struct { + uint32_t size; + uint32_t num_entries; + uint32_t unknown1; + uint32_t unknown2; + dat_music_t* entries; + uint32_t* offsets; +} dat_musics_t; + +struct tag_dat_t { + dat_objects_t objects; + dat_musics_t musics; +}; +typedef struct tag_dat_t dat_t; + +dat_t* dat_new(); +void dat_finish(dat_t* dat); +size_t dat_serialize(uint8_t* buffer, dat_t* dat, int is_storing); +void dat_dump(FILE *fp, dat_t* dat); + +#endif/*__IP3DB_DAT_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dat.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,59 @@ +/* + * Low-level library for db.dic. + * + * Copyright (c) 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:$ */ + +/* +Some important findings from db.dic: +- This file seems to define field names/types in a database. +- This file stores offset addresses of root nodes in db.idx. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <ucs2char.h> + +#include "serialize.h" +#include "ip3db.h" + +/* +typedef struct { + uint32_t next; + uint32_t type; + uint32_t idx_root; + ucs2char_t* name; +} dic_entry_t; +*/ + +uint32_t dic_get_idxroot(uint8_t *buffer, int field) +{ + uint32_t value; + ip3db_index_param_t* index_param = ip3db_get_indexparam(field); + uint8_t *p = buffer + index_param->dic_offset; + serialize_uint32be(p + sizeof(uint32_t) * 2, &value, 0); + return value; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dic.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/dic.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,29 @@ +/* + * Low-level library for db.dic. + * + * Copyright (c) 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:$ */ + +#ifndef __IP3DB_DIC_H__ +#define __IP3DB_DIC_H__ + +uint32_t dic_get_idxroot(uint8_t *buffer, int field); + +#endif/*__IP3DB_DIC_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dic.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,292 @@ +/* + * Low-level library for db.idx. + * + * Copyright (c) 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:$ */ + +/* +Brief summary of db.idx structure: +- This file seems to have 12-bytes header +- Indices consist of multiple binary search trees +- The offset addresses to the root nodes are specified in db.dic +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <ucs2char.h> + +#include "serialize.h" +#include "util.h" +#include "ip3db.h" +#include "dic.h" + +typedef struct { + uint32_t size; + uint32_t unknown1; + uint32_t unknown2; +} header_t; + +typedef struct { + uint32_t left; + uint32_t right; + uint32_t height; + uint32_t leaf; +} node_t; + +typedef struct { + uint32_t dat_offset; + uint32_t next; +} tail_t; + +typedef struct { + uint32_t type; + union { + uint8_t byte; + uint16_t word; + uint32_t dword; + ucs2char_t* str; + } value; +} variant_t; + +static size_t idx_serialize_header(uint8_t *block, header_t *header, int is_storing) +{ + uint8_t *p = block; + p += serialize_uint32be(p, &header->size, is_storing); + p += serialize_uint32be(p, &header->unknown1, is_storing); + p += serialize_uint32be(p, &header->unknown2, is_storing); + return sizeof(header_t); +} + +static size_t idx_serialize_node(uint8_t *block, node_t *node, int is_storing) +{ + uint8_t *p = block; + p += serialize_uint32be(p, &node->left, 0); + p += serialize_uint32be(p, &node->right, 0); + p += serialize_uint32be(p, &node->height, 0); + p += serialize_uint32be(p, &node->leaf, 0); + return sizeof(node_t); +} + +static size_t idx_serialize_tail(uint8_t *block, tail_t* tail, int is_storing) +{ + uint8_t *p = block; + p += serialize_uint32be(p, &tail->dat_offset, is_storing); + p += serialize_uint32be(p, &tail->next, is_storing); + return sizeof(tail_t); +} + +void variant_init(variant_t* var, int type) +{ + memset(var, 0, sizeof(*var)); + var->type = type; +} + +void variant_finish(variant_t* var) +{ + if (var->type == IP3DBVT_STRING) { + ucs2free(var->value.str); + } + variant_init(var, IP3DBVT_NONE); +} + +/** + * Prototype definition of a callback function for idx_walk. + * @param buffer The pointer to the index buffer. + * @param offset The offset address of the current node. + * @param node The information of the node. + * @param key The key value of the node. + * @param types The key types. + * @param level The current key level. + * @param flag + * @param instance The instance value. + */ +typedef int (*idx_walk_callback_t)( + uint8_t* buffer, + uint32_t offset, + node_t* node, + variant_t* key, + int* types, + int level, + int flag, + void *instance + ); + +void idx_walk( + uint8_t *buffer, + uint32_t offset, + int *types, + int level, + idx_walk_callback_t callback, + void *instance + ) +{ + node_t node; + variant_t key; + int type = types[level]; + uint8_t* p = buffer + offset; + + /* Read the node information. */ + p += idx_serialize_node(p, &node, 0); + + /* Descend to left children. */ + if (node.left) { + idx_walk(buffer, node.left, types, level, callback, instance); + } + + /* Read the key value. */ + variant_init(&key, type); + switch (type) { + case IP3DBVT_BYTE: + p += serialize_uint8(p, &key.value.byte, 0); + break; + case IP3DBVT_WORD: + p += serialize_uint16be(p, &key.value.word, 0); + break; + case IP3DBVT_DWORD: + p += serialize_uint32be(p, &key.value.dword, 0); + break; + case IP3DBVT_STRING: + p += serialize_ucs2be_string_var_alloc(p, &key.value.str) * sizeof(ucs2char_t); + break; + } + + /* Invoke the callback function. */ + if (callback && type) { + callback(buffer, offset, &node, &key, types, level, 1, instance); + } + + /* Descend to the next key level if necessary. */ + if (level+1 < IP3DBIDX_MAX_KEYLEVEL && types[level+1]) { + idx_walk(buffer, node.leaf, types, level+1, callback, instance); + } + + /* Invoke the callback function. */ + if (callback && type) { + callback(buffer, offset, &node, &key, types, level, 0, instance); + } + + /* Descend to right children. */ + if (node.right) { + idx_walk(buffer, node.right, types, level, callback, instance); + } +} + +static void fprinti(FILE *fp, int n) +{ + while (n--) fputc(' ', fp); +} + +int idx_walkcb_dump( + uint8_t* buffer, + uint32_t offset, + node_t* node, + variant_t* key, + int* types, + int level, + int flag, + void *instance + ) +{ + FILE *fp = (FILE*)instance; + int indent = 2 * (level + 1); + + if (flag) { + fprinti(fp, indent); + fprintf(fp, "NODE (0x%08X) = {\n", offset); + fprinti(fp, indent); + fprintf(fp, " left: 0x%08X\n", node->left); + fprinti(fp, indent); + fprintf(fp, " right: 0x%08X\n", node->right); + fprinti(fp, indent); + fprintf(fp, " data: 0x%08X\n", node->leaf); + + fprinti(fp, indent); + fprintf(fp, " key: "); + switch (key->type) { + case IP3DBVT_BYTE: + fprintf(fp, "0x%02X", key->value.byte); + break; + case IP3DBVT_WORD: + fprintf(fp, "0x%04X", key->value.word); + break; + case IP3DBVT_DWORD: + fprintf(fp, "0x%08X", key->value.dword); + break; + case IP3DBVT_STRING: + fprints(fp, "%s", key->value.str); + break; + } + fprintf(fp, "\n"); + + if (IP3DBIDX_MAX_KEYLEVEL <= level+1 || !types[level+1]) { + tail_t tail; + + memset(&tail, 0, sizeof(tail)); + tail.next = node->leaf; + + fprinti(fp, indent); + fprintf(fp, " dat_offset: [\n", node->left); + while (tail.next) { + uint8_t *p = buffer + tail.next; + idx_serialize_tail(p, &tail, 0); + fprinti(fp, indent); + fprintf(fp, " 0x%08X\n", tail.dat_offset); + } + fprinti(fp, indent); + fprintf(fp, " ]\n", node->left); + } + } else { + fprinti(fp, indent); + fprintf(fp, "}\n"); + } + + return 0; +} + +int idx_dump(FILE *fpo, ip3db_t* db) +{ + int i; + header_t header; + + fprintf(fpo, "===== db.idx =====\n"); + + /* Dump the header. */ + idx_serialize_header(db->idx_buffer, &header, 0); + fprintf(fpo, "size: 0x%08X\n", header.size); + fprintf(fpo, "unknown1: 0x%08X\n", header.unknown1); + fprintf(fpo, "unknown2: 0x%08X\n", header.unknown2); + + /* Dump the binary search trees. */ + for (i = 0;i < IP3DBIDX_LAST;++i) { + ip3db_index_param_t* index_param = ip3db_get_indexparam(i); + uint32_t idx_root = dic_get_idxroot(db->dic_buffer, i); + fprintf(fpo, "[%s]\n", index_param->name); + idx_walk(db->idx_buffer, idx_root, index_param->types, 0, idx_walkcb_dump, (void*)stdout); + } + + fprintf(fpo, "\n"); + return 0; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/idx.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/idx.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,28 @@ +/* + * Low-level library for db.idx. + * + * Copyright (c) 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:$ */ + +#ifndef __IP3DB_IDX_H__ +#define __IP3DB_IDX_H__ + + +#endif/*__IP3DB_IDX_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/idx.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,127 @@ +/* + * Media database reader/writer for iriver E10. + * + * Copyright (c) 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 "util.h" +#include "dat.h" +#include "ip3db.h" + +static ip3db_index_param_t ip3db_index_param[IP3DBIDX_LAST] = { + {"Music.Title", 0x0086, {IP3DBVT_STRING, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.Rating", 0x00F8, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.TrackNumber", 0x0152, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.ChangedFlag", 0x022C, {IP3DBVT_BYTE, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.ClusM", 0x027A, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.UID", 0x031C, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Music.Genre-Artist-Title", 0x0352, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_STRING}}, + {"Music.Artist-Album-TrackNumber", 0x0384, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_WORD}}, + {"Music.Artist-TrackNumber", 0x03C2, {IP3DBVT_STRING, IP3DBVT_WORD, IP3DBVT_NONE}}, + {"Music.Artist-Title", 0x03F4, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_NONE}}, + {"Music.Genre-Title", 0x041A, {IP3DBVT_STRING, IP3DBVT_STRING, IP3DBVT_NONE}}, + {"Music.Album-TrackNumber", 0x043E, {IP3DBVT_STRING, IP3DBVT_WORD, IP3DBVT_NONE}}, + {"Object.UID", 0x099A, {IP3DBVT_DWORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Object.FileType", 0x09F0, {IP3DBVT_WORD, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Object.ObjectName", 0x0A0E, {IP3DBVT_STRING, IP3DBVT_NONE, IP3DBVT_NONE}}, + {"Object.FileType-ParentUid-Properties", 0x0ACE, {IP3DBVT_WORD, IP3DBVT_DWORD, IP3DBVT_BYTE}}, +}; + +ip3db_index_param_t* ip3db_get_indexparam(int field) +{ + return &ip3db_index_param[field]; +} + +void ip3db_init(ip3db_t* db) +{ + memset(db, 0, sizeof(*db)); +} + +void ip3db_finish(ip3db_t* db) +{ + free(db->dat_buffer); + free(db->dic_buffer); + free(db->idx_buffer); + ip3db_init(db); +} + +static const ucs2char_t g_ucs2cs_datdb[] = {'d','b','.','d','a','t',0}; +static const ucs2char_t g_ucs2cs_dicdb[] = {'d','b','.','d','i','c',0}; +static const ucs2char_t g_ucs2cs_idxdb[] = {'d','b','.','i','d','x',0}; + +result_t ip3db_load(ip3db_t* db, const ucs2char_t* path) +{ + FILE *fp = 0; + ucs2char_t filename[MAX_PATH]; + + ucs2cpy(filename, path); + ucs2cat(filename, g_ucs2cs_datdb); + fp = ucs2fopen(filename, "rb"); + if (!fp) { + ip3db_finish(db); + return 1; + } + fread_all(fp, &db->dat_buffer, &db->dat_size); + fclose(fp); + + ucs2cpy(filename, path); + ucs2cat(filename, g_ucs2cs_dicdb); + fp = ucs2fopen(filename, "rb"); + if (!fp) { + ip3db_finish(db); + return 1; + } + fread_all(fp, &db->dic_buffer, &db->dic_size); + fclose(fp); + + ucs2cpy(filename, path); + ucs2cat(filename, g_ucs2cs_idxdb); + fp = ucs2fopen(filename, "rb"); + if (!fp) { + ip3db_finish(db); + return 1; + } + fread_all(fp, &db->idx_buffer, &db->idx_size); + fclose(fp); + + return 0; +} + +result_t ip3db_dump(FILE *fpo, ip3db_t* db) +{ + /* Dump db.dat */ + dat_t* dat = dat_new(); + dat_serialize(db->dat_buffer, dat, 0); + dat_dump(fpo, dat); + dat_finish(dat); + + /* Dump db.idx */ + idx_dump(fpo, db); + return 0; +} \ No newline at end of file Property changes on: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,88 @@ +/* + * Media database reader/writer for iriver E10. + * + * Copyright (c) 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:$ */ + +#ifndef __IP3DB_IP3DB_H__ +#define __IP3DB_IP3DB_H__ + +enum { + IP3DBIDX_MUSIC_TITLE, + IP3DBIDX_MUSIC_RATING, + IP3DBIDX_MUSIC_TRACKNUMBER, + IP3DBIDX_MUSIC_CHANGEDFLAG, + IP3DBIDX_MUSIC_CLUSM, + IP3DBIDX_MUSIC_UID, + IP3DBIDX_MUSIC_GENRE_ARTIST_TITLE, + IP3DBIDX_MUSIC_ARTIST_ALBUM_TRACKNUMBER, + IP3DBIDX_MUSIC_ARTIST_TRACKNUMBER, + IP3DBIDX_MUSIC_ARTIST_TITLE, + IP3DBIDX_MUSIC_GENRE_TITLE, + IP3DBIDX_MUSIC_ALBUM_TRACKNUMBER, + IP3DBIDX_OBJECT_UID, + IP3DBIDX_OBJECT_FILETYPE, + IP3DBIDX_OBJECT_OBJECTNAME, + IP3DBIDX_OBJECT_FILETYPE_PARENTUID_PROP, + IP3DBIDX_LAST +}; + +enum { + IP3DBIDX_MAX_KEYLEVEL = 3, +}; + +enum { + IP3DBVT_NONE, + IP3DBVT_BYTE, + IP3DBVT_WORD, + IP3DBVT_DWORD, + IP3DBVT_STRING, +}; + + +typedef struct { + const char* name; + uint32_t dic_offset; + int types[IP3DBIDX_MAX_KEYLEVEL]; +} ip3db_index_param_t; + +struct tag_dat_t; typedef struct tag_dat_t dat_t; + +typedef struct { + uint8_t* dat_buffer; + long dat_size; + uint8_t* dic_buffer; + long dic_size; + uint8_t* idx_buffer; + long idx_size; + + dat_t* dat; +} ip3db_t; + +int idx_dump(FILE *fpo, ip3db_t* db); + +ip3db_index_param_t* ip3db_get_indexparam(int field); + +void ip3db_init(ip3db_t* db); +void ip3db_finish(ip3db_t* db); +result_t ip3db_load(ip3db_t* db, const ucs2char_t* path); +result_t ip3db_dump(FILE *fpo, ip3db_t* db); + +#endif /*_IP3DB_IP3DB_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,243 @@ +<?xml version="1.0" encoding="shift_jis"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="pmp_iriverplus3" + ProjectGUID="{C74FE9C9-B5C4-438A-B157-9BCB6C8A7546}" + RootNamespace="pmp_iriverplus3" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(SolutionDir)include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PMP_IRIVERPLUS3_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="$(SolutionDir)include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PMP_IRIVERPLUS3_EXPORTS" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\dat.c" + > + </File> + <File + RelativePath=".\dic.c" + > + </File> + <File + RelativePath=".\idx.c" + > + </File> + <File + RelativePath=".\ip3db.c" + > + </File> + <File + RelativePath=".\serialize.c" + > + </File> + <File + RelativePath=".\util.c" + > + </File> + </Filter> + <Filter + Name="\x83w\x83b\x83_\x81[ \x83t\x83@\x83C\x83\x8B" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\dat.h" + > + </File> + <File + RelativePath=".\dic.h" + > + </File> + <File + RelativePath=".\idx.h" + > + </File> + <File + RelativePath=".\ip3db.h" + > + </File> + <File + RelativePath=".\serialize.h" + > + </File> + <File + RelativePath=".\util.h" + > + </File> + </Filter> + <Filter + Name="\x83\x8A\x83\\x81[\x83X \x83t\x83@\x83C\x83\x8B" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: trunk/pmplib/lib/pmp_iriverplus3/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/serialize.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/serialize.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,155 @@ +/* + * Data serializer (with byte-order consideration). + * + * 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 <memory.h> +#include <stddef.h> +#include <ucs2char.h> + +#include "serialize.h" + +size_t serialize_uint8(uint8_t* buffer, uint8_t* value, int is_storing) +{ + if (is_storing) { + *buffer = *value; + } else { + *value = *buffer; + } + return 1; +} + +size_t serialize_uint8_array(uint8_t* buffer, uint8_t* array, size_t length, int is_storing) +{ + size_t i; + for (i = 0;i < length;i++) { + buffer += serialize_uint8(buffer, array++, is_storing); + } + return length; +} + +size_t serialize_uint16be(uint8_t* buffer, uint16_t* value, int is_storing) +{ + if (is_storing) { + buffer[0] = (uint8_t)(*value >> 8); + buffer[1] = (uint8_t)(*value & 0xFF); + } else { + *value = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1]; + } + return sizeof(uint16_t); +} + +size_t serialize_uint16le(uint8_t* buffer, uint16_t* value, int is_storing) +{ + if (is_storing) { + buffer[1] = (uint8_t)(*value >> 8); + buffer[0] = (uint8_t)(*value & 0xFF); + } else { + *value = (uint16_t)buffer[1] << 8 | (uint16_t)buffer[0]; + } + return sizeof(uint16_t); +} + +size_t serialize_uint32be(uint8_t* buffer, uint32_t* value, int is_storing) +{ + if (is_storing) { + buffer[0] = (uint8_t)(*value >> 24); + buffer[1] = (uint8_t)(*value >> 16); + buffer[2] = (uint8_t)(*value >> 8); + buffer[3] = (uint8_t)(*value & 0xFF); + } else { + *value = + (uint32_t)buffer[0] << 24 | (uint32_t)buffer[1] << 16 | + (uint32_t)buffer[2] << 8 | (uint32_t)buffer[3]; + } + return sizeof(uint32_t); +} + +size_t serialize_uint32le(uint8_t* buffer, uint32_t* value, int is_storing) +{ + if (is_storing) { + buffer[3] = (uint8_t)(*value >> 24); + buffer[2] = (uint8_t)(*value >> 16); + buffer[1] = (uint8_t)(*value >> 8); + buffer[0] = (uint8_t)(*value & 0xFF); + } else { + *value = + (uint32_t)buffer[3] << 24 | (uint32_t)buffer[2] << 16 | + (uint32_t)buffer[1] << 8 | (uint32_t)buffer[0]; + } + return sizeof(uint32_t); +} + +size_t serialize_ucs2be(uint8_t* buffer, ucs2char_t* value, int is_storing) +{ + serialize_uint16be(buffer, (uint16_t*)value, is_storing); + return sizeof(ucs2char_t); +} + +size_t serialize_ucs2be_string_fixed(uint8_t* buffer, ucs2char_t* str, size_t length, int is_storing) +{ + size_t i; + for (i = 0;i < length;i++) { + serialize_ucs2be(buffer, str, is_storing); + buffer += sizeof(ucs2char_t); + ++str; + } + return length; +} + +size_t serialize_ucs2be_string_var(uint8_t* buffer, ucs2char_t* str, int is_storing) +{ + size_t length = 0; + while (serialize_ucs2be(buffer, str, is_storing), *str) { + ++length; + ++str; + buffer += sizeof(ucs2char_t); + } + return length; +} + +size_t serialize_ucs2be_string_var_alloc(uint8_t* buffer, ucs2char_t** str) +{ + ucs2char_t c; + size_t length = 0; + uint8_t* p = buffer; + + /* Measure the length of the string. */ + while (serialize_ucs2be(p, &c, 0), c) { + ++length; + p += sizeof(ucs2char_t); + } + + /* Allocate a string buffer. */ + ucs2free(*str); + *str = ucs2malloc(sizeof(ucs2char_t) * (length+1)); + memset(*str, 0, sizeof(ucs2char_t) * (length+1)); + + /* Read the string. */ + serialize_ucs2be_string_fixed(buffer, *str, length, 0); + + return length; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/serialize.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/serialize.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/serialize.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/serialize.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,38 @@ +/* + * Data serializer (with byte-order consideration). + * + * 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$ */ + +#ifndef __IP2DB_SERIALIZE_H__ +#define __IP2DB_SERIALIZE_H__ + +size_t serialize_uint8(uint8_t* buffer, uint8_t* value, int is_storing); +size_t serialize_uint8_array(uint8_t* buffer, uint8_t* array, size_t length, int is_storing); +size_t serialize_uint16le(uint8_t* buffer, uint16_t* value, int is_storing); +size_t serialize_uint32le(uint8_t* buffer, uint32_t* value, int is_storing); +size_t serialize_uint16be(uint8_t* buffer, uint16_t* value, int is_storing); +size_t serialize_uint32be(uint8_t* buffer, uint32_t* value, int is_storing); +size_t serialize_ucs2be(uint8_t* buffer, ucs2char_t* value, int is_storing); +size_t serialize_ucs2be_string_fixed(uint8_t* buffer, ucs2char_t* str, size_t length, int is_storing); +size_t serialize_ucs2be_string_var(uint8_t* buffer, ucs2char_t* str, int is_storing); +size_t serialize_ucs2be_string_var_alloc(uint8_t* buffer, ucs2char_t** str); + +#endif/*__IP2DB_SERIALIZE_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/serialize.h ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/util.c 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,150 @@ +/* + * Miscellaneous utilities. + * + * 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 <malloc.h> + +#include "util.h" + +int is_all_value(uint8_t* array, size_t size, uint8_t value) +{ + size_t i; + for (i = 0;i < size;i++) { + if (array[0] != value) { + return 0; + } + } + return 1; +} + +void fprints(FILE *fp, const char *format, const ucs2char_t* value) +{ + fprints_fixed(fp, format, value, ucs2len(value)); +} + +void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, size_t length) +{ + char *mbs = NULL; + ucs2char_t* tmp = alloca(sizeof(ucs2char_t) * (length+1)); + memset(tmp, 0, sizeof(ucs2char_t) * (length+1)); + ucs2ncpy(tmp, value, length); + mbs = ucs2dupmbs(tmp); + if (mbs) { + fprintf(fp, format, mbs); + ucs2free(mbs); + } +} + +void prints_fixed(FILE *fp, const ucs2char_t* value, size_t length) +{ + size_t i; + + for (i = 0;i < length;++i) { + if (value[i]) { + char mbs[8]; + memset(mbs, 0, sizeof(mbs)); + ucs2tombs(mbs, sizeof(mbs), &value[i], 1); + fprintf(fp, mbs); + } else { + fprintf(fp, " "); + } + } +} + +void fprintt(FILE *fp, const char *format, uint32_t value) +{ + static time_t basetime = 0; /* Basetime (static variable). */ + time_t timer = 0; + + /* Initialize basetime (Sat Jan 01 00:00:00 2000) for the first time. */ + if (basetime == 0) { + struct tm bt; + memset(&bt, 0, sizeof(bt)); + bt.tm_year = 2000 - 1900; + bt.tm_mon = 1 - 1; + bt.tm_mday = 1; + bt.tm_hour = 0; + bt.tm_min = 0; + bt.tm_sec = 0; + basetime = mktime(&bt); + } + + timer = basetime + (time_t)value; + fprintf(fp, format, asctime(gmtime(&timer))); +} + +void print_keystr(FILE *fp, const ucs2char_t* value, size_t length) +{ + size_t i; + + for (i = 0;i < length;++i) { + if (value[i] != 0xFFFF) { + break; + } + } + if (i < length) { + fprintf(fp, "\""); + prints_fixed(fp, value, length); + fprintf(fp, "\""); + } else { + fprintf(fp, "LAST"); + } +} + +void print_next(FILE *fp, const uint32_t value, uint8_t height) +{ + fprintf(fp, "%s%d", (height > 0 ? "@" : ""), value); +} + +int fread_all(FILE *fp, uint8_t** ptr_buffer, long* ptr_size) +{ + uint8_t* buffer = NULL; + long size = 0; + + /* Obtain the stream size. */ + if (fseek(fp, 0, SEEK_END) != 0) { + return 1; + } + if ((size = ftell(fp)) == -1) { + return 1; + } + if (fseek(fp, 0, SEEK_SET) != 0) { + return 1; + } + + /* */ + buffer = (uint8_t*)malloc(size); + + fread(buffer, 1, size, fp); + + *ptr_buffer = buffer; + *ptr_size = size; + return 0; +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/util.c ___________________________________________________________________ Name: svn:keywords + Id Added: trunk/pmplib/lib/pmp_iriverplus3/util.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.h (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/util.h 2006-12-24 02:42:41 UTC (rev 194) @@ -0,0 +1,38 @@ +/* + * Miscellaneous utilities. + * + * 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$ */ + +#ifndef __IP3DB_UTIL_H__ +#define __IP3DB_UTIL_H__ + +int is_all_value(uint8_t* array, size_t size, uint8_t value); + +void fprints(FILE *fp, const char *format, const ucs2char_t* value); +void fprints_fixed(FILE *fp, const char *format, const ucs2char_t* value, size_t length); +void prints_fixed(FILE *fp, const ucs2char_t* value, size_t length); +void fprintt(FILE *fp, const char *format, uint32_t value); +void print_keystr(FILE *fp, const ucs2char_t* value, size_t length); +void print_next(FILE *fp, const uint32_t value, uint8_t height); + +int fread_all(FILE *fp, uint8_t** ptr_buffer, long* ptr_size); + +#endif/*__IP3DB_UTIL_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/util.h ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/pmplib/pmp.sln =================================================================== --- trunk/pmplib/pmp.sln 2006-12-24 01:56:05 UTC (rev 193) +++ trunk/pmplib/pmp.sln 2006-12-24 02:42:41 UTC (rev 194) @@ -9,63 +9,70 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmi", "lib\gmi\gmi.vcproj", "{3575EFC2-9051-467A-BEB4-E71E2F8664D7}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp", "lib\pmp\pmp.vcproj", "{8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A}" ProjectSection(ProjectDependencies) = postProject + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_irivnavi", "lib\pmp_irivnavi\pmp_irivnavi.vcproj", "{2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_iriverplus2", "lib\pmp_iriverplus2\pmp_iriverplus2.vcproj", "{E393575C-6B10-43BD-B2C0-63C5040A49F7}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "playlist", "lib\playlist\playlist.vcproj", "{3419FA86-F518-4D3B-94C6-B05436439102}" ProjectSection(ProjectDependencies) = postProject + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "easypmp_cui", "frontend\easypmp\cui\easypmp_cui.vcproj", "{FA1F30D4-6100-4379-8506-6CFE023B0AE7}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} + {544769C2-6989-452F-B626-E442CAC6553B} = {544769C2-6989-452F-B626-E442CAC6553B} + {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} + {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} + {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} - {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} - {544769C2-6989-452F-B626-E442CAC6553B} = {544769C2-6989-452F-B626-E442CAC6553B} - {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "easypmp_win32gui", "frontend\easypmp\win32gui\easypmp_win32gui.vcproj", "{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} + {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} + {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} + {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} - {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} - {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} - {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_portalplayer1", "lib\pmp_portalplayer1\pmp_portalplayer1.vcproj", "{544769C2-6989-452F-B626-E442CAC6553B}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_iriverplus3", "lib\pmp_iriverplus3\pmp_iriverplus3.vcproj", "{C74FE9C9-B5C4-438A-B157-9BCB6C8A7546}" + ProjectSection(ProjectDependencies) = postProject + {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1... [truncated message content] |
From: <ny...@us...> - 2006-12-24 05:09:19
|
Revision: 195 http://svn.sourceforge.net/pmplib/?rev=195&view=rev Author: nyaochi Date: 2006-12-23 21:09:19 -0800 (Sat, 23 Dec 2006) Log Message: ----------- [pmp_iriverplus3] - Implemented a primitive export routine for PMPlib; - "easypmp -R -L0" now works with iriver E10. Modified Paths: -------------- trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj Added Paths: ----------- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2006-12-24 02:42:41 UTC (rev 194) +++ trunk/pmplib/include/pmp.h 2006-12-24 05:09:19 UTC (rev 195) @@ -49,6 +49,7 @@ PMP_DEVICENOTFOUND, PMP_NOTSUPPORTED, PMP_INSUFFICIENTMEMORY, + PMP_NOTIMPLIMENTED, PMPDBE_OUTOFMEMORY, PMPDBE_NOTFOUND, PMPDBE_INVALIDTYPE, Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 02:42:41 UTC (rev 194) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-24 05:09:19 UTC (rev 195) @@ -19,7 +19,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -71,18 +71,12 @@ ip3db_init(db); } -static const ucs2char_t g_ucs2cs_datdb[] = {'d','b','.','d','a','t',0}; -static const ucs2char_t g_ucs2cs_dicdb[] = {'d','b','.','d','i','c',0}; -static const ucs2char_t g_ucs2cs_idxdb[] = {'d','b','.','i','d','x',0}; - -result_t ip3db_load(ip3db_t* db, const ucs2char_t* path) +result_t ip3db_read(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn) { FILE *fp = 0; ucs2char_t filename[MAX_PATH]; - ucs2cpy(filename, path); - ucs2cat(filename, g_ucs2cs_datdb); - fp = ucs2fopen(filename, "rb"); + fp = ucs2fopen(datfn, "rb"); if (!fp) { ip3db_finish(db); return 1; @@ -90,9 +84,7 @@ fread_all(fp, &db->dat_buffer, &db->dat_size); fclose(fp); - ucs2cpy(filename, path); - ucs2cat(filename, g_ucs2cs_dicdb); - fp = ucs2fopen(filename, "rb"); + fp = ucs2fopen(dicfn, "rb"); if (!fp) { ip3db_finish(db); return 1; @@ -100,9 +92,7 @@ fread_all(fp, &db->dic_buffer, &db->dic_size); fclose(fp); - ucs2cpy(filename, path); - ucs2cat(filename, g_ucs2cs_idxdb); - fp = ucs2fopen(filename, "rb"); + fp = ucs2fopen(idxfn, "rb"); if (!fp) { ip3db_finish(db); return 1; @@ -113,7 +103,7 @@ return 0; } -result_t ip3db_dump(FILE *fpo, ip3db_t* db) +result_t ip3db_dump(ip3db_t* db, FILE *fpo) { /* Dump db.dat */ dat_t* dat = dat_new(); Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 02:42:41 UTC (rev 194) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-24 05:09:19 UTC (rev 195) @@ -19,7 +19,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifndef __IP3DB_IP3DB_H__ #define __IP3DB_IP3DB_H__ @@ -82,7 +82,7 @@ void ip3db_init(ip3db_t* db); void ip3db_finish(ip3db_t* db); -result_t ip3db_load(ip3db_t* db, const ucs2char_t* path); -result_t ip3db_dump(FILE *fpo, ip3db_t* db); +result_t ip3db_read(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn); +result_t ip3db_dump(ip3db_t* db, FILE *fpo); #endif /*_IP3DB_IP3DB_H__*/ Added: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2006-12-24 05:09:19 UTC (rev 195) @@ -0,0 +1,561 @@ +/* + * PMP library implementation for iriver E10. + * + * Copyright (c) 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*/ +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> +#include <filepath.h> +#include <pmp.h> +#include <pmphelp.h> + +#include "ip3db.h" + +#ifdef PMP_IRIVERPLUS3_EXPORTS +#define PMPIRIVERPLUS3API __declspec(dllexport) +#else +#define PMPIRIVERPLUS3API +#endif + + +typedef struct { + const char *id; + const char *name; + const char *mode; + const char *min_version; + const char *max_version; + const char *sys_filename; + const char *dat_filename; + const char *dic_filename; + const char *idx_filename; + const char *path_to_music; + const char *path_to_playlist; + const char *playlist_ext; +} ip3model_descriptor_t; + +static const ip3model_descriptor_t g_model_descriptions[] = { + { + "iriver_e10_ums_1.04", "E10 UMS", "UM", + "1.04", "1.04", + "System\\E10.SYS", "System\\db.dat", "System\\db.dic", "System\\db.idx", + "\\", "Playlists\\", + ".plp", + }, + { + NULL, NULL, NULL, + NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, + NULL, + }, +}; + +typedef struct { + char id[128]; + char name[128]; + char mode[128]; + char language[128]; + char version[128]; + + ucs2char_t path_to_root[MAX_PATH]; + ucs2char_t path_to_music[MAX_PATH]; + ucs2char_t path_to_playlist[MAX_PATH]; + ucs2char_t sys_filename[MAX_PATH]; + ucs2char_t dat_filename[MAX_PATH]; + ucs2char_t dic_filename[MAX_PATH]; + ucs2char_t idx_filename[MAX_PATH]; + ucs2char_t playlist_ext[MAX_PATH]; +} ip3_environment_t; + + +typedef struct { + ip3_environment_t env; +} pmp_internal_t; + +typedef struct { + ip3db_t ip3db; +} pmpdb_internal_t; + +typedef struct { + ip3db_t ip3db; +} pmppl_internal_t; + + +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_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 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 void set_environment( + ip3_environment_t* env, + const ip3model_descriptor_t* md, + const ucs2char_t* path_to_device + ) +{ + ucs2char_t* ucs2 = NULL; + + ucs2cpy(env->path_to_root, path_to_device); + + ucs2cpy(env->path_to_music, path_to_device); + filepath_addslash(env->path_to_music); + ucs2 = mbsdupucs2(md->path_to_music); + ucs2cat(env->path_to_music, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->path_to_playlist, path_to_device); + filepath_addslash(env->path_to_playlist); + ucs2 = mbsdupucs2(md->path_to_playlist); + ucs2cat(env->path_to_playlist, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->sys_filename, path_to_device); + filepath_addslash(env->sys_filename); + ucs2 = mbsdupucs2(md->sys_filename); + ucs2cat(env->sys_filename, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->dat_filename, path_to_device); + filepath_addslash(env->dat_filename); + ucs2 = mbsdupucs2(md->dat_filename); + ucs2cat(env->dat_filename, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->dic_filename, path_to_device); + filepath_addslash(env->dic_filename); + ucs2 = mbsdupucs2(md->dic_filename); + ucs2cat(env->dic_filename, ucs2); + ucs2free(ucs2); + + ucs2cpy(env->idx_filename, path_to_device); + filepath_addslash(env->idx_filename); + ucs2 = mbsdupucs2(md->idx_filename); + ucs2cat(env->idx_filename, ucs2); + ucs2free(ucs2); + + ucs2 = mbsdupucs2(md->playlist_ext); + ucs2cat(env->playlist_ext, ucs2); + ucs2free(ucs2); +} + +static int match_model( + const char *id, + const ucs2char_t* path_to_device, + const ip3model_descriptor_t* md, + ip3_environment_t* env + ) +{ + memset(env, 0, sizeof(*env)); + + if (!id || strcmp(md->id, id) != 0) { + return 0; + } + + set_environment(env, md, path_to_device); + return 1; +} + +static char* strip(char *str) +{ + char *p = str + strlen(str) - 1; + while (*str && isspace(*str)) { + str++; + } + while (str <= p && isspace(*p)) { + *p-- = 0; + } + return str; +} + +#define COMP(a, b) ((a)>(b))-((a)<(b)) + +static int compare_version(const char *x, const char *y) +{ + char *p = NULL, *q = NULL; + + for (;;) { + long a = strtol(x, &p, 10); + long b = strtol(y, &q, 10); + int value = COMP(a, b); + if (value != 0) { + return value; + } + if (!*p || !*q || *p != *q) { + return COMP(*p, *q); + } + x = p+1; + y = q+1; + } +} + +static int detect_model( + const ucs2char_t* path_to_device, + const ip3model_descriptor_t* md, + ip3_environment_t* env + ) +{ + ucs2char_t* ucs2 = NULL; + ucs2char_t filename[MAX_PATH]; + + memset(env, 0, sizeof(*env)); + + ucs2cpy(filename, path_to_device); + filepath_addslash(filename); + ucs2 = mbsdupucs2(md->sys_filename); + ucs2cat(filename, ucs2); + ucs2free(ucs2); + if (filepath_file_exists(filename)) { + int match = 1; + char line[128]; + FILE *fp = ucs2fopen(filename, "r"); + if (!fp) { + return 0; + } + + while (fgets(line, sizeof(line)-1, fp)) { + char *p = strip(line); + if (p[0] == '[' && line[strlen(p)-1] == ']') { + p[strlen(p)-1] = 0; + strcpy(env->name, p+1); + } else if (strncmp(p, "version = ", 10) == 0) { + /* They are too stupid to describe version "1.04" as "1.4" */ + if (strlen(p+10) == 3 && p[11] == '.') { + env->version[0] = p[10]; + env->version[1] = p[11]; + env->version[2] = '0'; + env->version[3] = p[12]; + env->version[4] = 0; + } else { + strcpy(env->version, p+10); + } + } else if (strncmp(p, "language = ", 11) == 0) { + strcpy(env->language, p+11); + } else if (strncmp(p, "mode = ", 7) == 0) { + strcpy(env->mode, p+7); + } + } + fclose(fp); + + match &= (strcmp(env->mode, md->mode) == 0); + match &= (compare_version(md->min_version, env->version) <= 0); + match &= (compare_version(env->version, md->max_version) <= 0); + + if (match) { + set_environment(env, md, path_to_device); + return 1; + } + } + return 0; +} + + + +PMPIRIVERPLUS3API result_t pmp_enumerate_devid(pmp_enumerate_devid_callback_t callback, void *instance) +{ + const ip3model_descriptor_t* md = g_model_descriptions; + for (;md->id;++md) { + callback(instance, md->id); + } + return 0; +} + +PMPIRIVERPLUS3API result_t pmp_create(pmp_t** ptr_pmp, const ucs2char_t* path_to_device, const char *id) +{ + result_t ret = 0; + pmp_t* pmp = NULL; + pmp_internal_t* pmpi = NULL; + const ip3model_descriptor_t* md = NULL; + ip3_environment_t env; + pmp_environment_t* pmpenv = NULL; + + *ptr_pmp = 0; + + // Find a suitable model for the device. + md = g_model_descriptions; + for (;md->id;++md) { + if (detect_model(path_to_device, md, &env)) { + if (!id || !id[0]) { + break; + } + if (strcmp(md->id, id) == 0) { + break; + } + } + if (match_model(id, path_to_device, md, &env)) { + break; + } + } + if (!md->id) { + return PMP_DEVICENOTFOUND; + } + + // Allocate PMP class instance. + pmp = (pmp_t*)calloc(1, sizeof(pmp_t)); + if (!pmp) { + return PMPDBE_OUTOFMEMORY; + } + + 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->is_supported_codec = pmp_is_supported_codec; + pmp->is_supported_ext = pmp_is_supported_ext; + + // Allocate the internal variables. + pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); + if (!pmpi) { + free(pmp); + return PMPDBE_OUTOFMEMORY; + } + pmp->instance = pmpi; + + // Initialize the internal variables. + memcpy(&pmpi->env, &env, sizeof(env)); + + // Initialize the (exportable) env. + pmpenv = &pmp->env; + strcpy(pmpenv->id, md->id); + strcpy(pmpenv->name, md->name); + strcpy(pmpenv->mode, md->mode); + strcpy(pmpenv->language, pmpi->env.language); + strcpy(pmpenv->version, pmpi->env.version); + pmpenv->path_to_root.flag = PMPPEF_SUPPORT | PMPPEF_CONSTANT; + ucs2cpy(pmpenv->path_to_root.path, pmpi->env.path_to_root); + pmpenv->path_to_music.flag = PMPPEF_SUPPORT | PMPPEF_RECURSIVE; + ucs2cpy(pmpenv->path_to_music.path, pmpi->env.path_to_music); + pmpenv->path_to_playlist.flag = PMPPEF_SUPPORT; + ucs2cpy(pmpenv->path_to_playlist.path, pmpi->env.path_to_playlist); + ucs2cpy(pmpenv->playlist_ext, pmpi->env.playlist_ext); + + // Prepare + pmp->add_ref(pmp); + *ptr_pmp = pmp; + return 0; +} + +static uint32_t pmp_add_ref(pmp_t* pmp) +{ + return interlocked_increment(&pmp->ref_count); +} + +static uint32_t pmp_release(pmp_t* pmp) +{ + uint32_t count = interlocked_decrement(&pmp->ref_count); + if (count == 0) { + free(pmp->instance); + free(pmp); + } + return count; +} + +static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb) +{ + pmpdb_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)); + if (!pmpdb) { + return PMPDBE_OUTOFMEMORY; + } + + 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; + + pmpdbi = calloc(1, sizeof(pmpdb_internal_t)); + if (!pmpdbi) { + free(pmpdb); + return PMPDBE_OUTOFMEMORY; + } + ip3db_init(&pmpdbi->ip3db); + + pmpdb->pmp = pmp; + pmpdb->instance = pmpdbi; + + pmpdb->add_ref(pmpdb); + *ptr_pmpdb = pmpdb; + return 0; +} + +static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl) +{ + pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; + pmppl_t* pmppl = NULL; + pmppl_internal_t* pmppli = NULL; + + *ptr_pmppl = 0; + return PMP_NOTIMPLIMENTED; +} + + + +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_add_ref(pmpdb_t* pmpdb) +{ + return interlocked_increment(&pmpdb->ref_count); +} + +static uint32_t pmpdb_release(pmpdb_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; +} + +static result_t pmpdb_read(pmpdb_t* pmpdb) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; + return ip3db_read( + &pmpdbi->ip3db, + pmpi->env.dat_filename, + pmpi->env.dic_filename, + pmpi->env.idx_filename + ); +} + +static result_t pmpdb_write(pmpdb_t* pmpdb) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; + return PMP_NOTIMPLIMENTED; + //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) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; + return PMP_NOTIMPLIMENTED; + //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); +} + +static result_t pmpdb_dump(pmpdb_t* pmpdb, FILE *fp, int level) +{ + pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + if (level > 0) { + return PMP_NOTIMPLIMENTED; + //return ip2db_repr(&pmpdbi->ip2db, fp); + } else { + return ip3db_dump(&pmpdbi->ip3db, fp); + } +} + + + + +static uint32_t pmppl_add_ref(pmppl_t* pmppl) +{ + return interlocked_increment(&pmppl->ref_count); +} + +static uint32_t pmppl_release(pmppl_t* pmppl) +{ + uint32_t count = interlocked_decrement(&pmppl->ref_count); + if (count == 0) { + pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; + free(pmppl->instance); + free(pmppl); + } + return count; +} + +static result_t pmppl_write(pmppl_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; + return PMP_NOTIMPLIMENTED; + /* + if (ip2db_playlist_write(&pmppli->ip2db, filename, files, num_files, pmpi->env.path_to_root) != 0) { + return PMPPLE_WRITE; + } + return 0; + */ +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2006-12-24 02:42:41 UTC (rev 194) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2006-12-24 05:09:19 UTC (rev 195) @@ -17,7 +17,7 @@ <Configurations> <Configuration Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" + OutputDirectory="$(SolutionDir)debug" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" @@ -193,6 +193,10 @@ > </File> <File + RelativePath=".\pmp_iriverplus3.c" + > + </File> + <File RelativePath=".\serialize.c" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-27 08:08:29
|
Revision: 202 http://svn.sourceforge.net/pmplib/?rev=202&view=rev Author: nyaochi Date: 2006-12-27 00:08:26 -0800 (Wed, 27 Dec 2006) Log Message: ----------- Implemented AVL tree for db.idx. Sophisticated dump routine for db.idx by using the AVL tree library. We are now close to generate db.idx Modified Paths: -------------- trunk/pmplib/include/os.h trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/idx.h trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h Modified: trunk/pmplib/include/os.h =================================================================== --- trunk/pmplib/include/os.h 2006-12-25 15:15:36 UTC (rev 201) +++ trunk/pmplib/include/os.h 2006-12-27 08:08:26 UTC (rev 202) @@ -29,6 +29,7 @@ #if defined(WIN32) || defined(OS2) typedef unsigned char uint8_t; typedef unsigned int uint32_t; +typedef int int32_t; typedef unsigned short uint16_t; #elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-25 15:15:36 UTC (rev 201) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2006-12-27 08:08:26 UTC (rev 202) @@ -1,5 +1,5 @@ /* - * Low-level library for db.idx. + * AVL tree implementation for db.idx. * * Copyright (c) 2006 Nyaochi * @@ -42,138 +42,366 @@ #include "util.h" #include "ip3db.h" #include "dic.h" +#include "dat.h" +#include "idx.h" +#define COMP(a, b) ((a)>(b))-((a)<(b)) + typedef struct { uint32_t size; uint32_t unknown1; uint32_t unknown2; -} header_t; +} idx_header_t; -typedef struct { - uint32_t left; - uint32_t right; - uint32_t height; - uint32_t leaf; -} node_t; +struct tag_avlnode_t { + uint32_t left; + uint32_t right; + int32_t balance; + uint32_t tail; +}; +typedef struct tag_avlnode_t avlnode_t; -typedef struct { - uint32_t dat_offset; - uint32_t next; -} tail_t; +struct tag_avltail_t { + uint32_t data; + uint32_t next; +}; +typedef struct tag_avltail_t avltail_t; -static size_t idx_serialize_header(uint8_t *block, header_t *header, int is_storing) +struct tag_avl_t { + uint8_t* buffer; + 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); + +static uint32_t avl_current(avl_t* avl) { - uint8_t *p = block; - p += serialize_uint32be(p, &header->size, is_storing); - p += serialize_uint32be(p, &header->unknown1, is_storing); - p += serialize_uint32be(p, &header->unknown2, is_storing); - return sizeof(header_t); + return avl->offset; } -static size_t idx_serialize_node(uint8_t *block, node_t *node, int is_storing) +static uint32_t avl_allocate(avl_t* avl, uint32_t size) { - uint8_t *p = block; - p += serialize_uint32be(p, &node->left, 0); - p += serialize_uint32be(p, &node->right, 0); - p += serialize_uint32be(p, &node->height, 0); - p += serialize_uint32be(p, &node->leaf, 0); - return sizeof(node_t); + uint32_t offset = avl->offset; + avl->offset += size; + return offset; } -static size_t idx_serialize_tail(uint8_t *block, tail_t* tail, int is_storing) +static avlnode_t *avlnode(avl_t* avl, uint32_t offset) { - uint8_t *p = block; - p += serialize_uint32be(p, &tail->dat_offset, is_storing); - p += serialize_uint32be(p, &tail->next, is_storing); - return sizeof(tail_t); + return (avlnode_t*)(avl->buffer + offset); } -/** - * Prototype definition of a callback function for idx_walk. - * @param buffer The pointer to the index buffer. - * @param offset The offset address of the current node. - * @param node The information of the node. - * @param key The key value of the node. - * @param types The key types. - * @param level The current key level. - * @param flag - * @param instance The instance value. - */ -typedef int (*idx_walk_callback_t)( - uint8_t* buffer, - uint32_t offset, - node_t* node, - ip3db_variant_t* key, - dic_table_t* dic_table, - int index, - int level, - int flag, - void *instance - ); +static void avl_rewind(avl_t* avl, uint32_t offset) +{ + memset(avlnode(avl, offset), 0, avl->offset - offset); + avl->offset = offset; +} -void idx_walk( - uint8_t *buffer, - uint32_t offset, - dic_table_t* dic_table, - int index, - int level, - idx_walk_callback_t callback, - void *instance - ) +static uint32_t avlnode_new(avl_t* avl) { - node_t node; - ip3db_variant_t key; + uint32_t offset = avl_allocate(avl, sizeof(avlnode_t)); + avlnode_t* a = avlnode(avl, offset); + a->left = 0; + a->right = 0; + a->balance = 0; + a->tail = 0; + return offset; +} + +static uint32_t avltail_new(avl_t* avl) +{ + uint32_t offset = avl_allocate(avl, sizeof(avltail_t)); + avltail_t* a = (avltail_t*)avlnode(avl, offset); + a->data = 0; + a->next = 0; + return offset; +} + +static void avl_swl(avl_t* avl, uint32_t *offr) +{ + uint32_t offa = *offr; + avlnode_t* a = avlnode(avl, offa); + uint32_t offb = a->right; + avlnode_t* b = avlnode(avl, offb); + *offr = offb; + a->right = b->left; + b->left = offa; +} + +static void avl_swr(avl_t* avl, uint32_t *offr) +{ + uint32_t offa = *offr; + avlnode_t* a = avlnode(avl, offa); + uint32_t offb = a->left; + avlnode_t* b = avlnode(avl, offb); + *offr = offb; + a->left = b->right; + b->right = offa; +} + +static void avl_nasty(avl_t* avl, uint32_t offr) +{ + avlnode_t* root = avlnode(avl, offr); + avlnode_t* left = avlnode(avl, root->left); + avlnode_t* right = avlnode(avl, root->right); + switch (root->balance) { + case -1: + left->balance = 0; + right->balance = 1; + break; + case 0: + left->balance = 0; + right->balance = 0; + break; + case 1: + left->balance = -1; + right->balance = 0; + break; + } + root->balance = 0; +} + +static int avl_insert(avl_t* avl, uint32_t* offr, uint32_t* offa, avl_comp_t comp) +{ + avlnode_t* root = NULL; + avlnode_t* left = NULL; + avlnode_t* right = NULL; + + if (!*offr) { + /* An empty tree: set the current node as the root node. */ + *offr = *offa; + return 1; + } else { + uint32_t x = *offr + sizeof(avlnode_t); + uint32_t y = *offa + sizeof(avlnode_t); + int cmp = comp(avl, x, y); + if (cmp > 0) { + /* Insert the node to the left sub-tree. */ + root = avlnode(avl, *offr); + if (root->left) { + uint32_t off_left = root->left; + int ret = avl_insert(avl, &off_left, offa, comp); + if (ret > 0) { + switch (root->balance--) { + case 1: return 0; + case 0: return 1; + } + left = avlnode(avl, root->left); + if (left->balance < 0) { + avl_swr(avl, offr); + root = avlnode(avl, *offr); + right = avlnode(avl, root->right); + root->balance = 0; + right->balance = 0; + } else { + avl_swl(avl, &root->left); + avl_swr(avl, offr); + avl_nasty(avl, *offr); + } + } else if (ret == 0) { + root->left = off_left; + } else { + return -1; + } + return 0; + } else { + root->left = *offa; + if (root->balance--) return 0; + return 1; + } + } else if (cmp < 0) { + /* Insert the node to the right sub-tree. */ + root = avlnode(avl, *offr); + if (root->right) { + uint32_t off_right = root->right; + int ret = avl_insert(avl, &off_right, offa, comp); + if (ret > 0) { + switch (root->balance++) { + case -1: return 0; + case 0: return 1; + } + right = avlnode(avl, root->right); + if (right->balance > 0) { + avl_swl(avl, offr); + root = avlnode(avl, *offr); + left = avlnode(avl, root->left); + root->balance = 0; + left->balance = 0; + } else { + avl_swr(avl, &root->right); + avl_swl(avl, offr); + avl_nasty(avl, *offr); + } + } else if (ret == 0) { + root->right = off_right; + } else { + return -1; + } + return 0; + } else { + root->right = *offa; + if (root->balance++) return 0; + return 1; + } + } else { + *offa = *offr; + return -1; + } + } +} + +static int avl_comp_byte(avl_t* avl, uint32_t _x, uint32_t _y) +{ + uint8_t* x = avl->buffer + _x; + uint8_t* y = avl->buffer + _y; + return COMP(*x, *y); +} + +static int avl_comp_word(avl_t* avl, uint32_t _x, uint32_t _y) +{ + uint16_t* x = (uint16_t*)(avl->buffer + _x); + uint16_t* y = (uint16_t*)(avl->buffer + _y); + return COMP(*x, *y); +} + +static int avl_comp_dword(avl_t* avl, uint32_t _x, uint32_t _y) +{ + uint32_t* x = (uint32_t*)(avl->buffer + _x); + uint32_t* y = (uint32_t*)(avl->buffer + _y); + return COMP(*x, *y); +} + +static int avl_comp_ucs2string(avl_t* avl, uint32_t _x, uint32_t _y) +{ + ucs2char_t* x = (ucs2char_t*)(avl->buffer + _x); + ucs2char_t* y = (ucs2char_t*)(avl->buffer + _y); + while (*x && *y && *x == *y) { + x++; + y++; + } + return COMP(*x, *y); +} + +static int avl_insert_key(avl_t* avl, const void* key, size_t size, int type, uint32_t* offset, uint32_t* root) +{ + int ret = 0; + uint32_t offset_prev = avl_current(avl); + uint32_t offset_this = avlnode_new(avl); + uint32_t offset_key = avl_allocate(avl, (uint32_t)size); + void *pkey = avlnode(avl, offset_key); + static avl_comp_t comp[] = {NULL, avl_comp_byte, avl_comp_word, avl_comp_dword, avl_comp_ucs2string}; + + memcpy(pkey, key, size); + ret = avl_insert(avl, root, &offset_this, comp[type]); + if (ret != -1) { + /* A new key. */ + *offset = offset_this; + return 0; + } else { + /* The key exists in the AVL tree. */ + avl_rewind(avl, offset_prev); + *offset = offset_this; + return 1; + } +} + +static int avl_insert_keydata(avl_t* avl, const void* key, size_t size, int type, uint32_t data, uint32_t* root) +{ + uint32_t offset = 0; + int ret = avl_insert_key(avl, key, size, type, &offset, root); + avlnode_t* node = avlnode(avl, offset); + uint32_t offset_tail = avltail_new(avl); + avltail_t* tail = (avltail_t*)avlnode(avl, offset_tail); + tail->data = data; + tail->next = node->tail; + node->tail = offset_tail; + return ret; +} + +static void from_uint16be(uint16_t* value) +{ + uint8_t* src = (uint8_t*)value; + uint16_t tmp = (uint16_t)src[0] << 8 | (uint16_t)src[1]; + *value = tmp; +} + +static void from_uint32be(uint32_t* value) +{ + uint8_t* src = (uint8_t*)value; + uint32_t tmp = (uint32_t)src[0] << 24 | (uint32_t)src[1] << 16 | (uint32_t)src[2] << 8 | (uint32_t)src[3]; + *value = tmp; +} + +static void from_ucs2be_string(ucs2char_t* value) +{ + while (*value) { + from_uint16be((uint16_t*)value); + value++; + } +} + +static void from_be_avlnode(avlnode_t* node) +{ + from_uint32be(&node->left); + from_uint32be(&node->right); + from_uint32be(&node->balance); + from_uint32be(&node->tail); +} + +static void from_be_avltree(avl_t* avl, uint32_t offset, dic_table_t* dic_table, int index, int level) +{ + avlnode_t* node = avlnode(avl, offset); int field = dic_table->indices[index].fields[level]; int type = dic_table->fields[field].type; - uint8_t* p = buffer + offset; - /* Read the node information. */ - p += idx_serialize_node(p, &node, 0); + /* Convert the current node. */ + from_be_avlnode(node); - /* Descend to left children. */ - if (node.left) { - idx_walk(buffer, node.left, dic_table, index, level, callback, instance); + /* Descend to the left node. */ + if (node->left) { + from_be_avltree(avl, node->left, dic_table, index, level); } - /* Read the key value. */ - ip3db_variant_init(&key, type); + /* Convert the key value. */ switch (type) { case IP3DBVT_BYTE: - p += serialize_uint8(p, &key.value.byte, 0); break; case IP3DBVT_WORD: - p += serialize_uint16be(p, &key.value.word, 0); + from_uint16be((uint16_t*)(node+1)); break; case IP3DBVT_DWORD: - p += serialize_uint32be(p, &key.value.dword, 0); + from_uint32be((uint32_t*)(node+1)); break; case IP3DBVT_STRING: - p += serialize_ucs2be_string_var_alloc(p, &key.value.str) * sizeof(ucs2char_t); + from_ucs2be_string((ucs2char_t*)(node+1)); break; } - /* Invoke the callback function. */ - if (callback && type) { - callback(buffer, offset, &node, &key, dic_table, index, level, 1, instance); - } - - /* Descend to the next key level if necessary. */ - if (level+1 < IP3DBIDX_MAX_KEYLEVEL) { - int next_field = dic_table->indices[index].fields[level+1]; - if (next_field != -1) { - idx_walk(buffer, node.leaf, dic_table, index, level+1, callback, instance); + /* Convert the sub AVL trees or tail. */ + if (node->tail) { + if (level+1 < IP3DBIDX_MAX_KEYLEVEL && dic_table->indices[index].fields[level+1] != -1) { + /* Convert the AVL tree in the next level. */ + from_be_avltree(avl, node->tail, dic_table, index, level+1); + } else { + /* Convert the tail. */ + avltail_t* tail = (avltail_t*)avlnode(avl, node->tail); + for (;;) { + from_uint32be(&tail->next); + from_uint32be(&tail->data); + if (!tail->next) { + break; + } + tail = (avltail_t*)avlnode(avl, tail->next); + } } } - /* Invoke the callback function. */ - if (callback && type) { - callback(buffer, offset, &node, &key, dic_table, index, level, 0, instance); + /* Descend to the right node. */ + if (node->right) { + from_be_avltree(avl, node->right, dic_table, index, level); } - - /* Descend to right children. */ - if (node.right) { - idx_walk(buffer, node.right, dic_table, index, level, callback, instance); - } } static void fprinti(FILE *fp, int n) @@ -181,89 +409,164 @@ while (n--) fputc(' ', fp); } -int idx_walkcb_dump( - uint8_t* buffer, - uint32_t offset, - node_t* node, - ip3db_variant_t* key, - dic_table_t* dic_table, - int index, - int level, - int flag, - void *instance - ) +static void avl_dump(avl_t* avl, uint32_t offset, dic_table_t* dic_table, int index, int level, FILE *fpo) { - FILE *fp = (FILE*)instance; + avlnode_t* node = avlnode(avl, offset); int field = dic_table->indices[index].fields[level]; int type = dic_table->fields[field].type; - int is_tail = (IP3DBIDX_MAX_KEYLEVEL <= level+1 || dic_table->indices[index].fields[level+1] == -1); int indent = 2 * (level + 1); - if (flag) { - fprinti(fp, indent); - fprintf(fp, "NODE (0x%08X) = {\n", offset); - fprinti(fp, indent); - fprintf(fp, " left: 0x%08X\n", node->left); - fprinti(fp, indent); - fprintf(fp, " right: 0x%08X\n", node->right); - fprinti(fp, indent); - fprintf(fp, " data: 0x%08X\n", node->leaf); + /* Descend to the left node. */ + if (node->left) { + avl_dump(avl, node->left, dic_table, index, level, fpo); + } - fprinti(fp, indent); - fprintf(fp, " key: "); - switch (key->type) { - case IP3DBVT_BYTE: - fprintf(fp, "0x%02X", key->value.byte); + /* Dump the current node. */ + fprinti(fpo, indent); + fprintf(fpo, "NODE (0x%08X)\n", offset); + fprinti(fpo, indent); + fprintf(fpo, " left: 0x%08X\n", node->left); + fprinti(fpo, indent); + fprintf(fpo, " right: 0x%08X\n", node->right); + fprinti(fpo, indent); + fprintf(fpo, " tail: 0x%08X\n", node->tail); + fprinti(fpo, indent); + fprintf(fpo, " key: "); + switch (type) { + case IP3DBVT_BYTE: + fprintf(fpo, "0x%02X", *(uint8_t*)(node+1)); + break; + case IP3DBVT_WORD: + fprintf(fpo, "0x%04X", *(uint16_t*)(node+1)); + break; + case IP3DBVT_DWORD: + fprintf(fpo, "0x%08X", *(uint32_t*)(node+1)); + break; + case IP3DBVT_STRING: + fprints(fpo, "%s", (ucs2char_t*)(node+1)); + break; + } + fprintf(fpo, "\n"); + + /* Convert the sub AVL trees or tail. */ + if (node->tail) { + if (level+1 < IP3DBIDX_MAX_KEYLEVEL && dic_table->indices[index].fields[level+1] != -1) { + /* Convert the AVL tree in the next level. */ + avl_dump(avl, node->tail, dic_table, index, level+1, fpo); + } else { + /* Convert the tail. */ + avltail_t* tail = (avltail_t*)avlnode(avl, node->tail); + + fprinti(fpo, indent); + fprintf(fpo, " TAIL: [\n"); + for (;;) { + fprinti(fpo, indent); + fprintf(fpo, " 0x%08X\n", tail->data); + if (!tail->next) { + break; + } + tail = (avltail_t*)avlnode(avl, tail->next); + } + fprinti(fpo, indent); + fprintf(fpo, " ]\n", node->left); + } + } + + /* Descend to the right node. */ + if (node->right) { + avl_dump(avl, node->right, dic_table, index, level, fpo); + } +} + +void avl_walk2(avl_t* avl, uint32_t offr, avl_comp_t comp) +{ + wchar_t* key = 0; + avlnode_t* root = avlnode(avl, offr); + avltail_t* tail = (avltail_t*)avlnode(avl, root->tail); + if (root->left) avl_walk2(avl, root->left, comp); + key = (wchar_t*)avlnode(avl, offr + sizeof(avlnode_t)); + printf("%S: ", key); + for (;;) { + printf("%d ", tail->data); + if (!tail->next) { break; - case IP3DBVT_WORD: - fprintf(fp, "0x%04X", key->value.word); - break; - case IP3DBVT_DWORD: - fprintf(fp, "0x%08X", key->value.dword); - break; - case IP3DBVT_STRING: - fprints(fp, "%s", key->value.str); - break; } - fprintf(fp, "\n"); + tail = (avltail_t*)avlnode(avl, tail->next); + } + printf("\n"); - if (is_tail) { - tail_t tail; + if (root->right) avl_walk2(avl, root->right, comp); +} - memset(&tail, 0, sizeof(tail)); - tail.next = node->leaf; +void avl_walk(avl_t* avl, uint32_t offr, avl_comp_t comp) +{ + wchar_t* key = 0; + avlnode_t* root = avlnode(avl, offr); + if (root->left) avl_walk(avl, root->left, comp); + key = (wchar_t*)avlnode(avl, offr + sizeof(avlnode_t)); + printf("%S: ", key); + avl_walk2(avl, root->tail, comp); + if (root->right) avl_walk(avl, root->right, comp); +} - fprinti(fp, indent); - fprintf(fp, " TAIL: [\n", node->left); - while (tail.next) { - uint8_t *p = buffer + tail.next; - idx_serialize_tail(p, &tail, 0); - fprinti(fp, indent); - fprintf(fp, " 0x%08X\n", tail.dat_offset); - } - fprinti(fp, indent); - fprintf(fp, " ]\n", node->left); - } - } else { - fprinti(fp, indent); - fprintf(fp, "}\n"); +idx_t *idx_new() +{ + idx_t* idx = (idx_t*)malloc(sizeof(idx_t)); + idx->max_size = 0x00020000; + idx->buffer = (uint8_t*)malloc(idx->max_size); + idx->size = 0; + idx->avl = (avl_t*)malloc(sizeof(avl_t)); + idx->avl->buffer = idx->buffer; + idx->avl->offset = sizeof(idx_header_t); + idx->avl->size = idx->max_size; + return idx; +} + +void idx_finish(idx_t* idx) +{ + free(idx->avl); + free(idx->buffer); + free(idx); +} + +int idx_read(idx_t* idx, dic_t* dic, FILE *fpi) +{ + int i; + idx_header_t* header = (idx_header_t*)idx->buffer; + + /* Read the whole data at a time. */ + if (fread(idx->buffer, 1, idx->max_size, fpi) != idx->max_size) { + return 1; } + /* Convert the byte order of the header from big endian to the native one. */ + from_uint32be(&header->size); + from_uint32be(&header->unknown1); + from_uint32be(&header->unknown2); + + /* Convert the byte order of AVL trees. */ + for (i = 0;i < dic->music.num_indices;++i) { + uint32_t idx_root = dic_get_idxroot(dic, IP3DBIDX_MUSIC, i); + from_be_avltree(idx->avl, idx_root, &dic->music, i, 0); + } + for (i = 0;i < dic->objects.num_indices;++i) { + uint32_t idx_root = dic_get_idxroot(dic, IP3DBIDX_OBJECTS, i); + from_be_avltree(idx->avl, idx_root, &dic->objects, i, 0); + } return 0; } -int idx_dump(uint8_t* buffer, dic_t* dic, FILE *fpo) +result_t idx_dump(idx_t* idx, dic_t* dic, FILE *fpo) { int i; - header_t header; + idx_header_t* header = (idx_header_t*)idx->buffer; fprintf(fpo, "===== db.idx =====\n"); /* Dump the header. */ - idx_serialize_header(buffer, &header, 0); - fprintf(fpo, "size: 0x%08X\n", header.size); - fprintf(fpo, "unknown1: 0x%08X\n", header.unknown1); - fprintf(fpo, "unknown2: 0x%08X\n", header.unknown2); + fprintf(fpo, "size: 0x%08X\n", header->size); + fprintf(fpo, "unknown1: 0x%08X\n", header->unknown1); + fprintf(fpo, "unknown2: 0x%08X\n", header->unknown2); /* Dump the binary search trees. */ for (i = 0;i < dic->music.num_indices;++i) { @@ -271,17 +574,16 @@ fprintf(fpo, "["); dic_repr_index(dic, IP3DBIDX_MUSIC, i, fpo); fprintf(fpo, "]\n"); - idx_walk(buffer, idx_root, &dic->music, i, 0, idx_walkcb_dump, (void*)stdout); + avl_dump(idx->avl, idx_root, &dic->music, i, 0, fpo); } for (i = 0;i < dic->objects.num_indices;++i) { uint32_t idx_root = dic_get_idxroot(dic, IP3DBIDX_OBJECTS, i); fprintf(fpo, "["); dic_repr_index(dic, IP3DBIDX_OBJECTS, i, fpo); fprintf(fpo, "]\n"); - idx_walk(buffer, idx_root, &dic->objects, i, 0, idx_walkcb_dump, (void*)stdout); + avl_dump(idx->avl, idx_root, &dic->objects, i, 0, fpo); } fprintf(fpo, "\n"); return 0; } - Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.h 2006-12-25 15:15:36 UTC (rev 201) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.h 2006-12-27 08:08:26 UTC (rev 202) @@ -24,6 +24,19 @@ #ifndef __IP3DB_IDX_H__ #define __IP3DB_IDX_H__ -int idx_dump(uint8_t* buffer, dic_t* dic, FILE *fpo); +struct tag_avl_t; typedef struct tag_avl_t avl_t; +struct tag_idx_t { + uint8_t* buffer; + uint32_t size; + uint32_t max_size; + avl_t* avl; +}; +typedef struct tag_idx_t idx_t; + +idx_t *idx_new(); +void idx_finish(idx_t* idx); +result_t idx_read(idx_t* idx, dic_t* dic, FILE *fpi); +result_t idx_dump(idx_t* idx, dic_t* dic, FILE *fpo); + #endif/*__IP3DB_IDX_H__*/ Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-25 15:15:36 UTC (rev 201) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-27 08:08:26 UTC (rev 202) @@ -105,6 +105,7 @@ memset(db, 0, sizeof(*db)); db->dat = dat_new(); db->dic = dic_new(); + db->idx = idx_new(); dic_template = dic_get_template(&db->dic_size); db->dic_buffer = (uint8_t*)malloc(db->dic_size); @@ -116,9 +117,9 @@ { dic_finish(db->dic); dat_finish(db->dat); + idx_finish(db->idx); free(db->dat_buffer); free(db->dic_buffer); - free(db->idx_buffer); ip3db_init(db); } @@ -126,39 +127,39 @@ { FILE *fp = 0; - fp = ucs2fopen(datfn, "rb"); + fp = ucs2fopen(dicfn, "rb"); if (!fp) { ip3db_finish(db); return 1; } - fread_all(fp, &db->dat_buffer, &db->dat_size); + fread_all(fp, &db->dic_buffer, &db->dic_size); fclose(fp); - fp = ucs2fopen(dicfn, "rb"); - if (!fp) { + if (dic_serialize(db->dic, db->dic_buffer, 0) != 0) { ip3db_finish(db); return 1; } - fread_all(fp, &db->dic_buffer, &db->dic_size); - fclose(fp); - fp = ucs2fopen(idxfn, "rb"); + fp = ucs2fopen(datfn, "rb"); if (!fp) { ip3db_finish(db); return 1; } - fread_all(fp, &db->idx_buffer, &db->idx_size); + fread_all(fp, &db->dat_buffer, &db->dat_size); fclose(fp); - if (dic_serialize(db->dic, db->dic_buffer, 0) != 0) { + if (dat_serialize(db->dat, db->dic, db->dat_buffer, 0) != 0) { ip3db_finish(db); return 1; } - if (dat_serialize(db->dat, db->dic, db->dat_buffer, 0) != 0) { + fp = ucs2fopen(idxfn, "rb"); + if (!fp) { ip3db_finish(db); return 1; } + idx_read(db->idx, db->dic, fp); + fclose(fp); return 0; } @@ -168,7 +169,6 @@ FILE *fp = 0; free(db->dat_buffer); - free(db->idx_buffer); db->dat_size = 0x00040000; //db->dat_buffer = (uint8_t*)calloc(db->dat_size, sizeof(uint8_t)); @@ -221,7 +221,7 @@ dat_dump(db->dat, db->dic, fpo); /* Dump db.idx */ - idx_dump(db->idx_buffer, db->dic, fpo); + idx_dump(db->idx, db->dic, fpo); return 0; } @@ -230,8 +230,6 @@ /* Construct Objects table in db.dat */ dat_construct(db->dat, db->dic, records, num_records); - /* Construct Music table in db.dat */ - /* Construct db.idx */ /* Update db.dic */ Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-25 15:15:36 UTC (rev 201) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-27 08:08:26 UTC (rev 202) @@ -146,17 +146,17 @@ struct tag_dat_t; typedef struct tag_dat_t dat_t; struct tag_dic_t; typedef struct tag_dic_t dic_t; +struct tag_idx_t; typedef struct tag_idx_t idx_t; typedef struct { uint8_t* dat_buffer; long dat_size; uint8_t* dic_buffer; long dic_size; - uint8_t* idx_buffer; - long idx_size; dat_t* dat; dic_t* dic; + idx_t* idx; } ip3db_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-27 16:38:55
|
Revision: 206 http://svn.sourceforge.net/pmplib/?rev=206&view=rev Author: nyaochi Date: 2006-12-27 08:38:53 -0800 (Wed, 27 Dec 2006) Log Message: ----------- - Trivial comments. - Reduce some warnings with MSVC2005. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/include/os.h trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2006-12-27 14:50:16 UTC (rev 205) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2006-12-27 16:38:53 UTC (rev 206) @@ -25,14 +25,14 @@ #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 <locale.h> +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ #ifdef _MSC_VER #include <direct.h> /* getcwd() */ #endif/*_MSC_VER*/ Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2006-12-27 14:50:16 UTC (rev 205) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2006-12-27 16:38:53 UTC (rev 206) @@ -25,13 +25,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*/ #ifdef _MSC_VER #include <direct.h> /* getcwd() */ #endif/*_MSC_VER*/ Modified: trunk/pmplib/include/os.h =================================================================== --- trunk/pmplib/include/os.h 2006-12-27 14:50:16 UTC (rev 205) +++ trunk/pmplib/include/os.h 2006-12-27 16:38:53 UTC (rev 206) @@ -24,6 +24,14 @@ #ifndef __OS_H__ #define __OS_H__ +#ifdef _MSC_VER +#define HAVE_STRING_H 1 +#endif/*_MSC_VER*/ + +#if _MSC_VER >= 1400 +#define _CRT_SECURE_NO_DEPRECATE 1 /* Use 'unsafe' CRT routines. */ +#endif/*_MSC_VER*/ + #include <stdio.h> #if defined(WIN32) || defined(OS2) @@ -45,8 +53,11 @@ #endif #if defined(WIN32) +#define fileno _fileno +#define strnicmp _strnicmp #define snprintf _snprintf #define snwprintf _snwprintf +#define strdup _strdup #define getcwd _getcwd #define alloca _alloca #define strnicmp _strnicmp Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2006-12-27 14:50:16 UTC (rev 205) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2006-12-27 16:38:53 UTC (rev 206) @@ -43,7 +43,7 @@ */ #ifdef WIN32 -#define strncasecmp strnicmp +#define strncasecmp _strnicmp #endif int gmi_vorbis(media_info_t* info, const ucs2char_t *filename) Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-27 14:50:16 UTC (rev 205) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-27 16:38:53 UTC (rev 206) @@ -274,6 +274,11 @@ fprintf(fp, "}\n"); } +typedef struct { + const ip3db_music_record_t* base; + int index; +} ip3db_sort_index_t; + static int comp_pathname(const void *__x, const void *__y) { const ip3db_sort_index_t* _x = (const ip3db_sort_index_t*)__x; Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-27 14:50:16 UTC (rev 205) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2006-12-27 16:38:53 UTC (rev 206) @@ -42,6 +42,9 @@ var->type = type; if (var->type == IP3DBVT_STRING) { var->value.str = mbsdupucs2(""); + if (!var->value.str) { + var->type = IP3DBVT_NONE; + } } } Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-27 14:50:16 UTC (rev 205) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2006-12-27 16:38:53 UTC (rev 206) @@ -25,18 +25,18 @@ #define __IP3DB_IP3DB_H__ enum { - IP3DBIDX_MAX_KEYLEVEL = 3, + IP3DBIDX_MAX_KEYLEVEL = 3, /**< The maximum number of multiple AVL trees. */ }; /** * Field type IDs used in db.dic (Do not change the associated values) */ enum { - IP3DBVT_NONE = 0, - IP3DBVT_STRING = 1, - IP3DBVT_BYTE = 2, - IP3DBVT_WORD = 3, - IP3DBVT_DWORD = 4, + IP3DBVT_NONE = 0, /**< Attached to no specific type. */ + IP3DBVT_STRING = 1, /**< UCS-2 string. */ + IP3DBVT_BYTE = 2, /**< uint8_t */ + IP3DBVT_WORD = 3, /**< uint16_t */ + IP3DBVT_DWORD = 4, /**< uint32_t */ }; /** @@ -52,6 +52,9 @@ } value; } ip3db_variant_t; +/** + * Fields in a music record. + */ enum { IP3DBF_MUSIC_NONE = -1, IP3DBF_MUSIC_BEGIN = 0, @@ -84,14 +87,11 @@ IP3DBF_MUSIC_LAST, }; +/** + * A music record. + */ typedef ip3db_variant_t ip3db_music_record_t[IP3DBF_MUSIC_LAST]; -typedef struct { - const ip3db_music_record_t* base; - int index; -} ip3db_sort_index_t; - - enum { IP3DBF_OBJECTS_NONE = -1, IP3DBF_OBJECTS_BEGIN = 0, 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. |
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...> - 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 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-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 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 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: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 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 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 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-08 09:01:39
|
Revision: 252 http://svn.sourceforge.net/pmplib/?rev=252&view=rev Author: nyaochi Date: 2007-01-08 01:01:37 -0800 (Mon, 08 Jan 2007) Log Message: ----------- - Documentation for PMPlib Helper API (pmplib_*). - Define @default and @assert paragraphs in Doxyfile Modified Paths: -------------- trunk/pmplib/doc/Doxyfile trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp/pmp.c Modified: trunk/pmplib/doc/Doxyfile =================================================================== --- trunk/pmplib/doc/Doxyfile 2007-01-07 19:38:17 UTC (rev 251) +++ trunk/pmplib/doc/Doxyfile 2007-01-08 09:01:37 UTC (rev 252) @@ -34,7 +34,8 @@ INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 -ALIASES = +ALIASES = "assert=\par Assertions:\n" \ + "default=\par Default Value:\n" OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO BUILTIN_STL_SUPPORT = NO Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-07 19:38:17 UTC (rev 251) +++ trunk/pmplib/include/pmp.h 2007-01-08 09:01:37 UTC (rev 252) @@ -28,12 +28,26 @@ #define PMPAPI __declspec(dllexport) #else #define PMPAPI -#endif +#endif/*PMP_EXPORTS*/ #ifdef __cplusplus extern "C" { #endif/*__cplusplus*/ + +/** + * @mainpage PMPlib API Documentation + * + * @section intro Introduction + * + * This is the documentation for the PMPlib API. + */ + +/** + * \addtogroup pmp PMPlib APIs + * @{ + */ + /* * Forward structure declarations. */ @@ -129,7 +143,14 @@ /** - * The root interface for a portable media device. + * The root interface for portable media device. + * This structure represents the basic interface that is common to any + * portal media devices. It defines several member variables and pure + * virtual functions to access the implementation for the target device. + * Use pmplib_create() function to obtain the instance suitable for a + * specific device. + * + * @see pmplib_create */ struct tag_pmp_t { /** @@ -237,6 +258,11 @@ }; typedef result_t (*pmp_create_t)(pmp_t** pmp, const ucs2char_t* path_to_device, const char *devid); + +/** + * Prototype for the callback function for receiving device identifiers. + * + */ 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); @@ -245,20 +271,186 @@ 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); +PMPAPI void pmp_copy_environment(pmp_environment_t* dst, const pmp_environment_t* src); -struct tag_pmplib_t; typedef struct tag_pmplib_t pmplib_t; + + + + +/** + * @defgroup pmplib PMPlib Helper API + * + * This API provides the utility for selecting a PMPlib driver from a number + * of installed ones. Because the PMPlib project implements a number of + * drivers for different portable media devices, an application must choose + * a suitable driver that matches to the target device. Using this API, an + * application can query a driver suitable for the portable media device + * specified by the mount location (root directory of the device) and/or + * string identifier. An application can also enumerate the string + * identifiers of the drivers installed in the system. + * + * An application must call pmplib_init() function to initialize the API + * and obtain the pointer to a ::pmplib_t instance that is used for subsequent + * calls of the API. + * The application can query an interface to a PMPlib driver by using + * pmplib_create() function. A list of installed device identifiers is + * obtained by receiving callback notifications invoked by + * pmplib_enumerate_devid() function. The application must terminate this + * API by calling pmplib_finish() function. + * + * This is an example of querying an interface to the driver that matches to + * the device connected to the mount point (Win32 path "D:\"): + * + * @code + * #include <ucs2char.h> + * #include <pmp.h> + * + * int main(int argc, char *argv[]) + * { + * result_t ret = 0; + * pmp_t* pmp = NULL; + * pmplib_t* pmplib = NULL; + * static const ucs2char_t path[] = {'D',':','\\',0}; + * + * // Initialize the PMPlib Helper API. + * if ((ret = pmplib_init(&pmplib)) != 0) { + * // Failed to initialize the API. + * goto error_exit; + * } + * + * // Query an interface to the PMPlib driver suitable for the path. + * if ((ret = pmplib_create(pmplib, &pmp, path, NULL)) != 0) { + * // Failed to find a suitable driver. + * goto error_exit; + * } + * + * // Processing with the driver. + * ... + * + * // Release the driver. + * pmp->release(pmp); + * + * // Terminate the helper API. + * pmplib_finish(pmplib); + * return 0; + * + * error_exit: + * // Error handling. + * ... + * return 1; + * } + * @endcode + * + * @{ + */ + +struct tag_pmplib_t; + +/** + * The structure for the PMPlib Helper API. + * An application should use a pointer to this structure as a handle value + * for this API. Call pmplib_init() function to obtain a pointer to this + * structure and pmplib_finish() function to terminate this API. Access to + * a member in this structure is prohibited since it is reserved for the + * internal use of the library implementation only. + */ +typedef struct tag_pmplib_t pmplib_t; + +/** + * Initialize the PMPlib helper library. + * + * This function loads the drivers installed in the system to prepare them. + * + * @retval ptr_pmplib The pointer to the buffer to receive the pointer + * to the ::pmplib_t instance initialized by this + * function. + * @retval result_t The status code. + * + * @assert + * @code ptr_pmplib != NULL @endcode + * + * @note + * Call this function before using any other functions in this API. + */ PMPAPI result_t pmplib_init(pmplib_t** ptr_pmplib); +/** + * Uninitialize the PMPlib helper library. + * + * This function detatch the drivers loaded by pmplib_init() function. + * + * @param pmplib The pointer to the ::pmplib_t instance. + * @retval result_t The status code. + * + * @assert + * @code ptr_pmplib != NULL @endcode + * + * @note + * Call this function to terminate this API. + */ 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); +/** + * Query a driver and create a ::pmp_t instance. + * + * This function queries the driver suitable for the portable media device + * specified by the mount location and/or identifier, and returns the + * interface to the driver (::pmp_t instance). An application must specify + * parameter \a path_to_device. If parameter \a id is not \c NULL, this + * function constructs a ::pmp_t instance of the driver with the device + * identifier. If the parameter \a id is \c NULL, this function tries to + * recognize the model of the device based on the content under the location + * (\a path_to_device). If successful, the interface to the driver will be + * returned to the \a pmp argument. + * + * @param pmplib The pointer to the ::pmplib_t instance. + * @param path_to_device A UCS-2 string representing the location of the + * target device. This parameter cannot be \c NULL. + * @param id A C-string representing the device identifier of + * the target device. If this argument is \c NULL, + * this function tries to recognize the model of the + * device based on the location (\a path_to_device). + * @retval ptr_pmp The pointer to the buffer to receive the pointer + * to the driver interface (::pmp_t instance). + * @retval result_t The status code. + * + * @assert + * @code pmplib != NULL @endcode + * @code ptr_pmp != NULL @endcode + * @code path_to_device != NULL @endcode + */ +PMPAPI result_t pmplib_create(pmplib_t* pmplib, pmp_t** ptr_pmp, const ucs2char_t* path_to_device, const char *id); +/** + * Enumerate device identifiers of the installed drivers. + * + * This function enumerates the device identifiers of the installed drivers, + * and invokes the \a callback function for each identifier. + * + * @param pmplib The pointer to the ::pmplib_t instance. + * @param callback The pointer to the callback function to receive + * device identifiers. + * @param instance A user-defined instance value. The callback + * function will receive the same value so that it can + * distinguish the caller. + * @retval result_t The status code. + * + * @assert + * @code pmplib != NULL @endcode + * @code callback != NULL @endcode + */ 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*/ Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-01-07 19:38:17 UTC (rev 251) +++ trunk/pmplib/lib/pmp/pmp.c 2007-01-08 09:01:37 UTC (rev 252) @@ -63,7 +63,7 @@ return 0; } -void pmplib_copy_environment(pmp_environment_t* dst, const pmp_environment_t* src) +void pmp_copy_environment(pmp_environment_t* dst, const pmp_environment_t* src) { memcpy(dst, src, sizeof(*src)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-12 17:30:24
|
Revision: 260 http://svn.sourceforge.net/pmplib/?rev=260&view=rev Author: nyaochi Date: 2007-01-12 09:30:24 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Separate pmp_device_description_t from pmp_environment_t. Modified Paths: -------------- trunk/pmplib/doc/Doxyfile trunk/pmplib/frontend/easypmp/cui/device.c trunk/pmplib/frontend/easypmp/win32gui/preference.h trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 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/doc/Doxyfile =================================================================== --- trunk/pmplib/doc/Doxyfile 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/doc/Doxyfile 2007-01-12 17:30:24 UTC (rev 260) @@ -83,10 +83,8 @@ #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = .. -FILE_PATTERNS = *.c \ - *.cpp \ - *.h \ +INPUT = ../include +FILE_PATTERNS = *.h \ *.dox RECURSIVE = YES EXCLUDE = ../libltdl \ Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-12 17:30:24 UTC (rev 260) @@ -59,13 +59,13 @@ void device_show_information(pmp_t* pmp, FILE *fp) { - fprintf(fp, "Device identifier: %s\n", pmp->env.id); - fprintf(fp, " Product name: %s\n", pmp->env.name); - fprintf(fp, " Firmware mode: %s\n", pmp->env.mode); - fprintf(fp, " Firmware version: %s\n", pmp->env.version); - fprintf(fp, " Default language: %s\n", pmp->env.language); + fprintf(fp, "Device identifier: %s\n", pmp->decl.id); + fprintf(fp, " Product name: %s\n", pmp->decl.name); + fprintf(fp, " Firmware mode: %s\n", pmp->decl.mode); + fprintf(fp, " Firmware version: %s\n", pmp->decl.version); + fprintf(fp, " Default language: %s\n", pmp->decl.language); + fprints(fp, " Root directory: %s\n", pmp->env.path_to_root.path); - device_show_path(fp, " Music directory: %s\n", pmp->env.path_to_music.path); device_show_path(fp, " Playlist directory: %s\n", pmp->env.path_to_playlist.path); Modified: trunk/pmplib/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-01-12 17:30:24 UTC (rev 260) @@ -200,16 +200,16 @@ if (pmp) { strPlayerLocation = UCS2CT(pmp->env.path_to_root.path); - strPlayerIdentifier = A2CT(pmp->env.id); - strPlayerDescription = A2CT(pmp->env.name); + strPlayerIdentifier = A2CT(pmp->decl.id); + strPlayerDescription = A2CT(pmp->decl.name); strPlayerDescription += _T(""); - if (*pmp->env.version) { + if (*pmp->decl.version) { strPlayerDescription += _T(" "); - strPlayerDescription += A2CT(pmp->env.version); + strPlayerDescription += A2CT(pmp->decl.version); } - if (*pmp->env.mode) { + if (*pmp->decl.mode) { strPlayerDescription += _T(" "); - strPlayerDescription += A2CT(pmp->env.mode); + strPlayerDescription += A2CT(pmp->decl.mode); } } else { strPlayerIdentifier = _T(""); Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-01-12 17:30:24 UTC (rev 260) @@ -670,11 +670,11 @@ USES_CONVERSION; write_log(LL_INFO, _T("[Player information]")); - write_log(LL_INFO, _T("Device identifier: %s"), A2CT(pmp->env.id)); - write_log(LL_INFO, _T("Product name: %s"), A2CT(pmp->env.name)); - write_log(LL_TRACE, _T("Firmware mode: %s"), A2CT(pmp->env.mode)); - write_log(LL_INFO, _T("Firmware version: %s"), A2CT(pmp->env.version)); - write_log(LL_TRACE, _T("Default language: %s"), A2CT(pmp->env.language)); + write_log(LL_INFO, _T("Device identifier: %s"), A2CT(pmp->decl.id)); + write_log(LL_INFO, _T("Product name: %s"), A2CT(pmp->decl.name)); + write_log(LL_TRACE, _T("Firmware mode: %s"), A2CT(pmp->decl.mode)); + write_log(LL_INFO, _T("Firmware version: %s"), A2CT(pmp->decl.version)); + write_log(LL_TRACE, _T("Default language: %s"), A2CT(pmp->decl.language)); write_log(LL_TRACE, _T("Root directory: %s"), UCS2CT(pmp->env.path_to_root.path)); write_log(LL_TRACE, _T("Music directory: %s"), UCS2CT(pmp->env.path_to_music.path)); write_log(LL_TRACE, _T("Playlist directory: %s"), UCS2CT(pmp->env.path_to_playlist.path)); Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/include/pmp.h 2007-01-12 17:30:24 UTC (rev 260) @@ -132,7 +132,9 @@ char mode[128]; /**< Firmware mode. */ char language[128]; /**< Firmware language. */ char version[128]; /**< Firmware version. */ +} pmp_device_description_t; +typedef struct { pmp_pathenv_t path_to_root; /**< Path to the root directory */ pmp_pathenv_t path_to_music; /**< Path to the music files */ pmp_pathenv_t path_to_playlist; /**< Path to the playlist files */ @@ -176,6 +178,8 @@ */ uint32_t flag; + pmp_device_description_t decl; + /** * Portable media device environment. */ @@ -281,14 +285,15 @@ /** * @defgroup pmplib PMPlib Helper API * - * This API provides the utility for selecting a PMPlib driver from a number - * of installed ones. Because the PMPlib project implements a number of - * drivers for different portable media devices, an application must choose - * a suitable driver that matches to the target device. Using this API, an - * application can query a driver suitable for the portable media device - * specified by the mount location (root directory of the device) and/or - * string identifier. An application can also enumerate the string - * identifiers of the drivers installed in the system. + * The PMPlib Helper API provides the utility for choosing a suitable PMPlib + * driver from a number of installed drivers. Because the PMPlib project + * implements a number of drivers for different portable media devices, an + * application must choose a suitable driver that matches to the target + * device. By using this API, an application can query a driver suitable for + * the portable media device specified by the mount location (root directory + * of the device) and/or the string identifier of a driver. An application can + * also enumerate the string identifiers of the drivers available in the + * system. * * An application must call pmplib_init() function to initialize the API * and obtain the pointer to a ::pmplib_t instance that is used for subsequent @@ -353,7 +358,7 @@ * for this API. Call pmplib_init() function to obtain a pointer to this * structure and pmplib_finish() function to terminate this API. Access to * a member in this structure is prohibited since it is reserved for the - * internal use of the library implementation only. + * internal use of the library only. */ typedef struct tag_pmplib_t pmplib_t; @@ -398,11 +403,11 @@ * specified by the mount location and/or identifier, and returns the * interface to the driver (::pmp_t instance). An application must specify * parameter \a path_to_device. If parameter \a id is not \c NULL, this - * function constructs a ::pmp_t instance of the driver with the device - * identifier. If the parameter \a id is \c NULL, this function tries to - * recognize the model of the device based on the content under the location - * (\a path_to_device). If successful, the interface to the driver will be - * returned to the \a pmp argument. + * function obtains the interface to the driver with the device identifier + * specified in \a id parameter. If the parameter \a id is \c NULL, this + * function tries to recognize the model of the device based on the content + * of the files located under \a path_to_device. If successful, the interface + * to the driver will be returned in the \a pmp argument. * * @param pmplib The pointer to the ::pmplib_t instance. * @param path_to_device A UCS-2 string representing the location of the @@ -432,8 +437,7 @@ * @param callback The pointer to the callback function to receive * device identifiers. * @param instance A user-defined instance value. The callback - * function will receive the same value so that it can - * distinguish the caller. + * function will receive the same value. * @retval result_t The status code. * * @assert Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-12 17:30:24 UTC (rev 260) @@ -345,12 +345,12 @@ memcpy(&pmpi->env, &env, sizeof(env)); // Initialize the (exportable) env. + strcpy(pmp->decl.id, md->id); + strcpy(pmp->decl.name, md->name); + strcpy(pmp->decl.mode, md->mode); + strcpy(pmp->decl.language, pmpi->env.language); + strcpy(pmp->decl.version, pmpi->env.version); pmpenv = &pmp->env; - strcpy(pmpenv->id, md->id); - strcpy(pmpenv->name, md->name); - strcpy(pmpenv->mode, md->mode); - strcpy(pmpenv->language, pmpi->env.language); - strcpy(pmpenv->version, pmpi->env.version); pmpenv->path_to_root.flag = PMPPEF_SUPPORT | PMPPEF_CONSTANT; ucs2cpy(pmpenv->path_to_root.path, pmpi->env.path_to_root); pmpenv->path_to_music.flag = PMPPEF_SUPPORT | PMPPEF_RECURSIVE; Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-12 17:30:24 UTC (rev 260) @@ -356,12 +356,12 @@ memcpy(&pmpi->env, &env, sizeof(env)); // Initialize the (exportable) env. + strcpy(pmp->decl.id, md->id); + strcpy(pmp->decl.name, md->name); + strcpy(pmp->decl.mode, md->mode); + strcpy(pmp->decl.language, pmpi->env.language); + strcpy(pmp->decl.version, pmpi->env.version); pmpenv = &pmp->env; - strcpy(pmpenv->id, md->id); - strcpy(pmpenv->name, md->name); - strcpy(pmpenv->mode, md->mode); - strcpy(pmpenv->language, pmpi->env.language); - strcpy(pmpenv->version, pmpi->env.version); pmpenv->path_to_root.flag = PMPPEF_SUPPORT | PMPPEF_CONSTANT; ucs2cpy(pmpenv->path_to_root.path, pmpi->env.path_to_root); pmpenv->path_to_music.flag = PMPPEF_SUPPORT | PMPPEF_RECURSIVE; Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-12 17:30:24 UTC (rev 260) @@ -197,17 +197,17 @@ // Set model information. switch (model) { case MODEL_IRIVER_H100: - strcpy(pmp->env.id, MODELID_H100); - strcpy(pmp->env.name, "iRiver H100 series"); + strcpy(pmp->decl.id, MODELID_H100); + strcpy(pmp->decl.name, "iRiver H100 series"); break; case MODEL_IRIVER_H300: - strcpy(pmp->env.id, MODELID_H300); - strcpy(pmp->env.name, "iRiver H300 series"); + strcpy(pmp->decl.id, MODELID_H300); + strcpy(pmp->decl.name, "iRiver H300 series"); break; } - strcpy(pmp->env.mode, "UM"); - strcpy(pmp->env.language, "N/A"); - pmp->env.version[0] = 0; // Unknown version + strcpy(pmp->decl.mode, "UM"); + strcpy(pmp->decl.language, "N/A"); + strcpy(pmp->decl.version, "Unknown"); // Set enviroments. pmpenv = &pmp->env; Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-11 17:11:53 UTC (rev 259) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-12 17:30:24 UTC (rev 260) @@ -408,14 +408,16 @@ // Initialize the internal variables. memcpy(&pmpi->env, &env, sizeof(env)); - + + // Initialize the device description. + strcpy(pmp->decl.id, md->id); + strcpy(pmp->decl.name, pmpi->env.model.name); + strcpy(pmp->decl.mode, pmpi->env.model.mode); + strcpy(pmp->decl.language, pmpi->env.model.language); + strcpy(pmp->decl.version, pmpi->env.model.version); + // Initialize the (exportable) env. pmpenv = &pmp->env; - strcpy(pmpenv->id, md->id); - strcpy(pmpenv->name, pmpi->env.model.name); - strcpy(pmpenv->mode, pmpi->env.model.mode); - strcpy(pmpenv->language, pmpi->env.model.language); - strcpy(pmpenv->version, pmpi->env.model.version); pmpenv->path_to_root.flag = PMPPEF_SUPPORT | PMPPEF_CONSTANT; ucs2cpy(pmpenv->path_to_root.path, pmpi->env.path_to_root); pmpenv->path_to_music.flag = PMPPEF_SUPPORT | PMPPEF_RECURSIVE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-12 17:38:13
|
Revision: 261 http://svn.sourceforge.net/pmplib/?rev=261&view=rev Author: nyaochi Date: 2007-01-12 09:38:12 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Implement querying supported firmware ranges. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/device.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/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-12 17:30:24 UTC (rev 260) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-12 17:38:12 UTC (rev 261) @@ -63,6 +63,7 @@ fprintf(fp, " Product name: %s\n", pmp->decl.name); fprintf(fp, " Firmware mode: %s\n", pmp->decl.mode); fprintf(fp, " Firmware version: %s\n", pmp->decl.version); + fprintf(fp, " Firmware range: %s to %s\n", pmp->decl.min_version, pmp->decl.max_version); fprintf(fp, " Default language: %s\n", pmp->decl.language); fprints(fp, " Root directory: %s\n", pmp->env.path_to_root.path); Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-12 17:30:24 UTC (rev 260) +++ trunk/pmplib/include/pmp.h 2007-01-12 17:38:12 UTC (rev 261) @@ -132,6 +132,8 @@ char mode[128]; /**< Firmware mode. */ char language[128]; /**< Firmware language. */ char version[128]; /**< Firmware version. */ + char min_version[128]; /**< Minimum firmware version. */ + char max_version[128]; /**< Maximum firmware version. */ } pmp_device_description_t; typedef struct { Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-12 17:30:24 UTC (rev 260) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-12 17:38:12 UTC (rev 261) @@ -350,6 +350,9 @@ strcpy(pmp->decl.mode, md->mode); strcpy(pmp->decl.language, pmpi->env.language); strcpy(pmp->decl.version, pmpi->env.version); + strcpy(pmp->decl.min_version, md->min_version); + strcpy(pmp->decl.max_version, md->max_version); + pmpenv = &pmp->env; pmpenv->path_to_root.flag = PMPPEF_SUPPORT | PMPPEF_CONSTANT; ucs2cpy(pmpenv->path_to_root.path, pmpi->env.path_to_root); Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-12 17:30:24 UTC (rev 260) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-12 17:38:12 UTC (rev 261) @@ -361,6 +361,9 @@ strcpy(pmp->decl.mode, md->mode); strcpy(pmp->decl.language, pmpi->env.language); strcpy(pmp->decl.version, pmpi->env.version); + strcpy(pmp->decl.min_version, md->min_version); + strcpy(pmp->decl.max_version, md->max_version); + pmpenv = &pmp->env; pmpenv->path_to_root.flag = PMPPEF_SUPPORT | PMPPEF_CONSTANT; ucs2cpy(pmpenv->path_to_root.path, pmpi->env.path_to_root); Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-12 17:30:24 UTC (rev 260) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-12 17:38:12 UTC (rev 261) @@ -208,6 +208,8 @@ strcpy(pmp->decl.mode, "UM"); strcpy(pmp->decl.language, "N/A"); strcpy(pmp->decl.version, "Unknown"); + strcpy(pmp->decl.max_version, "N/A"); + strcpy(pmp->decl.min_version, "N/A"); // Set enviroments. pmpenv = &pmp->env; Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-12 17:30:24 UTC (rev 260) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-12 17:38:12 UTC (rev 261) @@ -415,6 +415,8 @@ strcpy(pmp->decl.mode, pmpi->env.model.mode); strcpy(pmp->decl.language, pmpi->env.model.language); strcpy(pmp->decl.version, pmpi->env.model.version); + strcpy(pmp->decl.min_version, md->min_version); + strcpy(pmp->decl.max_version, md->max_version); // Initialize the (exportable) env. pmpenv = &pmp->env; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-12 18:07:32
|
Revision: 263 http://svn.sourceforge.net/pmplib/?rev=263&view=rev Author: nyaochi Date: 2007-01-12 10:07:26 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Add pmp_device_description_t::manufacturer field. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/device.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/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-12 17:43:13 UTC (rev 262) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-12 18:07:26 UTC (rev 263) @@ -60,6 +60,7 @@ void device_show_information(pmp_t* pmp, FILE *fp) { fprintf(fp, "Device identifier: %s\n", pmp->decl.id); + fprintf(fp, " Manufacturer: %s\n", pmp->decl.manufacturer); fprintf(fp, " Product name: %s\n", pmp->decl.name); fprintf(fp, " Firmware mode: %s\n", pmp->decl.mode); fprintf(fp, " Firmware version: %s\n", pmp->decl.version); Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-12 17:43:13 UTC (rev 262) +++ trunk/pmplib/include/pmp.h 2007-01-12 18:07:26 UTC (rev 263) @@ -126,14 +126,31 @@ ucs2char_t path[MAX_PATH]; } pmp_pathenv_t; +enum { + PMP_DECLSIZE = 128, +}; + +/** + * PMP device decription. + * This structure stores information about a PMP device. + */ typedef struct { - 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. */ - char min_version[128]; /**< Minimum firmware version. */ - char max_version[128]; /**< Maximum firmware version. */ + /** Device identifier (e.g., "iriver_e10_ums_1.00-1.04"). */ + char id[PMP_DECLSIZE]; + /** Manufacturer (e.g., "iriver"). */ + char manufacturer[PMP_DECLSIZE]; + /** Model name (e.g., "E10"). */ + char name[PMP_DECLSIZE]; + /** Firmware mode (e.g., "UM"). */ + char mode[PMP_DECLSIZE]; + /** Firmware default language (e.g., "JP"). */ + char language[PMP_DECLSIZE]; + /** Firmware version (e.g., "1.4"). */ + char version[PMP_DECLSIZE]; + /** Minimum firmware version (e.g., "1.0"). */ + char min_version[PMP_DECLSIZE]; + /** Maximum firmware version (e.g., "1.4"). */ + char max_version[PMP_DECLSIZE]; } pmp_device_description_t; typedef struct { Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-12 17:43:13 UTC (rev 262) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-12 18:07:26 UTC (rev 263) @@ -46,6 +46,7 @@ typedef struct { const char *id; + const char *manufacturer; const char *name; const char *mode; const char *min_version; @@ -60,21 +61,21 @@ static const ip2model_descriptor_t g_model_descriptions[] = { { - "iriver_h10jr_ums_1.00-1.61", "H10Jr UMS", "UM", + "iriver_h10jr_ums_1.00-1.61", "iriver", "H10Jr UMS", "UM", "1.00", "1.61", "System\\H10_Jr.SYS", "System\\H10_Jr.DAT", "System\\H10_Jr.IDX", "Music\\", "Playlists\\", ".plp", }, { - "iriver_u10_ums_1.00-1.65", "U10 UMS", "UM", + "iriver_u10_ums_1.00-1.65", "iriver", "U10 UMS", "UM", "1.00", "1.65", "System\\U10.SYS", "System\\U10.dat", "System\\U10.idx", "Music\\", "Playlists\\", ".plp", }, { - NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -346,6 +347,7 @@ // Initialize the (exportable) env. strcpy(pmp->decl.id, md->id); + strcpy(pmp->decl.manufacturer, md->manufacturer); strcpy(pmp->decl.name, md->name); strcpy(pmp->decl.mode, md->mode); strcpy(pmp->decl.language, pmpi->env.language); Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-12 17:43:13 UTC (rev 262) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-12 18:07:26 UTC (rev 263) @@ -47,6 +47,7 @@ typedef struct { const char *id; + const char *manufacturer; const char *name; const char *mode; const char *min_version; @@ -62,14 +63,14 @@ static const ip3model_descriptor_t g_model_descriptions[] = { { - "iriver_e10_ums_1.00-1.04", "E10 UMS", "UM", + "iriver_e10_ums_1.00-1.04", "iriver", "E10 UMS", "UM", "1.00", "1.04", "System\\E10.SYS", "System\\db.dat", "System\\db.dic", "System\\db.idx", "", "Playlists\\", ".plp", }, { - NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -357,6 +358,7 @@ // Initialize the (exportable) env. strcpy(pmp->decl.id, md->id); + strcpy(pmp->decl.manufacturer, md->manufacturer); strcpy(pmp->decl.name, md->name); strcpy(pmp->decl.mode, md->mode); strcpy(pmp->decl.language, pmpi->env.language); Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-12 17:43:13 UTC (rev 262) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-12 18:07:26 UTC (rev 263) @@ -198,11 +198,13 @@ switch (model) { case MODEL_IRIVER_H100: strcpy(pmp->decl.id, MODELID_H100); - strcpy(pmp->decl.name, "iRiver H100 series"); + strcpy(pmp->decl.manufacturer, "iriver"); + strcpy(pmp->decl.name, "H100 series"); break; case MODEL_IRIVER_H300: strcpy(pmp->decl.id, MODELID_H300); - strcpy(pmp->decl.name, "iRiver H300 series"); + strcpy(pmp->decl.manufacturer, "iriver"); + strcpy(pmp->decl.name, "H300 series"); break; } strcpy(pmp->decl.mode, "UM"); Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-12 17:43:13 UTC (rev 262) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-12 18:07:26 UTC (rev 263) @@ -47,6 +47,7 @@ typedef struct { const char *id; + const char *manufacturer; const char *name; uint32_t capacity; const char *mode; @@ -63,7 +64,7 @@ static const pp1model_descriptor_t g_model_descriptions[] = { { - "iriver_h10_5/6gb_ums_2.04-2.53", "H10 5GB/6GB UMS", + "iriver_h10_5/6gb_ums_2.04-2.53", "iriver", "H10 5GB/6GB UMS", 5, "UM", "2.04", "2.53", "System\\H10.mi4", "System\\DATA\\H10DB.hdr", "Media\\Music\\", "Media\\Playlist\\", @@ -71,7 +72,7 @@ hdr_init_h10_5gb_ums_0205_0253, iriver_h10_parse_model }, { - "iriver_h10pure_5/6gb_ums_2.04-2.51", "H10Pure 5GB/6GB UMS", + "iriver_h10pure_5/6gb_ums_2.04-2.51", "iriver", "H10Pure 5GB/6GB UMS", 5, "UM", "2.04", "2.51", "System\\H10_5GP.mi4", "System\\DATA\\H10DB.hdr", "Media\\Music\\", "Media\\Playlist\\", @@ -79,7 +80,7 @@ hdr_init_h10_5gb_ums_0205_0253, iriver_h10_parse_model }, { - "iriver_h10_5/6gb_mtp_2.03-2.10", "H10 5GB/6GB MTP", + "iriver_h10_5/6gb_mtp_2.03-2.10", "iriver", "H10 5GB/6GB MTP", 5, "MT", "2.03", "2.10", "System\\H10.mi4", "System\\DATA\\H10DB.hdr", "Music\\", "Playlists\\", @@ -87,7 +88,7 @@ hdr_init_h10_5gb_mtp_0203_0210, iriver_h10_parse_model }, { - "iriver_h10pure_5/6gb_mtp_2.03-2.10", "H10Pure 5GB/6GB MTP", + "iriver_h10pure_5/6gb_mtp_2.03-2.10", "iriver", "H10Pure 5GB/6GB MTP", 5, "MT", "2.03", "2.10", "System\\H10EMP.mi4", "System\\DATA\\H10DB.hdr", "Music\\", "Playlists\\", @@ -95,7 +96,7 @@ hdr_init_h10_5gb_mtp_0203_0210, iriver_h10_parse_model }, { - "iriver_h10_5/6gb_mtp_2.51", "H10 5GB/6GB MTP", + "iriver_h10_5/6gb_mtp_2.51", "iriver", "H10 5GB/6GB MTP", 5, "MT", "2.51", "2.51", "System\\H10.mi4", "System\\DATA\\H10DB.hdr", "Music\\", "Playlists\\", @@ -103,7 +104,7 @@ hdr_init_h10_5gb_mtp_0251, iriver_h10_parse_model }, { - "iriver_h10pure_5/6gb_mtp_2.51", "H10Pure 5GB/6GB MTP", + "iriver_h10pure_5/6gb_mtp_2.51", "iriver", "H10Pure 5GB/6GB MTP", 5, "MT", "2.51", "2.51", "System\\H10EMP.mi4", "System\\DATA\\H10DB.hdr", "Music\\", "Playlists\\", @@ -111,7 +112,7 @@ hdr_init_h10_5gb_mtp_0251, iriver_h10_parse_model }, { - "iriver_h10_20gb_mtp_1.00-1.02", "H10 20GB MTP", + "iriver_h10_20gb_mtp_1.00-1.02", "iriver", "H10 20GB MTP", 20, "MT", "1.00", "1.02", "System\\H10_20GC.mi4", "System\\DATA\\H10DB.hdr", "Music\\", "Playlists\\", @@ -119,7 +120,7 @@ hdr_init_h10_20gb_mtp_0100_0102, iriver_h10_parse_model }, { - "iriver_h10_20gb_mtp_2.51", "H10 20GB MTP", + "iriver_h10_20gb_mtp_2.51", "iriver", "H10 20GB MTP", 20, "MT", "2.51", "2.51", "System\\H10_20GC.mi4", "System\\DATA\\H10DB.hdr", "Music\\", "Playlists\\", @@ -127,7 +128,7 @@ hdr_init_h10_20gb_mtp_0251, iriver_h10_parse_model }, { - "medion_mdjuke220", "MEDION MDJUKE220", + "medion_mdjuke220", "MEDION", "MDJUKE220", 20, "UM", "1.4.2", "1.4.2", "SYSTEM\\JUKEBOX.mi4", "SYSTEM\\DATA\\PP5000.HDR", "MyJukeBox\\MUSIC\\", "MyJukeBox\\Playlist\\", @@ -135,7 +136,7 @@ hdr_init_medion_mdjuke220, medion_mdjuke220_parse_model }, { - "medion_mdjuke440", "MEDION MDJUKE440", + "medion_mdjuke440", "MEDION", "MDJUKE440", 20, "UM", "1.5.5", "1.5.5", "SYSTEM\\JUKEBOX.mi4", "SYSTEM\\DATA\\PP5000.HDR", "MyJukeBox\\MUSIC\\", "MyJukeBox\\Playlist\\", @@ -143,7 +144,7 @@ hdr_init_medion_mdjuke440, medion_mdjuke220_parse_model }, { - "samsung_yh820", "Samsung YH-820", + "samsung_yh820", "Samsung", "YH-820", 5, "UM", "3.00", "3.00", "SYSTEM\\FW_YH820.mi4", "System\\DATA\\PP5000.HDR", "System\\MUSIC\\", "System\\PLAYLIST\\", @@ -151,7 +152,7 @@ hdr_init_samsung_yh820, samsung_parse_model }, { - "samsung_yh920", "Samsung YH-920", + "samsung_yh920", "Samsung", "YH-920", 20, "UM", "5.15", "5.15", "SYSTEM\\FW_YH920.mi4", "System\\DATA\\PP5000.HDR", "System\\MUSIC\\", "System\\PLAYLIST\\", @@ -159,7 +160,7 @@ hdr_init_samsung_yh920, samsung_parse_model }, { - "samsung_yh925", "Samsung YH-925", + "samsung_yh925", "Samsung", "YH-925", 5, "UM", "1.61", "1.61", "SYSTEM\\FW_YH925.mi4", "System\\DATA\\PP5000.HDR", "System\\MUSIC\\", "System\\PLAYLIST\\", @@ -167,7 +168,7 @@ hdr_init_samsung_yh925, samsung_parse_model }, { - "philips_hdd6320", "Philips HDD6320", + "philips_hdd6320", "Philips", "HDD6320", 20, "UM", "5.40", "5.40", "SYSTEM\\FWImage.ebn", "System\\DATA\\PP5000.HDR", "Music\\", "Playlists\\", @@ -175,7 +176,7 @@ hdr_init_philips_hdd6320, philips_hdd6320_parse_model }, { - "msi_megaplayer540", "MSI MEGA PLAYER 540", + "msi_megaplayer540", "MSI", "MEGA PLAYER 540", 8, "UM", "01.00.16", "01.00.16", "SYSTEM\\PP5020.mi4", "System\\DATA\\PP5000.HDR", "MUSIC\\", "Playlists\\", @@ -184,7 +185,7 @@ }, #if 0 { - "sirius_s50", "Sirius S50", + "sirius_s50", "Sirius", "S50", 1, "UM", "0.00", "0.00", "SYSTEM\\config\\sysinfo.cfg", "SYSTEM\\DB\\SONG\\Xena.HDR", "SYSTEM\\MEDIA\\MP3\\", "SYSTEM\\MEDIA\\PLAYLIST\\", @@ -193,7 +194,7 @@ }, #endif { - NULL, NULL, + NULL, NULL, NULL, 0, NULL, 0, 0, NULL, NULL, NULL, NULL, @@ -411,6 +412,7 @@ // Initialize the device description. strcpy(pmp->decl.id, md->id); + strcpy(pmp->decl.manufacturer, md->manufacturer); strcpy(pmp->decl.name, md->name); strcpy(pmp->decl.mode, md->mode); strcpy(pmp->decl.language, pmpi->env.model.language); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-16 16:38:31
|
Revision: 264 http://svn.sourceforge.net/pmplib/?rev=264&view=rev Author: nyaochi Date: 2007-01-16 08:38:24 -0800 (Tue, 16 Jan 2007) Log Message: ----------- Rename pmp_environment_t to pmp_device_environment_t Modified Paths: -------------- trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp/pmp.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 Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-12 18:07:26 UTC (rev 263) +++ trunk/pmplib/include/pmp.h 2007-01-16 16:38:24 UTC (rev 264) @@ -126,16 +126,21 @@ ucs2char_t path[MAX_PATH]; } pmp_pathenv_t; -enum { - PMP_DECLSIZE = 128, -}; +/** Maximum size, in chars, of a device description. */ +#define PMP_DECLSIZE (128) +/** Unavailable field of a device description. */ +#define PMP_DECLUNAVAIL ("***") /** * PMP device decription. - * This structure stores information about a PMP device. + * This structure stores information about a PMP device. An PMP device driver + * should fill these fields properly so that an application can obtain the + * information about the device. An empty value represents the uncertainity + * of the field value at this stage. The value ::PMP_DECLUNAVAIL (\c "***") + * implies the unavailability of the field value for the device. */ typedef struct { - /** Device identifier (e.g., "iriver_e10_ums_1.00-1.04"). */ + /** Device identifier (e.g., "iriver_e10_ums_1.0-1.4"). */ char id[PMP_DECLSIZE]; /** Manufacturer (e.g., "iriver"). */ char manufacturer[PMP_DECLSIZE]; @@ -153,13 +158,17 @@ char max_version[PMP_DECLSIZE]; } pmp_device_description_t; +/** + * PMP device environment. + * This structure stores + */ typedef struct { pmp_pathenv_t path_to_root; /**< Path to the root directory */ pmp_pathenv_t path_to_music; /**< Path to the music files */ pmp_pathenv_t path_to_playlist; /**< Path to the playlist files */ pmp_pathenv_t path_to_photo; /**< Path to the photo files */ ucs2char_t playlist_ext[MAX_PATH]; -} pmp_environment_t; +} pmp_device_environment_t; @@ -202,7 +211,7 @@ /** * Portable media device environment. */ - pmp_environment_t env; + pmp_device_environment_t env; /** * The pointer to pmp_music_t interface. @@ -294,7 +303,7 @@ 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); -PMPAPI void pmp_copy_environment(pmp_environment_t* dst, const pmp_environment_t* src); +PMPAPI void pmp_copy_environment(pmp_device_environment_t* dst, const pmp_device_environment_t* src); Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-01-12 18:07:26 UTC (rev 263) +++ trunk/pmplib/lib/pmp/pmp.c 2007-01-16 16:38:24 UTC (rev 264) @@ -63,7 +63,7 @@ return 0; } -void pmp_copy_environment(pmp_environment_t* dst, const pmp_environment_t* src) +void pmp_copy_environment(pmp_device_environment_t* dst, const pmp_device_environment_t* src) { memcpy(dst, src, sizeof(*src)); } Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-12 18:07:26 UTC (rev 263) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-01-16 16:38:24 UTC (rev 264) @@ -298,7 +298,7 @@ pmp_internal_t* pmpi = NULL; const ip2model_descriptor_t* md = NULL; ip2_environment_t env; - pmp_environment_t* pmpenv = NULL; + pmp_device_environment_t* pmpenv = NULL; *ptr_pmp = 0; Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-12 18:07:26 UTC (rev 263) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-16 16:38:24 UTC (rev 264) @@ -309,7 +309,7 @@ pmp_internal_t* pmpi = NULL; const ip3model_descriptor_t* md = NULL; ip3_environment_t env; - pmp_environment_t* pmpenv = NULL; + pmp_device_environment_t* pmpenv = NULL; *ptr_pmp = 0; Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-12 18:07:26 UTC (rev 263) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-01-16 16:38:24 UTC (rev 264) @@ -128,7 +128,7 @@ result_t ret = 0; pmp_t* pmp = NULL; pmp_internal_t* pmpi = NULL; - pmp_environment_t* pmpenv = NULL; + pmp_device_environment_t* pmpenv = NULL; *ptr_pmp = 0; @@ -208,10 +208,10 @@ break; } strcpy(pmp->decl.mode, "UM"); - strcpy(pmp->decl.language, "N/A"); - strcpy(pmp->decl.version, "Unknown"); - strcpy(pmp->decl.max_version, "N/A"); - strcpy(pmp->decl.min_version, "N/A"); + strcpy(pmp->decl.language, PMP_DECLUNAVAIL); + strcpy(pmp->decl.version, PMP_DECLUNAVAIL); + strcpy(pmp->decl.max_version, PMP_DECLUNAVAIL); + strcpy(pmp->decl.min_version, PMP_DECLUNAVAIL); // Set enviroments. pmpenv = &pmp->env; Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-12 18:07:26 UTC (rev 263) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-01-16 16:38:24 UTC (rev 264) @@ -361,7 +361,7 @@ pmp_internal_t* pmpi = NULL; const pp1model_descriptor_t* md = NULL; pp1_environment_t env; - pmp_environment_t* pmpenv = NULL; + pmp_device_environment_t* pmpenv = NULL; // Initialize. *ptr_pmp = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-17 16:32:03
|
Revision: 265 http://svn.sourceforge.net/pmplib/?rev=265&view=rev Author: nyaochi Date: 2007-01-17 08:31:59 -0800 (Wed, 17 Jan 2007) Log Message: ----------- Incremental commit. Drastic change of the API. This revision broke playlist conversion for all players, music database construction for all players except for iriver E10. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/frontend/easypmp/cui/device.c trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp/pmp.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-01-16 16:38:24 UTC (rev 264) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-01-17 16:31:59 UTC (rev 265) @@ -111,6 +111,7 @@ int result = 0; uint32_t i; result_t res = 0; + ucs2char_t music_path[MAX_PATH]; pmp_music_t* pmpdb = pmp->music; pmp_music_record_t* records = NULL; pmp_music_record_t* old_records = NULL; @@ -121,6 +122,8 @@ return EASYPMPE_CANCEL; } + filepath_combinepath(music_path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_music); + /* * Read the existing database for update processing mode. */ @@ -135,7 +138,7 @@ } // Obtain the number of records in the database. - res = pmpdb->get(pmpdb, NULL, &num_old_records); + res = pmpdb->get_records(pmpdb, NULL, &num_old_records); if (res != 0) { result = MAKE_PMP_ERROR(res); goto error_exit; @@ -149,7 +152,7 @@ } // Obtain the records from the database. - res = pmpdb->get(pmpdb, old_records, &num_old_records); + res = pmpdb->get_records(pmpdb, old_records, &num_old_records); if (res != 0) { result = MAKE_PMP_ERROR(res); goto error_exit; @@ -220,7 +223,7 @@ if (gmi_get( record, filename, - pmp->env.path_to_music.path, + music_path, opt->media_info_source, opt->strip_words, opt->num_strip_words @@ -242,7 +245,7 @@ result = EASYPMPE_CANCEL; goto error_exit; } - res = pmpdb->set(pmpdb, records, fl->num_elements); + res = pmpdb->set_records(pmpdb, records, fl->num_elements); if (res != 0) { result = MAKE_PMP_ERROR(res); goto error_exit; Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-01-16 16:38:24 UTC (rev 264) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-01-17 16:31:59 UTC (rev 265) @@ -39,11 +39,6 @@ #include <easypmp.h> -/** - * \addtogroup common - * @{ - */ - typedef struct { const option_t* opt; easypmp_filelist_t* fl; @@ -54,11 +49,20 @@ static int found_music_file(void *instance, const ucs2char_t* found_path, const ucs2char_t* found_file) { + uint32_t i; 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_music->is_supported_ext(pmp_music, found_file)) { + // Check if the file has an extension supported by the target player. + for (i = 0;i < pmp->info.num_audio_extensions;++i) { + if (filepath_hasext(found_file, pmp->info.audio_extensions[i])) { + break; + } + } + + if (i != pmp->info.num_audio_extensions) { // Supported music file. easypmp_filename_t* new_filename = NULL; @@ -98,12 +102,10 @@ ) { enumerate_dat_t ed; + ucs2char_t music_path[MAX_PATH]; // Decode the music path prefix for system path separators - size_t prefix_length = ucs2len(pmp->env.path_to_music.path); - ucs2char_t *music_path = alloca(sizeof(ucs2char_t) * (prefix_length + 1)); - ucs2cpy(music_path, pmp->env.path_to_music.path); - + filepath_combinepath(music_path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_music); filepath_decode(music_path); fl->num_elements = 0; @@ -118,7 +120,7 @@ return find_file( music_path, - pmp->env.path_to_music.flag & PMPPEF_RECURSIVE ? 1 : 0, + pmp->info.music_flag & PMPMF_RECURSIVE ? 1 : 0, found_music_file, &ed ); @@ -172,6 +174,7 @@ { int ret = 0; enumerate_dat_t ed; + ucs2char_t path[MAX_PATH]; fl->num_elements = 0; fl->elements = NULL; @@ -184,17 +187,23 @@ ed.instance = instance; if (opt->verb & MODE_PLAYLIST_PLAYLIST) { + // Decode the playlist path prefix for system path separators + filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); + filepath_decode(path); ret = find_file( - pmp->env.path_to_playlist.path, - pmp->env.path_to_playlist.flag & PMPPEF_RECURSIVE ? 1 : 0, + path, + pmp->info.playlist_flag & PMPPF_RECURSIVE ? 1 : 0, found_playlist_file, &ed ); } if (opt->verb & MODE_PLAYLIST_MUSIC) { + // Decode the playlist path prefix for system path separators + filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_music); + filepath_decode(path); ret = find_file( - pmp->env.path_to_music.path, - pmp->env.path_to_music.flag & PMPPEF_RECURSIVE ? 1 : 0, + path, + pmp->info.music_flag & PMPMF_RECURSIVE ? 1 : 0, found_playlist_file, &ed ); @@ -210,5 +219,3 @@ free(fl->elements); memset(fl, 0, sizeof(*fl)); } - -/** @} */ Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-16 16:38:24 UTC (rev 264) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-17 16:31:59 UTC (rev 265) @@ -75,6 +75,7 @@ ) { int result = 0; + /* int i, j, num_succeeded = 0; char *mbs = NULL; pmp_playlist_t* pmppl = NULL; @@ -263,6 +264,7 @@ pmppl->release(pmppl); pmppl = NULL; } + */ return result; } /** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-16 16:38:24 UTC (rev 264) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-01-17 16:31:59 UTC (rev 265) @@ -59,19 +59,17 @@ void device_show_information(pmp_t* pmp, FILE *fp) { - fprintf(fp, "Device identifier: %s\n", pmp->decl.id); - fprintf(fp, " Manufacturer: %s\n", pmp->decl.manufacturer); - fprintf(fp, " Product name: %s\n", pmp->decl.name); - fprintf(fp, " Firmware mode: %s\n", pmp->decl.mode); - fprintf(fp, " Firmware version: %s\n", pmp->decl.version); - fprintf(fp, " Firmware range: %s to %s\n", pmp->decl.min_version, pmp->decl.max_version); - fprintf(fp, " Default language: %s\n", pmp->decl.language); + fprintf(fp, "Device identifier: %s\n", pmp->info.decl.id); + fprintf(fp, " Manufacturer: %s\n", pmp->info.decl.manufacturer); + fprintf(fp, " Product name: %s\n", pmp->info.decl.name); + fprintf(fp, " Firmware mode: %s\n", pmp->info.decl.mode); + fprintf(fp, " Firmware version: %s\n", pmp->info.decl.version); + fprintf(fp, " Firmware range: %s to %s\n", pmp->info.decl.min_version, pmp->info.decl.max_version); + fprintf(fp, " Default language: %s\n", pmp->info.decl.language); - fprints(fp, " Root directory: %s\n", pmp->env.path_to_root.path); - device_show_path(fp, " Music directory: %s\n", pmp->env.path_to_music.path); - device_show_path(fp, " Playlist directory: %s\n", pmp->env.path_to_playlist.path); - - fprints(fp, " Playlist extension: %s\n", pmp->env.playlist_ext); + fprints(fp, " Root directory: %s\n", pmp->info.path_to_root); + device_show_path(fp, " Music directory: %s\n", pmp->info.path_to_music); + device_show_path(fp, " Playlist directory: %s\n", pmp->info.path_to_playlist); } static void enumerate_devid_callback(void *instance, const char *devid) Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-16 16:38:24 UTC (rev 264) +++ trunk/pmplib/include/pmp.h 2007-01-17 16:31:59 UTC (rev 265) @@ -53,7 +53,6 @@ */ 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. @@ -109,11 +108,15 @@ #define PMPFOURCC(a, b, c, d) \ ((uint32_t)(a) << 24 | (uint32_t)(b) << 16 | (uint32_t)(c) << 8 | (uint32_t)(d)) +#define PMPCODEC_NONE PMPFOURCC(' ',' ',' ',' ') #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 */ +#define PMPMAXCODECS 32 +#define PMPMAXEXT 8 + enum { PMPPEF_NONE = 0x0000, PMPPEF_SUPPORT = 0x0001, @@ -121,11 +124,19 @@ PMPPEF_RECURSIVE = 0x0004, }; -typedef struct { - int flag; - ucs2char_t path[MAX_PATH]; -} pmp_pathenv_t; +enum { + PMPMF_NONE = 0x0000, + PMPMF_SUPPORT = 0x0001, + PMPMF_RECURSIVE = 0x0002, +}; +enum { + PMPPF_NONE = 0x0000, + PMPPF_SUPPORT = 0x0001, + PMPPF_RECURSIVE = 0x0002, +}; + + /** Maximum size, in chars, of a device description. */ #define PMP_DECLSIZE (128) /** Unavailable field of a device description. */ @@ -133,7 +144,7 @@ /** * PMP device decription. - * This structure stores information about a PMP device. An PMP device driver + * This structure stores information about a PMP device. A PMP device driver * should fill these fields properly so that an application can obtain the * information about the device. An empty value represents the uncertainity * of the field value at this stage. The value ::PMP_DECLUNAVAIL (\c "***") @@ -160,18 +171,39 @@ /** * PMP device environment. - * This structure stores + * This structure stores information about predefined paths, capability, */ typedef struct { - pmp_pathenv_t path_to_root; /**< Path to the root directory */ - pmp_pathenv_t path_to_music; /**< Path to the music files */ - pmp_pathenv_t path_to_playlist; /**< Path to the playlist files */ - pmp_pathenv_t path_to_photo; /**< Path to the photo files */ - ucs2char_t playlist_ext[MAX_PATH]; -} pmp_device_environment_t; + /** Path to the root directory of the player. */ + ucs2char_t path_to_root[MAX_PATH]; + /** Relative path to the system directory from the root. */ + ucs2char_t path_to_system[MAX_PATH]; + /** Relative path to the music directory from the root. */ + ucs2char_t path_to_music[MAX_PATH]; + /** Relative path to the playlist directory from the root. */ + ucs2char_t path_to_playlist[MAX_PATH]; + /** Music flags. */ + uint32_t music_flag; + /** Playlist flags. */ + uint32_t playlist_flag; + /** Number of elements in \a audio_codecs array. */ + uint32_t num_audio_codecs; + /** Array of PMPFOURCC values corresponding to the supported audio codecs. */ + uint32_t* audio_codecs; + /** Number of elements in \a audio_extensions array. */ + uint32_t num_audio_extensions; + /** Array of ucs2char_t string values for audio file extensions. */ + ucs2char_t** audio_extensions; + + /** Description about the device. */ + const pmp_device_description_t decl; +} pmp_device_information_t; + + + /** * The root interface for portable media device. * This structure represents the basic interface that is common to any @@ -206,12 +238,10 @@ */ uint32_t flag; - pmp_device_description_t decl; - /** - * Portable media device environment. + * PMP device decription. */ - pmp_device_environment_t env; + pmp_device_information_t info; /** * The pointer to pmp_music_t interface. @@ -220,7 +250,7 @@ /** * Increment the reference counter. - * @param pmp Ths pointer to the pmp_t instance. + * @param pmp The pointer to the pmp_t instance. */ uint32_t (*add_ref)(pmp_t* pmp); @@ -228,14 +258,23 @@ * 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. + * @param pmp The pointer to the pmp_t instance. */ uint32_t (*release)(pmp_t* pmp); + /** + * Open the PMP device. + * @param pmp The pointer to the pmp_t instance. + * @param flag The open flags. + */ result_t (*open)(pmp_t* pmp, uint32_t flag); + + /** + * Close the PMP device. + * @param pmp The pointer to the pmp_t instance. + * @param flag The close flags. + */ 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); @@ -265,30 +304,28 @@ }; typedef struct tag_pmp_music_record_t pmp_music_record_t; +typedef struct { + ucs2char_t filename[MAX_PATH]; +} pmp_playlist_entry_t; + +typedef struct { + ucs2char_t name[MAX_PATH]; + int num_entries; + pmp_playlist_entry_t* entries; +} pmp_playlist_t; + struct tag_pmp_music_t { void* instance; pmp_t* pmp; - 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 (*set_records)(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records); + result_t (*get_records)(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records); + result_t (*set_playlists)(pmp_music_t* pmpdb, const pmp_playlist_t* playlists, uint32_t num_playlists); 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 { - void* instance; - uint32_t ref_count; - pmp_t* pmp; - uint32_t (*add_ref)(pmp_playlist_t* pmppl); - uint32_t (*release)(pmp_playlist_t* pmppl); - - 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); /** @@ -303,7 +340,6 @@ 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); -PMPAPI void pmp_copy_environment(pmp_device_environment_t* dst, const pmp_device_environment_t* src); Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-01-16 16:38:24 UTC (rev 264) +++ trunk/pmplib/lib/pmp/pmp.c 2007-01-17 16:31:59 UTC (rev 265) @@ -62,8 +62,3 @@ dst->date = src->date ? ucs2dup(src->date) : NULL; return 0; } - -void pmp_copy_environment(pmp_device_environment_t* dst, const pmp_device_environment_t* src) -{ - memcpy(dst, src, sizeof(*src)); -} Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-16 16:38:24 UTC (rev 264) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-17 16:31:59 UTC (rev 265) @@ -56,6 +56,9 @@ const char *dat_filename; const char *dic_filename; const char *idx_filename; + const char *extensions; + uint32_t codecs[8]; + const char *path_to_system; const char *path_to_music; const char *path_to_playlist; const char *playlist_ext; @@ -63,154 +66,155 @@ static const ip3model_descriptor_t g_model_descriptions[] = { { - "iriver_e10_ums_1.00-1.04", "iriver", "E10 UMS", "UM", - "1.00", "1.04", + "iriver_e10_ums_1.0-1.4", "iriver", "E10 UMS", "UM", + "1.0", "1.4", "System\\E10.SYS", "System\\db.dat", "System\\db.dic", "System\\db.idx", - "", "Playlists\\", + ".mp3\0.ogg\0.wma\0.wav\0", + {PMPCODEC_MPEGLAYER3, PMPCODEC_VORBIS, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, + "System\\", "", "Playlists\\", ".plp", }, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, + {0, 0, 0, 0, 0, 0, 0, 0}, NULL, NULL, NULL, }, }; typedef struct { - char id[128]; - char name[128]; - char mode[128]; - char language[128]; - char version[128]; - - ucs2char_t path_to_root[MAX_PATH]; - ucs2char_t path_to_music[MAX_PATH]; - ucs2char_t path_to_playlist[MAX_PATH]; - ucs2char_t sys_filename[MAX_PATH]; - ucs2char_t dat_filename[MAX_PATH]; - ucs2char_t dic_filename[MAX_PATH]; - ucs2char_t idx_filename[MAX_PATH]; - ucs2char_t playlist_ext[MAX_PATH]; -} ip3_environment_t; - - -typedef struct { - ip3_environment_t env; + const ip3model_descriptor_t* decl; } pmp_internal_t; -typedef struct { - ip3db_t ip3db; -} pmpdb_internal_t; - -typedef struct { - ip3db_t ip3db; -} pmppl_internal_t; - - 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_create_instance_music(pmp_t* pmp, pmp_music_t** ptr_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_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); +static uint32_t pmpmusic_release(pmp_music_t* pmpdb); +static result_t pmpmusic_set_records(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records); +static result_t pmpmusic_get_records(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records); +static result_t pmpmusic_dump(pmp_music_t* pmpdb, FILE *fp, int level); +static result_t pmpmusic_set_playlists(pmp_music_t* pmpdb, const pmp_playlist_t* playlists, uint32_t num_playlists); -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); +#define COMP(a, b) ((a)>(b))-((a)<(b)) -static void set_environment( - ip3_environment_t* env, +static char* strip(char *str) +{ + char *p = str + strlen(str) - 1; + while (*str && isspace(*str)) { + str++; + } + while (str <= p && isspace(*p)) { + *p-- = 0; + } + return str; +} + +static const char *strcpy_if_empty(char *dst, const char *src) +{ + return *dst ? dst : strcpy(dst, src); +} + +static void set_device_info( + const char *id, + const ucs2char_t* path_to_device, const ip3model_descriptor_t* md, - const ucs2char_t* path_to_device + pmp_device_information_t* info ) { + uint32_t n; + const char *p = NULL; ucs2char_t* ucs2 = NULL; + pmp_device_description_t* decl = (pmp_device_description_t*)&info->decl; - ucs2cpy(env->path_to_root, path_to_device); + strcpy_if_empty(decl->id, id); + strcpy_if_empty(decl->manufacturer, md->manufacturer); + strcpy_if_empty(decl->name, md->name); + strcpy_if_empty(decl->mode, md->mode); + //strcpy_if_empty(decl->language, md->language); + //strcpy_if_empty(decl->version, md->version); + strcpy_if_empty(decl->min_version, md->min_version); + strcpy_if_empty(decl->max_version, md->max_version); - ucs2cpy(env->path_to_music, path_to_device); - filepath_addslash(env->path_to_music); + ucs2cpy(info->path_to_root, path_to_device); + + ucs2 = mbsdupucs2(md->path_to_system); + ucs2cpy(info->path_to_system, ucs2); + ucs2free(ucs2); + ucs2 = mbsdupucs2(md->path_to_music); - ucs2cat(env->path_to_music, ucs2); + ucs2cpy(info->path_to_music, ucs2); ucs2free(ucs2); - ucs2cpy(env->path_to_playlist, path_to_device); - filepath_addslash(env->path_to_playlist); ucs2 = mbsdupucs2(md->path_to_playlist); - ucs2cat(env->path_to_playlist, ucs2); + ucs2cpy(info->path_to_playlist, ucs2); ucs2free(ucs2); - ucs2cpy(env->sys_filename, path_to_device); - filepath_addslash(env->sys_filename); - ucs2 = mbsdupucs2(md->sys_filename); - ucs2cat(env->sys_filename, ucs2); - ucs2free(ucs2); + info->music_flag = PMPMF_SUPPORT | PMPMF_RECURSIVE; + info->playlist_flag = PMPPF_SUPPORT; - ucs2cpy(env->dat_filename, path_to_device); - filepath_addslash(env->dat_filename); - ucs2 = mbsdupucs2(md->dat_filename); - ucs2cat(env->dat_filename, ucs2); - ucs2free(ucs2); + // Audio codecs. + for (n = 0;md->codecs[n];++n) ; + info->num_audio_codecs = n; + info->audio_codecs = (uint32_t*)ucs2malloc(sizeof(uint32_t) * info->num_audio_codecs); + for (n = 0;n < info->num_audio_codecs;++n) { + info->audio_codecs[n] = md->codecs[n]; + } - ucs2cpy(env->dic_filename, path_to_device); - filepath_addslash(env->dic_filename); - ucs2 = mbsdupucs2(md->dic_filename); - ucs2cat(env->dic_filename, ucs2); - ucs2free(ucs2); + // Obtain the number of extensions separated by '\0' characters. + for (n = 0, p = md->extensions;*p;p += (strlen(p)+1)) { + n++; + } + info->num_audio_extensions = n; + info->audio_extensions = (ucs2char_t*)ucs2malloc(sizeof(ucs2char_t*) * info->num_audio_extensions); + for (n = 0, p = md->extensions;*p;p += (strlen(p)+1)) { + info->audio_extensions[n++] = mbsdupucs2(p); + } - ucs2cpy(env->idx_filename, path_to_device); - filepath_addslash(env->idx_filename); - ucs2 = mbsdupucs2(md->idx_filename); - ucs2cat(env->idx_filename, ucs2); - ucs2free(ucs2); - ucs2 = mbsdupucs2(md->playlist_ext); - ucs2cat(env->playlist_ext, ucs2); - ucs2free(ucs2); } -static int match_model( - const char *id, - const ucs2char_t* path_to_device, - const ip3model_descriptor_t* md, - ip3_environment_t* env - ) +static void free_device_info(pmp_device_information_t* info) { - memset(env, 0, sizeof(*env)); - - if (!id || strcmp(md->id, id) != 0) { - return 0; + uint32_t i; + for (i = 0;i < info->num_audio_extensions;++i) { + ucs2free(info->audio_extensions[i]); } - - set_environment(env, md, path_to_device); - return 1; + ucs2free(info->audio_codecs); + ucs2free(info->audio_extensions); + memset(info, 0, sizeof(*info)); } -static char* strip(char *str) +static void set_filenames(ucs2char_t *dat, ucs2char_t *dic, ucs2char_t *idx, pmp_t *pmp) { - char *p = str + strlen(str) - 1; - while (*str && isspace(*str)) { - str++; - } - while (str <= p && isspace(*p)) { - *p-- = 0; - } - return str; + ucs2char_t* ucs2 = NULL; + pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; + + ucs2cpy(dat, pmp->info.path_to_root); + filepath_addslash(dat); + ucs2 = mbsdupucs2(pmpi->decl->dat_filename); + ucs2cat(dat, ucs2); + ucs2free(ucs2); + + ucs2cpy(dic, pmp->info.path_to_root); + filepath_addslash(dic); + ucs2 = mbsdupucs2(pmpi->decl->dic_filename); + ucs2cat(dic, ucs2); + ucs2free(ucs2); + + ucs2cpy(idx, pmp->info.path_to_root); + filepath_addslash(idx); + ucs2 = mbsdupucs2(pmpi->decl->idx_filename); + ucs2cat(idx, ucs2); + ucs2free(ucs2); } -#define COMP(a, b) ((a)>(b))-((a)<(b)) static int compare_version(const char *x, const char *y) { @@ -234,19 +238,23 @@ static int detect_model( const ucs2char_t* path_to_device, const ip3model_descriptor_t* md, - ip3_environment_t* env + pmp_device_information_t* ptr_info ) { ucs2char_t* ucs2 = NULL; ucs2char_t filename[MAX_PATH]; + pmp_device_description_t decl; - memset(env, 0, sizeof(*env)); + memset(&decl, 0, sizeof(decl)); + // filename = "${path_to_device}/${md->sys_filename}" ucs2cpy(filename, path_to_device); filepath_addslash(filename); ucs2 = mbsdupucs2(md->sys_filename); ucs2cat(filename, ucs2); ucs2free(ucs2); + + // Check the existence of the system file. if (filepath_file_exists(filename)) { int match = 1; char line[128]; @@ -259,32 +267,25 @@ char *p = strip(line); if (p[0] == '[' && line[strlen(p)-1] == ']') { p[strlen(p)-1] = 0; - strcpy(env->name, p+1); + strcpy(decl.name, p+1); } else if (strncmp(p, "version = ", 10) == 0) { - /* They are too stupid to describe version "1.04" as "1.4" */ - if (strlen(p+10) == 3 && p[11] == '.') { - env->version[0] = p[10]; - env->version[1] = p[11]; - env->version[2] = '0'; - env->version[3] = p[12]; - env->version[4] = 0; - } else { - strcpy(env->version, p+10); - } + strcpy(decl.version, p+10); } else if (strncmp(p, "language = ", 11) == 0) { - strcpy(env->language, p+11); + strcpy(decl.language, p+11); } else if (strncmp(p, "mode = ", 7) == 0) { - strcpy(env->mode, p+7); + strcpy(decl.mode, p+7); } } + fclose(fp); - match &= (strcmp(env->mode, md->mode) == 0); - match &= (compare_version(md->min_version, env->version) <= 0); - match &= (compare_version(env->version, md->max_version) <= 0); + // Test the compability of the device. + match &= (strcmp(decl.mode, md->mode) == 0); + match &= (compare_version(md->min_version, decl.version) <= 0); + match &= (compare_version(decl.version, md->max_version) <= 0); if (match) { - set_environment(env, md, path_to_device); + memcpy((pmp_device_description_t*)&ptr_info->decl, &decl, sizeof(decl)); return 1; } } @@ -308,25 +309,32 @@ pmp_t* pmp = NULL; pmp_internal_t* pmpi = NULL; const ip3model_descriptor_t* md = NULL; - ip3_environment_t env; - pmp_device_environment_t* pmpenv = NULL; + pmp_device_information_t info; + // Initialize device information. + memset(&info, 0, sizeof(info)); + + // Return a NULL pointer by default. *ptr_pmp = 0; // Find a suitable model for the device. md = g_model_descriptions; for (;md->id;++md) { - if (detect_model(path_to_device, md, &env)) { - if (!id || !id[0]) { + if (id && *id) { + // Match the device identifier. + if (strcmp(md->id, id) == 0) { + // This will fill some members in decl. + detect_model(path_to_device, md, &info); + set_device_info(id, path_to_device, md, &info); break; } - if (strcmp(md->id, id) == 0) { + } else { + // Detect the model automatically. + if (detect_model(path_to_device, md, &info)) { + set_device_info(md->id, path_to_device, md, &info); break; } } - if (match_model(id, path_to_device, md, &env)) { - break; - } } if (!md->id) { return PMP_DEVICENOTFOUND; @@ -342,7 +350,6 @@ pmp->release = pmp_release; pmp->open = pmp_open; pmp->close = pmp_close; - pmp->create_instance_pl = pmp_create_instance_pl; pmp->add_ref(pmp); // Allocate the internal variables. @@ -351,32 +358,14 @@ free(pmp); return PMPDBE_OUTOFMEMORY; } - pmp->instance = pmpi; + pmpi->decl = md; // Initialize the internal variables. - memcpy(&pmpi->env, &env, sizeof(env)); + pmp->instance = pmpi; + memcpy((pmp_device_information_t*)&pmp->info, &info, sizeof(info)); - // Initialize the (exportable) env. - strcpy(pmp->decl.id, md->id); - strcpy(pmp->decl.manufacturer, md->manufacturer); - strcpy(pmp->decl.name, md->name); - strcpy(pmp->decl.mode, md->mode); - strcpy(pmp->decl.language, pmpi->env.language); - strcpy(pmp->decl.version, pmpi->env.version); - strcpy(pmp->decl.min_version, md->min_version); - strcpy(pmp->decl.max_version, md->max_version); - - pmpenv = &pmp->env; - pmpenv->path_to_root.flag = PMPPEF_SUPPORT | PMPPEF_CONSTANT; - ucs2cpy(pmpenv->path_to_root.path, pmpi->env.path_to_root); - pmpenv->path_to_music.flag = PMPPEF_SUPPORT | PMPPEF_RECURSIVE; - ucs2cpy(pmpenv->path_to_music.path, pmpi->env.path_to_music); - pmpenv->path_to_playlist.flag = PMPPEF_SUPPORT; - 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); + ret = pmp_create_instance_music(pmp, &pmp->music); if (ret != 0) { pmp_release(pmp); return ret; @@ -396,7 +385,8 @@ { uint32_t count = pmp_interlocked_decrement(&pmp->ref_count); if (count == 0) { - pmpdb_release(pmp->music); + pmpmusic_release(pmp->music); + free_device_info(&pmp->info); free(pmp->instance); free(pmp); } @@ -409,10 +399,11 @@ pmp->flag = flag; if (pmp->flag & PMPOF_MUSIC_DB_READ) { - ret = pmpdb_read(pmp->music); - if (ret != 0) { - return ret; - } + ucs2char_t dat[MAX_PATH], dic[MAX_PATH], idx[MAX_PATH]; + ip3db_t* ip3db = (ip3db_t*)pmp->music->instance; + + set_filenames(dat, dic, idx, pmp); + return ip3db_read(ip3db, dat, dic, idx); } return 0; } @@ -421,76 +412,43 @@ { result_t ret = 0; if (pmp->flag & PMPOF_MUSIC_DB_WRITE) { - ret = pmpdb_write(pmp->music); - if (ret != 0) { - return ret; - } - } - return 0; -} + ucs2char_t dat[MAX_PATH], dic[MAX_PATH], idx[MAX_PATH]; + ip3db_t* ip3db = (ip3db_t*)pmp->music->instance; -static result_t pmp_create_instance_db(pmp_t* pmp, pmp_music_t** ptr_pmpdb) -{ - 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(pmp_music_t)); - if (!pmpdb) { - return PMPDBE_OUTOFMEMORY; + set_filenames(dat, dic, idx, pmp); + return ip3db_write(ip3db, dat, dic, idx); } - - 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) { - free(pmpdb); - return PMPDBE_OUTOFMEMORY; - } - ip3db_init(&pmpdbi->ip3db); - - pmpdb->pmp = pmp; - pmpdb->instance = pmpdbi; - - *ptr_pmpdb = pmpdb; return 0; } -static result_t pmp_create_instance_pl(pmp_t* pmp, pmp_playlist_t** ptr_pmppl) +static result_t pmp_create_instance_music(pmp_t* pmp, pmp_music_t** ptr_music) { + ip3db_t* ip3db = NULL; + pmp_music_t* music = NULL; pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; - pmp_playlist_t* pmppl = NULL; - pmppl_internal_t* pmppli = NULL; - *ptr_pmppl = 0; + *ptr_music = 0; - pmppl = calloc(1, sizeof(pmp_playlist_t)); - if (!pmppl) { + music = calloc(1, sizeof(pmp_music_t)); + if (!music) { 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); + ip3db = calloc(1, sizeof(ip3db_t)); + if (!ip3db) { + free(music); return PMPDBE_OUTOFMEMORY; } - ip3db_init(&pmppli->ip3db); - ip3db_read(&pmppli->ip3db, pmpi->env.dat_filename, pmpi->env.dic_filename, pmpi->env.idx_filename); + ip3db_init(ip3db); - pmppl->pmp = pmp; - pmppl->instance = pmppli; + music->set_records = pmpmusic_set_records; + music->get_records = pmpmusic_get_records; + music->dump = pmpmusic_dump; + music->set_playlists = pmpmusic_set_playlists; + music->pmp = pmp; + music->instance = ip3db; - *ptr_pmppl = pmppl; + *ptr_music = music; return 0; } @@ -498,39 +456,15 @@ -static uint32_t pmpdb_release(pmp_music_t* pmpdb) +static uint32_t pmpmusic_release(pmp_music_t* pmpmusic) { - pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; - ip3db_finish(&pmpdbi->ip3db); - free(pmpdb->instance); - free(pmpdb); + ip3db_t* ip3db = (ip3db_t*)pmpmusic->instance; + ip3db_finish(ip3db); + free(pmpmusic->instance); + free(pmpmusic); return 0; } -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 ip3db_read( - &pmpdbi->ip3db, - pmpi->env.dat_filename, - pmpi->env.dic_filename, - pmpi->env.idx_filename - ); -} - -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 ip3db_write( - &pmpdbi->ip3db, - pmpi->env.dat_filename, - pmpi->env.dic_filename, - pmpi->env.idx_filename - ); -} - static ucs2char_t* _filepath_removeslash(ucs2char_t* path) { size_t length = ucs2len(path)-1; @@ -541,10 +475,11 @@ return (path + length); } -static result_t pmpdb_set(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records) +static result_t pmpmusic_set_records(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; + uint32_t i; + pmp_t* pmp = pmpdb->pmp; + ip3db_t* ip3db = (ip3db_t*)pmpdb->instance; pmp_internal_t* pmpi = (pmp_internal_t*)pmpdb->pmp->instance; ip3db_music_record_t* array = (ip3db_music_record_t*)malloc(sizeof(ip3db_music_record_t) * num_records); @@ -552,8 +487,8 @@ const pmp_music_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], filepath_skipdrive(src->filename, pmpi->env.path_to_root)); + ip3db_record_init(ip3db, &array[i]); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], filepath_skipdrive(src->filename, pmp->info.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); @@ -581,18 +516,18 @@ ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_UID], (uint32_t)i+1); } - ip3db_set(&pmpdbi->ip3db, array, num_records); + ip3db_set(ip3db, array, num_records); free(array); return 0; } -static result_t pmpdb_get(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records) +static result_t pmpmusic_get_records(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records) { - pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + pmp_t* pmp = pmpdb->pmp; + ip3db_t* ip3db = (ip3db_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_t* db = &pmpdbi->ip3db; - int i, n = ip3db_num_records(db); + ucs2char_t *path_to_root = alloca(sizeof(ucs2char_t) * (ucs2len(pmp->info.path_to_root)+1)); + int i, n = ip3db_num_records(ip3db); if (!records) { *num_records = (uint32_t)n; @@ -600,17 +535,17 @@ } for (i = 0;i < n;++i) { - const ip3db_variant_t* src = (const ip3db_variant_t*)ip3db_get_record(db, i); + const ip3db_variant_t* src = (const ip3db_variant_t*)ip3db_get_record(ip3db, i); pmp_music_record_t* dst = &records[i]; size_t length = 0; pmp_record_init(dst); - length = ucs2len(pmpi->env.path_to_root); + length = ucs2len(pmp->info.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); + ucs2cpy(dst->filename, pmp->info.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); @@ -640,65 +575,25 @@ return 0; } -static result_t pmpdb_dump(pmp_music_t* pmpdb, FILE *fp, int level) +static result_t pmpmusic_dump(pmp_music_t* pmpmusic, FILE *fp, int level) { - pmpdb_internal_t* pmpdbi = (pmpdb_internal_t*)pmpdb->instance; + ip3db_t* ip3db = (ip3db_t*)pmpmusic->instance; if (level > 0) { return PMP_NOTIMPLIMENTED; //return ip2db_repr(&pmpdbi->ip2db, fp); } else { - return ip3db_dump(&pmpdbi->ip3db, fp); + return ip3db_dump(ip3db, fp); } } -static int pmpdb_is_supported_codec(pmp_music_t* pmpdb, uint32_t codec) +static result_t pmpmusic_set_playlists(pmp_music_t* pmpmusic, const pmp_playlist_t* playlists, uint32_t num_playlists) { - 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 pmp_interlocked_increment(&pmppl->ref_count); -} - -static uint32_t pmppl_release(pmp_playlist_t* pmppl) -{ - uint32_t count = pmp_interlocked_decrement(&pmppl->ref_count); - if (count == 0) { - pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; - free(pmppl->instance); - free(pmppl); - } - return count; -} - -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; if (ip3db_playlist_write(&pmppli->ip3db, filename, files, num_files, pmpi->env.path_to_root) != 0) { return PMPPLE_WRITE; } + */ 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-17 17:44:44
|
Revision: 266 http://svn.sourceforge.net/pmplib/?rev=266&view=rev Author: nyaochi Date: 2007-01-17 09:44:42 -0800 (Wed, 17 Jan 2007) Log Message: ----------- Incremental commit before fixing a bug. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/include/pmp.h Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-01-17 16:31:59 UTC (rev 265) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-01-17 17:44:42 UTC (rev 266) @@ -300,11 +300,11 @@ int database_dump(pmp_t* pmp, FILE *fp, int level) { - pmp_music_t* pmpdb = pmp->music; - if (!pmpdb) { + pmp_music_t* music = pmp->music; + if (!music) { return 1; } - pmpdb->dump(pmpdb, fp, level); + music->dump(music, fp, level); return 0; } Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-17 16:31:59 UTC (rev 265) +++ trunk/pmplib/include/pmp.h 2007-01-17 17:44:42 UTC (rev 266) @@ -115,7 +115,6 @@ #define PMPCODEC_WAV PMPFOURCC('W','A','V','E') /**< Microsoft Riff WAVE */ #define PMPMAXCODECS 32 -#define PMPMAXEXT 8 enum { PMPPEF_NONE = 0x0000, @@ -318,9 +317,10 @@ void* instance; pmp_t* pmp; - result_t (*set_records)(pmp_music_t* pmpdb, const pmp_music_record_t* records, uint32_t num_records); - result_t (*get_records)(pmp_music_t* pmpdb, pmp_music_record_t* records, uint32_t* num_records); - result_t (*set_playlists)(pmp_music_t* pmpdb, const pmp_playlist_t* playlists, uint32_t num_playlists); + result_t (*set_records)(pmp_music_t* music, const pmp_music_record_t* records, uint32_t num_records); + result_t (*get_records)(pmp_music_t* music, pmp_music_record_t* records, uint32_t* num_records); + result_t (*set_playlists)(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists); + result_t (*get_playlists)(pmp_music_t* music, pmp_playlist_t* playlists, uint32_t* num_playlists); result_t (*dump)(pmp_music_t* pmpdb, FILE *fp, int level); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |