From: <ny...@us...> - 2007-02-10 17:55:27
|
Revision: 329 http://svn.sourceforge.net/pmplib/?rev=329&view=rev Author: nyaochi Date: 2007-02-10 09:55:24 -0800 (Sat, 10 Feb 2007) Log Message: ----------- Bump the version number to 0.14. Modified Paths: -------------- trunk/pmplib/AUTHORS trunk/pmplib/README trunk/pmplib/configure.in trunk/pmplib/frontend/easypmp/cui/main.c Modified: trunk/pmplib/AUTHORS =================================================================== --- trunk/pmplib/AUTHORS 2007-02-10 17:50:11 UTC (rev 328) +++ trunk/pmplib/AUTHORS 2007-02-10 17:55:24 UTC (rev 329) @@ -1,2 +1,2 @@ -Nyaochi <ny...@ny...> +Naoaki Okazaki <nyaochi at users sourceforge net> Martin Ellis <mar...@kd...> Modified: trunk/pmplib/README =================================================================== --- trunk/pmplib/README 2007-02-10 17:50:11 UTC (rev 328) +++ trunk/pmplib/README 2007-02-10 17:55:24 UTC (rev 329) @@ -1,5 +1,5 @@ PMPLib - Version 0.13 + Version 0.14 http://pmplib.sourceforge.net/ * STRUCTURE Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-02-10 17:50:11 UTC (rev 328) +++ trunk/pmplib/configure.in 2007-02-10 17:55:24 UTC (rev 329) @@ -27,7 +27,7 @@ dnl ------------------------------------------------------------------ dnl Initialization for automake dnl ------------------------------------------------------------------ -AM_INIT_AUTOMAKE(pmplib, 0.13) +AM_INIT_AUTOMAKE(pmplib, 0.14) AC_CONFIG_HEADERS(config.h) AM_MAINTAINER_MODE AM_C_PROTOTYPES Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 17:50:11 UTC (rev 328) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 17:55:24 UTC (rev 329) @@ -52,8 +52,8 @@ #endif #define APPLICATION_S "EasyPMP [CUI]" -#define VERSION_S "0.13 alpha" -#define COPYRIGHT_S "Copyright (c) 2005-2007 Nyaochi" +#define VERSION_S "0.14 alpha" +#define COPYRIGHT_S "Copyright (c) 2005-2007 PMPlib Project" int database_dump(pmp_t* pmp, FILE *fpo, int level); void device_show_information(pmp_t* pmp, FILE *fpe); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-10 18:39:35
|
Revision: 331 http://svn.sourceforge.net/pmplib/?rev=331&view=rev Author: nyaochi Date: 2007-02-10 10:39:35 -0800 (Sat, 10 Feb 2007) Log Message: ----------- Reduced warnings. Modified Paths: -------------- trunk/pmplib/include/pmplib/os_types.h trunk/pmplib/lib/filepath/filepath_posix.c trunk/pmplib/lib/pmp/pmp_posix.c trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c Modified: trunk/pmplib/include/pmplib/os_types.h =================================================================== --- trunk/pmplib/include/pmplib/os_types.h 2007-02-10 18:03:21 UTC (rev 330) +++ trunk/pmplib/include/pmplib/os_types.h 2007-02-10 18:39:35 UTC (rev 331) @@ -24,7 +24,7 @@ #ifndef __OS_TYPES_H__ #define __OS_TYPES_H__ -#if defined(__GNU_C__) +#if defined(__GNUC__) #include <inttypes.h> #elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) Modified: trunk/pmplib/lib/filepath/filepath_posix.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-10 18:03:21 UTC (rev 330) +++ trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-10 18:39:35 UTC (rev 331) @@ -37,6 +37,17 @@ #include <pmplib/filepath.h> #include "rel2abs.h" +static int _decode(char* path) +{ + while (*path) { + if (*path == 0x5C) { + *path = 0x2F; + } + path++; + } + return 0; +} + int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance) { DIR *dirp = NULL; @@ -272,7 +283,7 @@ char *mbs_path = ucs2dupmbs(filename); if (mbs_path) { - filepath_decode(mbs_path); + _decode(mbs_path); //fprintf(stderr, "is_exist: %s\n", mbs_path); ret = open(mbs_path, 0); free(mbs_path); @@ -372,7 +383,7 @@ char *mbs_path = ucs2dupmbs(filename); if (mbs_path) { - filepath_decode(mbs_path); + _decode(mbs_path); ret = stat(mbs_path, &st); free(mbs_path); if (ret == 0) { @@ -389,7 +400,7 @@ char *mbs_path = ucs2dupmbs(filename); if (mbs_path) { - filepath_decode(mbs_path); + _decode(mbs_path); ret = stat(mbs_path, &st); free(mbs_path); if (ret == 0) { @@ -406,7 +417,7 @@ char *mbs_path = ucs2dupmbs(filename); if (mbs_path) { - filepath_decode(mbs_path); + _decode(mbs_path); ret = stat(mbs_path, &st); free(mbs_path); if (ret == 0) { Modified: trunk/pmplib/lib/pmp/pmp_posix.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-10 18:03:21 UTC (rev 330) +++ trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-10 18:39:35 UTC (rev 331) @@ -129,14 +129,14 @@ result_t pmplib_create(pmplib_t* pmplib, pmp_t** pmp, const ucs2char_t* path_to_device, const char *id) { - result_t ret = PMP_DEVICENOTFOUND; + result_t ret = PMPERR_DEVICENOTFOUND; uint32_t i; for (i = 0;i < pmplib->num_plugins;++i) { pmplib_create_t func = (pmplib_create_t)lt_dlsym(pmplib->plugins[i], "pmp_create"); if (func) { ret = func(pmp, path_to_device, id); - if (ret != PMP_DEVICENOTFOUND) { + if (ret != PMPERR_DEVICENOTFOUND) { return ret; } } Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-10 18:03:21 UTC (rev 330) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-10 18:39:35 UTC (rev 331) @@ -735,9 +735,11 @@ { int i; uint32_t offset = 0; + long size = 0; /* Read the whole data at a time. */ - fread_all(fpi, &idx->avl->buffer, &idx->avl->size); + fread_all(fpi, &idx->avl->buffer, &size); + idx->avl->size = size; /* Convert the byte order of the header from big endian to the native one. */ while (offset < idx->avl->size) { Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-02-10 18:03:21 UTC (rev 330) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-02-10 18:39:35 UTC (rev 331) @@ -214,7 +214,7 @@ return 0; } -result_t ip3db_set(ip3db_t* db, const ip3db_music_record_t* records, int num_records, const ip3db_playlist_t* playlists, int num_playlists) +result_t ip3db_set(ip3db_t* db, const ip3db_music_record_t* records, int num_records, ip3db_playlist_t* playlists, int num_playlists) { /* Construct records in db->dat from the records. */ dat_set(db->dat, db->dic, records, num_records, playlists, num_playlists); Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2007-02-10 18:03:21 UTC (rev 330) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2007-02-10 18:39:35 UTC (rev 331) @@ -206,7 +206,7 @@ void ip3db_finish(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_write(ip3db_t* db, const ucs2char_t* datfn, const ucs2char_t* dicfn, const ucs2char_t* idxfn); -result_t ip3db_set(ip3db_t* db, const ip3db_music_record_t* records, int num_records, const ip3db_playlist_t* playlists, int num_playlists); +result_t ip3db_set(ip3db_t* db, const ip3db_music_record_t* records, int num_records, ip3db_playlist_t* playlists, int num_playlists); int ip3db_num_records(ip3db_t* db); ip3db_music_record_t* ip3db_get_record(ip3db_t* db, int i); result_t ip3db_dump(ip3db_t* db, FILE *fpo); Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-10 18:03:21 UTC (rev 330) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-10 18:39:35 UTC (rev 331) @@ -605,9 +605,21 @@ // Register records (and playlists) to the database. if (pmp->flag & PMPOF_MUSIC_PL_WRITE) { - ip3db_set(&pmpmi->ip3db, records, pmpmi->num_records, pmpmi->playlists, pmpmi->num_playlists); + ip3db_set( + &pmpmi->ip3db, + (const ip3db_music_record_t*)records, + pmpmi->num_records, + pmpmi->playlists, + pmpmi->num_playlists + ); } else { - ip3db_set(&pmpmi->ip3db, records, pmpmi->num_records, NULL, 0); + ip3db_set( + &pmpmi->ip3db, + (const ip3db_music_record_t*)records, + pmpmi->num_records, + NULL, + 0 + ); } // Write out the music database. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-11 06:27:02
|
Revision: 333 http://svn.sourceforge.net/pmplib/?rev=333&view=rev Author: nyaochi Date: 2007-02-10 22:26:59 -0800 (Sat, 10 Feb 2007) Log Message: ----------- Fix pmplib RPMs Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/pmplib.spec.in Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-11 04:19:38 UTC (rev 332) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-11 06:26:59 UTC (rev 333) @@ -380,12 +380,6 @@ // Convert playlists. if (opt.verb & MODE_PLAYLIST) { -#ifndef HAVE_JSAPI_H - if(opt.verb & MODE_PLAYLIST_JSPL) { - fprintf(fpe, "Warning: Ignoring -j/--jspl option. This version of easypmp\n"); - fprintf(fpe, " was built without support for JavaScript playlists.\n"); - } -#endif easypmp_playlist(pmp, &playlists, &musics, &opt, records, num_records, easypmp_progress, NULL); } Modified: trunk/pmplib/pmplib.spec.in =================================================================== --- trunk/pmplib/pmplib.spec.in 2007-02-11 04:19:38 UTC (rev 332) +++ trunk/pmplib/pmplib.spec.in 2007-02-11 06:26:59 UTC (rev 333) @@ -16,8 +16,10 @@ Group: Applications/Multimedia Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-root -BuildRequires: gcc => 3.0.1, libid3tag-devel, zlib-devel, libogg-devel, libvorbis-devel +BuildRequires: gcc => 3.0.1, libid3tag-devel => 0.15.1, zlib-devel => 1.2.3, libogg-devel => 1.1.3, libvorbis-devel => 1.1.2 +%define pmplibdocdir %{_docdir}/%{name} + %description Portable Media Player library (PMPlib) is a management software/library for various portable media players. @@ -34,7 +36,7 @@ Summary: Command-line tools for PMPlib (EasyPMP) License: GPL Group: Applications/Multimedia -Requires: %{name} = %{version}, libid3tag, zlib, libogg, libvorbis +Requires: %{name} = %{version}, libid3tag => 0.15.1, zlib => 1.2.3, libogg => 1.1.3, libvorbis => 1.1.2 %description tools Portable Media Player library (PMPlib) is a management software/library for various portable media players. @@ -45,7 +47,7 @@ %setup %build -%configure +%configure --disable-js %{__make} %install @@ -61,7 +63,11 @@ %files %defattr(-,root,root) -%doc AUTHORS COPYING ChangeLog INSTALL NEWS README +%doc %{pmplibdocdir}/AUTHORS +%doc %{pmplibdocdir}/COPYING +%doc %{pmplibdocdir}/ChangeLog +%doc %{pmplibdocdir}/INSTALL +%doc %{pmplibdocdir}/README %{_libdir}/pmplib/irivnavi.so %{_libdir}/pmplib/portalplayer1.so %{_libdir}/pmplib/iriverplus2.so This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-11 15:55:43
|
Revision: 334 http://svn.sourceforge.net/pmplib/?rev=334&view=rev Author: nyaochi Date: 2007-02-11 07:55:30 -0800 (Sun, 11 Feb 2007) Log Message: ----------- - Prepare for 0.14 release - Updated roadmap. Modified Paths: -------------- trunk/pmplib/ChangeLog trunk/pmplib/Makefile.am trunk/pmplib/README trunk/pmplib/doc/roadmap.txt trunk/pmplib/doc/structure.txt trunk/pmplib/pmplib.spec.in Modified: trunk/pmplib/ChangeLog =================================================================== --- trunk/pmplib/ChangeLog 2007-02-11 06:26:59 UTC (rev 333) +++ trunk/pmplib/ChangeLog 2007-02-11 15:55:30 UTC (rev 334) @@ -2,6 +2,36 @@ ChangeLog file for pmplib + Changes in 0.14 (2007-02-12) +- Implemented playlist conversion for iriver E10 (pmp_iriverplus3). +- Added the support for MSI MEGA PLAYER 540 in pmp_portalplayer1. +- Added the support of Ogg Vorbis for Samsung YH-920. +- On-the-fly playlist conversion from M3U/PLS playlist file located + on the PC. Use -P (--playlist-source) option to configure the + source directory. +- Configurable paths to music and playlist directories. +- Display supported firmware versions, audio codecs, and file + extensions. +- Suppress flickering in the progress report. +- Report file names from which EasyPMP failed to obtain the media + information. +- Report names of music files whose artist or album names are empty + as they may be moved to "Unknown artist" or "Unkonwn album" section. +- Changed the default character encoding for non-unicode ID3v1/ID3v2 + tags to ISO-8859-1. +- Fixed several bugs in reading/writing the database for iriver E10. +- Improved the routine for writing the iriver E10 database with the + latest knowledge. +- Fixed a crash reported at (thanks jonof): + http://nyaochi.sakura.ne.jp/pmplib/index.php?topic=210.msg910#msg910 +- Applied two patches for libid3tag for bug-fixes (Win32 version). +- Updated the JavaScript engine to SpiderMonkey 1.6 (Win32 version). +- Distribute RPM packages, pmplib, pmplib-tools, and pmplib-devel. +- Grand API restructuring and documentation. +- Install header files for the development to ${PREFIX}/include/pmplib +- Merged libucs2 (ucs2.dll) and libfilepath (filepath.dll) into libpmp + (pmp.dll) for simplicity. + 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. Modified: trunk/pmplib/Makefile.am =================================================================== --- trunk/pmplib/Makefile.am 2007-02-11 06:26:59 UTC (rev 333) +++ trunk/pmplib/Makefile.am 2007-02-11 15:55:30 UTC (rev 334) @@ -3,7 +3,7 @@ SUBDIRS = m4 libltdl include lib/ucs2 lib/filepath lib/pmp lib/gmi lib/playlist 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 +doc_DATA = README INSTALL COPYING COPYING.LIB AUTHORS ChangeLog EXTRA_DIST = \ autogen.sh \ Modified: trunk/pmplib/README =================================================================== --- trunk/pmplib/README 2007-02-11 06:26:59 UTC (rev 333) +++ trunk/pmplib/README 2007-02-11 15:55:30 UTC (rev 334) @@ -1,9 +1,9 @@ - PMPLib + PMPlib Version 0.14 http://pmplib.sourceforge.net/ * STRUCTURE -For a description of each component of PMPLib, please see the +For a description of each component of PMPlib, please see the doc/structure.txt file. * COPYRIGHT AND LICENSING INFORMATION @@ -16,7 +16,7 @@ The following text applies to the programs and the pmp and gmi libraries. - Copyright (c) 2005-2006 Nyaochi <ny...@ny...> + Copyright (c) 2005-2007 Naoaki Okazaki <nyaochi at users.sourceforge.net> Copyright (c) 2006 Martin Ellis <mar...@kd...> This program is free software; you can redistribute it and/or @@ -38,7 +38,7 @@ lib/pmp_portalplayer1, lib/pmp_iriverplus2, lib/pmp_irivnavi, lib/ucs2, lib/filepath, and lib/playlist directories. - Copyright (c) 2005-2006 Nyaochi <ny...@ny...> + Copyright (c) 2005-2007 Naoaki Okazaki <nyaochi at users.sourceforge.net> Copyright (c) 2006 Martin Ellis <mar...@kd...> This library is free software; you can redistribute it and/or Modified: trunk/pmplib/doc/roadmap.txt =================================================================== --- trunk/pmplib/doc/roadmap.txt 2007-02-11 06:26:59 UTC (rev 333) +++ trunk/pmplib/doc/roadmap.txt 2007-02-11 15:55:30 UTC (rev 334) @@ -4,20 +4,16 @@ This file describes the changes planned for each version of pmplib. Note that all plans listed here are subject to change! -Version 0.13 -- Add the photo playlist support for iRiver U10. -- Separate the source and destination directories for playlist conversion. +Version 0.15 or later +- Support iPod +- Support tuner presets +- Support photo playlists -Version 0.14 -- ? - Things to be done before 1.0 - Finalize the programing interfaces in the libraries. - Write documents (build instruction, usage, programing interface, etc.) Long-term plan -- Analyze database format (4th generation) used in iriver E10. Implement - database reader/writer for iriver E10. - Support tuner preset conversion. - Replace libid3tag, libogg, libvorbis with taglib. - Prepare a syncronization plugin for foobar2000 (or Winamp???). Modified: trunk/pmplib/doc/structure.txt =================================================================== --- trunk/pmplib/doc/structure.txt 2007-02-11 06:26:59 UTC (rev 333) +++ trunk/pmplib/doc/structure.txt 2007-02-11 15:55:30 UTC (rev 334) @@ -33,9 +33,14 @@ Library for reading non-device specific playlist files (for example, .m3u files) (LGPL). +lib/pmp_iriverplus3: + Support library for + * iRiver E10 + (LGPL) + lib/pmp_iriverplus2: Support library for - * iRiver H10Jnr; and + * iRiver H10Jr; and * iRiver U10 devices. (LGPL) Modified: trunk/pmplib/pmplib.spec.in =================================================================== --- trunk/pmplib/pmplib.spec.in 2007-02-11 06:26:59 UTC (rev 333) +++ trunk/pmplib/pmplib.spec.in 2007-02-11 15:55:30 UTC (rev 334) @@ -65,6 +65,7 @@ %defattr(-,root,root) %doc %{pmplibdocdir}/AUTHORS %doc %{pmplibdocdir}/COPYING +%doc %{pmplibdocdir}/COPYING.LIB %doc %{pmplibdocdir}/ChangeLog %doc %{pmplibdocdir}/INSTALL %doc %{pmplibdocdir}/README This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-11 16:59:22
|
Revision: 336 http://svn.sourceforge.net/pmplib/?rev=336&view=rev Author: nyaochi Date: 2007-02-11 08:59:22 -0800 (Sun, 11 Feb 2007) Log Message: ----------- Bug-fix in ucs2init() and ucs2setenc() Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/frontend/easypmp/cui/util.h trunk/pmplib/lib/ucs2/ucs2char_iconv.c Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-11 15:56:15 UTC (rev 335) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-11 16:59:22 UTC (rev 336) @@ -204,7 +204,8 @@ // Initialize various routines. setlocale(LC_ALL, ""); - console_init(); + ucs2init(); + console_init(); // Initialize option values. option_init(&opt); @@ -356,7 +357,10 @@ // Enumerate music files for database and playlist modes. memset(&musics, 0, sizeof(musics)); if ((opt.verb & MODE_DATABASE) || (opt.verb & MODE_PLAYLIST)) { - fprintf(fpo, "Enumerating music files\n"); + fprintf(fpo, "Enumerating music files in "); + fputucs2str_path(fpo, pmp->info.path_to_root); + fputucs2str_path(fpo, pmp->info.path_to_music); + fprintf(fpo, "\n"); easypmp_enumerate_music(&musics, pmp, &opt, easypmp_enumerate_progress, NULL); console_clearln(fpo); fprintf(fpo, " %d music files were found\n", musics.num_elements); @@ -366,7 +370,14 @@ // Enumerate playlist files for playlist mode. memset(&playlists, 0, sizeof(playlists)); if (opt.verb & MODE_PLAYLIST) { - fprintf(fpe, "Enumerating playlist files\n"); + fprintf(fpe, "Enumerating playlist files in "); + if (opt.path_to_playlist_source) { + fprints(fpo, "%s", opt.path_to_playlist_source); + } else { + fputucs2str_path(fpo, pmp->info.path_to_root); + fputucs2str_path(fpo, pmp->info.path_to_playlist); + } + fprintf(fpo, "\n"); easypmp_enumerate_playlist(&playlists, pmp, &opt, easypmp_enumerate_progress, NULL); console_clearln(fpo); fprintf(fpo, " %d playlist files were found\n", playlists.num_elements); Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-11 15:56:15 UTC (rev 335) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-11 16:59:22 UTC (rev 336) @@ -78,9 +78,6 @@ fprintf(fp, " -r, --reconvert Discard the existing playlist files and reconvert\n"); fprintf(fp, " -f, --find-missing Correct playlists with corrupt references to media files\n"); fprintf(fp, " -i, --ignore-missing Continue a conversion even if a media file is missing\n"); -#ifdef HAVE_JSAPI_H - fprintf(fp, " -j, --jspl Enable JavaScript playlist (JSPL)\n"); -#endif fprintf(fp, "\n"); fprintf(fp, "Player options:\n"); fprintf(fp, " -l, --list-device Show the list of supported devices and exit\n"); Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-11 15:56:15 UTC (rev 335) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-11 16:59:22 UTC (rev 336) @@ -22,15 +22,6 @@ /* $Id$ */ -/** - * @file - * Utility functions for the easypmp command line program (mostly - * display related). - * - * @addtogroup cui - * @{ - */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif/*HAVE_CONFIG_H*/ @@ -103,4 +94,17 @@ } } -/** @} */ +void fputucs2str_path(FILE *fp, const ucs2char_t* str) +{ + while (*str) { + ucs2char_t c = *str; + if (c == 0x005C) { + c = PATHCHAR; + } + if (c == 0x002F) { + c = PATHCHAR; + } + fputucs2c(c, fp); + str++; + } +} Modified: trunk/pmplib/frontend/easypmp/cui/util.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.h 2007-02-11 15:56:15 UTC (rev 335) +++ trunk/pmplib/frontend/easypmp/cui/util.h 2007-02-11 16:59:22 UTC (rev 336) @@ -35,6 +35,7 @@ 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); +void fputucs2str_path(FILE *fp, const ucs2char_t* str); /** @} */ Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-11 15:56:15 UTC (rev 335) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-11 16:59:22 UTC (rev 336) @@ -65,18 +65,6 @@ static char g_encoding[128]; static char g_ucs2encoding[128]; -static char *get_default_encoding() -{ - const char *encoding = getenv("CHARSET"); - -#ifdef HAVE_LANGINFO_CODESET - if (!encoding) { - encoding = nl_langinfo(CODESET); - } -#endif - return encoding ? strdup(encoding) : strdup(MBS_CHARSET); -} - static void print_ucs2(const ucs2char_t* str) { while (*str) { @@ -102,7 +90,18 @@ int ucs2init() { - strcpy(g_encoding, MBS_CHARSET); + ucs2conv_t conv; + const char *encoding = getenv("CHARSET"); + +#ifdef HAVE_LANGINFO_CODESET + if (!encoding) { + encoding = nl_langinfo(CODESET); + } +#endif + + strcpy(g_encoding, encoding ? encoding : MBS_CHARSET); + strcpy(g_ucs2encoding, get_ucs2encoding()); + return ucs2check(&conv); } static int ucs2check(ucs2conv_t* conv) @@ -142,8 +141,9 @@ { int ret = 0; ucs2conv_t conv; + memset(g_encoding, 0, sizeof(g_encoding)); strncpy(g_encoding, encoding, sizeof(g_encoding)); - strncpy(g_ucs2encoding, get_ucs2encoding(), sizeof(g_ucs2encoding)); + strcpy(g_ucs2encoding, get_ucs2encoding()); return ucs2check(&conv); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-11 17:33:09
|
Revision: 339 http://svn.sourceforge.net/pmplib/?rev=339&view=rev Author: nyaochi Date: 2007-02-11 09:33:05 -0800 (Sun, 11 Feb 2007) Log Message: ----------- Fixed a bug in playlist conversion with --find-missing option. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/lib/playlist/playlist.c Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-11 17:16:01 UTC (rev 338) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-11 17:33:05 UTC (rev 339) @@ -164,7 +164,7 @@ // Normalize the playlist. n = playlist_normalize( pl, - filepath_skippath(pl->name), + pl->name, pmp->info.path_to_root, mediafiles, musics->num_elements Modified: trunk/pmplib/lib/playlist/playlist.c =================================================================== --- trunk/pmplib/lib/playlist/playlist.c 2007-02-11 17:16:01 UTC (rev 338) +++ trunk/pmplib/lib/playlist/playlist.c 2007-02-11 17:33:05 UTC (rev 339) @@ -261,7 +261,7 @@ filename = filepath_skippath(mediafile); ucs2cpy(pathname, mediafile); filepath_remove_filespec(pathname); - + /* Search for the file name in music folders. */ if (find_musicfile(mediafiles, num_mediafiles, filename, &begin, &end)) { /* Found music file(s) that have the filename. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2007-02-13 23:31:21
|
Revision: 361 http://svn.sourceforge.net/pmplib/?rev=361&view=rev Author: sucknblow Date: 2007-02-13 15:31:21 -0800 (Tue, 13 Feb 2007) Log Message: ----------- Install modules to /usr/lib/pmplib-x.yz on Debian Modified Paths: -------------- trunk/pmplib/configure.in trunk/pmplib/debian/libpmp0.install trunk/pmplib/debian/rules trunk/pmplib/lib/pmp/Makefile.am trunk/pmplib/lib/pmp_iriverplus2/Makefile.am trunk/pmplib/lib/pmp_iriverplus3/Makefile.am trunk/pmplib/lib/pmp_irivnavi/Makefile.am trunk/pmplib/lib/pmp_portalplayer1/Makefile.am Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-02-13 21:25:28 UTC (rev 360) +++ trunk/pmplib/configure.in 2007-02-13 23:31:21 UTC (rev 361) @@ -226,6 +226,20 @@ AM_CONDITIONAL(have_getopt, test "$ac_cv_header_getopt_h" = "yes") dnl ------------------------------------------------------------------ +dnl Check whether to install plugins in lib/pmplib or lib/pmplib-x.yz +dnl ------------------------------------------------------------------ +AC_ARG_ENABLE( + versioned-libdir, + [AC_HELP_STRING(--enable-versioned-libdir, [Include version number in plugins path])] +) +if test "$enable_versioned_libdir" = "yes" ; then + PLUGIN_DIR=$PACKAGE-$VERSION +else + PLUGIN_DIR=$PACKAGE +fi +AC_SUBST(PLUGIN_DIR) + +dnl ------------------------------------------------------------------ dnl Output the configure results. dnl ------------------------------------------------------------------ AC_CONFIG_FILES(Makefile m4/Makefile include/Makefile include/pmplib/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/pmp/Makefile lib/gmi/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile pmplib.spec) Modified: trunk/pmplib/debian/libpmp0.install =================================================================== --- trunk/pmplib/debian/libpmp0.install 2007-02-13 21:25:28 UTC (rev 360) +++ trunk/pmplib/debian/libpmp0.install 2007-02-13 23:31:21 UTC (rev 361) @@ -1,4 +1,4 @@ debian/tmp/usr/lib/libpmp*.so.* -debian/tmp/usr/lib/pmplib/*.so -debian/tmp/usr/lib/pmplib/*.la +debian/tmp/usr/lib/pmplib*/*.so +debian/tmp/usr/lib/pmplib*/*.la debian/tmp/usr/share/pmplib/* Modified: trunk/pmplib/debian/rules =================================================================== --- trunk/pmplib/debian/rules 2007-02-13 21:25:28 UTC (rev 360) +++ trunk/pmplib/debian/rules 2007-02-13 23:31:21 UTC (rev 361) @@ -22,6 +22,7 @@ dh_testdir CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" \ ./configure \ + --enable-versioned-libdir \ --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ Modified: trunk/pmplib/lib/pmp/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp/Makefile.am 2007-02-13 21:25:28 UTC (rev 360) +++ trunk/pmplib/lib/pmp/Makefile.am 2007-02-13 23:31:21 UTC (rev 361) @@ -8,7 +8,7 @@ pmp.c \ pmp_posix.c -libpmp_la_CPPFLAGS = -DPMP_MODULES_DIR="\"$(libdir)/@PACKAGE@\"" $(LTDLINCL) +libpmp_la_CPPFLAGS = -DPMP_MODULES_DIR="\"$(libdir)/$(PLUGIN_DIR)\"" $(LTDLINCL) libpmp_la_LDFLAGS = \ -no-undefined Modified: trunk/pmplib/lib/pmp_iriverplus2/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/Makefile.am 2007-02-13 21:25:28 UTC (rev 360) +++ trunk/pmplib/lib/pmp_iriverplus2/Makefile.am 2007-02-13 23:31:21 UTC (rev 361) @@ -1,6 +1,6 @@ # $Id$ -pmpdir=$(libdir)/@PACKAGE@ +pmpdir=$(libdir)/$(PLUGIN_DIR) pmp_LTLIBRARIES = iriverplus2.la iriverplus2_la_SOURCES = \ Modified: trunk/pmplib/lib/pmp_iriverplus3/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/Makefile.am 2007-02-13 21:25:28 UTC (rev 360) +++ trunk/pmplib/lib/pmp_iriverplus3/Makefile.am 2007-02-13 23:31:21 UTC (rev 361) @@ -1,6 +1,6 @@ # $Id$ -pmpdir=$(libdir)/@PACKAGE@ +pmpdir=$(libdir)/$(PLUGIN_DIR) pmp_LTLIBRARIES = iriverplus3.la iriverplus3_la_SOURCES = \ Modified: trunk/pmplib/lib/pmp_irivnavi/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/Makefile.am 2007-02-13 21:25:28 UTC (rev 360) +++ trunk/pmplib/lib/pmp_irivnavi/Makefile.am 2007-02-13 23:31:21 UTC (rev 361) @@ -1,6 +1,6 @@ # $Id$ -pmpdir=$(libdir)/@PACKAGE@ +pmpdir=$(libdir)/$(PLUGIN_DIR) pmp_LTLIBRARIES = irivnavi.la irivnavi_la_SOURCES = \ Modified: trunk/pmplib/lib/pmp_portalplayer1/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/Makefile.am 2007-02-13 21:25:28 UTC (rev 360) +++ trunk/pmplib/lib/pmp_portalplayer1/Makefile.am 2007-02-13 23:31:21 UTC (rev 361) @@ -1,6 +1,6 @@ # $Id$ -pmpdir=$(libdir)/@PACKAGE@ +pmpdir=$(libdir)/$(PLUGIN_DIR) pmp_LTLIBRARIES = portalplayer1.la portalplayer1_la_SOURCES = \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-06 04:06:44
|
Revision: 297 http://svn.sourceforge.net/pmplib/?rev=297&view=rev Author: nyaochi Date: 2007-02-05 20:06:42 -0800 (Mon, 05 Feb 2007) Log Message: ----------- More work on API restructuring. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/include/filepath.h trunk/pmplib/include/gmi.h trunk/pmplib/include/ucs2char.h trunk/pmplib/lib/filepath/filepath_posix.c trunk/pmplib/lib/filepath/filepath_win32.c trunk/pmplib/lib/gmi/gmi.c trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/playlist/jspl.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.c trunk/pmplib/lib/ucs2/ucs2char.c trunk/pmplib/lib/ucs2/ucs2char_iconv.c trunk/pmplib/lib/ucs2/ucs2char_win32.c Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-06 04:06:42 UTC (rev 297) @@ -169,7 +169,7 @@ uint32_t timestamp = 0; filepath_combinepath(filename, MAX_PATH, target->pathname, target->filename); - timestamp = (uint32_t)ucs2stat_mtime(filename); + timestamp = (uint32_t)filepath_mtime(filename); // Report the progress. if (progress(instance, EASYPMPP_MUSIC_GMI | EASYPMPSP_PROGRESS, i, 0, filename) != 0) { @@ -202,6 +202,7 @@ filename, music_path, opt->media_info_source, + opt->music_encoding, opt->strip_words, opt->num_strip_words ) == 0) { Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-06 04:06:42 UTC (rev 297) @@ -36,10 +36,6 @@ #include <direct.h> /* getcwd() */ #endif/*_MSC_VER*/ -#ifdef HAVE_LANGINFO_CODESET -#include <langinfo.h> -#endif - #include <ucs2char.h> #include <filepath.h> #include <gmi.h> @@ -106,25 +102,13 @@ fprintf(fp, " -h, --help Show this help message and exit\n"); } -static char *get_default_encoding() -{ - const char *encoding = getenv("CHARSET"); - -#ifdef HAVE_LANGINFO_CODESET - if (!encoding) { - encoding = nl_langinfo(CODESET); - } -#endif - return encoding ? strdup(encoding) : strdup("UTF-8"); -} - void option_init(option_t* opt) { memset(opt, 0, sizeof(*opt)); // Set default values here. opt->media_info_source = GMIF_TAG; - opt->system_encoding = get_default_encoding(); + opt->system_encoding = strdup(ucs2getenc()); opt->music_encoding = strdup("ISO-8859-1"); } Modified: trunk/pmplib/include/filepath.h =================================================================== --- trunk/pmplib/include/filepath.h 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/include/filepath.h 2007-02-06 04:06:42 UTC (rev 297) @@ -82,6 +82,12 @@ FILEPATHAPI int filepath_encode(ucs2char_t* path); FILEPATHAPI int filepath_decode(ucs2char_t* path); +FILEPATHAPI time_t filepath_mtime(const ucs2char_t *filename); +FILEPATHAPI uint32_t filepath_size(const ucs2char_t *filename); +FILEPATHAPI int filepath_is_dir(const ucs2char_t *filename); +FILEPATHAPI int filepath_exist(const ucs2char_t *filename); + + #ifdef __cplusplus } #endif/*__cplusplus*/ Modified: trunk/pmplib/include/gmi.h =================================================================== --- trunk/pmplib/include/gmi.h 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/include/gmi.h 2007-02-06 04:06:42 UTC (rev 297) @@ -62,6 +62,7 @@ const ucs2char_t *filename, const ucs2char_t* path_to_music, int flag, + const char *charset, ucs2char_t **strip_words, int num_strip_words ); Modified: trunk/pmplib/include/ucs2char.h =================================================================== --- trunk/pmplib/include/ucs2char.h 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/include/ucs2char.h 2007-02-06 04:06:42 UTC (rev 297) @@ -38,8 +38,17 @@ #endif/*__cplusplus*/ /** - * \addtogroup ucs2 PMPlib UCS-2 API. - * @{ + * \addtogroup ucs2 UCS-2 Character/String API + * @{ + * + * The PMPlib UCS-2 character/string API provides a manupulation utility + * for characters/strings in UCS-2 encoding. As a number of portable media + * players support Unicode for displaying song information, PMPlib deals + * with Unicode characters/strings encoded in UCS-2. + * + * The byte order of UCS-2 character is dependent on the CPU architecture + * on which this code runs: e.g., little-endian on Intel IA-32/IA-64 and + * big-endian on IBM PowerPC. */ /** @@ -47,35 +56,241 @@ */ typedef uint16_t ucs2char_t; +/** + * Initialize the UCS-2 library. + * + * This function initializes internal variables used in the UCS-2 library. + * Call this function before using any other functions in this API. + * + * @retval int Zero if succeeded, otherwise non-zero value. + */ +UCS2API int ucs2init(); +/** + * @defgroup ucs2_conv Character encoding converter + * @{ + * + * This API subset converts the character encoding of a string from one to + * another. It supports mutual conversions between: + * UCS-2 and multi-byte character (i.e., \c char); + * UCS-2 and UTF-8. + * + * By default, this library detects the character encoding of multi-byte + * characters on the current system based on the value of LANG variable + * (for POSIX) or via GetACP() function (for Win32). + */ /** - * @defgroup ucs2_conv Charaset conversion routines. - * @{ + * Set the encoding for multi-byte characters (for iconv/libiconv). + * + * This function change the default encoding for multi-byte characters to the + * character encoding specified by the \a encoding argument. + * + * @param encoding The pointer to the string specifying the character + * encoding. + * + * @note + * This function is effective only on environments with iconv (libiconv). */ +UCS2API int ucs2setenc(const char *encoding); -struct tag_ucs2conv { - const char *from; - const char *to; -}; -typedef struct tag_ucs2conv ucs2conv_t; +/** + * Get the encoding for multi-byte characters (for iconv/libiconv). + * + * This function returns the default encoding for multi-byte characters used + * in the UCS-2 API. + * + * @retval const char* The pointer to the string of the character encoding. + * + * @note + * This function is effective only on environments with iconv (libiconv). + */ +UCS2API const char *ucs2getenc(); -UCS2API int ucs2init(const char *encoding); +/** + * Set the code page for multi-byte characters (for Win32). + * + * This function change the default encoding for multi-byte characters to the + * code page specified by the \a cp argument. + * + * @param cp The code page. + * + * @note + * This function is effective only on Win32 environments. + */ +UCS2API void ucs2setcp(int cp); -UCS2API int ucs2set_encoding(const char *encoding, ucs2conv_t* conv); -UCS2API int ucs2set_encoding_music(const char *encoding, ucs2conv_t* conv); -UCS2API void ucs2set_codepage(int cp); +/** + * Get the code page for multi-byte characters (for Win32). + * + * This function returns the default code page for multi-byte characters. + * + * @param cp The code page. + * + * @note + * This function is effective only on Win32 environments. + */ +UCS2API int ucs2getcp(); +/** + * Convert a UCS-2 string to multi-byte characters. + * + * @param mbstr The pointer to the buffer for receiving multi-byte + * characters converted from the UCS-2 string. If + * \a mbs_size is zero, this argument is not be used. + * @param mbs_size The size, in bytes, of the buffer pointed to by the + * \a mbstr argument. If this value is zero, the function + * returns the number of bytes required for the buffer. + * @param ucs2str The pointer to the UCS-2 string to be converted. + * @param ucs_size The size, in number of UCS-2 characters, of the UCS-2 + * string, \a ucs2str. + * @retval size_t The number of bytes written to \a mbstr buffer if + * the conversion is successful. If \a mbs_size is zero, + * the return value is the required size, in bytes, for a + * buffer to receive the converted string. This function + * returns zero if an error occurred. + */ UCS2API size_t ucs2tombs(char *mbstr, size_t mbs_size, const ucs2char_t *ucs2str, size_t ucs_size); + +/** + * Convert multi-byte characters to a UCS-2 string. + * + * @param ucs2str The pointer to the buffer for receiving UCS-2 string + * converted from the multi-byte characters. If + * \a ucs_size is zero, this argument is not be used. + * @param ucs_size The size, in number of UCS-2 characters, of the buffer + * pointed to by the \a ucs2str argument. If this value is + * zero, the function returns the number of UCS-2 + * characters required for the buffer. + * @param mbstr The pointer to the multi-byte characters to be + * converted. + * @param mbs_size The size, in bytes, of the multi-byte characters, + * \a mbstr. + * @retval size_t The number of UCS-2 characters written to \a ucs2str + * buffer if the conversion is successful. If \a ucs_size + * is zero, the return value is the required size, in + * number of UCS-2 characters, for a buffer to receive the + * converted string. This function returns zero if an error + * occurred. + */ UCS2API size_t mbstoucs2(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size); -UCS2API size_t mbstoucs2_music(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size); + +/** + * Convert multi-byte characters in a specific encoding to a UCS-2 string. + * + * @param ucs2str The pointer to the buffer for receiving UCS-2 string + * converted from the multi-byte characters. If + * \a ucs_size is zero, this argument is not be used. + * @param ucs_size The size, in number of UCS-2 characters, of the buffer + * pointed to by the \a ucs2str argument. If this value is + * zero, the function returns the number of UCS-2 + * characters required for the buffer. + * @param mbstr The pointer to the multi-byte characters to be + * converted. + * @param mbs_size The size, in bytes, of the multi-byte characters, + * \a mbstr. + * @param charset The pointer to the string specifying the encoding of + * the multi-byte characters. + * @retval size_t The number of UCS-2 characters written to \a ucs2str + * buffer if the conversion is successful. If \a ucs_size + * is zero, the return value is the required size, in + * number of UCS-2 characters, for a buffer to receive the + * converted string. This function returns zero if an error + * occurred. + * @note + * \a charset is ignored on Win32 environments. + */ +UCS2API size_t mbstoucs2_charset(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size, const char *charset); + +/** + * Convert a UCS-2 string to multi-byte characters. + * + * @param mbstr The pointer to the buffer for receiving UTF-8 string + * converted from the UCS-2 string. If \a mbs_size is + * zero, this argument is not be used. + * @param mbs_size The size, in bytes, of the buffer pointed to by the + * \a mbstr argument. If this value is zero, the function + * returns the number of bytes required for the buffer. + * @param ucs2str The pointer to the UCS-2 string to be converted. + * @param ucs_size The size, in number of UCS-2 characters, of the UCS-2 + * string, \a ucs2str. + * @retval size_t The number of bytes written to \a mbstr buffer if + * the conversion is successful. If \a mbs_size is zero, + * the return value is the required size, in bytes, for a + * buffer to receive the converted string. This function + * returns zero if an error occurred. + */ +UCS2API size_t ucs2toutf8(char *mbstr, size_t mbs_size, const ucs2char_t *ucs2str, size_t ucs_size); + +/** + * Convert a UTF-8 string to a UCS-2 string. + * + * @param ucs2str The pointer to the buffer for receiving UCS-2 string + * converted from the UTF-8 string. If \a ucs_size is + * zero, this argument is not be used. + * @param ucs_size The size, in number of UCS-2 characters, of the buffer + * pointed to by the \a ucs2str argument. If this value is + * zero, the function returns the number of UCS-2 + * characters required for the buffer. + * @param mbstr The pointer to the UTF-8 string to be converted. + * @param mbs_size The size, in bytes, of the UTF-8 string, \a mbstr. + * @retval size_t The number of UCS-2 characters written to \a ucs2str + * buffer if the conversion is successful. If \a ucs_size + * is zero, the return value is the required size, in + * number of UCS-2 characters, for a buffer to receive the + * converted string. This function returns zero if an error + * occurred. + */ UCS2API size_t utf8toucs2(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size); +/** + * Convert and duplicate a UCS-2 string to multi-byte characters. + * + * @param ucs2str The pointer to a UCS-2 string. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API char *ucs2dupmbs(const ucs2char_t *ucs2str); + +/** + * Convert and duplicate multi-byte characters to a UCS-2 string. + * + * @param mbstr The pointer to multi-byte characters. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ UCS2API ucs2char_t* mbsdupucs2(const char *mbstr); + +/** + * Convert and duplicate multi-byte characters in a specific encoding + * to a UCS-2 string. + * + * @param mbstr The pointer to multi-byte characters. + * @param charset The pointer to the string specifying the encoding of + * the multi-byte characters. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API ucs2char_t* mbsdupucs2_charset(const char *mbstr, const char *charset); + +/** + * Convert and duplicate a UCS-2 string to a UTF-8 string. + * + * @param ucs2str The pointer to a UCS-2 string. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API char *ucs2duputf8(const ucs2char_t *ucs2str); + +/** + * Convert and duplicate a UTF-8 string to a UCS-2 string. + * + * @param mbstr The pointer to multi-byte characters. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ UCS2API ucs2char_t* utf8dupucs2(const char *utf8str); -UCS2API ucs2char_t* mbsdupucs2_music(const char *mbstr); -UCS2API char *ucs2dupmbs(const ucs2char_t *ucs2str); /** * @} @@ -83,89 +298,324 @@ -UCS2API void ucs2big2little(ucs2char_t* value); - - /** - * @defgroup ucs2_memory Memory allocation routines. + * @defgroup ucs2_memory Memory manager routines * @{ */ +/** + * Allocate a memory block. + * + * @param size The size, in bytes, of the memory block. + * @retval void* The pointer to the allocated memory block. + */ UCS2API void *ucs2malloc(size_t size); + +/** + * Allocate a memory block with values initialized as zero. + * + * @param size The size, in bytes, of the memory block. + * @retval void* The pointer to the allocated memory block. + */ UCS2API void *ucs2calloc(size_t size); + +/** + * Resize a memory block. + * + * @param ptr The pointer to the memory block to be resized. + * @param size The size, in bytes, of the new memory block. + * @retval void* The pointer to the new memory block. + */ UCS2API void *ucs2realloc(void *ptr, size_t size); -UCS2API void ucs2free(void* str); +/** + * Free a memory block. + * + * @param ptr The pointer to the memory block to be freed. + */ +UCS2API void ucs2free(void* ptr); + /** * @} */ -UCS2API int is_ucs2surrogate(ucs2char_t c); -UCS2API int isucs2space(ucs2char_t c); -UCS2API int isucs2digit(ucs2char_t c); +/** + * @defgroup ucs2_char UCS-2 character routines + * @{ + */ +UCS2API int ucs2issurrogate(ucs2char_t c); +UCS2API int ucs2isspace(ucs2char_t c); +UCS2API int ucs2isdigit(ucs2char_t c); +UCS2API ucs2char_t ucs2lower(ucs2char_t c); +UCS2API ucs2char_t ucs2upper(ucs2char_t c); + +/** + * @} + */ + + + + + /** - * @defgroup ucs2_string_ansi ANSI C compatible string routines. + * @defgroup ucs2_string_ansi ANSI C compatible string routines * @{ + * + * This is the subset of the UCS-2 Character/String API that corresponds + * to string manupulation routines in the ANSI C standard. The following + * ANSI C functions are not defined in this subset: + * strcoll, strerror, strtok, strxfrm. */ +/** + * Concatenate two strings. + * + * @param dst The pointer to the destination of a string. + * @param src The pointer to the source of a string. + * @retval ucs2char_t* The pointer to the destination string. + */ UCS2API ucs2char_t* ucs2cat(ucs2char_t* dst, const ucs2char_t* src); -UCS2API ucs2char_t* ucs2chr(const ucs2char_t* string, ucs2char_t c); + +/** + * Search for the first occurrence of a character in a string. + * + * @param str The pointer to the string in which \a c is searched. + * @param c The target character. + * @retval ucs2char_t* The pointer to the character \a c in \a str, or \c NULL + * if \a c does not occur in \a str. + */ +UCS2API ucs2char_t* ucs2chr(const ucs2char_t* str, ucs2char_t c); + +/** + * Compare two strings. + * + * @param x The pointer to a string. + * @param y The pointer to another string. + * @retval int A positive value if \a x is greater than \a y; + * a negative value if \a x is smaller than \a y; + * zero if \a x is identical to \a y. + */ UCS2API int ucs2cmp(const ucs2char_t* x, const ucs2char_t* y); + +/** + * Copy a string. + * + * @param dst The pointer to the destination of a string. + * @param src The pointer to the source of a string. + * @retval ucs2char_t* The pointer to the destination string. + */ UCS2API ucs2char_t* ucs2cpy(ucs2char_t* dst, const ucs2char_t* src); -UCS2API size_t ucs2cspn(const ucs2char_t *str, const ucs2char_t *charset); -UCS2API ucs2char_t* ucs2dup(const ucs2char_t* src); -UCS2API size_t ucs2len(const ucs2char_t* string); -UCS2API ucs2char_t* ucs2ncat(ucs2char_t *dst, const ucs2char_t *src, size_t count); + +/** + * Count the number of characters not appearing in a character set. + * + * @param str The pointer to a string. + * @param charset The pointer to a character set. + * @retval size_t The number of characters from the beginning of \a str + * in which any character in \a charset appear for the + * first time, or the length of \a str if such a character + * does not exist. + */ +UCS2API size_t ucs2cspn(const ucs2char_t *str, const ucs2char_t *charset); + +/** + * Count the length of a string. + * + * @param str The pointer to a string. + * @retval size_t The number of characters in \a str. + */ +UCS2API size_t ucs2len(const ucs2char_t* str); + +/** + * Concatenate two strings (no more than the maximum length). + * + * @param dst The pointer to the destination of a string. + * @param src The pointer to the source of a string. + * @param n The number of characters to be concatenated. + * @retval ucs2char_t* The pointer to the destination string. + */ +UCS2API ucs2char_t* ucs2ncat(ucs2char_t *dst, const ucs2char_t *src, size_t n); + +/** + * Compare two strings (no longer than the maximum length). + * + * @param x The pointer to a string. + * @param y The pointer to another string. + * @param n The number of characters to be compared. + * @retval int A positive value if \a x is greater than \a y; + * a negative value if \a x is smaller than \a y; + * zero if \a x is identical to \a y. + */ UCS2API int ucs2ncmp(const ucs2char_t* x, const ucs2char_t* y, size_t n); -UCS2API ucs2char_t* ucs2ncpy(ucs2char_t* dst, const ucs2char_t* src, size_t count); -UCS2API ucs2char_t* ucs2pbrk(const ucs2char_t *str, const ucs2char_t *search); + +/** + * Copy a string (no more than the maximum length). + * + * @param dst The pointer to the destination of a string. + * @param src The pointer to the source of a string. + * @param n The number of characters to be copied. + * @retval ucs2char_t* The pointer to the destination string. + */ +UCS2API ucs2char_t* ucs2ncpy(ucs2char_t* dst, const ucs2char_t* src, size_t n); + +/** + * Find a character in a string that belongs to a character set. + * + * @param str The pointer to the string where \a charset is searched. + * @param charset The pointer to a character set. + * @retval ucs2char_t* The pointer to the character in \a str that belongs + * to \a charset, or \c NULL if such a character does not + * exist. + */ +UCS2API ucs2char_t* ucs2pbrk(const ucs2char_t *str, const ucs2char_t *charset); + +/** + * Search for the last occurrence of a character in a string. + * + * @param str The pointer to the string in which \a c is searched. + * @param c The target character. + * @retval ucs2char_t* The pointer to the character \a c in \a str, or \c NULL + * if \a c does not occur in \a str. + */ UCS2API ucs2char_t* ucs2rchr(const ucs2char_t* string, ucs2char_t c); + +/** + * Find a character in a string that does not belong to a character set. + * + * @param str The pointer to the string where \a charset is searched. + * @param charset The pointer to a character set. + * @retval ucs2char_t* The pointer to the character in \a str that does not + * belong to \a charset, or \c NULL if such a character + * does not exist. + */ UCS2API size_t ucs2spn(const ucs2char_t *str, const ucs2char_t *charset); -UCS2API ucs2char_t* ucs2str(const ucs2char_t* str, const ucs2char_t* search); +/** + * Find a substring in a string. + * + * @param str The pointer to the string where \a substr is searched. + * @param substr The pointer to the substring. + * @retval ucs2char_t* The pointer to the character where \a substr begins + * in \a str for the first time, or \c NULL if \a str + * does not contain \a substr. + */ +UCS2API ucs2char_t* ucs2str(const ucs2char_t* str, const ucs2char_t* substr); + /** - * @} + * @} */ + + + + /** - * @defgroup ucs2_string_ansi ANSI C compatible string routines. + * @defgroup ucs2_string_non_ansi Miscellaneous string routines * @{ */ +/** + * Duplicate a string. + * + * @param str The pointer to a string. + * @retval ucs2char_t* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API ucs2char_t* ucs2dup(const ucs2char_t* str); + +/** + * Duplicate a string no longer than the specified length. + * + * @param str The pointer to a string. + * @param length The maximum length of the duplicated string. + * @retval ucs2char_t* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ UCS2API ucs2char_t* ucs2ndup(const ucs2char_t* src, size_t length); + +/** + * Convert a string to lowercase. + * + * Given \a str argument, this function converts uppercase letters in the + * string to lowercase and overwrites the resultant string on the same buffer + * pointed by the \a str argument. + * + * @param str The pointer to a string. + * @retval ucs2char_t* The pointer to the string, which is the same value as + * \a str. + */ UCS2API ucs2char_t* ucs2lwr(ucs2char_t* str); + +/** + * Convert a string to uppercase. + * + * Given \a str argument, this function converts lowercase letters in the + * string to uppercase and overwrites the resultant string on the same buffer + * pointed by the \a str argument. + * + * @param str The pointer to a string. + * @retval ucs2char_t* The pointer to the string, which is the same value as + * \a str. + */ UCS2API ucs2char_t* ucs2upr(ucs2char_t* str); + +/** + * Compare two strings incasesensitively. + * + * @param x The pointer to a string. + * @param y The pointer to another string. + * @retval int A positive value if \a x is greater than \a y; + * a negative value if \a x is smaller than \a y; + * zero if \a x is identical to \a y. + */ UCS2API int ucs2icmp(const ucs2char_t* x, const ucs2char_t* y); + +/** + * Compare two strings incasesensitively (no longer than the maximum length). + * + * @param x The pointer to a string. + * @param y The pointer to another string. + * @param n The number of characters to be compared. + * @retval int A positive value if \a x is greater than \a y; + * a negative value if \a x is smaller than \a y; + * zero if \a x is identical to \a y. + */ UCS2API int ucs2incmp(const ucs2char_t* x, const ucs2char_t* y, size_t n); +/** + * Strip whitespace characters at the head and tail of a string. + * + * Given \a str argument, this function trims whilespace characters at the + * head and tail of the string and overwrites the resultant string on the + * same buffer pointed by the \a str argument. + * + * @param str The pointer to a string. + * @retval ucs2char_t* The pointer to the string, which is the same value as + * \a str. + */ +UCS2API ucs2char_t* ucs2strip(ucs2char_t* str); + /** * @} */ -UCS2API ucs2char_t ucs2lower(ucs2char_t c); -UCS2API ucs2char_t ucs2upper(ucs2char_t c); +/** + * @defgroup ucs2_std Wrapper for stdio/stdlib routines + * @{ + */ - -UCS2API ucs2char_t* ucs2strip(ucs2char_t* str); - - UCS2API int ucs2toi(const ucs2char_t* str); UCS2API ucs2char_t* itoucs2(int value, ucs2char_t *string, int radix); - - -UCS2API time_t ucs2stat_mtime(const ucs2char_t *filename); -UCS2API uint32_t ucs2stat_size(const ucs2char_t *filename); -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); /** @} */ +/** @} */ + #ifdef __cplusplus } #endif/*__cplusplus*/ Modified: trunk/pmplib/lib/filepath/filepath_posix.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_posix.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-06 04:06:42 UTC (rev 297) @@ -72,7 +72,7 @@ ucs2cpy(tmp, path); ucs2cat(tmp, filename); - if (!ucs2stat_is_dir(tmp)){ + if (!filepath_is_dir(tmp)){ callback(instance, path, filename); } } @@ -101,7 +101,7 @@ ucs2cpy(tmp, path); ucs2cat(tmp, filename); - if (ucs2stat_is_dir(tmp)){ + if (filepath_is_dir(tmp)){ filepath_addslash(tmp); find_file(tmp, recursive, callback, instance); } @@ -354,7 +354,7 @@ int filepath_file_exists(const ucs2char_t* path) { - return ucs2stat_is_exist(path); + return filepath_exist(path); } int filepath_relative_to_absolute(ucs2char_t* absolute, const ucs2char_t* base, const ucs2char_t* relative) @@ -396,8 +396,8 @@ struct stat st1; struct stat st2; - time_t ret1 = ucs2stat_mtime(file1); - time_t ret2 = ucs2stat_mtime(file2); + time_t ret1 = filepath_mtime(file1); + time_t ret2 = filepath_mtime(file2); return (ret1 - ret2); } Modified: trunk/pmplib/lib/filepath/filepath_win32.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_win32.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-06 04:06:42 UTC (rev 297) @@ -27,6 +27,9 @@ #include <os.h> +#include <sys/types.h> +#include <sys/stat.h> + #include <windows.h> #include <shlwapi.h> @@ -234,3 +237,36 @@ /* Does nothing for WIN32. */ return 0; } + +time_t filepath_mtime(const ucs2char_t *filename) +{ + int ret = 0; + struct _stat st; + ret = _wstat(filename, &st); + if (ret == 0) { + return st.st_mtime; + } + return 0; +} + +uint32_t filepath_size(const ucs2char_t *filename) +{ + int ret = 0; + struct _stat st; + ret = _wstat(filename, &st); + if (ret == 0) { + return st.st_size; + } + return 0; +} + +int filepath_is_dir(const ucs2char_t *filename) +{ + int ret = 0; + struct _stat st; + ret = _wstat(filename, &st); + if (ret == 0) { + return ((st.st_mode & S_IFMT) == S_IFDIR); + } + return 0; +} Modified: trunk/pmplib/lib/gmi/gmi.c =================================================================== --- trunk/pmplib/lib/gmi/gmi.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/gmi/gmi.c 2007-02-06 04:06:42 UTC (rev 297) @@ -37,20 +37,20 @@ * @{ */ -int gmi_mp3(media_info_t* info, const ucs2char_t *filename); +int gmi_mp3(media_info_t* info, const ucs2char_t *filename, const char *charset); static const ucs2char_t ucs2cs_ext_mp3[] = {'.','m','p','3',0}; -int gmi_wma(media_info_t* info, const ucs2char_t *filename); +int gmi_wma(media_info_t* info, const ucs2char_t *filename, const char *charset); static const ucs2char_t ucs2cs_ext_wma[] = {'.','w','m','a',0}; -int gmi_vorbis(media_info_t* info, const ucs2char_t *filename); +int gmi_vorbis(media_info_t* info, const ucs2char_t *filename, const char *charset); static const ucs2char_t ucs2cs_ext_ogg[] = {'.','o','g','g',0}; -int gmi_wav(media_info_t* info, const ucs2char_t *filename); +int gmi_wav(media_info_t* info, const ucs2char_t *filename, const char *charset); static const ucs2char_t ucs2cs_ext_wav[] = {'.','w','a','v',0}; typedef struct { - int (*func)(media_info_t* info, const ucs2char_t *filename); + int (*func)(media_info_t* info, const ucs2char_t *filename, const char *charset); const ucs2char_t* ext; } gmi_exports_t; @@ -198,6 +198,7 @@ const ucs2char_t *filename, const ucs2char_t* path_to_music, int flag, + const char *charset, ucs2char_t **strip_words, int num_strip_words ) @@ -207,12 +208,12 @@ /* Set the pathname and filename. */ info->filename = ucs2dup(filename); - info->filesize = ucs2stat_size(filename); + info->filesize = filepath_size(filename); if (flag & GMIF_TAG) { while (exp->func) { if (filepath_hasext(filename, exp->ext)) { - if (exp->func(info, filename) == 0) { + if (exp->func(info, filename, charset) == 0) { ret = 0; break; } Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-06 04:06:42 UTC (rev 297) @@ -273,7 +273,7 @@ } -static ucs2char_t* get_frame_value(struct id3_tag *id3tag, const char *name) +static ucs2char_t* get_frame_value(struct id3_tag *id3tag, const char *name, const char *charset) { ucs2char_t* ret = NULL; const id3_ucs4_t *value = NULL; @@ -313,7 +313,7 @@ if (encoding == ID3_FIELD_TEXTENCODING_ISO_8859_1) { char *mbs = id3_ucs4_latin1duplicate(value); - ret = mbsdupucs2_music(mbs); /* MBS for music files. */ + ret = mbsdupucs2_charset(mbs, charset); /* MBS for music files. */ free(mbs); return ret; } else { @@ -324,7 +324,7 @@ } } -int gmi_mp3(media_info_t* info, const ucs2char_t *filename) +int gmi_mp3(media_info_t* info, const ucs2char_t *filename, const char *charset) { int i, num_tags = 0; mp3header_t mp3header; @@ -375,7 +375,7 @@ } /* Obtain track number first. */ - ucs2 = get_frame_value(id3tag, "TRCK"); + ucs2 = get_frame_value(id3tag, "TRCK", charset); if (ucs2 && *ucs2) { info->track_number = ucs2toi(ucs2); } else { @@ -384,7 +384,7 @@ ucs2free(ucs2); /* Obtain track title. */ - ucs2 = get_frame_value(id3tag, "TIT2"); + ucs2 = get_frame_value(id3tag, "TIT2", charset); if (ucs2 && *ucs2) { ucs2free(info->title); info->title = ucs2dup(ucs2); @@ -392,11 +392,11 @@ ucs2free(ucs2); /* Set artist field. */ - if (1) ucs2 = get_frame_value(id3tag, "TPE1"); - if (!ucs2) ucs2 = get_frame_value(id3tag, "TPE2"); - if (!ucs2) ucs2 = get_frame_value(id3tag, "TPE3"); - if (!ucs2) ucs2 = get_frame_value(id3tag, "TPE4"); - if (!ucs2) ucs2 = get_frame_value(id3tag, "TCOM"); + if (1) ucs2 = get_frame_value(id3tag, "TPE1", charset); + if (!ucs2) ucs2 = get_frame_value(id3tag, "TPE2", charset); + if (!ucs2) ucs2 = get_frame_value(id3tag, "TPE3", charset); + if (!ucs2) ucs2 = get_frame_value(id3tag, "TPE4", charset); + if (!ucs2) ucs2 = get_frame_value(id3tag, "TCOM", charset); if (ucs2 && *ucs2) { ucs2free(info->artist); info->artist = ucs2dup(ucs2); @@ -404,7 +404,7 @@ ucs2free(ucs2); /* Set composer field. */ - ucs2 = get_frame_value(id3tag, "TCOM"); + ucs2 = get_frame_value(id3tag, "TCOM", charset); if (ucs2 && *ucs2) { ucs2free(info->composer); info->composer = ucs2dup(ucs2); @@ -412,7 +412,7 @@ ucs2free(ucs2); /* Set album field. */ - ucs2 = get_frame_value(id3tag, "TALB"); + ucs2 = get_frame_value(id3tag, "TALB", charset); if (ucs2 && *ucs2) { ucs2free(info->album); info->album = ucs2dup(ucs2); @@ -423,7 +423,7 @@ * TCMP (compilation flag) handling for omnibus albums. * This patch was originally submitted by Espen Matheussen. */ - ucs2 = get_frame_value(id3tag, "TCMP"); + ucs2 = get_frame_value(id3tag, "TCMP", charset); if (ucs2 && *ucs2) { size_t length = 0; ucs2char_t* title = NULL; @@ -458,7 +458,7 @@ } /* Set genre field. */ - ucs2 = get_frame_value(id3tag, "TCON"); + ucs2 = get_frame_value(id3tag, "TCON", charset); if (ucs2 && *ucs2) { ucs2free(info->genre); info->genre = ucs2dup(ucs2); @@ -466,8 +466,8 @@ ucs2free(ucs2); /* Set year field. */ - if (1) ucs2 = get_frame_value(id3tag, "TYER"); - if (!ucs2) ucs2 = get_frame_value(id3tag, "TDRC"); + if (1) ucs2 = get_frame_value(id3tag, "TYER", charset); + if (!ucs2) ucs2 = get_frame_value(id3tag, "TDRC", charset); if (ucs2 && *ucs2) { ucs2free(info->date); info->date = ucs2dup(ucs2); Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-06 04:06:42 UTC (rev 297) @@ -46,7 +46,7 @@ #define strncasecmp _strnicmp #endif -int gmi_vorbis(media_info_t* info, const ucs2char_t *filename) +int gmi_vorbis(media_info_t* info, const ucs2char_t *filename, const char *charset) { int i, ret = 0; long lval = 0; @@ -59,7 +59,7 @@ /* Set the pathname and filename. */ /* info->filename = ucs2dup(filename); - info->filesize = ucs2stat_size(filename); + info->filesize = filepath_size(filename); */ /* Open the target file. */ Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-06 04:06:42 UTC (rev 297) @@ -77,7 +77,7 @@ -int parse_listinfo(media_info_t* info, FILE *fp, uint32_t chunksize) +int parse_listinfo(media_info_t* info, FILE *fp, uint32_t chunksize, const char *charset) { int ret = 0; char buffer[1024]; @@ -109,23 +109,23 @@ switch (ch.id) { case 0x44525049: /* "IPRD" */ ucs2free(info->album); - info->album = mbsdupucs2_music(buffer); + info->album = mbsdupucs2_charset(buffer, charset); break; case 0x4D414E49: /* "INAM" */ ucs2free(info->title); - info->title = mbsdupucs2_music(buffer); + info->title = mbsdupucs2_charset(buffer, charset); break; case 0x54524149: /* "IART" */ ucs2free(info->artist); - info->artist = mbsdupucs2_music(buffer); + info->artist = mbsdupucs2_charset(buffer, charset); break; case 0x524E4749: /* "IGNR" */ ucs2free(info->genre); - info->genre = mbsdupucs2_music(buffer); + info->genre = mbsdupucs2_charset(buffer, charset); break; case 0x44524349: /* "ICRD" */ ucs2free(info->date); - info->date = mbsdupucs2_music(buffer); + info->date = mbsdupucs2_charset(buffer, charset); break; case 0x6974726B: /* "itrk" */ info->track_number = atoi(buffer); @@ -147,7 +147,7 @@ } -int get_riff_audio_info(media_info_t* info, const ucs2char_t *filename) +int get_riff_audio_info(media_info_t* info, const ucs2char_t *filename, const char *charset) { int ret = 0; FILE *fp = NULL; @@ -235,7 +235,7 @@ goto get_riff_audio_info_error; } if (tmp32 == 0x4F464E49) { - ret |= parse_listinfo(info, fp, ch.size - 4); + ret |= parse_listinfo(info, fp, ch.size - 4, charset); if (ret != 0) { goto get_riff_audio_info_error; } @@ -254,11 +254,11 @@ return -1; } -int gmi_wav(media_info_t* info, const ucs2char_t *filename) +int gmi_wav(media_info_t* info, const ucs2char_t *filename, const char *charset) { int ret = 0; - ret = get_riff_audio_info(info, filename); + ret = get_riff_audio_info(info, filename, charset); if (ret == 0) { info->codec = PMPCODEC_WAV; } Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-06 04:06:42 UTC (rev 297) @@ -130,14 +130,14 @@ /* Skip space. */ pos--; while (begin <= pos) { - if (!isucs2space(*pos)) { + if (!ucs2isspace(*pos)) { break; } pos--; } /* Skip digits. */ while (begin <= pos) { - if (!isucs2digit(*pos)) { + if (!ucs2isdigit(*pos)) { pos++; break; } @@ -507,7 +507,7 @@ return -1; } -int gmi_wma(media_info_t* info, const ucs2char_t *filename) +int gmi_wma(media_info_t* info, const ucs2char_t *filename, const char *charset) { int ret = 0; Modified: trunk/pmplib/lib/playlist/jspl.c =================================================================== --- trunk/pmplib/lib/playlist/jspl.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/playlist/jspl.c 2007-02-06 04:06:42 UTC (rev 297) @@ -448,7 +448,7 @@ mbsfilename = ucs2dupmbs(filename); /* Obtain the filesize. */ - filesize = ucs2stat_size(filename); + filesize = filepath_size(filename); /* Read the entire file at one time. */ buff = (char*)malloc(filesize+1); Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-06 04:06:42 UTC (rev 297) @@ -414,6 +414,25 @@ return ret; } +static int is_bigendian(void) +{ + ucs2char_t c = 0x1234; + uint8_t* p = (uint8_t*)&c; + return (*p == 0x12); +} + +static void ucs2big2little(ucs2char_t* value) +{ + if (is_bigendian()) { + for (;*value;value++) { + ucs2char_t val = (*value << 8) | (*value >> 8); + *value = val; + } + } +} + + + static uint32_t ucs2crc(const ucs2char_t* value) { if (value) { Modified: trunk/pmplib/lib/ucs2/ucs2char.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/ucs2/ucs2char.c 2007-02-06 04:06:42 UTC (rev 297) @@ -59,17 +59,17 @@ free(str); } -int is_ucs2surrogate(ucs2char_t c) +int ucs2issurrogate(ucs2char_t c) { return (0xD800 <= c && c <= 0xDFFF); } -int isucs2space(ucs2char_t c) +int ucs2isspace(ucs2char_t c) { return ((0x0009 <= c && c <= 0x000D) || c == 0x0020); } -int isucs2digit(ucs2char_t c) +int ucs2isdigit(ucs2char_t c) { return (0x0030 <= c && c <= 0x0039); } @@ -299,14 +299,14 @@ if (str && *str) { ucs2char_t* p = NULL; for (p = str + ucs2len(str) - 1;str <= p;p--) { - if (!isucs2space(*p)) { + if (!ucs2isspace(*p)) { *(p + 1) = 0; break; } } for (p = str;p < str + ucs2len(str);p++) { - if (!isucs2space(*p)) { + if (!ucs2isspace(*p)) { break; } } @@ -381,12 +381,12 @@ return dst; } -ucs2char_t* mbsdupucs2_music(const char *mbstr) +ucs2char_t* mbsdupucs2_charset(const char *mbstr, const char *charset) { - size_t ucs2_size = mbstoucs2_music(NULL, 0, mbstr, strlen(mbstr)) + 1; + size_t ucs2_size = mbstoucs2_charset(NULL, 0, mbstr, strlen(mbstr), charset) + 1; ucs2char_t* dst = (ucs2char_t*)malloc(ucs2_size * sizeof(ucs2char_t)); if (dst) { - mbstoucs2_music(dst, ucs2_size * sizeof(ucs2char_t), mbstr, strlen(mbstr)+1); + mbstoucs2_charset(dst, ucs2_size * sizeof(ucs2char_t), mbstr, strlen(mbstr)+1, charset); } return dst; } Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-06 04:06:42 UTC (rev 297) @@ -39,11 +39,17 @@ #include <iconv.h> -/** - * \addtogroup ucs2 - * @{ - */ +#ifdef HAVE_LANGINFO_CODESET +#include <langinfo.h> +#endif + +struct tag_ucs2conv { + const char *from; + const char *to; +}; +typedef struct tag_ucs2conv ucs2conv_t; + #ifdef USE_LIBICONV_GNU #define iconv_open libiconv_open #define iconv_convert libiconv_convert @@ -57,9 +63,20 @@ #define MBS_CHARSET "UTF-8" static char g_encoding[128]; -static char g_encoding_music[128]; static char g_ucs2encoding[128]; +static char *get_default_encoding() +{ + const char *encoding = getenv("CHARSET"); + +#ifdef HAVE_LANGINFO_CODESET + if (!encoding) { + encoding = nl_langinfo(CODESET); + } +#endif + return encoding ? strdup(encoding) : strdup("UTF-8"); +} + static void print_ucs2(const ucs2char_t* str) { while (*str) { @@ -69,13 +86,6 @@ fprintf(stderr, "\n"); } -static int is_bigendian(void) -{ - ucs2char_t c = 0x1234; - uint8_t* p = (uint8_t*)&c; - return (*p == 0x12); -} - static const char *get_ucs2encoding(void) { static const char *unicode_big = "UNICODEBIG"; @@ -83,13 +93,12 @@ return is_bigendian() ? unicode_big : unicode_little; } -int ucs2init(const char *encoding) +int ucs2init() { if (!encoding) { encoding = MBS_CHARSET; } strcpy(g_encoding, encoding); - strcpy(g_encoding_music, encoding); } static int ucs2check(ucs2conv_t* conv) @@ -127,31 +136,16 @@ return 0; } -int ucs2set_encoding(const char *encoding, ucs2conv_t* conv) +int ucs2setenc(const char *encoding) { + int ret = 0; + ucs2conv_t conv; strncpy(g_encoding, encoding, sizeof(g_encoding)); strncpy(g_ucs2encoding, get_ucs2encoding(), sizeof(g_ucs2encoding)); - return ucs2check(conv); + return ucs2check(&conv); } -int ucs2set_encoding_music(const char *encoding, ucs2conv_t* conv) -{ - strncpy(g_encoding_music, encoding, sizeof(g_encoding_music)); - strncpy(g_ucs2encoding, get_ucs2encoding(), sizeof(g_ucs2encoding)); - return ucs2check(conv); -} - -void ucs2big2little(ucs2char_t* value) -{ - if (is_bigendian()) { - for (;*value;value++) { - ucs2char_t val = (*value << 8) | (*value >> 8); - *value = val; - } - } -} - int ucs2toi(const ucs2char_t* str) { int ret; @@ -267,7 +261,7 @@ return fp; } -time_t ucs2stat_mtime(const ucs2char_t *filename) +time_t filepath_mtime(const ucs2char_t *filename) { int ret = 0; struct stat st; @@ -284,7 +278,7 @@ return 0; } -uint32_t ucs2stat_size(const ucs2char_t *filename) +uint32_t filepath_size(const ucs2char_t *filename) { int ret = 0; struct stat st; @@ -301,7 +295,7 @@ return 0; } -int ucs2stat_is_dir(const ucs2char_t *filename) +int filepath_is_dir(const ucs2char_t *filename) { int ret = 0; struct stat st; @@ -318,7 +312,7 @@ return 0; } -int ucs2stat_is_exist(const ucs2char_t *filename) +int filepath_exist(const ucs2char_t *filename) { int ret = 0; struct stat st; @@ -336,5 +330,3 @@ } return 0; } - -/** @} */ Modified: trunk/pmplib/lib/ucs2/ucs2char_win32.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-01-30 15:43:25 UTC (rev 296) +++ trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-06 04:06:42 UTC (rev 297) @@ -29,8 +29,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> -#include <sys/stat.h> #include <ucs2char.h> #ifdef _WIN32 @@ -42,14 +40,16 @@ #endif static UINT g_codepage = CP_ACP; +static const char *g_encoding = ""; -void ucs2set_codepage(int cp) +void ucs2setcp(int cp) { g_codepage = (UINT)cp; } -void ucs2big2little(ucs2char_t* value) +UCS2API const char *ucs2getenc() { + return g_encoding; } int ucs2toi(const ucs2char_t* str) @@ -73,7 +73,7 @@ return MultiByteToWideChar(g_codepage, 0, mbstr, (int)mbs_len, ucs2str, (int)ucs_len); } -size_t mbstoucs2_music(ucs2char_t *ucs2str, size_t ucs_len, const char *mbstr, size_t mbs_len) +size_t mbstoucs2_charset(ucs2char_t *ucs2str, size_t ucs_len, const char *mbstr, size_t mbs_len, const char *charset) { return MultiByteToWideChar(g_codepage, 0, mbstr, (int)mbs_len, ucs2str, (int)ucs_len); } @@ -120,36 +120,3 @@ } return fp; } - -time_t ucs2stat_mtime(const ucs2char_t *filename) -{ - int ret = 0; - struct _stat st; - ret = _wstat(filename, &st); - if (ret == 0) { - return st.st_mtime; - } - return 0; -} - -uint32_t ucs2stat_size(const ucs2char_t *filename) -{ - int ret = 0; - struct _stat st; - ret = _wstat(filename, &st); - if (ret == 0) { - return st.st_size; - } - return 0; -} - -int ucs2stat_is_dir(const ucs2char_t *filename) -{ - int ret = 0; - struct _stat st; - ret = _wstat(filename, &st); - if (ret == 0) { - return ((st.st_mode & S_IFMT) == S_IFDIR); - } - return 0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 02:29:46
|
Revision: 316 http://svn.sourceforge.net/pmplib/?rev=316&view=rev Author: nyaochi Date: 2007-02-08 18:29:45 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Moved exportable include files into /include/pmplib directory: <ucs2char.h> -> <pmplib/ucs2char.h> <filepath.h> -> <pmplib/filepath.h> <pmp.h> -> <pmplib/pmp.h> Added <pmplib/os_types.h> 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/console_win32.c 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/cui/util.c trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp trunk/pmplib/include/gmi.h trunk/pmplib/include/os.h trunk/pmplib/include/playlist.h trunk/pmplib/include/pmplib/filepath.h trunk/pmplib/lib/filepath/filepath_win32.c trunk/pmplib/lib/gmi/gmi.c trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/playlist/jspl.c trunk/pmplib/lib/playlist/playlist.c trunk/pmplib/lib/playlist/rw_m3u.c trunk/pmplib/lib/playlist/rw_pls.c trunk/pmplib/lib/pmp/pmp.c trunk/pmplib/lib/pmp/pmp.vcproj trunk/pmplib/lib/pmp/pmp_win32.c trunk/pmplib/lib/pmp_iriverplus2/dat.c trunk/pmplib/lib/pmp_iriverplus2/idx.c trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c trunk/pmplib/lib/pmp_iriverplus2/idx_header.c trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c trunk/pmplib/lib/pmp_iriverplus2/idx_node.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.h trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c trunk/pmplib/lib/pmp_iriverplus2/playlist.c trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_iriverplus2/serialize.c trunk/pmplib/lib/pmp_iriverplus2/util.c trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/dic.c trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/lib/pmp_iriverplus3/serialize.c trunk/pmplib/lib/pmp_iriverplus3/util.c trunk/pmplib/lib/pmp_irivnavi/irivnavi.c trunk/pmplib/lib/pmp_irivnavi/playlist.c trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c trunk/pmplib/lib/pmp_irivnavi/serialize.c trunk/pmplib/lib/pmp_portalplayer1/dat.c trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c trunk/pmplib/lib/pmp_portalplayer1/hdr.c trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c trunk/pmplib/lib/pmp_portalplayer1/idx.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_msi_megaplayer.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/playlist.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.h trunk/pmplib/lib/pmp_portalplayer1/serialize.c trunk/pmplib/lib/pmp_portalplayer1/util.c trunk/pmplib/lib/ucs2/ucs2char.c trunk/pmplib/lib/ucs2/ucs2char_iconv.c trunk/pmplib/lib/ucs2/ucs2char_win32.c Added Paths: ----------- trunk/pmplib/include/pmplib/os_types.h Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-09 02:29:45 UTC (rev 316) @@ -33,9 +33,9 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include <gmi.h> #include <easypmp.h> Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,10 +32,10 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <playlist.h> -#include <pmp.h> +#include <pmplib/pmp.h> #include <easypmp.h> Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,9 +29,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include <playlist.h> #include <easypmp.h> Modified: trunk/pmplib/frontend/easypmp/cui/console_win32.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-02-09 02:29:45 UTC (rev 316) @@ -20,7 +20,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -30,7 +30,7 @@ #include <io.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <windows.h> Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,9 +29,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "util.h" Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-09 02:29:45 UTC (rev 316) @@ -37,10 +37,10 @@ #include <direct.h> /* getcwd() */ #endif/*_MSC_VER*/ -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <gmi.h> -#include <pmp.h> +#include <pmplib/pmp.h> #include <easypmp.h> #include "option.h" Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-09 02:29:45 UTC (rev 316) @@ -36,10 +36,10 @@ #include <direct.h> /* getcwd() */ #endif/*_MSC_VER*/ -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <gmi.h> -#include <pmp.h> +#include <pmplib/pmp.h> #ifdef HAVE_GETOPT_H #include <getopt.h> Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-09 02:29:45 UTC (rev 316) @@ -41,7 +41,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "console.h" Modified: trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-09 02:29:45 UTC (rev 316) @@ -27,10 +27,10 @@ #include "resource.h" #include <os.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <gmi.h> -#include <pmp.h> +#include <pmplib/pmp.h> #include <easypmp.h> #include "ejectdevice.h" Modified: trunk/pmplib/include/gmi.h =================================================================== --- trunk/pmplib/include/gmi.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/include/gmi.h 2007-02-09 02:29:45 UTC (rev 316) @@ -35,7 +35,7 @@ extern "C" { #endif/*__cplusplus*/ -#include <pmp.h> +#include <pmplib/pmp.h> /** * \addtogroup gmi Modified: trunk/pmplib/include/os.h =================================================================== --- trunk/pmplib/include/os.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/include/os.h 2007-02-09 02:29:45 UTC (rev 316) @@ -33,25 +33,9 @@ #endif/*_MSC_VER*/ #include <stdio.h> +#include <pmplib/os_types.h> -#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) -#include <sys/types.h> - -#else -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#endif - #if defined(WIN32) #define fileno _fileno #define strnicmp _strnicmp @@ -92,6 +76,4 @@ #endif -typedef int result_t; - #endif/*__OS_H__*/ Modified: trunk/pmplib/include/playlist.h =================================================================== --- trunk/pmplib/include/playlist.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/include/playlist.h 2007-02-09 02:29:45 UTC (rev 316) @@ -30,7 +30,7 @@ #define PLAYLISTAPI #endif -#include <pmp.h> +#include <pmplib/pmp.h> #ifdef __cplusplus extern "C" { Modified: trunk/pmplib/include/pmplib/filepath.h =================================================================== --- trunk/pmplib/include/pmplib/filepath.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/include/pmplib/filepath.h 2007-02-09 02:29:45 UTC (rev 316) @@ -25,7 +25,7 @@ #define __FILEPATHUTIL_H__ #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #ifdef FILEPATH_EXPORTS #define FILEPATHAPI __declspec(dllexport) Added: trunk/pmplib/include/pmplib/os_types.h =================================================================== --- trunk/pmplib/include/pmplib/os_types.h (rev 0) +++ trunk/pmplib/include/pmplib/os_types.h 2007-02-09 02:29:45 UTC (rev 316) @@ -0,0 +1,43 @@ +/* + * Basic type definitions among operating systems and compilers. + * + * 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 __OS_TYPES_H__ +#define __OS_TYPES_H__ + +#if defined(__GNU_C__) +#include <inttypes.h> + +#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) +#include <sys/types.h> + +#else +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +typedef int int32_t; +typedef unsigned short uint16_t; + +#endif + +typedef int result_t; + +#endif/*__OS_TYPES_H__*/ Property changes on: trunk/pmplib/include/pmplib/os_types.h ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Modified: trunk/pmplib/lib/filepath/filepath_win32.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-09 02:29:45 UTC (rev 316) @@ -33,7 +33,7 @@ #include <windows.h> #include <shlwapi.h> -#include <filepath.h> +#include <pmplib/filepath.h> #pragma comment(lib, "shlwapi.lib") int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance) Modified: trunk/pmplib/lib/gmi/gmi.c =================================================================== --- trunk/pmplib/lib/gmi/gmi.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #endif/*HAVE_CONFIG_H*/ #include <os.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <gmi.h> /** Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-09 02:29:45 UTC (rev 316) @@ -33,7 +33,7 @@ #include <string.h> #include <sys/types.h> #include <sys/stat.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <gmi.h> #include <id3tag.h> Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <gmi.h> #include <vorbis/codec.h> Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,7 +32,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <gmi.h> /** Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <gmi.h> /** Modified: trunk/pmplib/lib/playlist/jspl.c =================================================================== --- trunk/pmplib/lib/playlist/jspl.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/playlist/jspl.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,9 +32,9 @@ #include <string.h> #include <sys/types.h> #include <sys/stat.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include <playlist.h> #include <jsapi.h> Modified: trunk/pmplib/lib/playlist/playlist.c =================================================================== --- trunk/pmplib/lib/playlist/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/playlist/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,10 +32,10 @@ #include <string.h> #endif/*HAVE_STRING_H*/ #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <playlist.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> static const ucs2char_t ucs2cs_m3u[] = {'.','m','3','u',0}; static const ucs2char_t ucs2cs_m3u8[] = {'.','m','3','u','8',0}; Modified: trunk/pmplib/lib/playlist/rw_m3u.c =================================================================== --- trunk/pmplib/lib/playlist/rw_m3u.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/playlist/rw_m3u.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #ifdef HAVE_STRING_H #include <string.h> #endif/*HAVE_STRING_H*/ -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <playlist.h> static char *strip(char *line) Modified: trunk/pmplib/lib/playlist/rw_pls.c =================================================================== --- trunk/pmplib/lib/playlist/rw_pls.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/playlist/rw_pls.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <playlist.h> static char *strip(char *line) Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp/pmp.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <string.h> #endif/*HAVE_STRING_H*/ -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> void pmplib_record_init(pmp_music_record_t* record) { Modified: trunk/pmplib/lib/pmp/pmp.vcproj =================================================================== --- trunk/pmplib/lib/pmp/pmp.vcproj 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp/pmp.vcproj 2007-02-09 02:29:45 UTC (rev 316) @@ -196,6 +196,14 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File + RelativePath="..\..\include\os.h" + > + </File> + <File + RelativePath="..\..\include\pmplib\os_types.h" + > + </File> + <File RelativePath="..\..\include\pmp.h" > </File> Modified: trunk/pmplib/lib/pmp/pmp_win32.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_win32.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp/pmp_win32.c 2007-02-09 02:29:45 UTC (rev 316) @@ -27,12 +27,12 @@ #endif/*HAVE_CONFIG_H*/ #include <os.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <windows.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> struct tag_pmplib_t { uint32_t num_plugins; Modified: trunk/pmplib/lib/pmp_iriverplus2/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/dat.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/dat.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,7 +28,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_header.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_header.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_header.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_node.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_node.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_node.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "util.h" #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.h 2007-02-09 02:29:45 UTC (rev 316) @@ -24,7 +24,7 @@ #ifndef __IP2DB_IP2DB_H__ #define __IP2DB_IP2DB_H__ -#include <pmp.h> +#include <pmplib/pmp.h> #define PAGESIZE 0x400 Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c 2007-02-09 02:29:45 UTC (rev 316) @@ -27,8 +27,8 @@ #include <os.h> #include <stdlib.h> -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> #include "util.h" #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/serialize.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/serialize.c 2007-02-09 02:29:45 UTC (rev 316) @@ -30,7 +30,7 @@ #include <os.h> #include <stddef.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/util.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/util.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,7 +32,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-09 02:29:45 UTC (rev 316) @@ -38,7 +38,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-09 02:29:45 UTC (rev 316) @@ -35,7 +35,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-09 02:29:45 UTC (rev 316) @@ -46,7 +46,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "util.h" #include "ip3db.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "ip3db.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/serialize.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/serialize.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,7 +28,7 @@ #include <os.h> #include <memory.h> #include <stddef.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/util.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,7 +29,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <malloc.h> #include "util.h" Modified: trunk/pmplib/lib/pmp_irivnavi/irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/irivnavi.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_irivnavi/irivnavi.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> #include "serialize.h" #include "irivnavi.h" Modified: trunk/pmplib/lib/pmp_irivnavi/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -37,8 +37,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "irivnavi.h" Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-09 02:29:45 UTC (rev 316) @@ -33,9 +33,9 @@ #include <stdlib.h> #endif/*HAVE_STDLIB_H*/ #include <stddef.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "irivnavi.h" Modified: trunk/pmplib/lib/pmp_irivnavi/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/serialize.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_irivnavi/serialize.c 2007-02-09 02:29:45 UTC (rev 316) @@ -30,7 +30,7 @@ #include <os.h> #include <stddef.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/dat.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/dat.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/dat.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/hdr.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/hdr.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/hdr.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "pp1db.h" #include "hdr_template.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/idx.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/idx.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/idx.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> #include "serialize.h" #include "pp1db.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "pp1db.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #ifdef HAVE_STRING_H #include <string.h> #endif/*HAVE_STRING_H*/ -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "pp1db.h" #include "hdr_template.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "pp1db.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.h =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.h 2007-02-09 02:29:45 UTC (rev 316) @@ -24,7 +24,7 @@ #ifndef __PP1DB_H__ #define __PP1DB_H__ -#include <pmp.h> +#include <pmplib/pmp.h> #define PP1DB_PATHLENGTH 0x100 /**< Maximum length of path/file name. */ Modified: trunk/pmplib/lib/pmp_portalplayer1/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/serialize.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/serialize.c 2007-02-09 02:29:45 UTC (rev 316) @@ -30,7 +30,7 @@ #include <os.h> #include <stddef.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/util.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/util.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/util.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,7 +32,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" Modified: trunk/pmplib/lib/ucs2/ucs2char.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/ucs2/ucs2char.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,7 +29,7 @@ #include <ctype.h> #include <stdlib.h> #include <string.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> /** * \addtogroup ucs2 Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-09 02:29:45 UTC (rev 316) @@ -35,7 +35,7 @@ #include <stdlib.h> #include <string.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <iconv.h> Modified: trunk/pmplib/lib/ucs2/ucs2char_win32.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,7 +29,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #ifdef _WIN32 #include <windows.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-10 15:23:30
|
Revision: 325 http://svn.sourceforge.net/pmplib/?rev=325&view=rev Author: nyaochi Date: 2007-02-10 07:23:26 -0800 (Sat, 10 Feb 2007) Log Message: ----------- [Win32GUI] - Configurable source location of playlists - Configurable music and playlist location in the player - Disable Unicode JSPL for now Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 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/resource.h trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp trunk/pmplib/lib/playlist/contrib/js/jsapi.h trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h trunk/pmplib/lib/playlist/contrib/js/jslong.h trunk/pmplib/lib/playlist/contrib/js/jsosdep.h trunk/pmplib/lib/playlist/contrib/js/jsotypes.h trunk/pmplib/lib/playlist/contrib/js/jspubtd.h trunk/pmplib/lib/playlist/contrib/js/jstypes.h trunk/pmplib/lib/playlist/contrib/js/win32/debug/js32.dll trunk/pmplib/lib/playlist/contrib/js/win32/js32.lib trunk/pmplib/lib/playlist/contrib/js/win32/js32d.lib trunk/pmplib/lib/playlist/contrib/js/win32/release/js32.dll trunk/pmplib/lib/playlist/jspl.c trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 15:23:26 UTC (rev 325) @@ -76,9 +76,9 @@ MODE_DATABASE_REPR = 0x00000004, MODE_PLAYLIST = 0x00000010, MODE_PLAYLIST_RECONVERT = 0x00000100, - MODE_PLAYLIST_FIND = 0x00000200, - MODE_PLAYLIST_SKIP = 0x00000400, - MODE_PLAYLIST_JSPL = 0x00000800, + MODE_PLAYLIST_FIND = 0x00000200, + MODE_PLAYLIST_SKIP = 0x00000400, + MODE_PLAYLIST_JSPL = 0x00000800, MODE_LIST_DEVICES = 0x00001000, MODE_HELP = 0x00010000, MODE_HELP_VARIABLE = 0x00020000, @@ -98,9 +98,10 @@ ucs2char_t** strip_words; int num_strip_words; - char *path_to_pmp_music; - char *path_to_pmp_playlist; - char *path_to_playlist_source; + ucs2char_t* path_to_pmp_music; + ucs2char_t* path_to_pmp_playlist; + ucs2char_t* path_to_playlist_source; + int subdir_playlist_source; } option_t; typedef struct { Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 15:23:26 UTC (rev 325) @@ -189,7 +189,7 @@ // Decode the playlist path prefix for system path separators if (opt->path_to_playlist_source) { - mbstoucs2(path, MAX_PATH, opt->path_to_playlist_source, strlen(opt->path_to_playlist_source)+1); + ucs2cpy(path, opt->path_to_playlist_source); } else { filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); } @@ -197,7 +197,7 @@ filepath_decode(path); ret = find_file( path, - pmp->info.playlist_flag & PMPPF_RECURSIVE ? 1 : 0, + opt->subdir_playlist_source, found_playlist_file, &ed ); Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 15:23:26 UTC (rev 325) @@ -313,10 +313,10 @@ // Modify the default setting. if (opt.path_to_pmp_music) { - mbstoucs2(pmp->info.path_to_music, MAX_PATH, opt.path_to_pmp_music, strlen(opt.path_to_pmp_music)+1); + ucs2cpy(pmp->info.path_to_music, opt.path_to_pmp_music); } if (opt.path_to_pmp_playlist) { - mbstoucs2(pmp->info.path_to_playlist, MAX_PATH, opt.path_to_pmp_playlist, strlen(opt.path_to_pmp_playlist)+1); + ucs2cpy(pmp->info.path_to_playlist, opt.path_to_pmp_playlist); } // Generate open flag. Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 15:23:26 UTC (rev 325) @@ -128,6 +128,9 @@ ucs2free(opt->strip_words[i]); } ucs2free(opt->strip_words); + ucs2free(opt->path_to_pmp_music); + ucs2free(opt->path_to_pmp_playlist); + ucs2free(opt->path_to_playlist_source); free(opt->system_encoding); free(opt->music_encoding); memset(opt, 0, sizeof(*opt)); @@ -217,8 +220,8 @@ opt->verb |= MODE_PLAYLIST; break; case 'P': - free(opt->path_to_playlist_source); - opt->path_to_playlist_source = strdup(optarg); + ucs2free(opt->path_to_playlist_source); + opt->path_to_playlist_source = mbsdupucs2(optarg); break; case 'r': opt->verb |= MODE_PLAYLIST_RECONVERT; @@ -238,11 +241,11 @@ break; case 's': if (strncmp("pmp_music:", optarg, 10) == 0) { - free(opt->path_to_pmp_music); - opt->path_to_pmp_music = strdup(optarg+10); + ucs2free(opt->path_to_pmp_music); + opt->path_to_pmp_music = mbsdupucs2(optarg+10); } else if (strncmp("pmp_playlist:", optarg, 13) == 0) { - free(opt->path_to_pmp_playlist); - opt->path_to_pmp_playlist = strdup(optarg+13); + ucs2free(opt->path_to_pmp_playlist); + opt->path_to_pmp_playlist = mbsdupucs2(optarg+13); } else { fprintf(fpe, "Unrecognized variable: %s\n", optarg); return -1; Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-02-10 15:23:26 UTC (rev 325) @@ -92,51 +92,60 @@ // Dialog // -IDD_PREFERENCE DIALOGEX 0, 0, 263, 234 +IDD_PREFERENCE DIALOGEX 0, 0, 263, 265 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,210,48,12 - PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 + DEFPUSHBUTTON "OK",IDOK,144,240,48,12 + PUSHBUTTON "Cancel",IDCANCEL,204,240,48,12 GROUPBOX "Media database",IDC_STATIC,12,12,240,48 CONTROL "&None",IDC_RADIO_DATABASE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,24,72,8 CONTROL "&Update",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,96,24,72,8 CONTROL "&Rebuild",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,168,24,72,8 - LTEXT "Source of media information (&z):",IDC_STATIC,24,42,108,12 - COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,42,102,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,60 + LTEXT "Source of media information (&z):",IDC_STATIC,24,36,108,12 + COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,36,102,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,72 CONTROL "N&one",IDC_RADIO_PLAYLIST,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,78,72,8 CONTROL "&Update",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,96,78,72,8 CONTROL "Re&convert",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,168,78,72,8 - LTEXT "Conversion option:",IDC_STATIC,24,96,72,8 - CONTROL "&Find missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,96,72,8 - CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,96,72,8 - CONTROL "Use &JavaScript playlist",IDC_CHECK_PL_JSPL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,108,144,8 - GROUPBOX "Portable Player Device",IDC_STATIC,12,132,240,72 - LTEXT "&Location:",IDC_STATIC,24,145,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,145,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,145,66,12 - LTEXT "&Identifier:",IDC_STATIC,24,162,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_ID,78,162,162,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Description:",IDC_STATIC,24,180,42,12,SS_CENTERIMAGE - LTEXT "?X?^?e?B?b?N",IDC_STATIC_PLAYER_DESCRIPTION,78,180,162,12,0,WS_EX_CLIENTEDGE + LTEXT "Conversion option:",IDC_STATIC,24,90,72,8,SS_CENTERIMAGE + CONTROL "Find &missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,90,72,8 + CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,90,72,8 + LTEXT "Source folder(s):",IDC_STATIC,24,102,72,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_PLAYLIST_SOURCE,96,102,144,12,ES_AUTOHSCROLL + PUSHBUTTON "Re&fer",IDC_BUTTON_REFER_PLAYLIST_SOURCE,96,115,30,12 + CONTROL "Include su&b folders",IDC_CHECK_PLAYLIST_SUBFOLDERS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,117,72,8 + GROUPBOX "Portable Player Device",IDC_STATIC,12,144,240,90 + LTEXT "&Location:",IDC_STATIC,24,157,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_LOCATION,72,156,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,156,66,12 + LTEXT "&Identifier:",IDC_STATIC,24,174,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_ID,72,174,168,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "Description:",IDC_STATIC,24,192,42,12,SS_CENTERIMAGE + LTEXT "",IDC_STATIC_PLAYER_DESCRIPTION,72,192,168,12,0,WS_EX_CLIENTEDGE + LTEXT "Music folder:",IDC_STATIC,24,210,48,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_DEVICE_MUSIC,72,210,54,12,ES_AUTOHSCROLL + LTEXT "Playlist folder:",IDC_STATIC,138,210,48,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_DEVICE_PLAYLIST,186,210,54,12,ES_AUTOHSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,240,120,12 + PUSHBUTTON "&Default",IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE,126,115,30,12 END -IDD_PROCESSING DIALOGEX 0, 0, 263, 234 +IDD_PROCESSING DIALOGEX 0, 0, 263, 265 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,210,48,12,NOT WS_VISIBLE - PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 + DEFPUSHBUTTON "OK",IDOK,144,240,48,12,NOT WS_VISIBLE + PUSHBUTTON "Cancel",IDCANCEL,204,240,48,12 CONTROL "",IDC_LIST_PROGRESS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER,12,12,240,84 - EDITTEXT IDC_EDIT_LOG,12,96,240,102,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL + EDITTEXT IDC_EDIT_LOG,12,96,240,138,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 - CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,210,48,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,240,120,12 + CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,240,48,12 END @@ -153,7 +162,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 227 + BOTTOMMARGIN, 258 END IDD_PROCESSING, DIALOG @@ -161,7 +170,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 227 + BOTTOMMARGIN, 258 END END #endif // APSTUDIO_INVOKED @@ -197,8 +206,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,13,0,2 - PRODUCTVERSION 0,13,0,2 + FILEVERSION 0,14,0,2 + PRODUCTVERSION 0,14,0,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -214,12 +223,12 @@ BLOCK "040904b0" BEGIN VALUE "FileDescription", "EasyPMP [Win32 GUI] application" - VALUE "FileVersion", "0, 13, 0, 2" + VALUE "FileVersion", "0, 14, 0, 2" VALUE "InternalName", "easypmp_win32gui" VALUE "LegalCopyright", "Copyright 2005-2007 Nyaochi" VALUE "OriginalFilename", "easypmp_win32gui.exe" VALUE "ProductName", "EasyPMP [Win32 GUI]" - VALUE "ProductVersion", "0, 13, 0, 2" + VALUE "ProductVersion", "0, 14, 0, 2" END END BLOCK "VarFileInfo" Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2007-02-10 15:23:26 UTC (rev 325) @@ -4,6 +4,7 @@ Version="8.00" Name="easypmp_win32gui" ProjectGUID="{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" + RootNamespace="easypmp_win32gui" > <Platforms> <Platform @@ -236,6 +237,10 @@ > </File> <File + RelativePath=".\folderdialog.h" + > + </File> + <File RelativePath=".\maindlg.h" > </File> Modified: trunk/pmplib/frontend/easypmp/win32gui/maindlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -24,10 +24,6 @@ #pragma once -/** - * \addtogroup win32 - * @{ - */ class CMainDlg : public CDialogImpl<CMainDlg>, public CUpdateUI<CMainDlg>, @@ -72,7 +68,7 @@ DDX_RADIO(IDC_RADIO_PLAYLIST, m_setting.iPlaylistProcess) DDX_CHECK(IDC_CHECK_PL_FIND, m_setting.bSearchMissing) DDX_CHECK(IDC_CHECK_PL_SKIP, m_setting.bSkipMissing) - DDX_CHECK(IDC_CHECK_PL_JSPL, m_setting.bJSPL) + DDX_CHECK(IDC_CHECK_PLAYLIST_SUBFOLDERS, m_setting.bPlaylistSourceSubdirs) DDX_CHECK(IDC_CHECK_SAVE_LOG, m_setting.bSaveLog) DDX_CHECK(IDC_CHECK_SAFEREMOVE, m_setting.bSafelyRemove) END_DDX_MAP() @@ -82,6 +78,8 @@ MESSAGE_HANDLER(WM_APP, OnInitialize) COMMAND_ID_HANDLER(IDOK, OnOK) COMMAND_ID_HANDLER(IDCANCEL, OnCancel) + COMMAND_ID_HANDLER(IDC_BUTTON_REFER_PLAYLIST_SOURCE, OnClickReferPlaylistSource) + COMMAND_ID_HANDLER(IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE, OnClickDefaultPlaylistSource) COMMAND_HANDLER(IDC_COMBO_DEVICE_LOCATION, CBN_SELCHANGE, OnLocationSelChange) END_MSG_MAP() @@ -227,6 +225,24 @@ return 0; } + LRESULT OnClickReferPlaylistSource(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + CFolderDialog2 fd(m_hWnd, _T("Choose a folder for source playlists")); + fd.SetFolderPath(m_setting.strPlaylistSourceLocation); + if (fd.DoModal() == IDOK) { + m_setting.strPlaylistSourceLocation = fd.m_szFolderPath; + updateUI(FALSE); + } + return 0; + } + + LRESULT OnClickDefaultPlaylistSource(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + m_setting.strPlaylistSourceLocation = _T(""); + updateUI(FALSE); + return 0; + } + LRESULT OnLocationSelChange(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { CString strPlayerLocation; @@ -275,6 +291,9 @@ m_cmbPlayerLocation.GetLBText(m_cmbPlayerLocation.GetCurSel(), m_setting.strPlayerLocation); m_cmbPlayerIdentifier.GetLBText(m_cmbPlayerIdentifier.GetCurSel(), m_setting.strPlayerIdentifier); m_setting.iMediaInfoSource = m_cmbMediaInfoSource.GetCurSel(); + GetDlgItemText(IDC_EDIT_DEVICE_MUSIC, m_setting.strPlayerMusicLocation); + GetDlgItemText(IDC_EDIT_DEVICE_PLAYLIST, m_setting.strPlayerPlaylistLocation); + GetDlgItemText(IDC_EDIT_PLAYLIST_SOURCE, m_setting.strPlaylistSourceLocation); } else { if (m_cmbPlayerLocation.SelectString(-1, m_setting.strPlayerLocation) == CB_ERR) { m_cmbPlayerLocation.SetCurSel(-1); @@ -284,6 +303,9 @@ } m_cmbMediaInfoSource.SetCurSel(m_setting.iMediaInfoSource); SetDlgItemText(IDC_STATIC_PLAYER_DESCRIPTION, m_setting.strPlayerDescription); + SetDlgItemText(IDC_EDIT_DEVICE_MUSIC, m_setting.strPlayerMusicLocation); + SetDlgItemText(IDC_EDIT_DEVICE_PLAYLIST, m_setting.strPlayerPlaylistLocation); + SetDlgItemText(IDC_EDIT_PLAYLIST_SOURCE, m_setting.strPlaylistSourceLocation); } } @@ -352,5 +374,3 @@ m_strIniFile = strIniFile; } }; -/** @} */ - Modified: trunk/pmplib/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-10 15:23:26 UTC (rev 325) @@ -24,10 +24,6 @@ #pragma once -/** - * \addtogroup win32 - * @{ - */ class CEasyPMPSetting { public: int iDBProces; @@ -36,10 +32,13 @@ int iPlaylistProcess; BOOL bSearchMissing; BOOL bSkipMissing; - BOOL bJSPL; + CString strPlaylistSourceLocation; + BOOL bPlaylistSourceSubdirs; CString strPlayerLocation; CString strPlayerIdentifier; CString strPlayerDescription; + CString strPlayerMusicLocation; + CString strPlayerPlaylistLocation; BOOL bSaveLog; BOOL bSafelyRemove; int iCodePage; @@ -53,10 +52,13 @@ iPlaylistProcess = 2; bSearchMissing = TRUE; bSkipMissing = FALSE; - bJSPL = FALSE; - strPlayerLocation = _T(""); // Initialize empty. - strPlayerIdentifier = _T(""); // Initialize empty. - strPlayerDescription = _T(""); // Initialize empty. + strPlaylistSourceLocation = _T(""); // Initialize empty. + bPlaylistSourceSubdirs = FALSE; + strPlayerLocation = _T(""); // Initialize empty. + strPlayerIdentifier = _T(""); // Initialize empty. + strPlayerDescription = _T(""); // Initialize empty. + strPlayerMusicLocation = _T(""); + strPlayerPlaylistLocation = _T(""); bSaveLog = FALSE; bSafelyRemove = FALSE; iCodePage = CP_ACP; @@ -103,9 +105,12 @@ persistInt(iPlaylistProcess, _T("Playlist"), _T("Process"), szSettingFile, storing); persistBool(bSearchMissing, _T("Playlist"), _T("SearchMissing"), szSettingFile, storing); persistBool(bSkipMissing, _T("Playlist"), _T("SkipMissing"), szSettingFile, storing); - persistBool(bJSPL, _T("Playlist"), _T("JSPL"), szSettingFile, storing); + persistString(strPlaylistSourceLocation, _T("Playlist"), _T("SourceLocation"), szSettingFile, storing); + persistBool(bPlaylistSourceSubdirs, _T("Playlist"), _T("SourceSubdirs"), szSettingFile, storing); persistString(strPlayerLocation, _T("Player"), _T("Location"), szSettingFile, storing); persistString(strPlayerIdentifier, _T("Player"), _T("Identifier"), szSettingFile, storing); + persistString(strPlayerMusicLocation, _T("Player"), _T("MusicLocation"), szSettingFile, storing); + persistString(strPlayerPlaylistLocation, _T("Player"), _T("PlaylistLocation"), szSettingFile, storing); persistBool(bSafelyRemove, _T("General"), _T("SafelyRemove"), szSettingFile, storing); persistInt(iCodePage, _T("General"), _T("CodePage"), szSettingFile, storing); if (!storing) { @@ -206,9 +211,13 @@ strPlayerDescription += _T(" "); strPlayerDescription += A2CT(pmp->info.decl.mode); } + strPlayerMusicLocation = UCS2CT(pmp->info.path_to_music); + strPlayerPlaylistLocation = UCS2CT(pmp->info.path_to_playlist); } else { strPlayerIdentifier = _T(""); strPlayerDescription = _T(""); + strPlayerMusicLocation = _T(""); + strPlayerPlaylistLocation = _T(""); } } @@ -323,4 +332,3 @@ } }; -/** @} */ Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -280,8 +280,17 @@ } if (m_preference.bSearchMissing) opt.verb |= MODE_PLAYLIST_FIND; if (m_preference.bSkipMissing) opt.verb |= MODE_PLAYLIST_SKIP; - if (m_preference.bJSPL) opt.verb |= MODE_PLAYLIST_JSPL; + if (opt.verb & MODE_PLAYLIST) { + opt.verb |= MODE_PLAYLIST_JSPL; + } + if (!m_preference.strPlaylistSourceLocation.IsEmpty()) { + opt.path_to_playlist_source = ucs2dup(T2CUCS(m_preference.strPlaylistSourceLocation)); + } + if (m_preference.bPlaylistSourceSubdirs) { + opt.subdir_playlist_source = 1; + } + // Set path to the root folder. m_preference.GetPathToPlayerRoot(str); ucs2cpy(opt.path_to_root, T2CUCS(str)); @@ -329,6 +338,14 @@ return 1; } + // Modify the default setting. + if (!m_preference.strPlayerMusicLocation.IsEmpty()) { + ucs2cpy(pmp->info.path_to_music, T2CUCS(m_preference.strPlayerMusicLocation)); + } + if (!m_preference.strPlayerPlaylistLocation.IsEmpty()) { + ucs2cpy(pmp->info.path_to_playlist, T2CUCS(m_preference.strPlayerPlaylistLocation)); + } + // Generate open flag. int openflag = 0; if (opt.verb & MODE_DATABASE) { Modified: trunk/pmplib/frontend/easypmp/win32gui/resource.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/resource.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/resource.h 2007-02-10 15:23:26 UTC (rev 325) @@ -31,6 +31,13 @@ #define IDC_STATIC_PLAYER_DESCRIPTION 1021 #define IDC_CHECK_DONT_CLOSE 1021 #define IDC_LIST_PROGRESS 1031 +#define IDC_EDIT_PLAYLIST_SOURCE 1033 +#define IDC_BUTTON_REFER_PLAYLIST_SOURCE 1034 +#define IDC_CHECK_PLAYLIST_SUBFOLDERS 1035 +#define IDC_EDIT_DEVICE_MUSIC 1036 +#define IDC_EDIT_DEVICE_PLAYLIST 1037 +#define IDC_BUTTON1 1038 +#define IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE 1038 // Next default values for new objects // @@ -38,7 +45,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 205 #define _APS_NEXT_COMMAND_VALUE 32772 -#define _APS_NEXT_CONTROL_VALUE 1033 +#define _APS_NEXT_CONTROL_VALUE 1039 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif Modified: trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-10 15:23:26 UTC (rev 325) @@ -34,6 +34,7 @@ #include <easypmp.h> #include "ejectdevice.h" +#include "folderdialog.h" #include "progress_with_caption.h" #include "preference.h" #include "processingdlg.h" Modified: trunk/pmplib/lib/playlist/contrib/js/jsapi.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsapi.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsapi.h 2007-02-10 15:23:26 UTC (rev 325) @@ -135,6 +135,19 @@ #define JSFUN_FLAGS_MASK 0xf8 /* overlay JSFUN_* attributes */ /* + * Re-use JSFUN_LAMBDA, which applies only to scripted functions, for use in + * JSFunctionSpec arrays that specify generic native prototype methods, i.e., + * methods of a class prototype that are exposed as static methods taking an + * extra leading argument: the generic |this| parameter. + * + * If you set this flag in a JSFunctionSpec struct's flags initializer, then + * that struct must live at least as long as the native static method object + * created due to this flag by JS_DefineFunctions or JS_InitClass. Typically + * JSFunctionSpec structs are allocated in static arrays. + */ +#define JSFUN_GENERIC_NATIVE JSFUN_LAMBDA + +/* * Well-known JS values. The extern'd variables are initialized when the * first JSContext is created by JS_NewContext (see below). */ @@ -437,10 +450,26 @@ #define JSOPTION_PRIVATE_IS_NSISUPPORTS \ JS_BIT(3) /* context private data points to an nsISupports subclass */ -#define JSOPTION_COMPILE_N_GO JS_BIT(4) /* one-shot compile+execute, - enables compile-time scope - chain resolution of consts - in many cases, e.g. */ +#define JSOPTION_COMPILE_N_GO JS_BIT(4) /* caller of JS_Compile*Script + promises to execute compiled + script once only; enables + compile-time scope chain + resolution of consts. */ +#define JSOPTION_ATLINE JS_BIT(5) /* //@line number ["filename"] + option supported for the + XUL preprocessor and kindred + beasts. */ +#define JSOPTION_XML JS_BIT(6) /* EMCAScript for XML support: + parse <!-- --> as a token, + not backward compatible with + the comment-hiding hack used + in HTML script tags. */ +#define JSOPTION_NATIVE_BRANCH_CALLBACK \ + JS_BIT(7) /* the branch callback set by + JS_SetBranchCallback may be + called with a null script + parameter, by native code + that loops intensively */ extern JS_PUBLIC_API(uint32) JS_GetOptions(JSContext *cx); @@ -490,6 +519,15 @@ extern JS_PUBLIC_API(JSBool) JS_EnumerateStandardClasses(JSContext *cx, JSObject *obj); +/* + * Enumerate any already-resolved standard class ids into ida, or into a new + * JSIdArray if ida is null. Return the augmented array on success, null on + * failure with ida (if it was non-null on entry) destroyed. + */ +extern JS_PUBLIC_API(JSIdArray *) +JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *obj, + JSIdArray *ida); + extern JS_PUBLIC_API(JSObject *) JS_GetScopeChain(JSContext *cx); @@ -562,13 +600,67 @@ * JS_GC entry point clears them for the context on which GC is being forced. * Embeddings may need to do likewise for all contexts. * - * XXXbe See bug 40757 (http://bugzilla.mozilla.org/show_bug.cgi?id=40757), - * which proposes switching (with an #ifdef, alas, if we want to maintain API - * compatibility) to a JNI-like extensible local root frame stack model. + * See the scoped local root API immediately below for a better way to manage + * newborns in cases where native hooks (functions, getters, setters, etc.) + * create many GC-things, potentially without connecting them to predefined + * local roots such as *rval or argv[i] in an active native function. Using + * JS_EnterLocalRootScope disables updating of the context's per-gc-thing-type + * newborn roots, until control flow unwinds and leaves the outermost nesting + * local root scope. */ extern JS_PUBLIC_API(void) JS_ClearNewbornRoots(JSContext *cx); +/* + * Scoped local root management allows native functions, getter/setters, etc. + * to avoid worrying about the newborn root pigeon-holes, overloading local + * roots allocated in argv and *rval, or ending up having to call JS_Add*Root + * and JS_RemoveRoot to manage global roots temporarily. + * + * Instead, calling JS_EnterLocalRootScope and JS_LeaveLocalRootScope around + * the body of the native hook causes the engine to allocate a local root for + * each newborn created in between the two API calls, using a local root stack + * associated with cx. For example: + * + * JSBool + * my_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) + * { + * JSBool ok; + * + * if (!JS_EnterLocalRootScope(cx)) + * return JS_FALSE; + * ok = my_GetPropertyBody(cx, obj, id, vp); + * JS_LeaveLocalRootScope(cx); + * return ok; + * } + * + * NB: JS_LeaveLocalRootScope must be called once for every prior successful + * call to JS_EnterLocalRootScope. If JS_EnterLocalRootScope fails, you must + * not make the matching JS_LeaveLocalRootScope call. + * + * In case a native hook allocates many objects or other GC-things, but the + * native protects some of those GC-things by storing them as property values + * in an object that is itself protected, the hook can call JS_ForgetLocalRoot + * to free the local root automatically pushed for the now-protected GC-thing. + * + * JS_ForgetLocalRoot works on any GC-thing allocated in the current local + * root scope, but it's more time-efficient when called on references to more + * recently created GC-things. Calling it successively on other than the most + * recently allocated GC-thing will tend to average the time inefficiency, and + * may risk O(n^2) growth rate, but in any event, you shouldn't allocate too + * many local roots if you can root as you go (build a tree of objects from + * the top down, forgetting each latest-allocated GC-thing immediately upon + * linking it to its parent). + */ +extern JS_PUBLIC_API(JSBool) +JS_EnterLocalRootScope(JSContext *cx); + +extern JS_PUBLIC_API(void) +JS_LeaveLocalRootScope(JSContext *cx); + +extern JS_PUBLIC_API(void) +JS_ForgetLocalRoot(JSContext *cx, void *thing); + #ifdef DEBUG extern JS_PUBLIC_API(void) JS_DumpNamedRoots(JSRuntime *rt, @@ -647,8 +739,16 @@ extern JS_PUBLIC_API(JSBool) JS_IsAboutToBeFinalized(JSContext *cx, void *thing); +typedef enum JSGCParamKey { + JSGC_MAX_BYTES = 0, /* maximum nominal heap before last ditch GC */ + JSGC_MAX_MALLOC_BYTES = 1 /* # of JS_malloc bytes before last ditch GC */ +} JSGCParamKey; + +extern JS_PUBLIC_API(void) +JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32 value); + /* - * Add an external string finalizer, one created by JS_NewExternalString (see + * Add a finalizer for external strings created by JS_NewExternalString (see * below) using a type-code returned from this function, and that understands * how to free or release the memory pointed at by JS_GetStringChars(str). * @@ -730,9 +830,21 @@ JSXDRObjectOp xdrObject; JSHasInstanceOp hasInstance; JSMarkOp mark; - jsword spare; + JSReserveSlotsOp reserveSlots; }; +struct JSExtendedClass { + JSClass base; + JSEqualityOp equality; + JSObjectOp outerObject; + JSObjectOp innerObject; + jsword reserved0; + jsword reserved1; + jsword reserved2; + jsword reserved3; + jsword reserved4; +}; + #define JSCLASS_HAS_PRIVATE (1<<0) /* objects have private slot */ #define JSCLASS_NEW_ENUMERATE (1<<1) /* has JSNewEnumerateOp hook */ #define JSCLASS_NEW_RESOLVE (1<<2) /* has JSNewResolveOp hook */ @@ -742,6 +854,9 @@ object in prototype chain passed in via *objp in/out parameter */ +#define JSCLASS_CONSTRUCT_PROTOTYPE (1<<6) /* call constructor on class + prototype */ +#define JSCLASS_DOCUMENT_OBSERVER (1<<7) /* DOM document observer */ /* * To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise-or @@ -751,14 +866,21 @@ #define JSCLASS_RESERVED_SLOTS_SHIFT 8 /* room for 8 flags below */ #define JSCLASS_RESERVED_SLOTS_WIDTH 8 /* and 16 above this field */ #define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_WIDTH) -#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \ +#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \ << JSCLASS_RESERVED_SLOTS_SHIFT) #define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \ - >> JSCLASS_RESERVED_SLOTS_SHIFT) \ + >> JSCLASS_RESERVED_SLOTS_SHIFT) \ & JSCLASS_RESERVED_SLOTS_MASK) +#define JSCLASS_HIGH_FLAGS_SHIFT (JSCLASS_RESERVED_SLOTS_SHIFT + \ + JSCLASS_RESERVED_SLOTS_WIDTH) + +/* True if JSClass is really a JSExtendedClass. */ +#define JSCLASS_IS_EXTENDED (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0)) + /* Initializer for unused members of statically initialized JSClass structs. */ #define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,0,0,0 +#define JSCLASS_NO_RESERVED_MEMBERS 0,0,0,0,0 /* For detailed comments on these function pointer types, see jspubtd.h. */ struct JSObjectOps { @@ -791,6 +913,15 @@ JSSetRequiredSlotOp setRequiredSlot; }; +struct JSXMLObjectOps { + JSObjectOps base; + JSGetMethodOp getMethod; + JSSetMethodOp setMethod; + JSEnumerateValuesOp enumerateValues; + JSEqualityOp equality; + JSConcatenateOp concatenate; +}; + /* * Classes that expose JSObjectOps via a non-null getObjectOps class hook may * derive a property structure from this struct, return a pointer to it from @@ -819,8 +950,21 @@ extern JS_PUBLIC_API(JSBool) JS_IdToValue(JSContext *cx, jsid id, jsval *vp); +/* + * The magic XML namespace id is int-tagged, but not a valid integer jsval. + * Global object classes in embeddings that enable JS_HAS_XML_SUPPORT (E4X) + * should handle this id specially before converting id via JSVAL_TO_INT. + */ +#define JS_DEFAULT_XML_NAMESPACE_ID ((jsid) JSVAL_VOID) + +/* + * JSNewResolveOp flag bits. + */ #define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */ #define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignment */ +#define JSRESOLVE_DETECTING 0x04 /* 'if (o.p)...' or '(o.p) ?...:...' */ +#define JSRESOLVE_DECLARING 0x08 /* var, const, or function prolog op */ +#define JSRESOLVE_CLASSNAME 0x10 /* class name used when constructing */ extern JS_PUBLIC_API(JSBool) JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp); @@ -886,6 +1030,9 @@ extern JS_PUBLIC_API(JSBool) JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv); +extern JS_PUBLIC_API(JSBool) +JS_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp); + extern JS_PUBLIC_API(void *) JS_GetPrivate(JSContext *cx, JSObject *obj); @@ -958,6 +1105,18 @@ uintN *attrsp, JSBool *foundp); /* + * The same, but if the property is native, return its getter and setter via + * *getterp and *setterp, respectively (and only if the out parameter pointer + * is not null). + */ +extern JS_PUBLIC_API(JSBool) +JS_GetPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj, + const char *name, + uintN *attrsp, JSBool *foundp, + JSPropertyOp *getterp, + JSPropertyOp *setterp); + +/* * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be @@ -978,12 +1137,23 @@ const char *alias); extern JS_PUBLIC_API(JSBool) +JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, JSBool *foundp); + +extern JS_PUBLIC_API(JSBool) JS_LookupProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) +JS_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, const char *name, + uintN flags, jsval *vp); + +extern JS_PUBLIC_API(JSBool) JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) +JS_GetMethod(JSContext *cx, JSObject *obj, const char *name, JSObject **objp, + jsval *vp); + +extern JS_PUBLIC_API(JSBool) JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) @@ -1011,6 +1181,18 @@ uintN *attrsp, JSBool *foundp); /* + * The same, but if the property is native, return its getter and setter via + * *getterp and *setterp, respectively (and only if the out parameter pointer + * is not null). + */ +extern JS_PUBLIC_API(JSBool) +JS_GetUCPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, + uintN *attrsp, JSBool *foundp, + JSPropertyOp *getterp, + JSPropertyOp *setterp); + +/* * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be @@ -1030,6 +1212,11 @@ uintN attrs); extern JS_PUBLIC_API(JSBool) +JS_HasUCProperty(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, + JSBool *vp); + +extern JS_PUBLIC_API(JSBool) JS_LookupUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namelen, jsval *vp); @@ -1072,6 +1259,9 @@ JS_AliasElement(JSContext *cx, JSObject *obj, const char *name, jsint alias); extern JS_PUBLIC_API(JSBool) +JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp); + +extern JS_PUBLIC_API(JSBool) JS_LookupElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp); extern JS_PUBLIC_API(JSBool) @@ -1092,7 +1282,23 @@ extern JS_PUBLIC_API(JSIdArray *) JS_Enumerate(JSContext *cx, JSObject *obj); +/* + * Create an object to iterate over enumerable properties of obj, in arbitrary + * property definition order. NB: This differs from longstanding for..in loop + * order, which uses order of property definition in obj. + */ +extern JS_PUBLIC_API(JSObject *) +JS_NewPropertyIterator(JSContext *cx, JSObject *obj); + +/* + * Return true on success with *idp containing the id of the next enumerable + * property to visit using iterobj, or JSVAL_VOID if there is no such property + * left to visit. Return false on error. + */ extern JS_PUBLIC_API(JSBool) +JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp); + +extern JS_PUBLIC_API(JSBool) JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode, jsval *vp, uintN *attrsp); @@ -1112,12 +1318,16 @@ */ struct JSPrincipals { char *codebase; + + /* XXX unspecified and unused by Mozilla code -- can we remove these? */ void * (* JS_DLL_CALLBACK getPrincipalArray)(JSContext *cx, JSPrincipals *); JSBool (* JS_DLL_CALLBACK globalPrivilegesEnabled)(JSContext *cx, JSPrincipals *); /* Don't call "destroy"; use reference counting macros below. */ jsrefcount refcount; - void (* JS_DLL_CALLBACK destroy)(JSContext *cx, struct JSPrincipals *); + + void (* JS_DLL_CALLBACK destroy)(JSContext *cx, JSPrincipals *); + JSBool (* JS_DLL_CALLBACK subsume)(JSPrincipals *, JSPrincipals *); }; #ifdef JS_THREADSAFE @@ -1142,7 +1352,7 @@ JS_SetPrincipalsTranscoder(JSRuntime *rt, JSPrincipalsTranscoder px); extern JS_PUBLIC_API(JSObjectPrincipalsFinder) -JS_SetObjectPrincipalsFinder(JSContext *cx, JSObjectPrincipalsFinder fop); +JS_SetObjectPrincipalsFinder(JSRuntime *rt, JSObjectPrincipalsFinder fop); /************************************************************************/ @@ -1183,6 +1393,12 @@ JS_GetFunctionFlags(JSFunction *fun); /* + * Return the arity (length) of fun. + */ +extern JS_PUBLIC_API(uint16) +JS_GetFunctionArity(JSFunction *fun); + +/* * Infallible predicate to test whether obj is a function object (faster than * comparing obj's class name to "Function", but equivalent unless someone has * overwritten the "Function" identifier with a different constructor and then @@ -1198,6 +1414,11 @@ JS_DefineFunction(JSContext *cx, JSObject *obj, const char *name, JSNative call, uintN nargs, uintN attrs); +extern JS_PUBLIC_API(JSFunction *) +JS_DefineUCFunction(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, JSNative call, + uintN nargs, uintN attrs); + extern JS_PUBLIC_API(JSObject *) JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent); @@ -1543,6 +1764,44 @@ extern JS_PUBLIC_API(JSBool) JS_MakeStringImmutable(JSContext *cx, JSString *str); +/* + * Return JS_TRUE if C (char []) strings passed via the API and internally + * are UTF-8. The source must be compiled with JS_C_STRINGS_ARE_UTF8 defined + * to get UTF-8 support. + */ +JS_PUBLIC_API(JSBool) +JS_StringsAreUTF8(); + +/* + * Character encoding support. + * + * For both JS_EncodeCharacters and JS_DecodeBytes, set *dstlenp to the size + * of the destination buffer before the call; on return, *dstlenp contains the + * number of bytes (JS_EncodeCharacters) or jschars (JS_DecodeBytes) actually + * stored. To determine the necessary destination buffer size, make a sizing + * call that passes NULL for dst. + * + * On errors, the functions report the error. In that case, *dstlenp contains + * the number of characters or bytes transferred so far. If cx is NULL, no + * error is reported on failure, and the functions simply return JS_FALSE. + * + * NB: Neither function stores an additional zero byte or jschar after the + * transcoded string. + * + * If the source has been compiled with the #define JS_C_STRINGS_ARE_UTF8 to + * enable UTF-8 interpretation of C char[] strings, then JS_EncodeCharacters + * encodes to UTF-8, and JS_DecodeBytes decodes from UTF-8, which may create + * addititional errors if the character sequence is malformed. If UTF-8 + * support is disabled, the functions deflate and inflate, respectively. + */ +JS_PUBLIC_API(JSBool) +JS_EncodeCharacters(JSContext *cx, const jschar *src, size_t srclen, char *dst, + size_t *dstlenp); + +JS_PUBLIC_API(JSBool) +JS_DecodeBytes(JSContext *cx, const char *src, size_t srclen, jschar *dst, + size_t *dstlenp); + /************************************************************************/ /* @@ -1552,6 +1811,7 @@ JSLocaleToUpperCase localeToUpperCase; JSLocaleToLowerCase localeToLowerCase; JSLocaleCompare localeCompare; + JSLocaleToUnicode localeToUnicode; }; /* @@ -1697,6 +1957,9 @@ extern JS_PUBLIC_API(void) JS_ClearPendingException(JSContext *cx); +extern JS_PUBLIC_API(JSBool) +JS_ReportPendingException(JSContext *cx); + /* * Save the current exception state. This takes a snapshot of cx's current * exception state without making any change to that state. @@ -1727,6 +1990,14 @@ extern JS_PUBLIC_API(JSErrorReport *) JS_ErrorFromException(JSContext *cx, jsval v); +/* + * Given a reported error's message and JSErrorReport struct pointer, throw + * the corresponding exception on cx. + */ +extern JS_PUBLIC_API(JSBool) +JS_ThrowReportedError(JSContext *cx, const char *message, + JSErrorReport *reportp); + #ifdef JS_THREADSAFE /* @@ -1744,7 +2015,7 @@ extern JS_PUBLIC_API(jsword) JS_SetContextThread(JSContext *cx); -extern JS_PUBLIC_API(intN) +extern JS_PUBLIC_API(jsword) JS_ClearContextThread(JSContext *cx); #endif /* JS_THREADSAFE */ Modified: trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -42,54 +42,13 @@ #include "jsosdep.h" -#ifdef XP_MAC -#undef IS_LITTLE_ENDIAN -#define IS_BIG_ENDIAN 1 +#if defined(XP_WIN) || defined(XP_OS2) || defined(WINCE) -#define JS_BYTES_PER_BYTE 1L -#define JS_BYTES_PER_SHORT 2L -#define JS_BYTES_PER_INT 4L -#define JS_BYTES_PER_INT64 8L -#define JS_BYTES_PER_LONG 4L -#define JS_BYTES_PER_FLOAT 4L -#define JS_BYTES_PER_DOUBLE 8L -#define JS_BYTES_PER_WORD 4L -#define JS_BYTES_PER_DWORD 8L +#ifdef __WATCOMC__ +#define HAVE_VA_LIST_AS_ARRAY +#endif -#define JS_BITS_PER_BYTE 8L -#define JS_BITS_PER_SHORT 16L -#define JS_BITS_PER_INT 32L -#define JS_BITS_PER_INT64 64L -#define JS_BITS_PER_LONG 32L -#define JS_BITS_PER_FLOAT 32L -#define JS_BITS_PER_DOUBLE 64L -#define JS_BITS_PER_WORD 32L - -#define JS_BITS_PER_BYTE_LOG2 3L -#define JS_BITS_PER_SHORT_LOG2 4L -#define JS_BITS_PER_INT_LOG2 5L -#define JS_BITS_PER_INT64_LOG2 6L -#define JS_BITS_PER_LONG_LOG2 5L -#define JS_BITS_PER_FLOAT_LOG2 5L -#define JS_BITS_PER_DOUBLE_LOG2 6L -#define JS_BITS_PER_WORD_LOG2 5L - -#define JS_ALIGN_OF_SHORT 2L -#define JS_ALIGN_OF_INT 4L -#define JS_ALIGN_OF_LONG 4L -#define JS_ALIGN_OF_INT64 2L -#define JS_ALIGN_OF_FLOAT 4L -#define JS_ALIGN_OF_DOUBLE 4L -#define JS_ALIGN_OF_POINTER 4L -#define JS_ALIGN_OF_WORD 4L - -#define JS_BYTES_PER_WORD_LOG2 2L -#define JS_BYTES_PER_DWORD_LOG2 3L -#define PR_WORDS_PER_DWORD_LOG2 1L - -#elif defined(XP_WIN) || defined(XP_OS2) - -#if defined( _WIN32) || defined(XP_OS2) +#if defined(_WIN32) || defined(XP_OS2) || defined(WINCE) #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN @@ -133,7 +92,7 @@ #define JS_BYTES_PER_WORD_LOG2 2L #define JS_BYTES_PER_DWORD_LOG2 3L #define PR_WORDS_PER_DWORD_LOG2 1L -#endif /* _WIN32 || XP_OS2 */ +#endif /* _WIN32 || XP_OS2 || WINCE*/ #if defined(_WINDOWS) && !defined(_WIN32) /* WIN16 */ #define IS_LITTLE_ENDIAN 1 @@ -189,7 +148,7 @@ #else -#error "Must define one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN, or XP_UNIX" +#error "Must define one of XP_BEOS, XP_OS2, XP_WIN, or XP_UNIX" #endif Modified: trunk/pmplib/lib/playlist/contrib/js/jslong.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jslong.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jslong.h 2007-02-10 15:23:26 UTC (rev 325) @@ -185,7 +185,7 @@ /*********************************************************************** ** MACROS: JSLL_UDIVMOD ** DESCRIPTION: -** Produce both a quotient and a remainder given an unsigned +** Produce both a quotient and a remainder given an unsigned ** INPUTS: JSUint64 a: The dividend of the operation ** JSUint64 b: The quotient of the operation ** OUTPUTS: JSUint64 *qp: pointer to quotient Modified: trunk/pmplib/lib/playlist/contrib/js/jsosdep.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsosdep.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsosdep.h 2007-02-10 15:23:26 UTC (rev 325) @@ -52,21 +52,6 @@ #endif #endif /* XP_WIN || XP_OS2 */ -#ifdef XP_MAC -#define JS_HAVE_LONG_LONG - -JS_BEGIN_EXTERN_C - -#include <stddef.h> - -extern void* reallocSmaller(void* block, size_t newSize); - -extern char* strdup(const char* str); - -JS_END_EXTERN_C - -#endif /* XP_MAC */ - #ifdef XP_BEOS #define JS_HAVE_LONG_LONG #endif Modified: trunk/pmplib/lib/playlist/contrib/js/jsotypes.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsotypes.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsotypes.h 2007-02-10 15:23:26 UTC (rev 325) @@ -75,7 +75,7 @@ typedef JSUintn uintn; typedef JSUint64 uint64; -#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) +#if !defined(_WIN32) && !defined(XP_OS2) typedef JSUint32 uint32; #else typedef unsigned long uint32; @@ -102,7 +102,7 @@ #ifdef HPUX #include <model.h> #else -#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) +#if !defined(_WIN32) && !defined(XP_OS2) typedef JSInt32 int32; #else typedef long int32; @@ -112,14 +112,14 @@ #endif /* HPUX */ #endif /* AIX && HAVE_SYS_INTTYPES_H */ -#endif /* XP_BEOS */ +#endif /* XP_BEOS */ typedef JSFloat64 float64; /* Re: jsbit.h */ -#define TEST_BIT JS_TEST_BIT -#define SET_BIT JS_SET_BIT -#define CLEAR_BIT JS_CLEAR_BIT +#define TEST_BIT JS_TEST_BIT +#define SET_BIT JS_SET_BIT +#define CLEAR_BIT JS_CLEAR_BIT /* Re: prarena.h->plarena.h */ #define PRArena PLArena @@ -199,13 +199,4 @@ #define PR_CompareStrings PL_CompareStrings #define PR_CompareValues PL_CompareValues -#ifdef XP_MAC -#ifndef TRUE /* Mac standard is lower case true */ - #define TRUE 1 -#endif -#ifndef FALSE /* Mac standard is lower case false */ - #define FALSE 0 -#endif -#endif - #endif /* !defined(PROTYPES_H) */ Modified: trunk/pmplib/lib/playlist/contrib/js/jspubtd.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jspubtd.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jspubtd.h 2007-02-10 15:23:26 UTC (rev 325) @@ -69,6 +69,7 @@ JSVERSION_1_4 = 140, JSVERSION_ECMA_3 = 148, JSVERSION_1_5 = 150, + JSVERSION_1_6 = 160, JSVERSION_DEFAULT = 0, JSVERSION_UNKNOWN = -1 } JSVersion; @@ -84,6 +85,8 @@ JSTYPE_STRING, /* string */ JSTYPE_NUMBER, /* number */ JSTYPE_BOOLEAN, /* boolean */ + JSTYPE_NULL, /* null */ + JSTYPE_XML, /* xml object */ JSTYPE_LIMIT } JSType; @@ -112,6 +115,7 @@ /* Struct typedefs. */ typedef struct JSClass JSClass; +typedef struct JSExtendedClass JSExtendedClass; typedef struct JSConstDoubleSpec JSConstDoubleSpec; typedef struct JSContext JSContext; typedef struct JSErrorReport JSErrorReport; @@ -123,11 +127,12 @@ typedef struct JSObject JSObject; typedef struct JSObjectMap JSObjectMap; typedef struct JSObjectOps JSObjectOps; +typedef struct JSXMLObjectOps JSXMLObjectOps; typedef struct JSRuntime JSRuntime; -typedef struct JSRuntime JSTaskState; /* XXX deprecated name */ +typedef struct JSRuntime JSTaskState; /* XXX deprecated name */ typedef struct JSScript JSScript; typedef struct JSString JSString; -typedef struct JSXDRState JSXDRState; +typedef struct JSXDRState JSXDRState; typedef struct JSExceptionState JSExceptionState; typedef struct JSLocaleCallbacks JSLocaleCallbacks; @@ -203,6 +208,9 @@ * * JSRESOLVE_QUALIFIED a qualified property id: obj.id or obj[id], not id * JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment + * JSRESOLVE_DETECTING 'if (o.p)...' or similar detection opcode sequence + * JSRESOLVE_DECLARING var, const, or function prolog declaration opcode + * JSRESOLVE_CLASSNAME class name used when constructing * * The *objp out parameter, on success, should be null to indicate that id * was not resolved; and non-null, referring to obj or one of its prototypes, @@ -263,12 +271,17 @@ * Thus JSClass (which pre-dates JSObjectOps in the API) provides a low-level * interface to class-specific code and data, while JSObjectOps allows for a * higher level of operation, which does not use the object's class except to - * find the class's JSObjectOps struct, by calling clasp->getObjectOps. + * find the class's JSObjectOps struct, by calling clasp->getObjectOps, and to + * finalize the object. * * If this seems backwards, that's because it is! API compatibility requires * a JSClass *clasp parameter to JS_NewObject, etc. Most host objects do not * need to implement the larger JSObjectOps, and can share the common JSScope * code and data used by the native (js_ObjectOps, see jsobj.c) ops. + * + * Further extension to preserve API compatibility: if this function returns + * a pointer to JSXMLObjectOps.base, not to JSObjectOps, then the engine calls + * extended hooks needed for E4X. */ typedef JSObjectOps * (* JS_DLL_CALLBACK JSGetObjectOps)(JSContext *cx, JSClass *clasp); @@ -326,6 +339,21 @@ typedef uint32 (* JS_DLL_CALLBACK JSMarkOp)(JSContext *cx, JSObject *obj, void *arg); +/* + * The optional JSClass.reserveSlots hook allows a class to make computed + * per-instance object slots reservations, in addition to or instead of using + * JSCLASS_HAS_RESERVED_SLOTS(n) in the JSClass.flags initializer to reserve + * a constant-per-class number of slots. Implementations of this hook should + * return the number of slots to reserve, not including any reserved by using + * JSCLASS_HAS_RESERVED_SLOTS(n) in JSClass.flags. + * + * NB: called with obj locked by the JSObjectOps-specific mutual exclusion + * mechanism appropriate for obj, so don't nest other operations that might + * also lock obj. + */ +typedef uint32 +(* JS_DLL_CALLBACK JSReserveSlotsOp)(JSContext *cx, JSObject *obj); + /* JSObjectOps function pointer typedefs. */ /* @@ -372,11 +400,7 @@ */ typedef JSBool (* JS_DLL_CALLBACK JSLookupPropOp)(JSContext *cx, JSObject *obj, jsid id, - JSObject **objp, JSProperty **propp -#if defined JS_THREADSAFE && defined DEBUG - , const char *file, uintN line -#endif - ); + JSObject **objp, JSProperty **propp); /* * Define obj[id], a direct property of obj named id, having the given initial @@ -472,10 +496,31 @@ (* JS_DLL_CALLBACK JSGetRequiredSlotOp)(JSContext *cx, JSObject *obj, uint32 slot); -typedef void +typedef JSBool (* JS_DLL_CALLBACK JSSetRequiredSlotOp)(JSContext *cx, JSObject *obj, uint32 slot, jsval v); +typedef JSObject * +(* JS_DLL_CALLBACK JSGetMethodOp)(JSContext *cx, JSObject *obj, jsid id, + jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSSetMethodOp)(JSContext *cx, JSObject *obj, jsid id, + jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSEnumerateValuesOp)(JSContext *cx, JSObject *obj, + JSIterateOp enum_op, + jsval *statep, jsid *idp, jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSEqualityOp)(JSContext *cx, JSObject *obj, jsval v, + JSBool *bp); + +typedef JSBool +(* JS_DLL_CALLBACK JSConcatenateOp)(JSContext *cx, JSObject *obj, jsval v, + jsval *vp); + /* Typedef for native functions called by the JS VM. */ typedef JSBool @@ -502,13 +547,19 @@ JSErrorReport *report); typedef struct JSErrorFormatString { + /* The error format string (UTF-8 if JS_C_STRINGS_ARE_UTF8 is defined). */ const char *format; - uintN argCount; + + /* The number of arguments to expand in the formatted error message. */ + uint16 argCount; + + /* One of the JSExnType constants above. */ + int16 exnType; } JSErrorFormatString; typedef const JSErrorFormatString * (* JS_DLL_CALLBACK JSErrorCallback)(void *userRef, const char *locale, - const uintN errorNumber); + const uintN errorNumber); #ifdef va_start #define JS_ARGUMENT_FORMATTER_DEFINED 1 @@ -532,6 +583,9 @@ JSString *src1, JSString *src2, jsval *rval); +typedef JSBool +(* JS_DLL_CALLBACK JSLocaleToUnicode)(JSContext *cx, char *src, jsval *rval); + /* * Security protocol types. */ Modified: trunk/pmplib/lib/playlist/contrib/js/jstypes.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jstypes.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jstypes.h 2007-02-10 15:23:26 UTC (rev 325) @@ -107,22 +107,19 @@ #define JS_STATIC_DLL_CALLBACK(__x) __x JS_DLL_CALLBACK #endif /* _WINDLL */ -#elif defined(XP_MAC) -#define JS_EXTERN_API(__type) extern __declspec(export) __type -#define JS_EXPORT_API(__type) __declspec(export) __type -#define JS_EXTERN_DATA(__type) extern __declspec(export) __type -#define JS_EXPORT_DATA(__type) __declspec(export) __type +#else /* Unix */ -#define JS_DLL_CALLBACK -#define JS_STATIC_DLL_CALLBACK(__x) static __x +#ifdef HAVE_VISIBILITY_PRAGMA +#define JS_EXTERNAL_VIS __attribute__((visibility ("default"))) +#else +#define JS_EXTERNAL_VIS +#endif -#else /* Unix */ +#define JS_EXTERN_API(__type) extern JS_EXTERNAL_VIS __type +#define JS_EXPORT_API(__type) JS_EXTERNAL_VIS __type +#define JS_EXTERN_DATA(__type) extern JS_EXTERNAL_VIS __type +#define JS_EXPORT_DATA(__type) JS_EXTERNAL_VIS __type -#define JS_EXTERN_API(__type) extern __type -#define JS_EXPORT_API(__type) __type -#define JS_EXTERN_DATA(__type) extern __type -#define JS_EXPORT_DATA(__type) __type - #define JS_DLL_CALLBACK #define JS_STATIC_DLL_CALLBACK(__x) static __x @@ -141,7 +138,7 @@ #if defined(_WIN32) && !defined(__MWERKS__) # define JS_IMPORT_DATA(__x) __declspec(dllimport) __x #else -# define JS_IMPORT_DATA(__x) __x +# define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x) #endif /* @@ -203,6 +200,19 @@ #define JS_BITMASK(n) (JS_BIT(n) - 1) /*********************************************************************** +** MACROS: JS_PTR_TO_INT32 +** JS_PTR_TO_UINT32 +** JS_INT32_TO_PTR +** JS_UINT32_TO_PTR +** DESCRIPTION: +** Integer to pointer and pointer to integer conversion macros. +***********************************************************************/ +#define JS_PTR_TO_INT32(x) ((jsint)((char *)(x) - (char *)0)) +#define JS_PTR_TO_UINT32(x) ((jsuint)((char *)(x) - (char *)0)) +#define JS_INT32_TO_PTR(x) ((void *)((char *)0 + (jsint)(x))) +#define JS_UINT32_TO_PTR(x) ((void *)((char *)0 + (jsuint)(x))) + +/*********************************************************************** ** MACROS: JS_HOWMANY ** JS_ROUNDUP ** JS_MIN @@ -215,13 +225,13 @@ #define JS_MIN(x,y) ((x)<(y)?(x):(y)) #define JS_MAX(x,y) ((x)>(y)?(x):(y)) -#if (defined(XP_MAC) || defined(XP_WIN)) && !defined(CROSS_COMPILE) +#if (defined(XP_WIN) && !defined(CROSS_COMPILE)) || defined (WINCE) # include "jscpucfg.h" /* Use standard Mac or Windows configuration */ #elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2) || defined(CROSS_COMPILE) # include "jsautocfg.h" /* Use auto-detected configuration */ # include "jsosdep.h" /* ...and platform-specific flags */ #else -# error "Must define one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN or XP_UNIX" +# error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX" #endif JS_BEGIN_EXTERN_C @@ -231,7 +241,7 @@ ** JSInt8 ** DESCRIPTION: ** The int8 types are known to be 8 bits each. There is no type that -** is equivalent to a plain "char". +** is equivalent to a plain "char". ************************************************************************/ #if JS_BYTES_PER_BYTE == 1 typedef unsigned char JSUint8; @@ -244,7 +254,7 @@ ** TYPES: JSUint16 ** JSInt16 ** DESCRIPTION: -** The int16 t... [truncated message content] |
From: <ny...@us...> - 2007-02-10 17:50:19
|
Revision: 328 http://svn.sourceforge.net/pmplib/?rev=328&view=rev Author: nyaochi Date: 2007-02-10 09:50:11 -0800 (Sat, 10 Feb 2007) Log Message: ----------- Updated copyright information for 2007. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/frontend/easypmp/cui/console.h trunk/pmplib/frontend/easypmp/cui/console_posix.c trunk/pmplib/frontend/easypmp/cui/console_win32.c 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/cui/option.h trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/frontend/easypmp/cui/util.h trunk/pmplib/frontend/easypmp/win32gui/ejectdevice.h trunk/pmplib/frontend/easypmp/win32gui/ejectdevice_win32.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/progress_with_caption.h trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp trunk/pmplib/include/gmi.h trunk/pmplib/include/os.h trunk/pmplib/include/playlist.h trunk/pmplib/include/pmplib/filepath.h trunk/pmplib/include/pmplib/os_types.h trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/include/pmplib/ucs2char.h trunk/pmplib/include/ucs2string.h trunk/pmplib/lib/filepath/filepath_posix.c trunk/pmplib/lib/filepath/filepath_win32.c trunk/pmplib/lib/gmi/gmi.c trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/playlist/jspl.c trunk/pmplib/lib/playlist/playlist.c trunk/pmplib/lib/playlist/rw_m3u.c trunk/pmplib/lib/playlist/rw_pls.c trunk/pmplib/lib/pmp/pmp.c trunk/pmplib/lib/pmp/pmp_posix.c trunk/pmplib/lib/pmp/pmp_win32.c trunk/pmplib/lib/pmp_iriverplus2/dat.c trunk/pmplib/lib/pmp_iriverplus2/idx.c trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c trunk/pmplib/lib/pmp_iriverplus2/idx_header.c trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c trunk/pmplib/lib/pmp_iriverplus2/idx_node.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.h trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c trunk/pmplib/lib/pmp_iriverplus2/playlist.c trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_iriverplus2/serialize.c trunk/pmplib/lib/pmp_iriverplus2/serialize.h trunk/pmplib/lib/pmp_iriverplus2/util.c trunk/pmplib/lib/pmp_iriverplus2/util.h 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.c 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 trunk/pmplib/lib/pmp_irivnavi/irivnavi.c trunk/pmplib/lib/pmp_irivnavi/irivnavi.h trunk/pmplib/lib/pmp_irivnavi/playlist.c trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c trunk/pmplib/lib/pmp_irivnavi/serialize.c trunk/pmplib/lib/pmp_irivnavi/serialize.h trunk/pmplib/lib/pmp_portalplayer1/dat.c trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c trunk/pmplib/lib/pmp_portalplayer1/hdr.c trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c trunk/pmplib/lib/pmp_portalplayer1/hdr_template.h trunk/pmplib/lib/pmp_portalplayer1/idx.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_msi_megaplayer.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/playlist.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.h trunk/pmplib/lib/pmp_portalplayer1/serialize.c trunk/pmplib/lib/pmp_portalplayer1/serialize.h trunk/pmplib/lib/pmp_portalplayer1/util.c trunk/pmplib/lib/pmp_portalplayer1/util.h trunk/pmplib/lib/ucs2/ucs2char.c trunk/pmplib/lib/ucs2/ucs2char_iconv.c trunk/pmplib/lib/ucs2/ucs2char_win32.c Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP database construction. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP common header. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP file enumeration routines. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP playlist conversion. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/console.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/console.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Console manupulator. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/console_posix.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,8 @@ /* * Miscellaneous utilities. * - * Copyright (c) 2005-2006 Martin Ellis + * Copyright (c) 2006 Martin Ellis <mar...@kd...> + * Copyright (c) 2006-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/console_win32.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Console manupulator for Win32 API. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP [CUI] device information. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP [CUI] main. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP [CUI] option parser. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/option.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/option.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP [CUI] option parser. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Miscellaneous utilities. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/cui/util.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/cui/util.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Miscellaneous utilities. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/win32gui/ejectdevice.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/ejectdevice.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/win32gui/ejectdevice.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Eject removable device. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/win32gui/ejectdevice_win32.c =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/ejectdevice_win32.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/win32gui/ejectdevice_win32.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Eject removable device on Windows 2000/XP * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/win32gui/maindlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Preference dialog. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Preference management. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Processing dialog. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/win32gui/progress_with_caption.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/progress_with_caption.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/win32gui/progress_with_caption.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Progress-bar control with caption override. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * EasyPMP [Win32 GUI] main. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/include/gmi.h =================================================================== --- trunk/pmplib/include/gmi.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/include/gmi.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Tag and audio information retrieval. * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/include/os.h =================================================================== --- trunk/pmplib/include/os.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/include/os.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Compatibility stuff among operating systems and compilers. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/include/playlist.h =================================================================== --- trunk/pmplib/include/playlist.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/include/playlist.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Playlist library. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/include/pmplib/filepath.h =================================================================== --- trunk/pmplib/include/pmplib/filepath.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/include/pmplib/filepath.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * File/path utility implemented with Win32 API. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/include/pmplib/os_types.h =================================================================== --- trunk/pmplib/include/pmplib/os_types.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/include/pmplib/os_types.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Basic type definitions among operating systems and compilers. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifndef __OS_TYPES_H__ #define __OS_TYPES_H__ Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Digital Media Player library. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/include/pmplib/ucs2char.h =================================================================== --- trunk/pmplib/include/pmplib/ucs2char.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/include/pmplib/ucs2char.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * UCS-2 character set library. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/include/ucs2string.h =================================================================== --- trunk/pmplib/include/ucs2string.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/include/ucs2string.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * UCS-2 string library (char_trait<ucs2char_t> implementation). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/filepath/filepath_posix.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,8 +1,8 @@ /* * File/path utility implemented with POSIX API. * - * Copyright (c) 2005 Nyaochi - * Copyright (c) 2006 Martin Ellis <mar...@kd...> + * Copyright (c) 2005-2007 Naoaki Okazaki + * Copyright (c) 2006-2007 Martin Ellis <mar...@kd...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/filepath/filepath_win32.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * File/path utility implemented with Win32 API. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/gmi/gmi.c =================================================================== --- trunk/pmplib/lib/gmi/gmi.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/gmi/gmi.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,8 +1,7 @@ - /* * Common routines for tag and audio information retrieval. * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Tag and audio information retrieval by libid3tag * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Tag and audio information retrieval by libvorbisfile. * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,8 +1,7 @@ - /* * Tag and audio information retrieval from Riff/WAVE files. * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Tag and audio information retrieval from ASF files. * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/playlist/jspl.c =================================================================== --- trunk/pmplib/lib/playlist/jspl.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/playlist/jspl.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * JavaScript Playlist (JSPL) routine. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/playlist/playlist.c =================================================================== --- trunk/pmplib/lib/playlist/playlist.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/playlist/playlist.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Playlist library. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/playlist/rw_m3u.c =================================================================== --- trunk/pmplib/lib/playlist/rw_m3u.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/playlist/rw_m3u.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * M3U/M3U8 playlist routine. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/playlist/rw_pls.c =================================================================== --- trunk/pmplib/lib/playlist/rw_pls.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/playlist/rw_pls.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * PLS playlist routines. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp/pmp.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Common routines for tag and audio information retrieval. * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/pmp/pmp_posix.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Common routines for tag and audio information retrieval. * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/pmp/pmp_win32.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_win32.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp/pmp_win32.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Common routines for tag and audio information retrieval. * - * Copyright (c) 2005 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/pmplib/lib/pmp_iriverplus2/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/dat.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/dat.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low level interface for dat (e.g., U10.dat). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/idx.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low level interface for idx (e.g., U10.idx). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Descriptor page in idx. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Generic exports for idx. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_header.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_header.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_header.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Header page in idx. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * B-tree leaf (idx). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_node.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_node.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_node.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * B-tree node page in idx. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Media database reader/writer for players with iriver plus 2. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Media database reader/writer for players with iriver plus 2. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * High level interface for dat (e.g., U10.dat). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * High level interface for idx (e.g., U10.idx). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Playlist reader/writer for iRiver Plus 2. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * PMP library implementation for the players with iriver plus 2. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/serialize.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/serialize.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Data serializer (with byte-order consideration). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/serialize.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/serialize.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/serialize.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Data serializer (with byte-order consideration). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/util.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/util.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Miscellaneous utilities. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus2/util.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/util.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus2/util.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Miscellaneous utilities. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low-level library for db.dat. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low-level library for db.dat. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low-level library for db.dic. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low-level library for db.dic. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * AVL tree implementation for db.idx. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low-level library for db.idx. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Media database reader/writer for iriver E10. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Media database reader/writer for iriver E10. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * PMP library implementation for iriver E10. * - * Copyright (c) 2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/serialize.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/serialize.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Data serializer (with byte-order consideration). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/serialize.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/serialize.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/serialize.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Data serializer (with byte-order consideration). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/util.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Miscellaneous utilities. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_iriverplus3/util.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_iriverplus3/util.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Miscellaneous utilities. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_irivnavi/irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/irivnavi.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_irivnavi/irivnavi.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Reader/writer for iRivNavi.iDB. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_irivnavi/irivnavi.h =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/irivnavi.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_irivnavi/irivnavi.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Reader/writer for iRivNavi.iDB. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_irivnavi/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Playlist reader/writer for H100/300 (M3U). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * PMP library implementation for iriver H100/300. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_irivnavi/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/serialize.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_irivnavi/serialize.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Data serializer (with byte-order consideration). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_irivnavi/serialize.h =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/serialize.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_irivnavi/serialize.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Data serializer (with byte-order consideration). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/dat.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/dat.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/dat.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low level interface for dat (e.g., H10DB.dat, DB5000.DAT, ...). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low level interface for field descriptor. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/hdr.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/hdr.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/hdr.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low level interface for hdr (e.g., H10DB.hdr, DB5000.HDR, ...). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Header-template utility for different PortalPlayer-based players. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/hdr_template.h =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/hdr_template.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/hdr_template.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Database template. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/idx.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/idx.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/idx.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Low level interface for idx. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * iRiver H10 specific routines and header templates. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * MEDION MDJuke220 specific routines and header templates. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * MEDION MDJuke440 specific routines and header templates. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * MSI MEGA PLAYER specific routines and header templates. * - * Copyright (c) 2005-2007 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Philips HDD6320 specific routines and header templates. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Samsung YH-820/YH-925 specific routines and header templates. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Sirius S50 specific routines and header templates. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/playlist.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/playlist.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Playlist reader/writer for PortalPlayer (e.g., *.plp and *.pla). * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * PMP library implementation for PortalPlayer platform. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Media database reader/writer for PortalPlayer platform. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Naoaki Okazaki * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.h =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.h 2007-02-10 17:34:14 UTC (rev 327) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.h 2007-02-10 17:50:11 UTC (rev 328) @@ -1,7 +1,7 @@ /* * Media database reader/writer for PortalPlayer platform. * - * Copyright (c) 2005-2006 Nyaochi + * Copyright (c) 2005-2007 Na... [truncated message content] |
From: <suc...@us...> - 2007-02-13 21:22:22
|
Revision: 359 http://svn.sourceforge.net/pmplib/?rev=359&view=rev Author: sucknblow Date: 2007-02-13 13:22:10 -0800 (Tue, 13 Feb 2007) Log Message: ----------- svn:ignore some generated build system files. svn:eol-style native the pmp_iriverplus3 files, (except the .vcproj file) which seem to have ^M characters. Modified Paths: -------------- 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.c 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 Property Changed: ---------------- trunk/pmplib/ trunk/pmplib/include/ trunk/pmplib/include/pmplib/ trunk/pmplib/lib/pmp_iriverplus3/ trunk/pmplib/lib/pmp_iriverplus3/Makefile.am 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.c 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 trunk/pmplib/m4/ Property changes on: trunk/pmplib ___________________________________________________________________ Name: svn:ignore + Makefile.in Makefile Property changes on: trunk/pmplib/include ___________________________________________________________________ Name: svn:ignore + Makefile.in Makefile Property changes on: trunk/pmplib/include/pmplib ___________________________________________________________________ Name: svn:ignore + Makefile.in Makefile Property changes on: trunk/pmplib/lib/pmp_iriverplus3 ___________________________________________________________________ Name: svn:ignore + Makefile.in Makefile .libs .deps Property changes on: trunk/pmplib/lib/pmp_iriverplus3/Makefile.am ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-12 21:14:08 UTC (rev 358) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-13 21:22:10 UTC (rev 359) @@ -1,866 +1,866 @@ -/* - * Low-level library for db.dat. - * - * Copyright (c) 2005-2007 Naoaki Okazaki - * - * 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 are 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 <pmplib/ucs2char.h> - -#include "serialize.h" -#include "util.h" -#include "ip3db.h" -#include "dic.h" -#include "dat.h" - -#define PAGESIZE 0x00020000 -#define COMP(a, b) ((a)>(b))-((a)<(b)) - -typedef struct { - uint32_t size; - uint32_t num_entries; - uint32_t unknown1; - uint32_t next_page; -} page_header_t; - -struct tag_sort_index_t { - const void* base; - int index; -}; - -static void dat_entry_init(dat_entry_t* entry, const dic_table_t* dic_list) -{ - memset(entry, 0, sizeof(*entry)); - entry->fields = (ip3db_variant_t*)malloc(sizeof(ip3db_variant_t) * dic_list->num_fields); - if (entry->fields) { - int i; - entry->num_fields = dic_list->num_fields; - for (i = 0;i < entry->num_fields;++i) { - ip3db_variant_init(&entry->fields[i], dic_list->fields[i].type); - } - } -} - -static void dat_entry_finish(dat_entry_t* entry) -{ - if (entry) { - int i; - for (i = 0;i < entry->num_fields;++i) { - ip3db_variant_finish(&entry->fields[i]); - } - free(entry->fields); - memset(entry, 0, sizeof(*entry)); - } -} - -static size_t dat_entry_size(dat_entry_t* entry) -{ - int i; - size_t size = 0; - for (i = 0;i < entry->num_fields;++i) { - ip3db_variant_t* var = &entry->fields[i]; - switch (var->type) { - case IP3DBVT_STRING: - size += var->value.str ? sizeof(ucs2char_t) * (ucs2len(var->value.str) + 1) : sizeof(ucs2char_t); - break; - case IP3DBVT_BYTE: - size += sizeof(uint8_t); - break; - case IP3DBVT_WORD: - size += sizeof(uint16_t); - break; - case IP3DBVT_DWORD: - size += sizeof(uint32_t); - break; - } - } - return size; -} - -static size_t dat_entry_serialize(dat_entry_t* entry, uint8_t* block, int is_storing) -{ - int i; - uint8_t *p = block; - - /* Serialize all fields in this entry. */ - for (i = 0;i < entry->num_fields;++i) { - ip3db_variant_t* var = &entry->fields[i]; - switch (var->type) { - case IP3DBVT_STRING: - if (is_storing) { - if (var->value.str) { - p += (serialize_ucs2be_string_var(p, var->value.str, is_storing) + 1) * sizeof(ucs2char_t); - } else { - ucs2char_t v = 0; - p += serialize_ucs2be(p, &v, is_storing); - } - } else { - p += (serialize_ucs2be_string_var_alloc(p, &var->value.str) + 1) * sizeof(ucs2char_t); - } - break; - case IP3DBVT_BYTE: - p += serialize_uint8(p, &var->value.byte, is_storing); - break; - case IP3DBVT_WORD: - p += serialize_uint16be(p, &var->value.word, is_storing); - break; - case IP3DBVT_DWORD: - p += serialize_uint32be(p, &var->value.dword, is_storing); - break; - } - } - - return (size_t)(p - block); -} - -static void dat_entry_dump(dat_entry_t* entry, const dic_table_t* dic_list, FILE *fp) -{ - int i; - - /* Loop for all fields in this entry. */ - for (i = 0;i < entry->num_fields;++i) { - ip3db_variant_t* var = &entry->fields[i]; - - /* Output the field name. */ - fprints(fp, " %s: ", dic_list->fields[i].name); - - /* Output its value. */ - switch (var->type) { - case IP3DBVT_STRING: - fprints(fp, "%s\n", var->value.str); - break; - case IP3DBVT_BYTE: - fprintf(fp, "0x%02X\n", var->value.byte); - break; - case IP3DBVT_WORD: - fprintf(fp, "%d\n", var->value.word); - break; - case IP3DBVT_DWORD: - fprintf(fp, "%d\n", var->value.dword); - break; - } - } -} - - - -static void dat_list_init(dat_list_t* list) -{ - memset(list, 0, sizeof(*list)); -} - -static void dat_list_finish(dat_list_t* list) -{ - if (list) { - if (list->entries) { - uint32_t i; - for (i = 0;i < list->num_entries;++i) { - dat_entry_finish(&list->entries[i]); - } - free(list->entries); - } - memset(list, 0, sizeof(*list)); - } -} - -static dat_entry_t *dat_list_expand(dat_list_t* list) -{ - list->entries = (dat_entry_t*)realloc(list->entries, sizeof(dat_entry_t) * (list->num_entries+1)); - return &list->entries[list->num_entries++]; -} - -static size_t dat_list_read(dat_list_t* list, page_header_t* header, const dic_table_t* dic_list, uint8_t* buffer, uint32_t start) -{ - uint32_t i; - uint8_t *p = buffer + start; - uint8_t *q = buffer + start + PAGESIZE - sizeof(uint32_t); - - /* Read the header. */ - p += serialize_uint32be(p, &header->size, 0); - p += serialize_uint32be(p, &header->num_entries, 0); - p += serialize_uint32be(p, &header->unknown1, 0); - p += serialize_uint32be(p, &header->next_page, 0); - - /* Expand the array of records. */ - list->entries = (dat_entry_t*)realloc(list->entries, sizeof(dat_entry_t) * (list->num_entries + header->num_entries)); - for (i = 0;i < header->num_entries;++i) { - dat_entry_init(&list->entries[list->num_entries+i], dic_list); - } - - /* Read the new records. */ - for (i = 0;i < header->num_entries;++i) { - uint32_t offset = 0; - dat_entry_t* entry = &list->entries[list->num_entries+i]; - - /* Read the offset table. */ - q -= serialize_uint32be(q, &offset, 0); - entry->offset = offset + start; - - p += dat_entry_serialize(entry, buffer + entry->offset, 0); - } - - list->num_entries += header->num_entries; - return (size_t)(header->size); -} - -static size_t dat_list_write(dat_list_t* list, uint32_t i, page_header_t* header, uint8_t* buffer, uint32_t start) -{ - uint8_t *p = buffer + start; - uint8_t *q = buffer + start + PAGESIZE - sizeof(uint32_t); - - header->size = 0; - header->num_entries = 0; - - /* Skip the header for now when writing. */ - p += sizeof(uint32_t) * 4; - - /* Write records. */ - while (i < list->num_entries) { - uint32_t offset = 0; - size_t free_space = (size_t)(q-p); - dat_entry_t* entry = &list->entries[i]; - if (free_space < dat_entry_size(entry)) { - break; - } - entry->offset = (uint32_t)(p - buffer); /* compute the current offset address */ - - offset = entry->offset - start; - q -= serialize_uint32be(q, &offset, 1); - - p += dat_entry_serialize(entry, p, 1); - header->num_entries++; - i++; - } - - /* Compute the block size and write the header. */ - header->size = (uint32_t)(p - (buffer + start)); - if (list->num_entries <= i) { - header->next_page = 0; - } - - p = buffer + start; - p += serialize_uint32be(p, &header->size, 1); - p += serialize_uint32be(p, &header->num_entries, 1); - p += serialize_uint32be(p, &header->unknown1, 1); - p += serialize_uint32be(p, &header->next_page, 1); - return header->size; -} - -static void dat_list_dump(dat_list_t* list, const dic_table_t* dic_list, FILE *fp) -{ - uint32_t i; - for (i = 0;i < list->num_entries;++i) { - dat_entry_t* entry = &list->entries[i]; - fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, entry->offset); - dat_entry_dump(entry, dic_list, fp); - fprintf(fp, " }\n"); - } -} - - - -static int comp_object_uid(const void *__x, const void *__y) -{ - const sort_index_t* _x = (const sort_index_t*)__x; - const sort_index_t* _y = (const sort_index_t*)__y; - const dat_list_t* _xb = (const dat_list_t*)_x->base; - const dat_list_t* _yb = (const dat_list_t*)_y->base; - const ip3db_variant_t* x = _xb->entries[_x->index].fields; - const ip3db_variant_t* y = _yb->entries[_y->index].fields; - return COMP(x[IP3DBF_OBJECTS_UID].value.dword, y[IP3DBF_OBJECTS_UID].value.dword); -} - -static sort_index_t* dat_uidmap_create(dat_list_t* list) -{ - int i; - sort_index_t* si = (sort_index_t*)malloc(sizeof(sort_index_t) * list->num_entries); - - if (si) { - /* Sort UIDs. */ - for (i = 0;i < list->num_entries;++i) { - si[i].base = list; - si[i].index = i; - } - qsort(si, list->num_entries, sizeof(si[0]), comp_object_uid); - } - return si; -} - -static void dat_uidmap_finish(sort_index_t* si) -{ - free(si); -} - -static int dat_uidmap_get(sort_index_t* si, dat_list_t* list, uint32_t uid) -{ - int low = 0, high = list->num_entries-1; - - /* Binary search. */ - while (low <= high) { - int middle = (low + high) / 2; - int comp = COMP(uid, list->entries[si[middle].index].fields[IP3DBF_OBJECTS_UID].value.dword); - if (comp == 0) { - /* Found */ - return si[middle].index; - } else if (comp < 0) { - high = middle - 1; - } else { - low = middle + 1; - } - } - return -1; -} - -static ucs2char_t* ucs2append(const ucs2char_t* x, const ucs2char_t* y) -{ - ucs2char_t* ret = NULL; - size_t length = 0; - length += x ? ucs2len(x) : 0; - length += y ? ucs2len(y) : 0; - ret = ucs2calloc(sizeof(ucs2char_t) * (length+1)); - if (x) ucs2cat(ret, x); - if (y) ucs2cat(ret, y); - return ret; -} - - - -dat_t* dat_new() -{ - dat_t* dat = (dat_t*)calloc(1, sizeof(dat_t)); - if (dat) { - dat_list_init(&dat->objects); - dat_list_init(&dat->musics); - dat_list_init(&dat->references); - } - return dat; -} - -void dat_finish(dat_t* dat) -{ - dat_list_finish(&dat->objects); - dat_list_finish(&dat->musics); - dat_list_finish(&dat->references); - free(dat); -} - -int dat_read(dat_t* dat, const dic_t* dic, FILE *fpi) -{ - uint32_t i = 0, page = 0; - page_header_t ph; - long buffer_size = 0; - uint8_t* buffer = NULL; - - /* Read the whole image. */ - fread_all(fpi, &buffer, &buffer_size); - if (!buffer) { - return 1; - } - - /* Clear Object records. */ - dat_list_finish(&dat->objects); - - /* Read Objects page(s) */ - page = dic->objects.dat_page; - while (page) { - dat_list_read(&dat->objects, &ph, &dic->objects, buffer, PAGESIZE * (page - 1)); - page = ph.next_page; - } - - /* Construct Object UID -> dat->objects[i] mapping table. */ - dat_uidmap_finish(dat->objects_uidmap); - dat->objects_uidmap = dat_uidmap_create(&dat->objects); - - /* Clear Music records. */ - dat_list_finish(&dat->musics); - - /* Read Music page(s) */ - page = dic->music.dat_page; - while (page) { - dat_list_read(&dat->musics, &ph, &dic->music, buffer, PAGESIZE * (page - 1)); - page = ph.next_page; - } - - /* Set filename and pathname fields. */ - for (i = 0;i < dat->musics.num_entries;++i) { - dat_entry_t* entry = &dat->musics.entries[i]; - int index = dat_uidmap_get(dat->objects_uidmap, &dat->objects, entry->fields[IP3DBF_MUSIC_UID].value.dword); - if (0 <= index) { - static const ucs2char_t ucs2cs_root[] = {'/',0}; - ucs2char_t* pathname = NULL; - ucs2char_t* tmp = NULL; - size_t length = 0; - - /* Set the filename. */ - ip3db_variant_set_str( - &entry->fields[IP3DBF_MUSIC_FILENAME], - dat->objects.entries[index].fields[IP3DBF_OBJECTS_OBJECTNAME].value.str - ); - - /* Obtain the pathname by tracing parent UIDs. */ - for (;;) { - uint32_t parent_uid = dat->objects.entries[index].fields[IP3DBF_OBJECTS_PARENTUID].value.dword; - if (parent_uid == 0xFFFFFFFF) { - break; - } - index = dat_uidmap_get(dat->objects_uidmap, &dat->objects, parent_uid); - if (index < 0) { - break; - } - tmp = ucs2append( - dat->objects.entries[index].fields[IP3DBF_OBJECTS_OBJECTNAME].value.str, - pathname - ); - ucs2free(pathname); - pathname = tmp; - } - - tmp = ucs2append(ucs2cs_root, pathname); - ucs2free(pathname); - pathname = tmp; - ip3db_variant_set_str(&entry->fields[IP3DBF_MUSIC_FILEPATH], pathname); - ucs2free(pathname); - } - } - - /* Read References page(s) */ - page = dic->references.dat_page; - while (page) { - dat_list_read(&dat->references, &ph, &dic->references, buffer, PAGESIZE * (page - 1)); - page = ph.next_page; - } - - free(buffer); - return 0; -} - -int dat_write(dat_t* dat, dic_t* dic, FILE *fpo) -{ - uint32_t i = 0, page = 0; - page_header_t ph; - long buffer_size = 0; - uint8_t* buffer = NULL; - - /* Initialize the number of pages as zero. */ - dic->header.num_dat_pages = 0; - dic->objects.dat_page = 0; - dic->music.dat_page = 0; - dic->references.dat_page = 0; - - memset(&ph, 0, sizeof(ph)); - - /* Write Objects page(s) */ - if (0 < dat->objects.num_entries) { - i = 0; - dic->objects.dat_page = page = (dic->header.num_dat_pages + 1); - while (page) { - buffer_size = PAGESIZE * page; - buffer = (uint8_t*)realloc(buffer, sizeof(uint8_t) * buffer_size); - memset(buffer + PAGESIZE * (page - 1), 0, PAGESIZE); - - ph.next_page = page + 1; - dat_list_write(&dat->objects, i, &ph, buffer, PAGESIZE * (page - 1)); - - i += ph.num_entries; - dic->header.num_dat_pages += 1; - page = ph.next_page; - } - } - - /* Clear filepath and filename */ - for (i = 0;i < dat->musics.num_entries;++i) { - static const ucs2char_t empty[] = {0}; - dat_entry_t* entry = &dat->musics.entries[i]; - ip3db_variant_set_str(&entry->fields[IP3DBF_MUSIC_FILEPATH], empty); - ip3db_variant_set_str(&entry->fields[IP3DBF_MUSIC_FILENAME], empty); - } - - /* Write Music page(s) */ - if (0 < dat->musics.num_entries) { - i = 0; - dic->music.dat_page = page = (dic->header.num_dat_pages+1); - while (page) { - buffer_size = PAGESIZE * page; - buffer = (uint8_t*)realloc(buffer, sizeof(uint8_t) * buffer_size); - memset(buffer + PAGESIZE * (page - 1), 0, PAGESIZE); - - ph.next_page = page + 1; - dat_list_write(&dat->musics, i, &ph, buffer, PAGESIZE * (page - 1)); - - i += ph.num_entries; - dic->header.num_dat_pages += 1; - page = ph.next_page; - } - } - - /* Write References page(s) */ - if (0 < dat->references.num_entries) { - i = 0; - dic->references.dat_page = page = (dic->header.num_dat_pages+1); - while (page) { - buffer_size = PAGESIZE * page; - buffer = (uint8_t*)realloc(buffer, sizeof(uint8_t) * buffer_size); - memset(buffer + PAGESIZE * (page - 1), 0, PAGESIZE); - - ph.next_page = page + 1; - dat_list_write(&dat->references, i, &ph, buffer, PAGESIZE * (page - 1)); - - i += ph.num_entries; - dic->header.num_dat_pages += 1; - page = ph.next_page; - } - } - - /* Write out the pages to the file. */ - if (buffer && buffer_size > 0) { - if (fwrite(buffer, 1, buffer_size, fpo) != buffer_size) { - free(buffer); - return 1; - } - } - - free(buffer); - return 0; -} - -void dat_dump(dat_t* dat, const dic_t* dic, FILE *fp) -{ - fprintf(fp, "===== db.dat =====\n"); - fprintf(fp, "OBJECTS = {\n"); - dat_list_dump(&dat->objects, &dic->objects, fp); - fprintf(fp, "}\n"); - fprintf(fp, "MUSIC = {\n"); - dat_list_dump(&dat->musics, &dic->music, fp); - fprintf(fp, "}\n"); - fprintf(fp, "REFERENCES = {\n"); - dat_list_dump(&dat->references, &dic->references, fp); - fprintf(fp, "}\n"); -} - - - -static uint32_t findfile(dat_t* dat, const ucs2char_t *filename) -{ - int i; - const ucs2char_t *filepart = NULL; - ucs2char_t *pathname = alloca(sizeof(ucs2char_t) * (ucs2len(filename) + 1)); - - filepart = ucs2rchr(filename, '/'); - if (!filepart) { - filepart = filename; - } else { - filepart++; - } - - ucs2ncpy(pathname, filename, (filepart-filename)); - pathname[filepart-filename] = 0; - - for (i = 0;i < dat->musics.num_entries;++i) { - dat_entry_t* entry = &dat->musics.entries[i]; - if (ucs2icmp(entry->fields[IP3DBF_MUSIC_FILENAME].value.str, filepart) == 0 && - ucs2icmp(entry->fields[IP3DBF_MUSIC_FILEPATH].value.str, pathname) == 0) { - return entry->fields[IP3DBF_MUSIC_UID].value.dword; - } - } - return 0; -} - -typedef struct { - ucs2char_t* path; - uint32_t uid; -} dircache_element_t; - -typedef struct { - int max_elems; - int num_elems; - dircache_element_t* elems; -} dircache_t; - -static void dircache_init(dircache_t* dc) -{ - memset(dc, 0, sizeof(*dc)); -} - -static void dircache_finish(dircache_t* dc) -{ - int i; - for (i = 0;i < dc->max_elems;++i) { - ucs2free(dc->elems[i].path); - } - free(dc->elems); -} - -static void dircache_push(dircache_t* dc, const ucs2char_t* path, uint32_t uid) -{ - dircache_element_t* elem = NULL; - - if (dc->max_elems < dc->num_elems + 1) { - dc->elems = (dircache_element_t*)realloc(dc->elems, sizeof(dircache_element_t) * (dc->max_elems+1)); - memset(&dc->elems[dc->max_elems], 0, sizeof(dircache_element_t)); - ++dc->max_elems; - } - - elem = &dc->elems[dc->num_elems++]; - ucs2free(elem->path); - elem->path = ucs2dup(path); - elem->uid = uid; -} - -static void dircache_pop(dircache_t* dc, int i) -{ - int n = ++i; - for (;i < dc->num_elems;++i) { - ucs2free(dc->elems[i].path); - memset(&dc->elems[i], 0, sizeof(dc->elems[0])); - } - dc->num_elems = n; -} - -static int dircache_findprefix(dircache_t* dc, const ucs2char_t* path) -{ - int i = dc->num_elems; - while (--i >= 0) { - if (ucs2ncmp(path, dc->elems[i].path, ucs2len(dc->elems[i].path)) == 0) { - break; - } - } - return i; -} - -static dircache_element_t *dircache_get(dircache_t* dc, int i) -{ - return &dc->elems[i]; -} - - -typedef struct { - const ucs2char_t* filepath; - const ucs2char_t* filename; - uint8_t filetype; - int index; -} object_record_t; - - -static int comp_pathname(const void *_x, const void *_y) -{ - const object_record_t* x = (const object_record_t*)_x; - const object_record_t* y = (const object_record_t*)_y; - int ret = ucs2cmp(x->filepath, y->filepath); - if (ret == 0) { - return ucs2cmp(x->filename, y->filename); - } else { - return ret; - } -} - - - -static const ucs2char_t* skip_one_directory(const ucs2char_t* path) -{ - ucs2char_t* p = ucs2chr(path, '/'); - return p ? p+1 : NULL; -} - -void dat_set(dat_t* dat, dic_t* dic, const ip3db_music_record_t* records, int num_records, ip3db_playlist_t* playlists, int num_playlists) -{ - /* Procedure: - * 1) Construct the object chunk and attach music records with Object UIDs. - * Because the object chunk stores a tree structure of path names, we need to - * split a path name to elements and allocate an Object UID to each element. - * For example, the path name "/Music/Beatles/Love/01_love.ogg" will generate - * five objects each of which links to the object of the parent directory: - * - UID=0xFFFFFFFF: "/a/" (root directory; FileType = 0) - * - UID=1 : "Music/" (FileType = 1) - * - UID=2 : "Beatles/" (FileType = 1) - * - UID=3 : "Love/" (FileType = 1) - * - UID=4 : "01_love.ogg" (FileType = 2) - * In order to convert a list of path names to the tree structure, this - * implementation sorts the path names in alphabetical order and finds new - * path elements by using a directory queue (dircache_t). - * - * 3) Attach Object UIDs for file names (FileType = 2) to music records. - * These UIDs are stored in records in the music chunk so that the player - * can refer to the path/file name of a music track quickly. - * - * 4) Construct the music chunk by basically duplicating the records. - * - * Now the content of db.dat is ready. Note that the path character in db.dat - * is not '\\' but '/'. - */ - - int i, j; - dat_entry_t* entry; - uint32_t uid = 0; - static const uint32_t uid_root = 0xFFFFFFFF; - static const ucs2char_t ucs2cs_object_root[] = {'/','a','/',0}; - static const ucs2char_t ucs2cs_root[] = {'/', 0}; - dat_list_t* dato = &dat->objects; - dat_list_t* datm = &dat->musics; - dat_list_t* datr = &dat->references; - uint32_t num_objects = num_records + num_playlists; - object_record_t *objects = (object_record_t*)malloc(sizeof(object_record_t) * num_objects); - dircache_t dc; - - dircache_init(&dc); - - /* Clear all entries. */ - dat_list_finish(dato); - dat_list_finish(datm); - dat_list_finish(datr); - dat_uidmap_finish(dat->objects_uidmap); - - /* Append an entry for the root directory. */ - entry = dat_list_expand(dato); - dat_entry_init(entry, &dic->objects); - ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], ucs2cs_object_root); - ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid_root); - - /* Register the root node to the directory cache. */ - dircache_push(&dc, ucs2cs_root, uid_root); - - /* Sort the records in alphabetical order of their path names. */ - for (i = 0;i < num_records;++i) { - objects[i].filepath = records[i][IP3DBF_MUSIC_FILEPATH].value.str; - objects[i].filename = records[i][IP3DBF_MUSIC_FILENAME].value.str; - objects[i].filetype = 2; - objects[i].index = i; - } - for (i = 0;i < num_playlists;++i) { - objects[i+num_records].filepath = playlists[i].filepath; - objects[i+num_records].filename = playlists[i].filename; - objects[i+num_records].filetype = 4; - objects[i+num_records].index = i; - } - qsort(objects, num_objects, sizeof(objects[0]), comp_pathname); - - /* Loop for the records. */ - for (i = 0;i < num_objects;++i) { - /* - * Split a path name into two parts: a prefix that have already been - * registered in the Object table: and a postfix that is being registered - * as Object records. - */ - const ucs2char_t* path = objects[i].filepath; - const ucs2char_t* file = objects[i].filename; - int k = dircache_findprefix(&dc, path); - const dircache_element_t* com = dircache_get(&dc, k); - const ucs2char_t* p = path + ucs2len(com->path); /* the prefix */ - uint32_t puid = com->uid; /* the UID of the parent directory of the postfix */ - - /* Discard directory portions that do not share a prefix with the target. */ - dircache_pop(&dc, k); - - /* Create objects one by one for the directory portions in the postfix. */ - while (p && *p) { - ucs2char_t tmp[MAX_PATH]; - const ucs2char_t* q = skip_one_directory(p); - uid = dato->num_entries; - - /* A directory element (e.g., "Beatles/") */ - ucs2ncpy(tmp, p, q-p); - tmp[q-p] = 0; - - /* Create a new object. */ - entry = dat_list_expand(dato); - dat_entry_init(entry, &dic->objects); - ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid); - ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_PARENTUID], puid); - ip3db_variant_set_word(&entry->fields[IP3DBF_OBJECTS_FILETYPE], 1); - ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], tmp); - - /* Register the fullpath (e.g., "/Music/eatles/" in the dircache. */ - ucs2ncpy(tmp, path, q-path); - tmp[q-path] = 0; - dircache_push(&dc, tmp, uid); - - /* Store the current UID for children. */ - puid = uid; - - /* Move to the next portion. */ - p = q; - } - - /* Create a new object for the file name (FileType = 2). */ - if (objects[i].filetype == 2) { - /* Music file. */ - const ip3db_variant_t* record = records[objects[i].index]; - - uid = dato->num_entries; - entry = dat_list_expand(dato); - dat_entry_init(entry, &dic->objects); - ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid); - ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_PARENTUID], puid); - ip3db_variant_set_word(&entry->fields[IP3DBF_OBJECTS_FILETYPE], 2); - ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], file); - - /* Create a music record with UID referring to the file name. */ - entry = dat_list_expand(datm); - dat_entry_init(entry, &dic->music); - for (j = 0;j < entry->num_fields;++j) { - ip3db_variant_clone(&entry->fields[j], &record[j]); - } - ip3db_variant_set_dword(&entry->fields[IP3DBF_MUSIC_UID], uid); - } else if (objects[i].filetype == 4) { - /* Playlist file. */ - ip3db_playlist_t* pl = &playlists[objects[i].index]; - - pl->uid = dato->num_entries; - entry = dat_list_expand(dato); - dat_entry_init(entry, &dic->objects); - ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], pl->uid); - ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_PARENTUID], puid); - ip3db_variant_set_word(&entry->fields[IP3DBF_OBJECTS_FILETYPE], 4); - ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], file); - } - } - - /* Loop for playlists. */ - for (i = 0;i < num_playlists;++i) { - const ip3db_playlist_t* pl = &playlists[i]; - for (j = 0;j < pl->num_entries;++j) { - entry = dat_list_expand(datr); - dat_entry_init(entry, &dic->references); - - ip3db_variant_set_dword(&entry->fields[IP3DBF_REFERENCES_PARENTCLUSTER], pl->uid); - ip3db_variant_set_dword(&entry->fields[IP3DBF_REFERENCES_CHILDCLUSTER], findfile(dat, pl->entries[j])); - ip3db_variant_set_word(&entry->fields[IP3DBF_REFERENCES_FILEFORMAT], 0x3009); - } - } - - dircache_finish(&dc); - - dat->objects_uidmap = dat_uidmap_create(&dat->objects); -} +/* + * Low-level library for db.dat. + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * 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 are 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 <pmplib/ucs2char.h> + +#include "serialize.h" +#include "util.h" +#include "ip3db.h" +#include "dic.h" +#include "dat.h" + +#define PAGESIZE 0x00020000 +#define COMP(a, b) ((a)>(b))-((a)<(b)) + +typedef struct { + uint32_t size; + uint32_t num_entries; + uint32_t unknown1; + uint32_t next_page; +} page_header_t; + +struct tag_sort_index_t { + const void* base; + int index; +}; + +static void dat_entry_init(dat_entry_t* entry, const dic_table_t* dic_list) +{ + memset(entry, 0, sizeof(*entry)); + entry->fields = (ip3db_variant_t*)malloc(sizeof(ip3db_variant_t) * dic_list->num_fields); + if (entry->fields) { + int i; + entry->num_fields = dic_list->num_fields; + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_init(&entry->fields[i], dic_list->fields[i].type); + } + } +} + +static void dat_entry_finish(dat_entry_t* entry) +{ + if (entry) { + int i; + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_finish(&entry->fields[i]); + } + free(entry->fields); + memset(entry, 0, sizeof(*entry)); + } +} + +static size_t dat_entry_size(dat_entry_t* entry) +{ + int i; + size_t size = 0; + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_t* var = &entry->fields[i]; + switch (var->type) { + case IP3DBVT_STRING: + size += var->value.str ? sizeof(ucs2char_t) * (ucs2len(var->value.str) + 1) : sizeof(ucs2char_t); + break; + case IP3DBVT_BYTE: + size += sizeof(uint8_t); + break; + case IP3DBVT_WORD: + size += sizeof(uint16_t); + break; + case IP3DBVT_DWORD: + size += sizeof(uint32_t); + break; + } + } + return size; +} + +static size_t dat_entry_serialize(dat_entry_t* entry, uint8_t* block, int is_storing) +{ + int i; + uint8_t *p = block; + + /* Serialize all fields in this entry. */ + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_t* var = &entry->fields[i]; + switch (var->type) { + case IP3DBVT_STRING: + if (is_storing) { + if (var->value.str) { + p += (serialize_ucs2be_string_var(p, var->value.str, is_storing) + 1) * sizeof(ucs2char_t); + } else { + ucs2char_t v = 0; + p += serialize_ucs2be(p, &v, is_storing); + } + } else { + p += (serialize_ucs2be_string_var_alloc(p, &var->value.str) + 1) * sizeof(ucs2char_t); + } + break; + case IP3DBVT_BYTE: + p += serialize_uint8(p, &var->value.byte, is_storing); + break; + case IP3DBVT_WORD: + p += serialize_uint16be(p, &var->value.word, is_storing); + break; + case IP3DBVT_DWORD: + p += serialize_uint32be(p, &var->value.dword, is_storing); + break; + } + } + + return (size_t)(p - block); +} + +static void dat_entry_dump(dat_entry_t* entry, const dic_table_t* dic_list, FILE *fp) +{ + int i; + + /* Loop for all fields in this entry. */ + for (i = 0;i < entry->num_fields;++i) { + ip3db_variant_t* var = &entry->fields[i]; + + /* Output the field name. */ + fprints(fp, " %s: ", dic_list->fields[i].name); + + /* Output its value. */ + switch (var->type) { + case IP3DBVT_STRING: + fprints(fp, "%s\n", var->value.str); + break; + case IP3DBVT_BYTE: + fprintf(fp, "0x%02X\n", var->value.byte); + break; + case IP3DBVT_WORD: + fprintf(fp, "%d\n", var->value.word); + break; + case IP3DBVT_DWORD: + fprintf(fp, "%d\n", var->value.dword); + break; + } + } +} + + + +static void dat_list_init(dat_list_t* list) +{ + memset(list, 0, sizeof(*list)); +} + +static void dat_list_finish(dat_list_t* list) +{ + if (list) { + if (list->entries) { + uint32_t i; + for (i = 0;i < list->num_entries;++i) { + dat_entry_finish(&list->entries[i]); + } + free(list->entries); + } + memset(list, 0, sizeof(*list)); + } +} + +static dat_entry_t *dat_list_expand(dat_list_t* list) +{ + list->entries = (dat_entry_t*)realloc(list->entries, sizeof(dat_entry_t) * (list->num_entries+1)); + return &list->entries[list->num_entries++]; +} + +static size_t dat_list_read(dat_list_t* list, page_header_t* header, const dic_table_t* dic_list, uint8_t* buffer, uint32_t start) +{ + uint32_t i; + uint8_t *p = buffer + start; + uint8_t *q = buffer + start + PAGESIZE - sizeof(uint32_t); + + /* Read the header. */ + p += serialize_uint32be(p, &header->size, 0); + p += serialize_uint32be(p, &header->num_entries, 0); + p += serialize_uint32be(p, &header->unknown1, 0); + p += serialize_uint32be(p, &header->next_page, 0); + + /* Expand the array of records. */ + list->entries = (dat_entry_t*)realloc(list->entries, sizeof(dat_entry_t) * (list->num_entries + header->num_entries)); + for (i = 0;i < header->num_entries;++i) { + dat_entry_init(&list->entries[list->num_entries+i], dic_list); + } + + /* Read the new records. */ + for (i = 0;i < header->num_entries;++i) { + uint32_t offset = 0; + dat_entry_t* entry = &list->entries[list->num_entries+i]; + + /* Read the offset table. */ + q -= serialize_uint32be(q, &offset, 0); + entry->offset = offset + start; + + p += dat_entry_serialize(entry, buffer + entry->offset, 0); + } + + list->num_entries += header->num_entries; + return (size_t)(header->size); +} + +static size_t dat_list_write(dat_list_t* list, uint32_t i, page_header_t* header, uint8_t* buffer, uint32_t start) +{ + uint8_t *p = buffer + start; + uint8_t *q = buffer + start + PAGESIZE - sizeof(uint32_t); + + header->size = 0; + header->num_entries = 0; + + /* Skip the header for now when writing. */ + p += sizeof(uint32_t) * 4; + + /* Write records. */ + while (i < list->num_entries) { + uint32_t offset = 0; + size_t free_space = (size_t)(q-p); + dat_entry_t* entry = &list->entries[i]; + if (free_space < dat_entry_size(entry)) { + break; + } + entry->offset = (uint32_t)(p - buffer); /* compute the current offset address */ + + offset = entry->offset - start; + q -= serialize_uint32be(q, &offset, 1); + + p += dat_entry_serialize(entry, p, 1); + header->num_entries++; + i++; + } + + /* Compute the block size and write the header. */ + header->size = (uint32_t)(p - (buffer + start)); + if (list->num_entries <= i) { + header->next_page = 0; + } + + p = buffer + start; + p += serialize_uint32be(p, &header->size, 1); + p += serialize_uint32be(p, &header->num_entries, 1); + p += serialize_uint32be(p, &header->unknown1, 1); + p += serialize_uint32be(p, &header->next_page, 1); + return header->size; +} + +static void dat_list_dump(dat_list_t* list, const dic_table_t* dic_list, FILE *fp) +{ + uint32_t i; + for (i = 0;i < list->num_entries;++i) { + dat_entry_t* entry = &list->entries[i]; + fprintf(fp, " ENTRY %d (0x%08X) = {\n", i, entry->offset); + dat_entry_dump(entry, dic_list, fp); + fprintf(fp, " }\n"); + } +} + + + +static int comp_object_uid(const void *__x, const void *__y) +{ + const sort_index_t* _x = (const sort_index_t*)__x; + const sort_index_t* _y = (const sort_index_t*)__y; + const dat_list_t* _xb = (const dat_list_t*)_x->base; + const dat_list_t* _yb = (const dat_list_t*)_y->base; + const ip3db_variant_t* x = _xb->entries[_x->index].fields; + const ip3db_variant_t* y = _yb->entries[_y->index].fields; + return COMP(x[IP3DBF_OBJECTS_UID].value.dword, y[IP3DBF_OBJECTS_UID].value.dword); +} + +static sort_index_t* dat_uidmap_create(dat_list_t* list) +{ + int i; + sort_index_t* si = (sort_index_t*)malloc(sizeof(sort_index_t) * list->num_entries); + + if (si) { + /* Sort UIDs. */ + for (i = 0;i < list->num_entries;++i) { + si[i].base = list; + si[i].index = i; + } + qsort(si, list->num_entries, sizeof(si[0]), comp_object_uid); + } + return si; +} + +static void dat_uidmap_finish(sort_index_t* si) +{ + free(si); +} + +static int dat_uidmap_get(sort_index_t* si, dat_list_t* list, uint32_t uid) +{ + int low = 0, high = list->num_entries-1; + + /* Binary search. */ + while (low <= high) { + int middle = (low + high) / 2; + int comp = COMP(uid, list->entries[si[middle].index].fields[IP3DBF_OBJECTS_UID].value.dword); + if (comp == 0) { + /* Found */ + return si[middle].index; + } else if (comp < 0) { + high = middle - 1; + } else { + low = middle + 1; + } + } + return -1; +} + +static ucs2char_t* ucs2append(const ucs2char_t* x, const ucs2char_t* y) +{ + ucs2char_t* ret = NULL; + size_t length = 0; + length += x ? ucs2len(x) : 0; + length += y ? ucs2len(y) : 0; + ret = ucs2calloc(sizeof(ucs2char_t) * (length+1)); + if (x) ucs2cat(ret, x); + if (y) ucs2cat(ret, y); + return ret; +} + + + +dat_t* dat_new() +{ + dat_t* dat = (dat_t*)calloc(1, sizeof(dat_t)); + if (dat) { + dat_list_init(&dat->objects); + dat_list_init(&dat->musics); + dat_list_init(&dat->references); + } + return dat; +} + +void dat_finish(dat_t* dat) +{ + dat_list_finish(&dat->objects); + dat_list_finish(&dat->musics); + dat_list_finish(&dat->references); + free(dat); +} + +int dat_read(dat_t* dat, const dic_t* dic, FILE *fpi) +{ + uint32_t i = 0, page = 0; + page_header_t ph; + long buffer_size = 0; + uint8_t* buffer = NULL; + + /* Read the whole image. */ + fread_all(fpi, &buffer, &buffer_size); + if (!buffer) { + return 1; + } + + /* Clear Object records. */ + dat_list_finish(&dat->objects); + + /* Read Objects page(s) */ + page = dic->objects.dat_page; + while (page) { + dat_list_read(&dat->objects, &ph, &dic->objects, buffer, PAGESIZE * (page - 1)); + page = ph.next_page; + } + + /* Construct Object UID -> dat->objects[i] mapping table. */ + dat_uidmap_finish(dat->objects_uidmap); + dat->objects_uidmap = dat_uidmap_create(&dat->objects); + + /* Clear Music records. */ + dat_list_finish(&dat->musics); + + /* Read Music page(s) */ + page = dic->music.dat_page; + while (page) { + dat_list_read(&dat->musics, &ph, &dic->music, buffer, PAGESIZE * (page - 1)); + page = ph.next_page; + } + + /* Set filename and pathname fields. */ + for (i = 0;i < dat->musics.num_entries;++i) { + dat_entry_t* entry = &dat->musics.entries[i]; + int index = dat_uidmap_get(dat->objects_uidmap, &dat->objects, entry->fields[IP3DBF_MUSIC_UID].value.dword); + if (0 <= index) { + static const ucs2char_t ucs2cs_root[] = {'/',0}; + ucs2char_t* pathname = NULL; + ucs2char_t* tmp = NULL; + size_t length = 0; + + /* Set the filename. */ + ip3db_variant_set_str( + &entry->fields[IP3DBF_MUSIC_FILENAME], + dat->objects.entries[index].fields[IP3DBF_OBJECTS_OBJECTNAME].value.str + ); + + /* Obtain the pathname by tracing parent UIDs. */ + for (;;) { + uint32_t parent_uid = dat->objects.entries[index].fields[IP3DBF_OBJECTS_PARENTUID].value.dword; + if (parent_uid == 0xFFFFFFFF) { + break; + } + index = dat_uidmap_get(dat->objects_uidmap, &dat->objects, parent_uid); + if (index < 0) { + break; + } + tmp = ucs2append( + dat->objects.entries[index].fields[IP3DBF_OBJECTS_OBJECTNAME].value.str, + pathname + ); + ucs2free(pathname); + pathname = tmp; + } + + tmp = ucs2append(ucs2cs_root, pathname); + ucs2free(pathname); + pathname = tmp; + ip3db_variant_set_str(&entry->fields[IP3DBF_MUSIC_FILEPATH], pathname); + ucs2free(pathname); + } + } + + /* Read References page(s) */ + page = dic->references.dat_page; + while (page) { + dat_list_read(&dat->references, &ph, &dic->references, buffer, PAGESIZE * (page - 1)); + page = ph.next_page; + } + + free(buffer); + return 0; +} + +int dat_write(dat_t* dat, dic_t* dic, FILE *fpo) +{ + uint32_t i = 0, page = 0; + page_header_t ph; + long buffer_size = 0; + uint8_t* buffer = NULL; + + /* Initialize the number of pages as zero. */ + dic->header.num_dat_pages = 0; + dic->objects.dat_page = 0; + dic->music.dat_page = 0; + dic->references.dat_page = 0; + + memset(&ph, 0, sizeof(ph)); + + /* Write Objects page(s) */ + if (0 < dat->objects.num_entries) { + i = 0; + dic->objects.dat_page = page = (dic->header.num_dat_pages + 1); + while (page) { + buffer_size = PAGESIZE * page; + buffer = (uint8_t*)realloc(buffer, sizeof(uint8_t) * buffer_size); + memset(buffer + PAGESIZE * (page - 1), 0, PAGESIZE); + + ph.next_page = page + 1; + dat_list_write(&dat->objects, i, &ph, buffer, PAGESIZE * (page - 1)); + + i += ph.num_entries; + dic->header.num_dat_pages += 1; + page = ph.next_page; + } + } + + /* Clear filepath and filename */ + for (i = 0;i < dat->musics.num_entries;++i) { + static const ucs2char_t empty[] = {0}; + dat_entry_t* entry = &dat->musics.entries[i]; + ip3db_variant_set_str(&entry->fields[IP3DBF_MUSIC_FILEPATH], empty); + ip3db_variant_set_str(&entry->fields[IP3DBF_MUSIC_FILENAME], empty); + } + + /* Write Music page(s) */ + if (0 < dat->musics.num_entries) { + i = 0; + dic->music.dat_page = page = (dic->header.num_dat_pages+1); + while (page) { + buffer_size = PAGESIZE * page; + buffer = (uint8_t*)realloc(buffer, sizeof(uint8_t) * buffer_size); + memset(buffer + PAGESIZE * (page - 1), 0, PAGESIZE); + + ph.next_page = page + 1; + dat_list_write(&dat->musics, i, &ph, buffer, PAGESIZE * (page - 1)); + + i += ph.num_entries; + dic->header.num_dat_pages += 1; + page = ph.next_page; + } + } + + /* Write References page(s) */ + if (0 < dat->references.num_entries) { + i = 0; + dic->references.dat_page = page = (dic->header.num_dat_pages+1); + while (page) { + buffer_size = PAGESIZE * page; + buffer = (uint8_t*)realloc(buffer, sizeof(uint8_t) * buffer_size); + memset(buffer + PAGESIZE * (page - 1), 0, PAGESIZE); + + ph.next_page = page + 1; + dat_list_write(&dat->references, i, &ph, buffer, PAGESIZE * (page - 1)); + + i += ph.num_entries; + dic->header.num_dat_pages += 1; + page = ph.next_page; + } + } + + /* Write out the pages to the file. */ + if (buffer && buffer_size > 0) { + if (fwrite(buffer, 1, buffer_size, fpo) != buffer_size) { + free(buffer); + return 1; + } + } + + free(buffer); + return 0; +} + +void dat_dump(dat_t* dat, const dic_t* dic, FILE *fp) +{ + fprintf(fp, "===== db.dat =====\n"); + fprintf(fp, "OBJECTS = {\n"); + dat_list_dump(&dat->objects, &dic->objects, fp); + fprintf(fp, "}\n"); + fprintf(fp, "MUSIC = {\n"); + dat_list_dump(&dat->musics, &dic->music, fp); + fprintf(fp, "}\n"); + fprintf(fp, "REFERENCES = {\n"); + dat_list_dump(&dat->references, &dic->references, fp); + fprintf(fp, "}\n"); +} + + + +static uint32_t findfile(dat_t* dat, const ucs2char_t *filename) +{ + int i; + const ucs2char_t *filepart = NULL; + ucs2char_t *pathname = alloca(sizeof(ucs2char_t) * (ucs2len(filename) + 1)); + + filepart = ucs2rchr(filename, '/'); + if (!filepart) { + filepart = filename; + } else { + filepart++; + } + + ucs2ncpy(pathname, filename, (filepart-filename)); + pathname[filepart-filename] = 0; + + for (i = 0;i < dat->musics.num_entries;++i) { + dat_entry_t* entry = &dat->musics.entries[i]; + if (ucs2icmp(entry->fields[IP3DBF_MUSIC_FILENAME].value.str, filepart) == 0 && + ucs2icmp(entry->fields[IP3DBF_MUSIC_FILEPATH].value.str, pathname) == 0) { + return entry->fields[IP3DBF_MUSIC_UID].value.dword; + } + } + return 0; +} + +typedef struct { + ucs2char_t* path; + uint32_t uid; +} dircache_element_t; + +typedef struct { + int max_elems; + int num_elems; + dircache_element_t* elems; +} dircache_t; + +static void dircache_init(dircache_t* dc) +{ + memset(dc, 0, sizeof(*dc)); +} + +static void dircache_finish(dircache_t* dc) +{ + int i; + for (i = 0;i < dc->max_elems;++i) { + ucs2free(dc->elems[i].path); + } + free(dc->elems); +} + +static void dircache_push(dircache_t* dc, const ucs2char_t* path, uint32_t uid) +{ + dircache_element_t* elem = NULL; + + if (dc->max_elems < dc->num_elems + 1) { + dc->elems = (dircache_element_t*)realloc(dc->elems, sizeof(dircache_element_t) * (dc->max_elems+1)); + memset(&dc->elems[dc->max_elems], 0, sizeof(dircache_element_t)); + ++dc->max_elems; + } + + elem = &dc->elems[dc->num_elems++]; + ucs2free(elem->path); + elem->path = ucs2dup(path); + elem->uid = uid; +} + +static void dircache_pop(dircache_t* dc, int i) +{ + int n = ++i; + for (;i < dc->num_elems;++i) { + ucs2free(dc->elems[i].path); + memset(&dc->elems[i], 0, sizeof(dc->elems[0])); + } + dc->num_elems = n; +} + +static int dircache_findprefix(dircache_t* dc, const ucs2char_t* path) +{ + int i = dc->num_elems; + while (--i >= 0) { + if (ucs2ncmp(path, dc->elems[i].path, ucs2len(dc->elems[i].path)) == 0) { + break; + } + } + return i; +} + +static dircache_element_t *dircache_get(dircache_t* dc, int i) +{ + return &dc->elems[i]; +} + + +typedef struct { + const ucs2char_t* filepath; + const ucs2char_t* filename; + uint8_t filetype; + int index; +} object_record_t; + + +static int comp_pathname(const void *_x, const void *_y) +{ + const object_record_t* x = (const object_record_t*)_x; + const object_record_t* y = (const object_record_t*)_y; + int ret = ucs2cmp(x->filepath, y->filepath); + if (ret == 0) { + return ucs2cmp(x->filename, y->filename); + } else { + return ret; + } +} + + + +static const ucs2char_t* skip_one_directory(const ucs2char_t* path) +{ + ucs2char_t* p = ucs2chr(path, '/'); + return p ? p+1 : NULL; +} + +void dat_set(dat_t* dat, dic_t* dic, const ip3db_music_record_t* records, int num_records, ip3db_playlist_t* playlists, int num_playlists) +{ + /* Procedure: + * 1) Construct the object chunk and attach music records with Object UIDs. + * Because the object chunk stores a tree structure of path names, we need to + * split a path name to elements and allocate an Object UID to each element. + * For example, the path name "/Music/Beatles/Love/01_love.ogg" will generate + * five objects each of which links to the object of the parent directory: + * - UID=0xFFFFFFFF: "/a/" (root directory; FileType = 0) + * - UID=1 : "Music/" (FileType = 1) + * - UID=2 : "Beatles/" (FileType = 1) + * - UID=3 : "Love/" (FileType = 1) + * - UID=4 : "01_love.ogg" (FileType = 2) + * In order to convert a list of path names to the tree structure, this + * implementation sorts the path names in alphabetical order and finds new + * path elements by using a directory queue (dircache_t). + * + * 3) Attach Object UIDs for file names (FileType = 2) to music records. + * These UIDs are stored in records in the music chunk so that the player + * can refer to the path/file name of a music track quickly. + * + * 4) Construct the music chunk by basically duplicating the records. + * + * Now the content of db.dat is ready. Note that the path character in db.dat + * is not '\\' but '/'. + */ + + int i, j; + dat_entry_t* entry; + uint32_t uid = 0; + static const uint32_t uid_root = 0xFFFFFFFF; + static const ucs2char_t ucs2cs_object_root[] = {'/','a','/',0}; + static const ucs2char_t ucs2cs_root[] = {'/', 0}; + dat_list_t* dato = &dat->objects; + dat_list_t* datm = &dat->musics; + dat_list_t* datr = &dat->references; + uint32_t num_objects = num_records + num_playlists; + object_record_t *objects = (object_record_t*)malloc(sizeof(object_record_t) * num_objects); + dircache_t dc; + + dircache_init(&dc); + + /* Clear all entries. */ + dat_list_finish(dato); + dat_list_finish(datm); + dat_list_finish(datr); + dat_uidmap_finish(dat->objects_uidmap); + + /* Append an entry for the root directory. */ + entry = dat_list_expand(dato); + dat_entry_init(entry, &dic->objects); + ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], ucs2cs_object_root); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid_root); + + /* Register the root node to the directory cache. */ + dircache_push(&dc, ucs2cs_root, uid_root); + + /* Sort the records in alphabetical order of their path names. */ + for (i = 0;i < num_records;++i) { + objects[i].filepath = records[i][IP3DBF_MUSIC_FILEPATH].value.str; + objects[i].filename = records[i][IP3DBF_MUSIC_FILENAME].value.str; + objects[i].filetype = 2; + objects[i].index = i; + } + for (i = 0;i < num_playlists;++i) { + objects[i+num_records].filepath = playlists[i].filepath; + objects[i+num_records].filename = playlists[i].filename; + objects[i+num_records].filetype = 4; + objects[i+num_records].index = i; + } + qsort(objects, num_objects, sizeof(objects[0]), comp_pathname); + + /* Loop for the records. */ + for (i = 0;i < num_objects;++i) { + /* + * Split a path name into two parts: a prefix that have already been + * registered in the Object table: and a postfix that is being registered + * as Object records. + */ + const ucs2char_t* path = objects[i].filepath; + const ucs2char_t* file = objects[i].filename; + int k = dircache_findprefix(&dc, path); + const dircache_element_t* com = dircache_get(&dc, k); + const ucs2char_t* p = path + ucs2len(com->path); /* the prefix */ + uint32_t puid = com->uid; /* the UID of the parent directory of the postfix */ + + /* Discard directory portions that do not share a prefix with the target. */ + dircache_pop(&dc, k); + + /* Create objects one by one for the directory portions in the postfix. */ + while (p && *p) { + ucs2char_t tmp[MAX_PATH]; + const ucs2char_t* q = skip_one_directory(p); + uid = dato->num_entries; + + /* A directory element (e.g., "Beatles/") */ + ucs2ncpy(tmp, p, q-p); + tmp[q-p] = 0; + + /* Create a new object. */ + entry = dat_list_expand(dato); + dat_entry_init(entry, &dic->objects); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_PARENTUID], puid); + ip3db_variant_set_word(&entry->fields[IP3DBF_OBJECTS_FILETYPE], 1); + ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], tmp); + + /* Register the fullpath (e.g., "/Music/eatles/" in the dircache. */ + ucs2ncpy(tmp, path, q-path); + tmp[q-path] = 0; + dircache_push(&dc, tmp, uid); + + /* Store the current UID for children. */ + puid = uid; + + /* Move to the next portion. */ + p = q; + } + + /* Create a new object for the file name (FileType = 2). */ + if (objects[i].filetype == 2) { + /* Music file. */ + const ip3db_variant_t* record = records[objects[i].index]; + + uid = dato->num_entries; + entry = dat_list_expand(dato); + dat_entry_init(entry, &dic->objects); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], uid); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_PARENTUID], puid); + ip3db_variant_set_word(&entry->fields[IP3DBF_OBJECTS_FILETYPE], 2); + ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], file); + + /* Create a music record with UID referring to the file name. */ + entry = dat_list_expand(datm); + dat_entry_init(entry, &dic->music); + for (j = 0;j < entry->num_fields;++j) { + ip3db_variant_clone(&entry->fields[j], &record[j]); + } + ip3db_variant_set_dword(&entry->fields[IP3DBF_MUSIC_UID], uid); + } else if (objects[i].filetype == 4) { + /* Playlist file. */ + ip3db_playlist_t* pl = &playlists[objects[i].index]; + + pl->uid = dato->num_entries; + entry = dat_list_expand(dato); + dat_entry_init(entry, &dic->objects); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_UID], pl->uid); + ip3db_variant_set_dword(&entry->fields[IP3DBF_OBJECTS_PARENTUID], puid); + ip3db_variant_set_word(&entry->fields[IP3DBF_OBJECTS_FILETYPE], 4); + ip3db_variant_set_str(&entry->fields[IP3DBF_OBJECTS_OBJECTNAME], file); + } + } + + /* Loop for playlists. */ + for (i = 0;i < num_playlists;++i) { + const ip3db_playlist_t* pl = &playlists[i]; + for (j = 0;j < pl->num_entries;++j) { + entry = dat_list_expand(datr); + dat_entry_init(entry, &dic->references); + + ip3db_variant_set_dword(&entry->fields[IP3DBF_REFERENCES_PARENTCLUSTER], pl->uid); + ip3db_variant_set_dword(&entry->fields[IP3DBF_REFERENCES_CHILDCLUSTER], findfile(dat, pl->entries[j])); + ip3db_variant_set_word(&entry->fields[IP3DBF_REFERENCES_FILEFORMAT], 0x3009); + } + } + + dircache_finish(&dc); + + dat->objects_uidmap = dat_uidmap_create(&dat->objects); +} Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dat.c ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.h 2007-02-12 21:14:08 UTC (rev 358) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.h 2007-02-13 21:22:10 UTC (rev 359) @@ -1,54 +1,54 @@ -/* - * Low-level library for db.dat. - * - * Copyright (c) 2005-2007 Naoaki Okazaki - * - * 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 { - int num_fields; - ip3db_variant_t *fields; - uint32_t offset; -} dat_entry_t; - -typedef struct { - uint32_t num_entries; - dat_entry_t* entries; -} dat_list_t; - -struct tag_sort_index_t; typedef struct tag_sort_index_t sort_index_t; - -struct tag_dat_t { - dat_list_t objects; - dat_list_t musics; - dat_list_t references; - sort_index_t* objects_uidmap; -}; - -dat_t* dat_new(); -void dat_finish(dat_t* dat); -int dat_read(dat_t* dat, const dic_t* dic, FILE *fpi); -int dat_write(dat_t* dat, dic_t* dic, FILE *fpo); -void dat_dump(dat_t* dat, const dic_t* dic, FILE *fp); -void dat_set(dat_t* dat, dic_t* dic, const ip3db_music_record_t* records, int num_records, ip3db_playlist_t* playlists, int num_playlists); - -#endif/*__IP3DB_DAT_H__*/ +/* + * Low-level library for db.dat. + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * 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 { + int num_fields; + ip3db_variant_t *fields; + uint32_t offset; +} dat_entry_t; + +typedef struct { + uint32_t num_entries; + dat_entry_t* entries; +} dat_list_t; + +struct tag_sort_index_t; typedef struct tag_sort_index_t sort_index_t; + +struct tag_dat_t { + dat_list_t objects; + dat_list_t musics; + dat_list_t references; + sort_index_t* objects_uidmap; +}; + +dat_t* dat_new(); +void dat_finish(dat_t* dat); +int dat_read(dat_t* dat, const dic_t* dic, FILE *fpi); +int dat_write(dat_t* dat, dic_t* dic, FILE *fpo); +void dat_dump(dat_t* dat, const dic_t* dic, FILE *fp); +void dat_set(dat_t* dat, dic_t* dic, const ip3db_music_record_t* records, int num_records, ip3db_playlist_t* playlists, int num_playlists); + +#endif/*__IP3DB_DAT_H__*/ Property changes on: trunk/pmplib/lib/pmp_iriverplus3/dat.h ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-12 21:14:08 UTC (rev 358) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-13 21:22:10 UTC (rev 359) @@ -1,530 +1,530 @@ -/* - * Low-level library for db.dic. - * - * Copyright (c) 2005-2007 Naoaki Okazaki - * - * 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 defines 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 <pmplib/ucs2char.h> - -#include "serialize.h" -#include "util.h" -#include "ip3db.h" -#include "dic.h" - -static dic_index_t music_indices[] = { - {0, 0x0086, {IP3DBF_MUSIC_TITLE, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x00F8, {IP3DBF_MUSIC_RATING, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x0152, {IP3DBF_MUSIC_TRACKNUMBER, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x022C, {IP3DBF_MUSIC_CHANGEDFLAG, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x027A, {IP3DBF_MUSIC_CLUSM, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x031C, {IP3DBF_MUSIC_UID, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x0352, {IP3DBF_MUSIC_GENRE, IP3DBF_MUSIC_ARTIST, IP3DBF_MUSIC_TITLE}}, - {0, 0x0384, {IP3DBF_MUSIC_ARTIST, IP3DBF_MUSIC_ALBUM, IP3DBF_MUSIC_TRACKNUMBER}}, - {0, 0x03C2, {IP3DBF_MUSIC_ARTIST, IP3DBF_MUSIC_TRACKNUMBER, IP3DBF_MUSIC_NONE}}, - {0, 0x03F4, {IP3DBF_MUSIC_ARTIST, IP3DBF_MUSIC_TITLE, IP3DBF_MUSIC_NONE}}, - {0, 0x041A, {IP3DBF_MUSIC_GENRE, IP3DBF_MUSIC_TITLE, IP3DBF_MUSIC_NONE}}, - {0, 0x043E, {IP3DBF_MUSIC_ALBUM, IP3DBF_MUSIC_TRACKNUMBER, IP3DBF_MUSIC_NONE}}, -}; - -static dic_index_t references_indices[] = { - {0, 0x0764, {IP3DBF_REFERENCES_PARENTCLUSTER, IP3DBF_REFERENCES_NONE, IP3DBF_REFERENCES_NONE}}, - {0, 0x078C, {IP3DBF_REFERENCES_CHILDCLUSTER, IP3DBF_REFERENCES_NONE, IP3DBF_REFERENCES_NONE}}, -}; - -static dic_index_t objects_indices[] = { - {0, 0x099A, {IP3DBF_OBJECTS_UID, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x09F0, {IP3DBF_OBJECTS_FILETYPE, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x0A0E, {IP3DBF_OBJECTS_OBJECTNAME, IP3DBF_MUSIC_NONE, IP3DBF_MUSIC_NONE}}, - {0, 0x0ACE, {IP3DBF_OBJECTS_FILETYPE, IP3DBF_OBJECTS_PARENTUID, IP3DBF_OBJECTS_PROPERTIES}}, -}; - -static int dic_serialize(dic_t* dic, uint8_t* buffer, int is_storing); - -static void dic_field_init(dic_field_t* entry) -{ - memset(entry, 0, sizeof(*entry)); -} - -static void dic_field_finish(dic_field_t* entry) -{ - ucs2free(entry->name); - dic_field_init(entry); -} - -static size_t dic_field_serialize(uint8_t* block, dic_field_t* entry, int is_storing) -{ - uint8_t *p = block; - p += s... [truncated message content] |
From: <suc...@us...> - 2007-02-14 21:16:22
|
Revision: 364 http://svn.sourceforge.net/pmplib/?rev=364&view=rev Author: sucknblow Date: 2007-02-14 13:16:16 -0800 (Wed, 14 Feb 2007) Log Message: ----------- --enable-versioned-jspldir configure option for installing JSPLs to $prefix/share/pmplib-x.yz/jspl Modified Paths: -------------- trunk/pmplib/configure.in trunk/pmplib/frontend/easypmp/cui/Makefile.am trunk/pmplib/lib/playlist/Makefile.am Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-02-14 16:47:53 UTC (rev 363) +++ trunk/pmplib/configure.in 2007-02-14 21:16:16 UTC (rev 364) @@ -240,6 +240,20 @@ AC_SUBST(PLUGIN_DIR) dnl ------------------------------------------------------------------ +dnl Check whether to install JSPLs in share/pmplib/jspl or share/pmplib-x.yz/jspl +dnl ------------------------------------------------------------------ +AC_ARG_ENABLE( + versioned-jspldir, + [AC_HELP_STRING(--enable-versioned-jspldir, [Include version number in JSPL path])] +) +if test "$enable_versioned_jspldir" = "yes" ; then + JSPL_DIR=$PACKAGE-$VERSION +else + JSPL_DIR=$PACKAGE +fi +AC_SUBST(JSPL_DIR) + +dnl ------------------------------------------------------------------ dnl Output the configure results. dnl ------------------------------------------------------------------ AC_CONFIG_FILES(Makefile m4/Makefile include/Makefile include/pmplib/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/pmp/Makefile lib/gmi/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile pmplib.spec) Modified: trunk/pmplib/frontend/easypmp/cui/Makefile.am =================================================================== --- trunk/pmplib/frontend/easypmp/cui/Makefile.am 2007-02-14 16:47:53 UTC (rev 363) +++ trunk/pmplib/frontend/easypmp/cui/Makefile.am 2007-02-14 21:16:16 UTC (rev 364) @@ -30,7 +30,7 @@ INCLUDES = @INCLUDES@ AM_LDFLAGS = @LDFLAGS@ -easypmp_CFLAGS = -DPMP_JSPL_DIR="\"$(prefix)/share/@PACKAGE@/jspl\"" +easypmp_CFLAGS = -DPMP_JSPL_DIR="\"$(prefix)/share/$(JSPL_DIR)/jspl\"" easypmp_LDADD = \ $(top_builddir)/lib/pmp/libpmp.la \ Modified: trunk/pmplib/lib/playlist/Makefile.am =================================================================== --- trunk/pmplib/lib/playlist/Makefile.am 2007-02-14 16:47:53 UTC (rev 363) +++ trunk/pmplib/lib/playlist/Makefile.am 2007-02-14 21:16:16 UTC (rev 364) @@ -8,7 +8,7 @@ jspl/top_ranking.jspl jspl_c = jspl.c - jspldir = $(prefix)/share/@PACKAGE@/jspl + jspldir = $(prefix)/share/$(JSPL_DIR)/jspl jspl_DATA = $(jspl_files) endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2007-02-14 21:17:51
|
Revision: 365 http://svn.sourceforge.net/pmplib/?rev=365&view=rev Author: sucknblow Date: 2007-02-14 13:17:52 -0800 (Wed, 14 Feb 2007) Log Message: ----------- Use libtool -release option. Modified Paths: -------------- trunk/pmplib/debian/control trunk/pmplib/debian/libpmp-dev.install trunk/pmplib/debian/rules trunk/pmplib/lib/pmp/Makefile.am Added Paths: ----------- trunk/pmplib/debian/libpmp-0.14.install Removed Paths: ------------- trunk/pmplib/debian/libpmp0.install Modified: trunk/pmplib/debian/control =================================================================== --- trunk/pmplib/debian/control 2007-02-14 21:16:16 UTC (rev 364) +++ trunk/pmplib/debian/control 2007-02-14 21:17:52 UTC (rev 365) @@ -8,7 +8,7 @@ Package: easypmp Architecture: any Section: sound -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends} Description: create music databases used by portable media players Easypmp is a command line utility used to create and maintain the music database and playlists on a variety of portable music players. @@ -41,7 +41,7 @@ player. Playlist files typically have a .m3u or .pls file extension, and can be created by many desktop media players. -Package: libpmp0 +Package: libpmp-0.14 Architecture: any Section: libs Depends: ${shlibs:Depends} @@ -74,7 +74,7 @@ Package: libpmp-dev Architecture: any Section: libdevel -Depends: libpmp0 (= ${Source-Version}) +Depends: libpmp-${source:Upstream-Version} (= ${source:Version}) Description: library for creating databases for portable media players (development files) PMPlib is a library for creating and maintaining the music database and playlists for a variety of portable music players. Copied: trunk/pmplib/debian/libpmp-0.14.install (from rev 361, trunk/pmplib/debian/libpmp0.install) =================================================================== --- trunk/pmplib/debian/libpmp-0.14.install (rev 0) +++ trunk/pmplib/debian/libpmp-0.14.install 2007-02-14 21:17:52 UTC (rev 365) @@ -0,0 +1,4 @@ +debian/tmp/usr/lib/libpmp*-*.so +debian/tmp/usr/lib/pmplib*/*.so +debian/tmp/usr/lib/pmplib*/*.la +debian/tmp/usr/share/pmplib*/* Modified: trunk/pmplib/debian/libpmp-dev.install =================================================================== --- trunk/pmplib/debian/libpmp-dev.install 2007-02-14 21:16:16 UTC (rev 364) +++ trunk/pmplib/debian/libpmp-dev.install 2007-02-14 21:17:52 UTC (rev 365) @@ -1,3 +1,3 @@ debian/tmp/usr/include/pmplib/* -debian/tmp/usr/lib/*.so +debian/tmp/usr/lib/libpmp.so debian/tmp/usr/lib/*.la Deleted: trunk/pmplib/debian/libpmp0.install =================================================================== --- trunk/pmplib/debian/libpmp0.install 2007-02-14 21:16:16 UTC (rev 364) +++ trunk/pmplib/debian/libpmp0.install 2007-02-14 21:17:52 UTC (rev 365) @@ -1,4 +0,0 @@ -debian/tmp/usr/lib/libpmp*.so.* -debian/tmp/usr/lib/pmplib*/*.so -debian/tmp/usr/lib/pmplib*/*.la -debian/tmp/usr/share/pmplib/* Modified: trunk/pmplib/debian/rules =================================================================== --- trunk/pmplib/debian/rules 2007-02-14 21:16:16 UTC (rev 364) +++ trunk/pmplib/debian/rules 2007-02-14 21:17:52 UTC (rev 365) @@ -23,6 +23,7 @@ CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" \ ./configure \ --enable-versioned-libdir \ + --enable-versioned-jspldir \ --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ @@ -77,9 +78,9 @@ dh_strip dh_compress dh_fixperms - dh_makeshlibs + dh_makeshlibs -V dh_installdeb - dh_shlibdeps -Llibpmp0 -ldebian/libpmp0/usr/lib + dh_shlibdeps -Llibpmp-0.14 -ldebian/libpmp-0.14/usr/lib dh_gencontrol dh_md5sums dh_builddeb Modified: trunk/pmplib/lib/pmp/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp/Makefile.am 2007-02-14 21:16:16 UTC (rev 364) +++ trunk/pmplib/lib/pmp/Makefile.am 2007-02-14 21:17:52 UTC (rev 365) @@ -11,7 +11,8 @@ libpmp_la_CPPFLAGS = -DPMP_MODULES_DIR="\"$(libdir)/$(PLUGIN_DIR)\"" $(LTDLINCL) libpmp_la_LDFLAGS = \ - -no-undefined + -no-undefined \ + -release @VERSION@ libpmp_la_LIBADD = \ $(top_builddir)/lib/ucs2/libucs2.la \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2007-02-19 22:04:09
|
Revision: 380 http://svn.sourceforge.net/pmplib/?rev=380&view=rev Author: sucknblow Date: 2007-02-19 14:03:59 -0800 (Mon, 19 Feb 2007) Log Message: ----------- Attempt to work around totally braindead mozilla packaging. Modified Paths: -------------- trunk/pmplib/configure.in trunk/pmplib/frontend/easypmp/cui/Makefile.am trunk/pmplib/m4/smjs.m4 Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-02-18 19:07:28 UTC (rev 379) +++ trunk/pmplib/configure.in 2007-02-19 22:03:59 UTC (rev 380) @@ -221,6 +221,7 @@ AC_SUBST(VORBISFILE_LIBS) AC_SUBST(JS_CFLAGS) AC_SUBST(JS_LIBS) +AC_SUBST(JS_RPATH) AM_CONDITIONAL(have_jsapi, test -n "$JS_CFLAGS") AM_CONDITIONAL(have_getopt, test "$ac_cv_header_getopt_h" = "yes") Modified: trunk/pmplib/frontend/easypmp/cui/Makefile.am =================================================================== --- trunk/pmplib/frontend/easypmp/cui/Makefile.am 2007-02-18 19:07:28 UTC (rev 379) +++ trunk/pmplib/frontend/easypmp/cui/Makefile.am 2007-02-19 22:03:59 UTC (rev 380) @@ -28,7 +28,7 @@ AM_CFLAGS = @CFLAGS@ INCLUDES = @INCLUDES@ -AM_LDFLAGS = @LDFLAGS@ +AM_LDFLAGS = @LDFLAGS@ ${JS_RPATH} easypmp_CFLAGS = -DPMP_JSPL_DIR="\"$(prefix)/share/$(JSPL_DIR)/jspl\"" Modified: trunk/pmplib/m4/smjs.m4 =================================================================== --- trunk/pmplib/m4/smjs.m4 2007-02-18 19:07:28 UTC (rev 379) +++ trunk/pmplib/m4/smjs.m4 2007-02-19 22:03:59 UTC (rev 380) @@ -35,6 +35,39 @@ [#define XP_UNIX]) ]) +# Attempt to workaround totally brain-dead Mozilla packaging... +m4_define([spidermonkey_rpath],[ + saved_OPTERR="$OPTERR" + OPTERR=0 + saved_OPTIND="$OPTIND" + OPTIND=1 + saved_HAVE_GETOPTS="$HAVE_GETOPTS" + HAVE_GETOPTS= + JS_RPATH= + if test -n "$BASH_VERSION" -o "$ZSH_VERSION" ; then + HAVE_GETOPTS=yes + fi + if test "$HAVE_GETOPTS" = "yes" ; then + while getopts L:l: f `echo $JS_LIBS` ; do + case $f in + L) + if test "$OPTARG" != "/lib" -a "$OPTARG" != "/usr/lib" ; then + JS_RPATH="$JS_RPATH -Wl,--rpath \"$OPTARG\"" + fi + ;; + esac + done + else + JS_LIBDIR=`echo "$JS_LIBS "| sed 's/.*\(-L\([^" ]\|"[^"]*"\)*\) .*/\1/'` + if test "${JS_LIBDIR#-L}" != "${JS_LIBDIR}" ; then + JS_RPATH="$JS_RPATH -Wl,--rpath \"${JS_LIBDIR#-L}\"" + fi + fi + OPTERR="$saved_OPTERR" + OPTIND="$saved_OPTIND" + HAVE_GETOPTS="$saved_HAVE_GETOPTS" +]) + m4_define([spidermonkey_checkall], [if test x"$JS_CFLAGS" = x; then AC_MSG_NOTICE([looking for the Spidermonkey Javascript library in various places.]) @@ -124,6 +157,8 @@ fi AC_SUBST(JS_CFLAGS) AC_SUBST(JS_LIBS) + spidermonkey_rpath + AC_SUBST(JS_RPATH) ]) AC_DEFUN([AC_PATH_SPIDERMONKEY], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-21 15:56:22
|
Revision: 382 http://svn.sourceforge.net/pmplib/?rev=382&view=rev Author: nyaochi Date: 2007-02-21 07:56:22 -0800 (Wed, 21 Feb 2007) Log Message: ----------- Started to support Apple iPod in PMPlib. New driver module pmp_ipod was added. The code is in the very early stage of the development: only reading/dumping iTunesDB is working. Modified Paths: -------------- trunk/pmplib/include/pmplib/os_types.h trunk/pmplib/pmp.sln Added Paths: ----------- trunk/pmplib/lib/pmp_ipod/ trunk/pmplib/lib/pmp_ipod/ipod.c trunk/pmplib/lib/pmp_ipod/ipod.h trunk/pmplib/lib/pmp_ipod/itunesdb.c trunk/pmplib/lib/pmp_ipod/itunesdb.h trunk/pmplib/lib/pmp_ipod/pmp_ipod.c trunk/pmplib/lib/pmp_ipod/pmp_ipod.vcproj trunk/pmplib/lib/pmp_ipod/serialize.c trunk/pmplib/lib/pmp_ipod/serialize.h trunk/pmplib/lib/pmp_ipod/util.c trunk/pmplib/lib/pmp_ipod/util.h Modified: trunk/pmplib/include/pmplib/os_types.h =================================================================== --- trunk/pmplib/include/pmplib/os_types.h 2007-02-20 15:40:10 UTC (rev 381) +++ trunk/pmplib/include/pmplib/os_types.h 2007-02-21 15:56:22 UTC (rev 382) @@ -31,10 +31,12 @@ #include <sys/types.h> #else -typedef unsigned char uint8_t; -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned short uint16_t; +typedef char int8_t; +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +typedef int int32_t; +typedef unsigned short uint16_t; +typedef unsigned __int64 uint64_t; #endif Added: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c (rev 0) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-21 15:56:22 UTC (rev 382) @@ -0,0 +1,81 @@ +/* + * iPod + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * 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> +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ +#include <pmplib/ucs2char.h> + +#include "serialize.h" +#include "util.h" +#include "ipod.h" +#include "itunesdb.h" + +void ipod_init(ipod_t* ipod) +{ + ipod->itunesdb = calloc(1, sizeof(itunesdb_chunk_t)); +} + +void ipod_finish(ipod_t* ipod) +{ + +} + +result_t ipod_read(ipod_t* ipod, const ucs2char_t* itunesdb) +{ + FILE *fp = NULL; + + fp = ucs2fopen(itunesdb, "rb"); + if (fp) { + serializer_t sio; + uint8_t* buffer = NULL; + long size = 0; + + fread_all(fp, &buffer, &size); + fclose(fp); + + serialize_init_read(&sio, buffer, (size_t)size); + itunesdb_read(ipod->itunesdb, &sio); + serialize_finish(&sio); + + return 0; + } else { + return 1; + } +} + +result_t ipod_dump(ipod_t* ipod, FILE *fpo) +{ + serializer_t sio; + serialize_init_dump(&sio, fpo, 2); + itunesdb_repr(ipod->itunesdb, 0, &sio); + serialize_finish(&sio); + return 0; +} Property changes on: trunk/pmplib/lib/pmp_ipod/ipod.c ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Added: trunk/pmplib/lib/pmp_ipod/ipod.h =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.h (rev 0) +++ trunk/pmplib/lib/pmp_ipod/ipod.h 2007-02-21 15:56:22 UTC (rev 382) @@ -0,0 +1,16 @@ +#ifndef __IPOD_H__ +#define __IPOD_H__ + +struct tag_itunesdb_chunk; +typedef struct tag_itunesdb_chunk itunesdb_chunk_t; + +typedef struct { + itunesdb_chunk_t* itunesdb; +} ipod_t; + +void ipod_init(ipod_t* ipod); +void ipod_finish(ipod_t* ipod); +result_t ipod_read(ipod_t* ipod, const ucs2char_t* itunesdb); +result_t ipod_dump(ipod_t* ipod, FILE *fpo); + +#endif/*__IPOD_H__*/ Property changes on: trunk/pmplib/lib/pmp_ipod/ipod.h ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Added: trunk/pmplib/lib/pmp_ipod/itunesdb.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/itunesdb.c (rev 0) +++ trunk/pmplib/lib/pmp_ipod/itunesdb.c 2007-02-21 15:56:22 UTC (rev 382) @@ -0,0 +1,526 @@ +/* + * iTunesDB + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * 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> +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ +#include <pmplib/ucs2char.h> + +#include "ipod.h" +#include "serialize.h" +#include "util.h" +#include "itunesdb.h" + +static int mhbd_serialize(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + chunk_mhbd_t* mhbd = (chunk_mhbd_t*)chunk->data; + + if (serialize_uint32le(sio, "unknown1", "%d", &mhbd->unknown1)) return 1; + if (serialize_uint32le(sio, "version", "%d", &mhbd->version)) return 1; + if (serialize_uint32le(sio, "num_children", "%d", &mhbd->num_children)) return 1; + if (serialize_uint64le(sio, "identifier", "%lX", &mhbd->identifier)) return 1; + if (serialize_uint16le(sio, "unkonwn2", "%d", &mhbd->unknown2)) return 1; + if (serialize_uint16le(sio, "unkonwn3", "%d", &mhbd->unknown3)) return 1; + if (serialize_uint64le(sio, "unknown4", "%lX", &mhbd->unknown4)) return 1; + if (serialize_uint8_array(sio, "unknown5", "%02X ", mhbd->unknown5, sizeof(mhbd->unknown5))) return 1; + if (serialize_uint8_array(sio, "language", "%c ", mhbd->language, sizeof(mhbd->language))) return 1; + if (serialize_uint8_array(sio, "unknown6", "%02X ", mhbd->unknown6, sizeof(mhbd->unknown6))) return 1; + + return 0; +} + +static int mhsd_serialize(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + chunk_mhsd_t* mhsd = (chunk_mhsd_t*)chunk->data; + + if (serialize_uint32le(sio, "type", "%d", &mhsd->type)) return 1; + if (serialize_uint8_array(sio, "unknown1", "%02X ", mhsd->unknown1, sizeof(mhsd->unknown1))) return 1; + + return 0; +} + +static int mhlt_serialize(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + chunk_mhlt_t* mhlt = (chunk_mhlt_t*)chunk->data; + + if (serialize_uint8_array(sio, "unknown1", "%02X ", mhlt->unknown1, sizeof(mhlt->unknown1))) return 1; + + return 0; +} + +static int mhit_serialize(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + chunk_mhit_t* mhit = (chunk_mhit_t*)chunk->data; + + if (serialize_uint32le(sio, "num_children", "%u", &mhit->num_children)) return 1; + if (serialize_uint32le(sio, "uid", "%u", &mhit->uid)) return 1; + if (serialize_uint32le(sio, "visible", "%u", &mhit->visible)) return 1; + if (serialize_uint32le(sio, "filetype", "%08X", &mhit->filetype)) return 1; + if (serialize_uint8(sio, "type1", "%02X", &mhit->type1)) return 1; + if (serialize_uint8(sio, "type2", "%02X", &mhit->type2)) return 1; + if (serialize_uint8(sio, "compilation", "%u", &mhit->compilation)) return 1; + if (serialize_uint8(sio, "rating", "%u", &mhit->type1)) return 1; + if (serialize_uint32le(sio, "last_modified", "%u", &mhit->last_modified)) return 1; + if (serialize_uint32le(sio, "filesize", "%u", &mhit->filesize)) return 1; + if (serialize_uint32le(sio, "duration", "%u", &mhit->duration)) return 1; + if (serialize_uint32le(sio, "track_number", "%u", &mhit->track_number)) return 1; + if (serialize_uint32le(sio, "total_tracks", "%u", &mhit->total_tracks)) return 1; + if (serialize_uint32le(sio, "year", "%u", &mhit->year)) return 1; + if (serialize_uint32le(sio, "bitrate", "%u", &mhit->bitrate)) return 1; + if (serialize_uint16le(sio, "unknown1", "%u", &mhit->unknown1)) return 1; + if (serialize_uint16le(sio, "samplerate", "%u", &mhit->samplerate)) return 1; + if (serialize_int32le(sio, "volume", "%d", &mhit->volume)) return 1; + if (serialize_uint32le(sio, "start_time", "%u", &mhit->start_time)) return 1; + if (serialize_uint32le(sio, "stop_time", "%u", &mhit->stop_time)) return 1; + if (serialize_uint32le(sio, "sound_check", "%u", &mhit->sound_check)) return 1; + if (serialize_uint32le(sio, "play_count", "%u", &mhit->play_count)) return 1; + if (serialize_uint32le(sio, "play_count2", "%u", &mhit->play_count2)) return 1; + if (serialize_uint32le(sio, "last_played", "%u", &mhit->last_played)) return 1; + if (serialize_uint32le(sio, "disc_number", "%u", &mhit->disc_number)) return 1; + if (serialize_uint32le(sio, "total_discs", "%u", &mhit->total_discs)) return 1; + if (serialize_uint32le(sio, "user_id", "%u", &mhit->user_id)) return 1; + if (serialize_uint32le(sio, "date_added", "%u", &mhit->date_added)) return 1; + if (serialize_uint32le(sio, "bookmark_time", "%u", &mhit->bookmark_time)) return 1; + if (serialize_uint64le(sio, "dbid", "%X", &mhit->dbid)) return 1; + if (serialize_uint8(sio, "is_checked", "%u", &mhit->is_checked)) return 1; + if (serialize_uint8(sio, "rating_itunes", "%u", &mhit->rating_itunes)) return 1; + if (serialize_uint16le(sio, "bpm", "%u", &mhit->bpm)) return 1; + if (serialize_uint16le(sio, "num_artworks", "%u", &mhit->num_artworks)) return 1; + if (serialize_uint16le(sio, "unk9", "%u", &mhit->unk9)) return 1; + if (serialize_uint32le(sio, "artwork_size", "%u", &mhit->artwork_size)) return 1; + if (serialize_uint32le(sio, "unk11", "%u", &mhit->unk11)) return 1; + if (serialize_uint32le(sio, "samplerate2", "%u", &mhit->samplerate2)) return 1; + if (serialize_uint32le(sio, "disc_released", "%u", &mhit->disc_released)) return 1; + if (serialize_uint16le(sio, "unk14_1", "%u", &mhit->unk14_1)) return 1; + if (serialize_uint16le(sio, "unk14_2", "%u", &mhit->unk14_2)) return 1; + if (serialize_uint32le(sio, "unk15", "%u", &mhit->unk15)) return 1; + if (serialize_uint32le(sio, "unk16", "%u", &mhit->unk16)) return 1; + if (serialize_uint32le(sio, "skip_count", "%u", &mhit->skip_count)) return 1; + if (serialize_uint32le(sio, "last_skipped", "%u", &mhit->last_skipped)) return 1; + if (serialize_uint8(sio, "has_artwork", "%u", &mhit->has_artwork)) return 1; + if (serialize_uint8(sio, "skip_when_shuffling", "%u", &mhit->skip_when_shuffling)) return 1; + if (serialize_uint8(sio, "remember_playback_position", "%u", &mhit->remember_playback_position)) return 1; + if (serialize_uint8(sio, "flag4", "%u", &mhit->flag4)) return 1; + if (serialize_uint64le(sio, "dbid2", "%X", &mhit->dbid2)) return 1; + if (serialize_uint8(sio, "has_lyrics", "%u", &mhit->has_lyrics)) return 1; + if (serialize_uint8(sio, "is_movie", "%u", &mhit->is_movie)) return 1; + if (serialize_uint8(sio, "is_played", "%u", &mhit->is_played)) return 1; + if (serialize_uint8(sio, "unk17", "%u", &mhit->unk17)) return 1; + if (serialize_uint32le(sio, "unk21", "%u", &mhit->unk21)) return 1; + if (serialize_int32le(sio, "encoder_delay", "%d", &mhit->encoder_delay)) return 1; + if (serialize_uint64le(sio, "num_samples", "%u", &mhit->num_samples)) return 1; + if (serialize_uint32le(sio, "unk25", "%u", &mhit->unk25)) return 1; + if (serialize_int32le(sio, "padding_samples", "%d", &mhit->padding_samples)) return 1; + if (serialize_uint32le(sio, "unk27", "%u", &mhit->unk27)) return 1; + if (serialize_uint32le(sio, "media_type", "%u", &mhit->media_type)) return 1; + if (serialize_uint32le(sio, "season_number", "%u", &mhit->season_number)) return 1; + if (serialize_uint32le(sio, "episode_number", "%u", &mhit->episode_number)) return 1; + if (serialize_uint32le(sio, "unk31", "%u", &mhit->unk31)) return 1; + if (serialize_uint32le(sio, "unk32", "%u", &mhit->unk32)) return 1; + if (serialize_uint32le(sio, "unk33", "%u", &mhit->unk33)) return 1; + if (serialize_uint32le(sio, "unk34", "%u", &mhit->unk34)) return 1; + if (serialize_uint32le(sio, "unk35", "%u", &mhit->unk35)) return 1; + if (serialize_uint32le(sio, "unk36", "%u", &mhit->unk36)) return 1; + if (serialize_uint32le(sio, "unk37", "%u", &mhit->unk37)) return 1; + if (serialize_uint32le(sio, "offset_last8th_frame", "%u", &mhit->offset_last8th_frame)) return 1; + if (serialize_uint32le(sio, "unk38", "%u", &mhit->unk38)) return 1; + if (serialize_uint16le(sio, "gapless_track", "%u", &mhit->gapless_track)) return 1; + if (serialize_uint16le(sio, "gapless_album", "%u", &mhit->gapless_album)) return 1; + + return 0; +} + +static int mhlp_serialize(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + chunk_mhlp_t* mhlp = (chunk_mhlp_t*)chunk->data; + + if (serialize_uint8_array(sio, "unknown1", "%02X ", mhlp->unknown1, sizeof(mhlp->unknown1))) return 1; + + return 0; +} + +static int mhyp_serialize(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + chunk_mhyp_t* mhyp = (chunk_mhyp_t*)chunk->data; + + if (serialize_uint32le(sio, "num_mhod", "%u", &mhyp->num_mhod)) return 1; + if (serialize_uint32le(sio, "num_mhip", "%u", &mhyp->num_mhip)) return 1; + if (serialize_uint8(sio, "flag_master", "%u", &mhyp->flag_master)) return 1; + if (serialize_uint8(sio, "flag_unkonwn1", "%u", &mhyp->flag_unkonwn1)) return 1; + if (serialize_uint8(sio, "flag_unkonwn2", "%u", &mhyp->flag_unkonwn2)) return 1; + if (serialize_uint8(sio, "flag_unkonwn3", "%u", &mhyp->flag_unkonwn3)) return 1; + if (serialize_uint32le(sio, "timestamp", "%u", &mhyp->timestamp)) return 1; + if (serialize_uint64le(sio, "id", "%u", &mhyp->id)) return 1; + if (serialize_uint32le(sio, "unk3", "%u", &mhyp->unk3)) return 1; + if (serialize_uint16le(sio, "unk4", "%u", &mhyp->unk4)) return 1; + if (serialize_uint16le(sio, "flag_podcast", "%u", &mhyp->flag_podcast)) return 1; + if (serialize_uint32le(sio, "sort_order", "%u", &mhyp->sort_order)) return 1; + if (serialize_uint8_array(sio, "padding", "%02X ", mhyp->padding, sizeof(mhyp->padding))) return 1; + + return 0; +} + +static int mhip_serialize(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + chunk_mhip_t* mhyp = (chunk_mhip_t*)chunk->data; + + if (serialize_uint32le(sio, "num_mhod", "%u", &mhyp->num_mhod)) return 1; + if (serialize_uint32le(sio, "flag_podcast_group", "%X", &mhyp->flag_podcast_group)) return 1; + if (serialize_uint32le(sio, "group_id", "%u", &mhyp->group_id)) return 1; + if (serialize_uint32le(sio, "track_id", "%u", &mhyp->track_id)) return 1; + if (serialize_uint32le(sio, "timestamp", "%u", &mhyp->timestamp)) return 1; + if (serialize_uint32le(sio, "podcast_parent", "%u", &mhyp->podcast_parent)) return 1; + + return 0; +} + +static int mhod_string_serialize(itunesdb_chunk_t* chunk, const char *name, serializer_t* sio) +{ + chunk_mhod_string_t* string = &((chunk_mhod_t*)chunk->data)->data.str; + + if (serialize_uint32le(sio, "unk1", "%u", &string->unk1)) return 1; + if (serialize_uint32le(sio, "unk2", "%u", &string->unk2)) return 1; + if (serialize_uint32le(sio, "position", "%u", &string->position)) return 1; + if (serialize_uint32le(sio, "size", "%u", &string->size)) return 1; + if (serialize_uint32le(sio, "unknown", "%u", &string->unknown)) return 1; + if (serialize_uint32le(sio, "unk4", "%u", &string->unk4)) return 1; + if (serialize_ucs2lestr_fixed(sio, name, "%s", &string->value, string->size / sizeof(ucs2char_t))) return 1; + + return 0; +} + +static int mhod_url_serialize(itunesdb_chunk_t* chunk, const char *name, serializer_t* sio) +{ + chunk_mhod_t* mhod = (chunk_mhod_t*)chunk->data; + chunk_mhod_url_t* url = &mhod->data.url; + + if (serialize_uint32le(sio, "unk1", "%u", &url->unk1)) return 1; + if (serialize_uint32le(sio, "unk2", "%u", &url->unk2)) return 1; + if (serialize_utf8str_fixed(sio, name, "%s", &url->value, chunk->data_size - chunk->chunk_size)) return 1; + + return 0; +} + +static int mhod_index_serialize(itunesdb_chunk_t* chunk, const char *name, serializer_t* sio) +{ + uint32_t i; + chunk_mhod_t* mhod = (chunk_mhod_t*)chunk->data; + chunk_mhod_index_t* index = &mhod->data.index; + + if (serialize_uint32le(sio, "unk1", "%u", &index->unk1)) return 1; + if (serialize_uint32le(sio, "unk2", "%u", &index->unk2)) return 1; + if (serialize_uint32le(sio, "type", "%u", &index->type)) return 1; + if (serialize_uint32le(sio, "num_entries", "%u", &index->num_entries)) return 1; + if (serialize_uint8_array(sio, "padding", "%02X ", index->padding, sizeof(index->padding))) return 1; + + /* Allocate array when reading. */ + if (serialize_reading(sio)) { + index->entries = calloc(index->num_entries, sizeof(uint32_t)); + if (!index->entries) { + return 1; + } + } + + for (i = 0;i < index->num_entries;++i) { + char fieldname[128]; + sprintf(fieldname, "entries[%d]", i); + if (serialize_uint32le(sio, fieldname, "%u", &index->entries[i])) return 1; + } + + return 0; +} + +static int mhod_playlist_column_serialize(itunesdb_chunk_t* chunk, const char *name, serializer_t* sio) +{ + uint32_t i; + chunk_mhod_t* mhod = (chunk_mhod_t*)chunk->data; + chunk_mhod_playlist_column_t* pc = &mhod->data.pc; + + if (serialize_uint32le(sio, "unk1", "%u", &pc->unk1)) return 1; + if (serialize_uint32le(sio, "unk2", "%u", &pc->unk2)) return 1; + if (serialize_uint32le(sio, "unk3", "%u", &pc->unk3)) return 1; + if (serialize_uint64le(sio, "unk4", "%u", &pc->unk4)) return 1; + if (serialize_uint32le(sio, "unk8", "%u", &pc->unk8)) return 1; + if (serialize_uint16le(sio, "unk9", "%u", &pc->unk9)) return 1; + if (serialize_uint16le(sio, "unk10", "%u", &pc->unk10)) return 1; + if (serialize_uint32le(sio, "sort_type", "%u", &pc->sort_type)) return 1; + if (serialize_uint32le(sio, "num_columns", "%u", &pc->num_columns)) return 1; + if (serialize_uint32le(sio, "unknown", "%u", &pc->unknown)) return 1; + + /* Allocate array when reading. */ + if (serialize_reading(sio)) { + pc->columns = (chunk_mhod_playlist_column_definition_t*)calloc( + pc->num_columns, sizeof(chunk_mhod_playlist_column_definition_t)); + if (!pc->columns) { + return 1; + } + } + + for (i = 0;i < pc->num_columns;++i) { + char fieldname[128]; + chunk_mhod_playlist_column_definition_t* def = &pc->columns[i]; + + sprintf(fieldname, "columns[%d].id", i); + if (serialize_uint16le(sio, fieldname, "%u", &def->id)) return 1; + sprintf(fieldname, "columns[%d].width", i); + if (serialize_uint16le(sio, fieldname, "%u", &def->width)) return 1; + sprintf(fieldname, "columns[%d].sort_direction", i); + if (serialize_uint32le(sio, fieldname, "%u", &def->sort_direction)) return 1; + sprintf(fieldname, "columns[%d].padding", i); + if (serialize_uint64le(sio, fieldname, "%u", &def->padding)) return 1; + } + + return 0; +} + +static int mhod_playlist_order_serialize(itunesdb_chunk_t* chunk, const char *name, serializer_t* sio) +{ + chunk_mhod_t* mhod = (chunk_mhod_t*)chunk->data; + chunk_mhod_playlist_order_t* po = &mhod->data.po; + + if (serialize_uint32le(sio, "unk1", "%u", &po->unk1)) return 1; + if (serialize_uint32le(sio, "unk2", "%u", &po->unk2)) return 1; + if (serialize_uint32le(sio, "position", "%u", &po->position)) return 1; + if (serialize_uint8_array(sio, "padding", "%02X ", po->padding, sizeof(po->padding))) return 1; + + return 0; +} + +static const itunesdb_mhoddecl_t* find_mhoddecl(itunesdb_chunk_t* chunk) +{ + static const itunesdb_mhoddecl_t mds[] = { + {1, "title", 0, mhod_string_serialize}, + {2, "location", 0, mhod_string_serialize}, + {3, "album", 0, mhod_string_serialize}, + {4, "artist", 0, mhod_string_serialize}, + {5, "genre", 0, mhod_string_serialize}, + {6, "filetype", 0, mhod_string_serialize}, + {7, "EQ setting", 0, mhod_string_serialize}, + {8, "comment", 0, mhod_string_serialize}, + {9, "category", 0, mhod_string_serialize}, + {12, "composer", 0, mhod_string_serialize}, + {13, "grouping", 0, mhod_string_serialize}, + {14, "description", 0, mhod_string_serialize}, + {15, "podcast_enclosure_url", 0, mhod_url_serialize}, + {16, "podcast_rss_url", 0, mhod_url_serialize}, + {52, "index", 0, mhod_index_serialize}, + {100, "playlist_column", 0x288, mhod_playlist_column_serialize}, + {100, "playlist_order", 0x2C, mhod_playlist_order_serialize}, + {0, NULL, 0, NULL}, + }; + const itunesdb_mhoddecl_t* decl = mds; + chunk_mhod_t* mhod = (chunk_mhod_t*)chunk->data; + + while (decl->name) { + if (decl->type == mhod->type) { + if (decl->chunk_size == 0 || decl->chunk_size == chunk->chunk_size) { + return decl; + } + } + ++decl; + } + return NULL; +} + +static int mhod_serialize(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + chunk_mhod_t* mhod = (chunk_mhod_t*)chunk->data; + const itunesdb_mhoddecl_t* decl = NULL; + + if (serialize_uint32le(sio, "type", "%u", &mhod->type)) return 1; + + decl = find_mhoddecl(chunk); + if (decl) { + if (decl->serialize(chunk, decl->name, sio)) return 1; + } else { + if (serialize_dumping(sio)) { + serialize_indent(sio); + fprintf(sio->fp, "!unknown_mhod_type!\n"); + } + } + + return 0; +} + + +static const itunesdb_chunkdecl_t* find_chunkdecl(itunesdb_chunk_t* chunk) +{ + static const itunesdb_chunkdecl_t cds[] = { + {"mhbd", sizeof(chunk_mhbd_t), mhbd_serialize}, + {"mhsd", sizeof(chunk_mhsd_t), mhsd_serialize}, + {"mhlt", sizeof(chunk_mhlt_t), mhlt_serialize}, + {"mhit", sizeof(chunk_mhit_t), mhit_serialize}, + {"mhlp", sizeof(chunk_mhlp_t), mhlp_serialize}, + {"mhyp", sizeof(chunk_mhyp_t), mhyp_serialize}, + {"mhip", sizeof(chunk_mhip_t), mhip_serialize}, + {"mhod", sizeof(chunk_mhod_t), mhod_serialize}, + {NULL, 0, NULL}, + }; + const itunesdb_chunkdecl_t* decl = cds; + + while (decl->name) { + if (strncmp(decl->name, chunk->id, 4) == 0) { + return decl; + } + ++decl; + } + return NULL; +} + +int itunesdb_repr(itunesdb_chunk_t* chunk, size_t index, serializer_t* sio) +{ + uint32_t i; + itunesdb_chunk_t* child = NULL; + const itunesdb_chunkdecl_t* decl = NULL; + + /* Start of a chunk */ + serialize_indent(sio); + fprintf(sio->fp, "Chunk %c%c%c%c (%d) = {\n", chunk->id[0], chunk->id[1], chunk->id[2], chunk->id[3], index); + serialize_indent_ascend(sio); + + /* Show information of the chunk header */ + serialize_indent(sio); + fprintf(sio->fp, "offset: %08X\n", chunk->offset); + serialize_indent(sio); + fprintf(sio->fp, "data_size: %d\n", chunk->data_size); + serialize_indent(sio); + fprintf(sio->fp, "chunk_size: %d\n", chunk->chunk_size); + + /* Show fields in the chunk data */ + decl = find_chunkdecl(chunk); + if (decl) { + decl->serialize(chunk, sio); + } else { + serialize_indent(sio); + fprintf(sio->fp, "!unknown_chunk!\n"); + } + + /* Show number of children */ + serialize_indent(sio); + fprintf(sio->fp, "#children: %d\n", chunk->num_children); + + /* Descend to children */ + for (i = 0;i < chunk->num_children;++i) { + fputc('\n', sio->fp); + itunesdb_repr(&chunk->childlen[i], i, sio); + } + + /* End of the chunk */ + serialize_indent_descend(sio); + serialize_indent(sio); + fprintf(sio->fp, "}\n"); + + return 0; +} + +int itunesdb_read(itunesdb_chunk_t* chunk, serializer_t* sio) +{ + uint32_t i; + size_t begin = serialize_tell(sio); + const itunesdb_chunkdecl_t* decl = NULL; + + /* Read the chunk ID and header information */ + chunk->offset = begin; + if (serialize_uint8_array(sio, "id", "%c ", chunk->id, sizeof(chunk->id))) return 1; + if (serialize_uint32le(sio, "data_size", "%d", &chunk->data_size)) return 1; + if (serialize_uint32le(sio, "chunk_size", "%d", &chunk->chunk_size)) return 1; + + /* Read the chunk data if this chunk is 'known' */ + decl = find_chunkdecl(chunk); + if (decl) { + chunk->data = calloc(1, decl->data_size); + if (chunk->data) { + if (decl->serialize(chunk, sio)) return 1; + } + } + + if (strncmp(chunk->id, "mhod", 4) == 0) { + uint32_t next = begin + chunk->chunk_size; + if (next < serialize_tell(sio)) { + fprintf(stderr, "WARNING: backward seeking.\n"); + } + serialize_seek(sio, next); + } else { + uint32_t next = begin + chunk->data_size; + if (next < serialize_tell(sio)) { + fprintf(stderr, "WARNING: backward seeking.\n"); + } + serialize_seek(sio, next); + } + + /* Read children for this chunk. */ + if (strncmp(chunk->id, "mhlt", 4) == 0 || strncmp(chunk->id, "mhlp", 4) == 0) { + /* chunk->chunk_size represents the number of children for "mhlt" and "mhlp" chunks */ + chunk->num_children = chunk->chunk_size; + chunk->childlen = (itunesdb_chunk_t*)calloc(chunk->num_children, sizeof(itunesdb_chunk_t)); + for (i = 0;i < chunk->num_children;++i) { + itunesdb_read(&chunk->childlen[i], sio); + } + } else { + /* chunk->chunk_size represents the size in bytes of this chunk */ + chunk->num_children = 0; + chunk->childlen = NULL; + while (sio->offset - begin < chunk->chunk_size) { + chunk->num_children; + chunk->childlen = realloc(chunk->childlen, sizeof(itunesdb_chunk_t) * (chunk->num_children + 1)); + memset(&chunk->childlen[chunk->num_children], 0, sizeof(itunesdb_chunk_t)); + itunesdb_read(&chunk->childlen[chunk->num_children], sio); + ++chunk->num_children; + } + } + + return 0; +} + +#if 0 +int main(int argc, char *argv[]) +{ + FILE *fp = fopen("C:\\pmplib\\ipod_nano\\iPod_Control\\iTunes\\iTunesDB", "rb"); + if (fp) { + serializer_t sio; + uint8_t* buffer = NULL; + long size = 0; + itunesdb_chunk_t root; + + fread_all(fp, &buffer, &size); + fclose(fp); + + serialize_init_read(&sio, buffer, (size_t)size); + chunk_read(&root, &sio); + serialize_finish(&sio); + + serialize_init_dump(&sio, stdout, 2); + chunk_repr(&root, 0, &sio); + serialize_finish(&sio); + } + + return 0; +} +#endif \ No newline at end of file Property changes on: trunk/pmplib/lib/pmp_ipod/itunesdb.c ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Added: trunk/pmplib/lib/pmp_ipod/itunesdb.h =================================================================== --- trunk/pmplib/lib/pmp_ipod/itunesdb.h (rev 0) +++ trunk/pmplib/lib/pmp_ipod/itunesdb.h 2007-02-21 15:56:22 UTC (rev 382) @@ -0,0 +1,247 @@ +/* + * iTunesDB + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * 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 __ITUNESDB_H__ +#define __ITUNESDB_H__ + +typedef struct { + uint32_t unknown1; /* always set to 1. */ + uint32_t version; + uint32_t num_children; + uint64_t identifier; + uint16_t unknown2; /* always set to 2. */ + uint16_t unknown3; /* 0x0263 */ + uint64_t unknown4; + uint8_t unknown5[26]; /* zero padded. */ + uint8_t language[2]; /* e.g., "en", "ja" */ + uint8_t unknown6[32]; /* zero padded. */ +} chunk_mhbd_t; + +typedef struct { + uint32_t type; /* 1 (track list), 2 (playlist list), or 3 (podcast list). */ + uint8_t unknown1[16*5]; /* zero padded. */ +} chunk_mhsd_t; + +typedef struct { + uint8_t unknown1[16*5]; /* zero padded. */ +} chunk_mhlt_t; + +typedef struct { + uint32_t num_children; + uint32_t uid; + uint32_t visible; + uint32_t filetype; + uint8_t type1; + uint8_t type2; + uint8_t compilation; + uint8_t rating; + uint32_t last_modified; + uint32_t filesize; + uint32_t duration; + uint32_t track_number; + uint32_t total_tracks; + uint32_t year; + uint32_t bitrate; /* in [kbps] */ + uint16_t unknown1; + uint16_t samplerate; /* in [Hz] */ + int32_t volume; + uint32_t start_time; + uint32_t stop_time; + uint32_t sound_check; + uint32_t play_count; + uint32_t play_count2; + uint32_t last_played; + uint32_t disc_number; + uint32_t total_discs; + uint32_t user_id; + uint32_t date_added; + uint32_t bookmark_time; + uint64_t dbid; + uint8_t is_checked; + uint8_t rating_itunes; + uint16_t bpm; + uint16_t num_artworks; + uint16_t unk9; + uint32_t artwork_size; + uint32_t unk11; + uint32_t samplerate2; + uint32_t disc_released; + uint16_t unk14_1; + uint16_t unk14_2; + uint32_t unk15; + uint32_t unk16; + uint32_t skip_count; + uint32_t last_skipped; + uint8_t has_artwork; + uint8_t skip_when_shuffling; + uint8_t remember_playback_position; + uint8_t flag4; + uint64_t dbid2; + uint8_t has_lyrics; + uint8_t is_movie; + uint8_t is_played; + uint8_t unk17; + uint32_t unk21; + int32_t encoder_delay; + uint64_t num_samples; + uint32_t unk25; + int32_t padding_samples; + uint32_t unk27; + uint32_t media_type; + uint32_t season_number; + uint32_t episode_number; + uint32_t unk31; + uint32_t unk32; + uint32_t unk33; + uint32_t unk34; + uint32_t unk35; + uint32_t unk36; + uint32_t unk37; + uint32_t offset_last8th_frame; + uint32_t unk38; + uint16_t gapless_track; + uint16_t gapless_album; +} chunk_mhit_t; + +typedef struct { + uint8_t unknown1[16*5]; /* zero padded. */ +} chunk_mhlp_t; + +typedef struct { + uint32_t num_mhod; + uint32_t num_mhip; + uint8_t flag_master; + uint8_t flag_unkonwn1; + uint8_t flag_unkonwn2; + uint8_t flag_unkonwn3; + uint32_t timestamp; + uint64_t id; + uint32_t unk3; + uint16_t unk4; + uint16_t flag_podcast; + uint32_t sort_order; + uint8_t padding[0x3C]; +} chunk_mhyp_t; + +typedef struct { + uint32_t num_mhod; + uint32_t flag_podcast_group; + uint32_t group_id; + uint32_t track_id; + uint32_t timestamp; + uint32_t podcast_parent; +} chunk_mhip_t; + +typedef struct { + uint32_t unk1; + uint32_t unk2; + uint32_t position; + uint32_t size; + uint32_t unknown; + uint32_t unk4; + ucs2char_t* value; +} chunk_mhod_string_t; + +typedef struct { + uint32_t unk1; + uint32_t unk2; + char* value; +} chunk_mhod_url_t; + +typedef struct { + uint32_t unk1; + uint32_t unk2; + uint32_t type; + uint32_t num_entries; + uint8_t padding[40]; + uint32_t* entries; +} chunk_mhod_index_t; + +typedef struct { + uint16_t id; + uint16_t width; + uint32_t sort_direction; + uint64_t padding; +} chunk_mhod_playlist_column_definition_t; + +typedef struct { + uint32_t unk1; + uint32_t unk2; + uint32_t unk3; + uint64_t unk4; + uint32_t unk8; + uint16_t unk9; + uint16_t unk10; + uint32_t sort_type; + uint32_t num_columns; + uint32_t unknown; + chunk_mhod_playlist_column_definition_t* columns; +} chunk_mhod_playlist_column_t; + +typedef struct { + uint32_t unk1; + uint32_t unk2; + uint32_t position; + uint8_t padding[16]; +} chunk_mhod_playlist_order_t; + +typedef struct { + uint32_t type; + union { + chunk_mhod_string_t str; + chunk_mhod_url_t url; + chunk_mhod_index_t index; + chunk_mhod_playlist_column_t pc; + chunk_mhod_playlist_order_t po; + } data; +} chunk_mhod_t; + + +struct tag_itunesdb_chunk { + int8_t id[4]; + uint32_t data_size; + uint32_t chunk_size; + + void* data; + uint32_t num_children; /* This field does not exist in iTunesDB. */ + struct tag_itunesdb_chunk* childlen; + uint32_t offset; /* This field does not exist in iTunesDB. */ +}; + +typedef struct { + uint32_t type; + const char* name; + size_t chunk_size; + int (*serialize)(itunesdb_chunk_t* chunk, const char *name, serializer_t* sio); +} itunesdb_mhoddecl_t; + +typedef struct { + const char* name; + size_t data_size; + int (*serialize)(itunesdb_chunk_t* chunk, serializer_t* sio); +} itunesdb_chunkdecl_t; + +int itunesdb_repr(itunesdb_chunk_t* chunk, size_t index, serializer_t* sio); +int itunesdb_read(itunesdb_chunk_t* chunk, serializer_t* sio); + +#endif/*__ITUNESDB_H__*/ Property changes on: trunk/pmplib/lib/pmp_ipod/itunesdb.h ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Added: trunk/pmplib/lib/pmp_ipod/pmp_ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/pmp_ipod.c (rev 0) +++ trunk/pmplib/lib/pmp_ipod/pmp_ipod.c 2007-02-21 15:56:22 UTC (rev 382) @@ -0,0 +1,625 @@ +/* + * PMP library implementation for Apple iPod series. + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * 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 <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> + +#include "util.h" +#include "ipod.h" + +#ifdef PMP_IPOD_EXPORTS +#define PMPIPODAPI __declspec(dllexport) +#else +#define PMPIPODAPI +#endif + + +typedef struct { + const char *id; + const char *manufacturer; + const char *name; + const char *mode; + const char *min_version; + const char *max_version; + const char *itunesdb_filename; + const char *extensions; + uint32_t codecs[8]; + const char *path_to_system; + const char *path_to_music; + const char *path_to_playlist; +} ipod_descriptor_t; + +static const ipod_descriptor_t g_model_descriptions[] = { + { + "ipod", "Apple", "iPod", "UM", + "---", "---", + "iPod_Control\\iTunes\\iTunesDB", + ".mp3\0", + {PMPCODEC_MPEGLAYER3, 0, 0, 0, 0, 0, 0, 0}, + "iPod_Control", "iPod_Control\\Music", "Playlists", + }, + { + NULL, NULL, NULL, NULL, + NULL, NULL, + NULL, + NULL, + {0, 0, 0, 0, 0, 0, 0, 0}, + NULL, NULL, NULL, + }, +}; + +typedef struct { + const ipod_descriptor_t* decl; +} pmp_internal_t; + +typedef struct { + pmp_music_record_t* records; + int num_records; + pmp_playlist_t* playlists; + int num_playlists; +} pmp_music_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); +static result_t pmp_create_instance_music(pmp_t* pmp, pmp_music_t** ptr_pmpdb); + +static uint32_t pmpmusic_release(pmp_music_t* music); +static uint32_t pmpmusic_open(pmp_music_t* music); +static uint32_t pmpmusic_close(pmp_music_t* music); +static result_t pmpmusic_set_records(pmp_music_t* music, const pmp_music_record_t* records, uint32_t num_records); +static result_t pmpmusic_get_records(pmp_music_t* music, pmp_music_record_t* records, uint32_t* num_records); +static result_t pmpmusic_dump(pmp_music_t* music, FILE *fp, int level); +static result_t pmpmusic_set_playlists(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists); + + +#define COMP(a, b) ((a)>(b))-((a)<(b)) + +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 ipod_descriptor_t* md, + 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; + + 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->min_version, md->min_version); + strcpy_if_empty(decl->max_version, md->max_version); + + 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); + ucs2cpy(info->path_to_music, ucs2); + ucs2free(ucs2); + + ucs2 = mbsdupucs2(md->path_to_playlist); + ucs2cpy(info->path_to_playlist, ucs2); + ucs2free(ucs2); + + info->music_flag = PMPMF_SUPPORT | PMPMF_RECURSIVE; + info->playlist_flag = PMPPF_SUPPORT; + + // 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]; + } + + // 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); + } +} + +static void free_device_info(pmp_device_information_t* info) +{ + uint32_t i; + for (i = 0;i < info->num_audio_extensions;++i) { + ucs2free(info->audio_extensions[i]); + } + ucs2free(info->audio_codecs); + ucs2free(info->audio_extensions); + memset(info, 0, sizeof(*info)); +} + +static void set_filenames(ucs2char_t *itunesdb, pmp_t *pmp) +{ + ucs2char_t* ucs2 = NULL; + pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; + + ucs2cpy(itunesdb, pmp->info.path_to_root); + filepath_addslash(itunesdb); + ucs2 = mbsdupucs2(pmpi->decl->itunesdb_filename); + ucs2cat(itunesdb, ucs2); + ucs2free(ucs2); +} + + +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; + } +} + + + +PMPIPODAPI result_t pmp_enumerate_devid(pmplib_enumerate_devid_callback_t callback, void *instance) +{ + const ipod_descriptor_t* md = g_model_descriptions; + for (;md->id;++md) { + callback(instance, md->id); + } + return 0; +} + +PMPIPODAPI 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 ipod_descriptor_t* md = 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 (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 (!md->id) { + return PMPERR_DEVICENOTFOUND; + } + + // Allocate PMP class instance. + pmp = (pmp_t*)calloc(1, sizeof(pmp_t)); + if (!pmp) { + return PMPERR_INSUFFICIENTMEMORY; + } + + pmp->add_ref = pmp_add_ref; + pmp->release = pmp_release; + pmp->open = pmp_open; + pmp->close = pmp_close; + pmp->add_ref(pmp); + + // Allocate the internal variables. + pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); + if (!pmpi) { + free(pmp); + return PMPERR_INSUFFICIENTMEMORY; + } + pmpi->decl = md; + + // Initialize the internal variables. + pmp->instance = pmpi; + memcpy((pmp_device_information_t*)&pmp->info, &info, sizeof(info)); + + // Create music instance. + ret = pmp_create_instance_music(pmp, &pmp->music); + if (ret != 0) { + pmp_release(pmp); + return ret; + } + + // Prepare + *ptr_pmp = pmp; + return 0; +} + +static uint32_t pmp_add_ref(pmp_t* pmp) +{ + return pmplib_interlocked_increment(&pmp->ref_count); +} + +static uint32_t pmp_release(pmp_t* pmp) +{ + uint32_t count = pmplib_interlocked_decrement(&pmp->ref_count); + if (count == 0) { + pmpmusic_release(pmp->music); + free_device_info(&pmp->info); + free(pmp->instance); + free(pmp); + } + return count; +} + +static result_t pmp_open(pmp_t* pmp, uint32_t flag) +{ + result_t ret = 0; + + // Set the open flag. + pmp->flag = flag; + + // Open the music database. + ret = pmpmusic_open(pmp->music); + if (ret) { + return ret; + } + + return 0; +} + +static result_t pmp_close(pmp_t* pmp) +{ + result_t ret = 0; + + // Close the music database. + ret = pmpmusic_close(pmp->music); + if (ret) { + return ret; + } + + return 0; +} + +static result_t pmp_create_instance_music(pmp_t* pmp, pmp_music_t** ptr_music) +{ + pmp_music_t* music = NULL; + pmp_internal_t* pmpi = (pmp_internal_t*)pmp->instance; + pmp_music_internal_t* pmpmi = NULL; + + *ptr_music = 0; + + music = calloc(1, sizeof(pmp_music_t)); + if (!music) { + return PMPERR_INSUFFICIENTMEMORY; + } + + pmpmi = calloc(1, sizeof(pmp_music_internal_t)); + if (!pmpmi) { + free(music); + return PMPERR_INSUFFICIENTMEMORY; + } + + 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 = pmpmi; + + *ptr_music = music; + return 0; +} + + + + +static uint32_t pmpmusic_release(pmp_music_t* music) +{ + pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; + pmplib_records_finish(pmpmi->records, pmpmi->num_records); + pmplib_playlists_finish(pmpmi->playlists, pmpmi->num_playlists); + free(pmpmi); + free(music); + return 0; +} + +static uint32_t pmpmusic_open(pmp_music_t* music) +{ + //ip3db_t ip3db; + result_t ret = 0; + pmp_t* pmp = music->pmp; + pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; + + /* + // Initialize IP3DB. + ip3db_init(&ip3db); + + // Free the existing records. + pmplib_records_finish(pmpmi->records, pmpmi->num_records); + pmpmi->records = 0; + pmpmi->num_records = 0; + + // Open the music database if necessary. + if (pmp->flag & PMPOF_MUSIC_DB_READ) { + int i; + ucs2char_t dat[MAX_PATH], dic[MAX_PATH], idx[MAX_PATH]; + pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)pmp->music->instance; + + // Read the music database. + set_filenames(dat, dic, idx, pmp); + ret = ip3db_read(&ip3db, dat, dic, idx); + if (ret) { + goto exit_this; + } + + // The number of music records. + pmpmi->num_records = ip3db_num_records(&ip3db); + + // Allocate an array of the records. + pmpmi->records = (pmp_music_record_t*)malloc(sizeof(pmp_music_record_t) * pmpmi->num_records); + + // Convert IP3DB records to a pmp_music_record_t array. + for (i = 0;i < pmpmi->num_records;++i) { + const ip3db_variant_t* src = (const ip3db_variant_t*)ip3db_get_record(&ip3db, i); + pmp_music_record_t* dst = &pmpmi->records[i]; + size_t length = 0; + + pmplib_record_init(dst); + + 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, 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); + + dst->title = ucs2dup(src[IP3DBF_MUSIC_TITLE].value.str); + dst->artist = ucs2dup(src[IP3DBF_MUSIC_ARTIST].value.str); + dst->album = ucs2dup(src[IP3DBF_MUSIC_ALBUM].value.str); + dst->genre = ucs2dup(src[IP3DBF_MUSIC_GENRE].value.str); + dst->date = ucs2dup(src[IP3DBF_MUSIC_ORGRELEASEDATE].value.str); + switch (src[IP3DBF_MUSIC_FILEFORMAT].value.word) { + case 0: + dst->codec = PMPCODEC_MPEGLAYER3; + break; + case 3: + dst->codec = PMPCODEC_VORBIS; + break; + case 5: + dst->codec = PMPCODEC_WMA; + break; + } + dst->track_number = src[IP3DBF_MUSIC_TRACKNUMBER].value.word; + dst->bitrate = src[IP3DBF_MUSIC_BITRATE].value.dword; + dst->duration = src[IP3DBF_MUSIC_DURATION].value.dword; + dst->ts_update = src[IP3DBF_MUSIC_CLUSA].value.dword; + dst->rating = src[IP3DBF_MUSIC_RATING].value.word; + } + } + */ + +exit_this: + //ip3db_finish(&ip3db); + return ret; +} + +static uint32_t pmpmusic_close(pmp_music_t* music) +{ + //ip3db_t ip3db; + result_t ret = 0; + pmp_t* pmp = music->pmp; + pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; + + /* + // Initialize IP3DB. + ip3db_init(&ip3db); + + if (pmp->flag & PMPOF_MUSIC_DB_WRITE) { + int i; + ucs2char_t dat[MAX_PATH], dic[MAX_PATH], idx[MAX_PATH]; + ip3db_music_record_t* records = NULL; + + // Allocate an array of music records. + records = (ip3db_music_record_t*)malloc(sizeof(ip3db_music_record_t) * pmpmi->num_records); + + // Build an array of IP3DB records. + for (i = 0;i < pmpmi->num_records;++i) { + const pmp_music_record_t* src = &pmpmi->records[i]; + ip3db_variant_t* dst = records[i]; + + ip3db_record_init(&ip3db, &records[i]); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], filepath_changeroot(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); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILENAME], filepath_skippath(src->filename)); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_ARTIST], src->artist); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_ALBUM], src->album); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_GENRE], src->genre); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_TITLE], src->title); + ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_DURATION], src->duration); + ip3db_variant_set_word(&dst[IP3DBF_MUSIC_RATING], (uint16_t)src->rating); + switch (src->codec) { + case PMPCODEC_MPEGLAYER3: + ip3db_variant_set_word(&dst[IP3DBF_MUSIC_FILEFORMAT], 0); + break; + case PMPCODEC_VORBIS: + ip3db_variant_set_word(&dst[IP3DBF_MUSIC_FILEFORMAT], 3); + break; + case PMPCODEC_WMA: + ip3db_variant_set_word(&dst[IP3DBF_MUSIC_FILEFORMAT], 5); + break; + } + ip3db_variant_set_word(&dst[IP3DBF_MUSIC_TRACKNUMBER], (uint16_t)src->track_number); + ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_BITRATE], src->bitrate); + ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_CLUSA], src->ts_update); + ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_UID], (uint32_t)i+1); + } + + // Register records (and playlists) to the database. + if (pmp->flag & PMPOF_MUSIC_PL_WRITE) { + ip3db_set( + &ip3db, + (const ip3db_music_record_t*)records, + pmpmi->num_records, + pmpmi->playlists, + pmpmi->num_playlists + ); + } else { + ip3db_set( + &ip3db, + (const ip3db_music_record_t*)records, + pmpmi->num_records, + NULL, + 0 + ); + } + + // Write out the music database. + set_filenames(dat, dic, idx, pmp); + ret = ip3db_write(&ip3db, dat, dic, idx); + + // Free IP3DB records. + for (i = 0;i < pmpmi->num_records;++i) { + ip3db_record_finish(&ip3db, &records[i]); + } + free(records); + } + + ip3db_finish(&ip3db); + */ + return ret; +} + +static result_t pmpmusic_set_records(pmp_music_t* music, const pmp_music_record_t* records, uint32_t num_records) +{ + pmp_t* pmp = music->pmp; + pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; + + /* Free records attached to pmpmi. */ + pmplib_records_finish(pmpmi->records, pmpmi->num_records); + + /* Allocate new records. */ + pmpmi->records = (pmp_music_record_t*)ucs2malloc(sizeof(pmp_music_record_t) * num_records); + pmpmi->num_records = num_records; + pmplib_records_clone(pmpmi->records, records, num_records); + + return 0; + } + +static result_t pmpmusic_get_records(pmp_music_t* music, pmp_music_record_t* records, uint32_t* num_records) +{ + pmp_t* pmp = music->pmp; + pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; + + if (!records) { + *num_records = pmpmi->num_records; + return 0; + } else if (*num_records == pmpmi->num_records) { + pmplib_records_clone(records, pmpmi->records, pmpmi->num_records); + return 0; + } else { + return PMPERR_INSUFFICIENTMEMORY; + } +} + +static result_t pmpmusic_dump(pmp_music_t* music, FILE *fp, int level) +{ + ipod_t ipod; + result_t ret = 0; + ucs2char_t itunesdb[MAX_PATH]; + + // Initialize IP3DB. + ipod_init(&ipod); + + // Read the music database. + set_filenames(itunesdb, music->pmp); + ret = ipod_read(&ipod, itunesdb); + if (ret) { + goto exit_this; + } + + ret = ipod_dump(&ipod, fp); + if (ret) { + goto exit_this; + } + +exit_this: + ipod_finish(&ipod); + return ret; +} + +static result_t pmpmusic_set_playlists(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists) +{ + return PMPERR_NOTIMPLIMENTED; +} Property changes on: trunk/pmplib/lib/pmp_ipod/pmp_ipod.c ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Added: trunk/pmplib/lib/pmp_ipod/pmp_ipod.vcproj =================================================================== --- trunk/pmplib/lib/pmp_ipod/pmp_ipod.vcproj (rev 0) +++ trunk/pmplib/lib/pmp_ipod/pmp_ipod.vcproj 2007-02-21 15:56:22 UTC (rev 382) @@ -0,0 +1,231 @@ +<?xml version="1.0" encoding="shift_jis"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="pmp_ipod" + ProjectGUID="{529F5BE9-291E-4BCF-BE90-5E64B780340F}" + RootNamespace="pmp_ipod" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)debug" + 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_IPOD_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)release" + 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;_WINDOWS;_USRDLL;PMP_IPOD_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=".\ipod.c" + > + </File> + <File + RelativePath=".\itunesdb.c" + > + </File> + <File + RelativePath=".\pmp_ipod.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=".\ipod.h" + > + </File> + <File + RelativePath=".\itunesdb.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_ipod/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/serialize.c (rev 0) +++ trunk/pmplib/lib/pmp_ipod/serialize.c 2007-02-21 15:56:22 UTC (rev 382) @@ -0,0 +1,303 @@ +/* + * Data serializer (with byte-order consideration). + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * 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 <string.h> +#include <pmplib/ucs2char.h> + +#include "util.h" +#include "serialize.h" + +static int check(serializer_t* sio, size_t size) +{ + if (0 < sio->mode) { + if (sio->size < sio->offset + size) { + sio->size += sio->unit; + sio->base = (uint8_t*)realloc(sio->base, sio->size); + if (!sio->base) { + return 1; + } + } + } else if (sio->mode < 0) { + if (sio->limit < sio->offset + size) { + return 1; + } + if (sio->size < sio->offset + size) { + return 1; + } + } + return 0; +} + +void serialize_init_read(serializer_t* sio, uint8_t* base, size_t size) +{ + memset(sio, 0, sizeof(*sio)); + sio->base = base; + sio->size = size; + sio->limit = size; + sio->mode = -1; +} + +void serialize_init_write(serializer_t* sio, size_t unit) +{ + memset(sio, 0, sizeof(*sio)); + sio->unit = unit; + sio->mode = 1; +} + +void serialize_init_dump(serializer_t* sio, FILE *fp, size_t unit) +{ + memset(sio, 0, sizeof(*sio)); + sio->fp = fp; + sio->unit = unit; + sio->mode = 0; +} + +void serialize_finish(serializer_t* sio) +{ + if (0 < sio->mode) { + free(sio->base); + } + memset(sio, 0, sizeof(*sio)); +} + + +int serialize_uint8(serializer_t* sio, const char *name, const char *format, uint8_t* value) +{ + if (check(sio, sizeof(uint8_t))) return 1; + + if (0 < sio->mode) { + sio->base[sio->offset++] = *value; + } else if (sio->mode < 0) { + *value = sio->base[sio->offset++]; + } else { + serialize_indent(sio); + fprintf(sio->fp, "%s: ", name); + fprintf(sio->fp, format, *value); + fputc('\n', sio->fp); + } + return 0; +} + +int serialize_uint8_array(serializer_t* sio, const char *name, const char *format, uint8_t* array, size_t length) +{ + size_t i; + + if (check(sio, length)) return 1; + + if (0 < sio->mode) { + for (i = 0;i < length;++i) { + sio->base[sio->offset++] = array[i]; + } + } else if (sio->mode < 0) { + for (i = 0;i < length;++i) { + array[i] = sio->base[sio->offset++]; + } + } else { + serialize_indent(sio); + fprintf(sio->fp, "%s: ", name); + for (i = 0;i < length;++i) { + fprintf(sio->fp, format, array[i]); + } + fputc('\n', sio->fp); + } + return 0; +} + +int serialize_uint16le(serializer_t* sio, const char *name, const char *format, uint16_t* value) +{ + if (check(sio, sizeof(uint16_t))) return 1; + + if (0 < sio->mode) { + sio->base[sio->offset++] = (uint8_t)(*value & 0xFF); + sio->base[sio->offset++] = (uint8_t)(*value >> 8); + } else if (sio->mode < 0) { + *value = ((uint16_t)sio->base[sio->offset++]); + *value |= ((uint16_t)sio->base[sio->offset++] << 8); + } else { + serialize_indent(sio); + fprintf(sio->fp, "%s: ", name); + fprintf(sio->fp, format, *value); + fputc('\n', sio->fp); + } + return 0; +} + +int serialize_uint32le(serializer_t* sio, const char *name, const char *format, uint32_t* value) +{ + if (check(sio, sizeof(uint32_t))) return 1; + + if (0 < sio->mode) { + sio->base[sio->offset++] = (uint8_t)(*value & 0xFF); + sio->base[sio->offset++] = (uint8_t)(*value >> 8); + sio->base[sio->offset++] = (uint8_t)(*value >> 16); + sio->base[sio->offset++] = (uint8_t)(*value >> 24); + } else if (sio->mode < 0) { + *value = ((uint32_t)sio->base[sio->offset++]); + *value |= ((uint32_t)sio->base[sio->offset++] << 8); + *value |= ((uint32_t)sio->base[sio->offset++] << 16); + *value |= ((uint32_t)sio->base[sio->offset++] << 24); + } else { + serialize_indent(sio); + fprintf(sio->fp, "%s: ", name); + fprintf(sio->fp, format, *value); + fputc('\n', sio->fp); + } + return 0; +} + +int serialize_int32le(serializer_t* sio, const char *name, const char *format, int32_t* value) +{ + return serialize_uint32le(sio, name, format, (uint32_t*)value); +} + +int serialize_uint64le(serializer_t* sio, const char *name, const char *format, uint64_t* value) +{ + if ... [truncated message content] |
From: <ny...@us...> - 2007-02-23 08:28:18
|
Revision: 388 http://svn.sourceforge.net/pmplib/?rev=388&view=rev Author: nyaochi Date: 2007-02-23 00:28:19 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Added the version number of codecs to pmp_music_record_t. Modified Paths: -------------- trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/pmp_ipod/ipod.c Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-23 07:46:45 UTC (rev 387) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-23 08:28:19 UTC (rev 388) @@ -128,11 +128,11 @@ /** Unknown codec. */ #define PMPCODEC_NONE PMPFOURCC(' ',' ',' ',' ') /** MPEG Audio Layer III. */ -#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','1','3') +#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','A','3') /** Windows Media Audio. */ #define PMPCODEC_WMA PMPFOURCC('W','M','A',' ') /** Ogg Vorbis. */ -#define PMPCODEC_VORBIS PMPFOURCC('O','V','1',' ') +#define PMPCODEC_VORBIS PMPFOURCC('O','g','g','V') /** Microsoft Riff WAVE. */ #define PMPCODEC_WAV PMPFOURCC('W','A','V','E') @@ -374,6 +374,12 @@ uint32_t codec; /** + * Codec version multiplied by 100. + * e.g., 100 for MPEG version 1. + */ + uint32_t codec_version; + + /** * Track number. * e.g., 1 */ Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 07:46:45 UTC (rev 387) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 08:28:19 UTC (rev 388) @@ -477,6 +477,17 @@ info->sample_rate = mp3header.sample_rate; info->bitrate = mp3header.bitrate; info->duration = mp3header.duration; + switch (mp3header.version) { + case 0: + info->codec_version = 100; + break; + case 1: + info->codec_version = 200; + break; + case 2: + info->codec_version = 205; + break; + } } id3_file_close(id3file); /* This will call fclose(fp); */ Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 07:46:45 UTC (rev 387) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 08:28:19 UTC (rev 388) @@ -117,6 +117,7 @@ } info->codec = PMPCODEC_VORBIS; + info->codec_version = 1; // Clear the decoders buffers, also closes fp. ov_clear(&vf); Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-23 07:46:45 UTC (rev 387) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-23 08:28:19 UTC (rev 388) @@ -260,6 +260,7 @@ ret = get_riff_audio_info(info, filename, charset); if (ret == 0) { info->codec = PMPCODEC_WAV; + info->codec_version = 1; } return ret; } Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-23 07:46:45 UTC (rev 387) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-23 08:28:19 UTC (rev 388) @@ -514,6 +514,7 @@ ret = get_asf_audio_info(info, filename); if (ret == 0) { info->codec = PMPCODEC_WMA; + info->codec_version = 1; /* Set 1 for now. */ } return ret; } Modified: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 07:46:45 UTC (rev 387) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 08:28:19 UTC (rev 388) @@ -153,7 +153,11 @@ mhit_data->uid = uid; mhit_data->visible = 1; - mhit_data->filetype = 0x4D503320; + switch (rec->codec) { + case PMPCODEC_MPEGLAYER3: + mhit_data->filetype = 0x4D503320; + break; + } mhit_data->type1 = 0x01; mhit_data->type2 = 0x01; mhit_data->compilation = 0; @@ -169,6 +173,18 @@ mhit_data->date_added = rec->ts_import; mhit_data->dbid = 0; mhit_data->unk9 = 0xFFFF; + switch (rec->codec) { + case PMPCODEC_MPEGLAYER3: + switch (rec->codec_version) { + case 200: mhit_data->unk14_1 = 0x0016; break; + case 205: mhit_data->unk14_1 = 0x0020; break; + default: mhit_data->unk14_1 = 0x000C; break; + } + break; + case PMPCODEC_WAV: + mhit_data->unk14_1 = 0x0000; + break; + } mhit_data->unk14_1 = 12; mhit_data->is_played = 2; mhit_data->unk27 = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-23 08:43:33
|
Revision: 389 http://svn.sourceforge.net/pmplib/?rev=389&view=rev Author: nyaochi Date: 2007-02-23 00:43:34 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Added is_vbr flag to pmp_music_record_t. Modified Paths: -------------- trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/pmp_ipod/ipod.c Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-23 08:43:34 UTC (rev 389) @@ -380,6 +380,12 @@ uint32_t codec_version; /** + * VBR flag. + * e.g., 1 for MP3 VBR files. + */ + uint8_t is_vbr; + + /** * Track number. * e.g., 1 */ Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 08:43:34 UTC (rev 389) @@ -54,6 +54,8 @@ int frame_size; /**< size of the frame in bytes */ int samples_per_frame; /**< number of audio samples in the frame */ + int is_vbr; /**< true if VBR. */ + /* From Xing VBR header for VBR files, From file size for CBR files. */ int number_of_frames; /**< number of frames */ int data_size; /**< data size. */ @@ -248,9 +250,11 @@ double bitrate = header->data_size * 8.0 / duration; header->duration = (int)duration; header->bitrate = (int)bitrate; + header->is_vbr = 1; } else { double duration = (double)header->samples_per_frame * header->number_of_frames / header->sample_rate; header->duration = (int)duration; + header->is_vbr = 0; } /* Exit with success. */ @@ -488,6 +492,7 @@ info->codec_version = 205; break; } + info->is_vbr = mp3header.is_vbr; } id3_file_close(id3file); /* This will call fclose(fp); */ Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 08:43:34 UTC (rev 389) @@ -118,7 +118,8 @@ info->codec = PMPCODEC_VORBIS; info->codec_version = 1; - + info->is_vbr = 1; /* Most Ogg Vorbis files are encoded in VBR. */ + // Clear the decoders buffers, also closes fp. ov_clear(&vf); Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-23 08:43:34 UTC (rev 389) @@ -261,6 +261,7 @@ if (ret == 0) { info->codec = PMPCODEC_WAV; info->codec_version = 1; + info->is_vbr = 0; } return ret; } Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-23 08:43:34 UTC (rev 389) @@ -515,6 +515,7 @@ if (ret == 0) { info->codec = PMPCODEC_WMA; info->codec_version = 1; /* Set 1 for now. */ + info->is_vbr = 1; /* Set 1 for now. */ } return ret; } Modified: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 08:28:19 UTC (rev 388) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 08:43:34 UTC (rev 389) @@ -156,10 +156,14 @@ switch (rec->codec) { case PMPCODEC_MPEGLAYER3: mhit_data->filetype = 0x4D503320; + mhit_data->type1 = rec->is_vbr ? 0x01 : 0x00; + mhit_data->type2 = rec->is_vbr ? 0x01 : 0x00; break; + default: + mhit_data->type1 = 0x01; + mhit_data->type2 = 0x01; + break; } - mhit_data->type1 = 0x01; - mhit_data->type2 = 0x01; mhit_data->compilation = 0; mhit_data->rating = 0; mhit_data->last_modified = rec->ts_update; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-23 09:12:09
|
Revision: 390 http://svn.sourceforge.net/pmplib/?rev=390&view=rev Author: nyaochi Date: 2007-02-23 01:12:10 -0800 (Fri, 23 Feb 2007) Log Message: ----------- - duration in pmp_music_record_t is now represented in miliseconds. - added num_samples in pmp_music_record_t Modified Paths: -------------- trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/pmp_ipod/ipod.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.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_msi_megaplayer.c trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-23 09:12:10 UTC (rev 390) @@ -410,6 +410,12 @@ uint32_t duration; /** + * Number of samples. + * e.g., 260*44100. + */ + uint64_t num_samples; + + /** * File size in bytes. * e.g., 4160000 */ Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 09:12:10 UTC (rev 390) @@ -480,7 +480,8 @@ int channels = mp3header.channel_mode == 3 ? 1 : 2; info->sample_rate = mp3header.sample_rate; info->bitrate = mp3header.bitrate; - info->duration = mp3header.duration; + info->duration = (uint32_t)(mp3header.duration * 1000.0); + info->num_samples = (uint64_t)mp3header.samples_per_frame * mp3header.number_of_frames; switch (mp3header.version) { case 0: info->codec_version = 100; Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 09:12:10 UTC (rev 390) @@ -51,6 +51,7 @@ int i, ret = 0; long lval = 0; double dval = 0; + ogg_int64_t llval = 0; FILE *fp = NULL; OggVorbis_File vf; vorbis_info *vi = NULL; @@ -90,14 +91,17 @@ } info->bitrate = (uint32_t)lval; - /* Obtain duration. */ - dval = ov_time_total(&vf, -1); - if (dval < 0) { + /* Obtain the number of samples. */ + llval = ov_pcm_total(&vf, -1); + if (llval < 0) { ov_clear(&vf); goto error_exit; } - info->duration = (uint32_t)dval; + info->num_samples = (uint64_t)llval; + /* Compute duration. */ + info->duration = (uint32_t)((double)info->num_samples * 1000.0 / info->sample_rate); + vc = ov_comment(&vf, -1); for (i = 0;i < vc->comments;++i) { const char *fieldvalue = vc->user_comments[i]; Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-23 09:12:10 UTC (rev 390) @@ -226,7 +226,8 @@ info->bitrate = channels * sample_bits * info->sample_rate; break; case 0x61746164: - info->duration = (uint32_t)((double)ch.size * 8.0 / info->bitrate); + info->num_samples = (uint64_t)((double)ch.size * 8.0 / channels / sample_bits); + info->duration = (uint32_t)((double)ch.size * 8.0 * 1000.0 / info->bitrate); break; case 0x5453494C: ret |= read_uint32le(&tmp32, fp); Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-23 09:12:10 UTC (rev 390) @@ -251,7 +251,7 @@ duration += duration_high * 429.4967296; duration -= preroll_low / 1000.0; duration -= (preroll_high / 4294967.296); - info->duration = (uint32_t)duration; + info->duration = (uint32_t)(duration * 1000.0); } else if (guid_equals(guid, g_guid_stream_properties)) { @@ -516,6 +516,7 @@ info->codec = PMPCODEC_WMA; info->codec_version = 1; /* Set 1 for now. */ info->is_vbr = 1; /* Set 1 for now. */ + info->num_samples = (uint64_t)((double)info->duration * info->sample_rate / 1000); } return ret; } Modified: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 09:12:10 UTC (rev 390) @@ -168,7 +168,7 @@ mhit_data->rating = 0; mhit_data->last_modified = rec->ts_update; mhit_data->filesize = rec->filesize; - mhit_data->duration = rec->duration * 1000; + mhit_data->duration = rec->duration; mhit_data->track_number = rec->track_number; mhit_data->total_tracks = 100; mhit_data->year = 2000; @@ -193,6 +193,7 @@ mhit_data->is_played = 2; mhit_data->unk27 = 1; mhit_data->media_type = 1; + mhit_data->num_samples = rec->num_samples; /* Construct an "mhod" chunk for title. */ if (rec->title && *rec->title) { Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-23 09:12:10 UTC (rev 390) @@ -212,7 +212,7 @@ dst->year = ucs2toi(src->date); } dst->filesize = src->filesize; - dst->duration = src->duration; + dst->duration = src->duration / 1000; dst->sample_rate = src->sample_rate; dst->bitrate = src->bitrate; dst->timestamp = src->ts_update; @@ -297,7 +297,7 @@ dst->track_number = src.track_number; dst->sample_rate = src.sample_rate; dst->bitrate = src.bitrate; - dst->duration = src.duration; + dst->duration = src.duration * 1000; dst->filesize = src.filesize; dst->ts_update = src.timestamp; dst->rating = src.rating; Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-23 09:12:10 UTC (rev 390) @@ -541,7 +541,7 @@ } dst->track_number = src[IP3DBF_MUSIC_TRACKNUMBER].value.word; dst->bitrate = src[IP3DBF_MUSIC_BITRATE].value.dword; - dst->duration = src[IP3DBF_MUSIC_DURATION].value.dword; + dst->duration = src[IP3DBF_MUSIC_DURATION].value.dword * 1000; dst->ts_update = src[IP3DBF_MUSIC_CLUSA].value.dword; dst->rating = src[IP3DBF_MUSIC_RATING].value.word; } @@ -585,7 +585,7 @@ ip3db_variant_set_str(&dst[IP3DBF_MUSIC_ALBUM], src->album); ip3db_variant_set_str(&dst[IP3DBF_MUSIC_GENRE], src->genre); ip3db_variant_set_str(&dst[IP3DBF_MUSIC_TITLE], src->title); - ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_DURATION], src->duration); + ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_DURATION], src->duration / 1000); ip3db_variant_set_word(&dst[IP3DBF_MUSIC_RATING], (uint16_t)src->rating); switch (src->codec) { case PMPCODEC_MPEGLAYER3: Modified: trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-23 09:12:10 UTC (rev 390) @@ -119,7 +119,7 @@ dst->fields[PP1DB_DATFIELD_YEAR].value.dword = ucs2toi(src->date); } dst->fields[PP1DB_DATFIELD_FILESIZE].value.dword = src->filesize; - dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration; + dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration / 1000; dst->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword = src->sample_rate; dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate; dst->fields[PP1DB_DATFIELD_UNKNOWN4].value.dword = 0; @@ -168,7 +168,7 @@ dst->track_number = src->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword; dst->sample_rate = src->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword; dst->bitrate = src->fields[PP1DB_DATFIELD_BITRATE].value.dword; - dst->duration = src->fields[PP1DB_DATFIELD_DURATION].value.dword; + dst->duration = src->fields[PP1DB_DATFIELD_DURATION].value.dword * 1000; dst->filesize = src->fields[PP1DB_DATFIELD_FILESIZE].value.dword; dst->ts_update = src->fields[PP1DB_DATFIELD_UNKNOWN6].value.dword; dst->rating = src->fields[PP1DB_DATFIELD_RATING].value.dword; Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-23 09:12:10 UTC (rev 390) @@ -96,7 +96,7 @@ dst->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword = src->sample_rate; memset(duration, 0, sizeof(duration)); - itoucs2(src->duration, duration, 10); + itoucs2(src->duration / 1000, duration, 10); dst->fields[PP1DB_DATFIELD_DURATION].value.str = ucs2dup(duration); dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); @@ -134,7 +134,7 @@ dst->bitrate = src->fields[PP1DB_DATFIELD_BITRATE].value.dword; dst->sample_rate = src->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword; - dst->duration = ucs2toi(src->fields[PP1DB_DATFIELD_DURATION].value.str); + dst->duration = ucs2toi(src->fields[PP1DB_DATFIELD_DURATION].value.str) * 1000; dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); Modified: trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-23 09:12:10 UTC (rev 390) @@ -93,7 +93,7 @@ dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate; dst->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword = src->sample_rate; - itoucs2(src->duration, tmp, 10); + itoucs2(src->duration / 1000, tmp, 10); dst->fields[PP1DB_DATFIELD_DURATION].value.str = ucs2dup(tmp); dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); @@ -129,7 +129,7 @@ dst->bitrate = src->fields[PP1DB_DATFIELD_BITRATE].value.dword; dst->sample_rate = src->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword; - dst->duration = ucs2toi(src->fields[PP1DB_DATFIELD_DURATION].value.str); + dst->duration = ucs2toi(src->fields[PP1DB_DATFIELD_DURATION].value.str) * 1000; dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); dst->genre = ucs2dup(src->fields[PP1DB_DATFIELD_GENRE].value.str); Modified: trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-23 09:12:10 UTC (rev 390) @@ -100,7 +100,7 @@ dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate; dst->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword = src->sample_rate; - dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration; + dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration / 1000; dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown); @@ -139,7 +139,7 @@ dst->bitrate = src->fields[PP1DB_DATFIELD_BITRATE].value.dword; dst->sample_rate = src->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword; - dst->duration = src->fields[PP1DB_DATFIELD_DURATION].value.dword; + dst->duration = src->fields[PP1DB_DATFIELD_DURATION].value.dword * 1000; dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); Modified: trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-23 08:43:34 UTC (rev 389) +++ trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-23 09:12:10 UTC (rev 390) @@ -113,7 +113,7 @@ dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate; dst->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword = src->sample_rate; - dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration; + dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration / 1000; dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown); @@ -157,7 +157,7 @@ dst->bitrate = src->fields[PP1DB_DATFIELD_BITRATE].value.dword; dst->sample_rate = src->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword; - dst->duration = src->fields[PP1DB_DATFIELD_DURATION].value.dword; + dst->duration = src->fields[PP1DB_DATFIELD_DURATION].value.dword * 1000; dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-23 09:23:00
|
Revision: 391 http://svn.sourceforge.net/pmplib/?rev=391&view=rev Author: nyaochi Date: 2007-02-23 01:23:01 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Added total_tracks field to pmp_music_record_t. Modified Paths: -------------- trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/pmp_ipod/ipod.c Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-23 09:12:10 UTC (rev 390) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-23 09:23:01 UTC (rev 391) @@ -392,6 +392,12 @@ uint32_t track_number; /** + * Total number of tracks in this disc. + * e.g., 12 + */ + uint32_t total_tracks; + + /** * Sample rate in [Hz]. * e.g., 44100 */ Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 09:12:10 UTC (rev 390) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-23 09:23:01 UTC (rev 391) @@ -375,9 +375,17 @@ /* Obtain track number first. */ ucs2 = get_frame_value(id3tag, "TRCK", charset); if (ucs2 && *ucs2) { - info->track_number = ucs2toi(ucs2); + ucs2char_t* p = ucs2chr(ucs2, '/'); + if (p) { + info->track_number = ucs2toi(ucs2); + info->total_tracks = ucs2toi(p+1); + } else { + info->track_number = ucs2toi(ucs2); + info->total_tracks = 0; + } } else { info->track_number = 0; + info->total_tracks = 0; } ucs2free(ucs2); Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 09:12:10 UTC (rev 390) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 09:23:01 UTC (rev 391) @@ -114,7 +114,17 @@ } else if (strncasecmp(fieldvalue, "GENRE=", 6) == 0) { info->genre = utf8dupucs2(fieldvalue+6); } else if (strncasecmp(fieldvalue, "TRACKNUMBER=", 12) == 0) { - info->track_number = atoi(fieldvalue+12); + char* value = fieldvalue+12; + char* p = strchr(value, '/'); + if (p) { + info->track_number = atoi(value); + info->total_tracks = atoi(p+1); + } else { + info->track_number = atoi(value); + info->total_tracks = 0; + } + } else if (strncasecmp(fieldvalue, "TOTALTRACKS=", 12) == 0) { + info->total_tracks = atoi(fieldvalue+12); } else if (strncasecmp(fieldvalue, "DATE=", 5) == 0) { info->date = utf8dupucs2(fieldvalue+5); } Modified: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 09:12:10 UTC (rev 390) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 09:23:01 UTC (rev 391) @@ -170,7 +170,7 @@ mhit_data->filesize = rec->filesize; mhit_data->duration = rec->duration; mhit_data->track_number = rec->track_number; - mhit_data->total_tracks = 100; + mhit_data->total_tracks = rec->total_tracks; mhit_data->year = 2000; mhit_data->bitrate = rec->bitrate / 1000; mhit_data->samplerate = rec->sample_rate; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-23 09:37:32
|
Revision: 392 http://svn.sourceforge.net/pmplib/?rev=392&view=rev Author: nyaochi Date: 2007-02-23 01:37:33 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Added disc_number and total_discs fields to pmp_music_record_t although libgmi does not set them at this moment. Modified Paths: -------------- trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/pmp_ipod/ipod.c Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-23 09:23:01 UTC (rev 391) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-23 09:37:33 UTC (rev 392) @@ -398,6 +398,18 @@ uint32_t total_tracks; /** + * Disc number. + * e.g., 1 + */ + uint32_t disc_number; + + /** + * Total number of discs in this series. + * e.g., 2 + */ + uint32_t total_discs; + + /** * Sample rate in [Hz]. * e.g., 44100 */ Modified: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 09:23:01 UTC (rev 391) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 09:37:33 UTC (rev 392) @@ -174,6 +174,8 @@ mhit_data->year = 2000; mhit_data->bitrate = rec->bitrate / 1000; mhit_data->samplerate = rec->sample_rate; + mhit_data->disc_number = rec->disc_number; + mhit_data->total_discs = rec->total_discs; mhit_data->date_added = rec->ts_import; mhit_data->dbid = 0; mhit_data->unk9 = 0xFFFF; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-24 11:19:50
|
Revision: 394 http://svn.sourceforge.net/pmplib/?rev=394&view=rev Author: nyaochi Date: 2007-02-24 03:19:50 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Initial attempt to support MPEG4 files (m4a). The libgmi now has the dependency to libmp4v2: http://mpeg4ip.net/ http://resare.com/libmp4v2/ Still Win32 version only at this moment. Modified Paths: -------------- trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/gmi/gmi.c trunk/pmplib/lib/gmi/gmi.vcproj trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/pmp_ipod/ipod.c Added Paths: ----------- trunk/pmplib/lib/gmi/contrib/mp4v2/ trunk/pmplib/lib/gmi/contrib/mp4v2/mp4.h trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip.h trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_version.h trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_win32.h trunk/pmplib/lib/gmi/contrib/mp4v2/win32/ trunk/pmplib/lib/gmi/contrib/mp4v2/win32/libmp4v260.lib trunk/pmplib/lib/gmi/contrib/mp4v2/win32/libmp4v260d.lib trunk/pmplib/lib/gmi/gmi_mp4v2.c Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-23 09:38:48 UTC (rev 393) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-24 11:19:50 UTC (rev 394) @@ -129,6 +129,8 @@ #define PMPCODEC_NONE PMPFOURCC(' ',' ',' ',' ') /** MPEG Audio Layer III. */ #define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','A','3') +/** MPEG 4. */ +#define PMPCODEC_MPEG4AUDIO PMPFOURCC('M','P','4','A') /** Windows Media Audio. */ #define PMPCODEC_WMA PMPFOURCC('W','M','A',' ') /** Ogg Vorbis. */ @@ -340,6 +342,13 @@ ucs2char_t *artist; /** + * Album artist name. + * e.g., "Various" + * @assert @code album_artist != NULL @endcode + */ + ucs2char_t *album_artist; + + /** * Composer. * e.g., "John Lennon" * @assert @code composer != NULL @endcode @@ -368,6 +377,12 @@ ucs2char_t *date; /** + * Compilation flag. + * e.g., 1 for compilation album. + */ + uint8_t is_compilation; + + /** * FourCC representation of the codec. * e.g., PMPCODEC_MPEGLAYER3 */ Added: trunk/pmplib/lib/gmi/contrib/mp4v2/mp4.h =================================================================== --- trunk/pmplib/lib/gmi/contrib/mp4v2/mp4.h (rev 0) +++ trunk/pmplib/lib/gmi/contrib/mp4v2/mp4.h 2007-02-24 11:19:50 UTC (rev 394) @@ -0,0 +1,1222 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. + * + * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, + * and was contributed by Ximpo Group Ltd. + * + * Portions created by Ximpo Group Ltd. are + * Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dm...@ci... + * Alix Marchandise-Franquet al...@ci... + * Ximpo Group Ltd. mp...@xi... + * Bill May wm...@ci... + */ + +#ifndef __MP4_INCLUDED__ +#define __MP4_INCLUDED__ + +/* include system and project specific headers */ +#include "mpeg4ip.h" + +#include <math.h> /* to define float HUGE_VAL and/or NAN */ +#ifndef NAN +#define NAN HUGE_VAL +#endif + +#ifdef __cplusplus +/* exploit C++ ability of default values for function parameters */ +#define DEFAULT(x) =x +#else +#define DEFAULT(x) +#endif + +/* MP4 API types */ +typedef void* MP4FileHandle; +typedef u_int32_t MP4TrackId; +typedef u_int32_t MP4SampleId; +typedef u_int64_t MP4Timestamp; +typedef u_int64_t MP4Duration; +typedef u_int32_t MP4EditId; + +/* Invalid values for API types */ +#define MP4_INVALID_FILE_HANDLE ((MP4FileHandle)NULL) +#define MP4_INVALID_TRACK_ID ((MP4TrackId)0) +#define MP4_INVALID_SAMPLE_ID ((MP4SampleId)0) +#define MP4_INVALID_TIMESTAMP ((MP4Timestamp)-1) +#define MP4_INVALID_DURATION ((MP4Duration)-1) +#define MP4_INVALID_EDIT_ID ((MP4EditId)0) + +/* Macros to test for API type validity */ +#define MP4_IS_VALID_FILE_HANDLE(x) ((x) != MP4_INVALID_FILE_HANDLE) +#define MP4_IS_VALID_TRACK_ID(x) ((x) != MP4_INVALID_TRACK_ID) +#define MP4_IS_VALID_SAMPLE_ID(x) ((x) != MP4_INVALID_SAMPLE_ID) +#define MP4_IS_VALID_TIMESTAMP(x) ((x) != MP4_INVALID_TIMESTAMP) +#define MP4_IS_VALID_DURATION(x) ((x) != MP4_INVALID_DURATION) +#define MP4_IS_VALID_EDIT_ID(x) ((x) != MP4_INVALID_EDIT_ID) + +/* MP4 verbosity levels - e.g. MP4SetVerbosity() */ +#define MP4_DETAILS_ALL 0xFFFFFFFF +#define MP4_DETAILS_ERROR 0x00000001 +#define MP4_DETAILS_WARNING 0x00000002 +#define MP4_DETAILS_READ 0x00000004 +#define MP4_DETAILS_WRITE 0x00000008 +#define MP4_DETAILS_FIND 0x00000010 +#define MP4_DETAILS_TABLE 0x00000020 +#define MP4_DETAILS_SAMPLE 0x00000040 +#define MP4_DETAILS_HINT 0x00000080 +#define MP4_DETAILS_ISMA 0x00000100 +#define MP4_DETAILS_EDIT 0x00000200 + +#define MP4_DETAILS_READ_ALL \ + (MP4_DETAILS_READ | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE) +#define MP4_DETAILS_WRITE_ALL \ + (MP4_DETAILS_WRITE | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE) + +/* + * MP4 Known track type names - e.g. MP4GetNumberOfTracks(type) + * + * Note this first group of track types should be created + * via the MP4Add<Type>Track() functions, and not MP4AddTrack(type) + */ +#define MP4_OD_TRACK_TYPE "odsm" +#define MP4_SCENE_TRACK_TYPE "sdsm" +#define MP4_AUDIO_TRACK_TYPE "soun" +#define MP4_VIDEO_TRACK_TYPE "vide" +#define MP4_HINT_TRACK_TYPE "hint" +#define MP4_CNTL_TRACK_TYPE "cntl" +/* + * This second set of track types should be created + * via MP4AddSystemsTrack(type) + */ +#define MP4_CLOCK_TRACK_TYPE "crsm" +#define MP4_MPEG7_TRACK_TYPE "m7sm" +#define MP4_OCI_TRACK_TYPE "ocsm" +#define MP4_IPMP_TRACK_TYPE "ipsm" +#define MP4_MPEGJ_TRACK_TYPE "mjsm" + +#define MP4_IS_VIDEO_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_VIDEO_TRACK_TYPE)) + +#define MP4_IS_AUDIO_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_AUDIO_TRACK_TYPE)) + +#define MP4_IS_CNTL_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_CNTL_TRACK_TYPE)) + +#define MP4_IS_OD_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_OD_TRACK_TYPE)) + +#define MP4_IS_SCENE_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_SCENE_TRACK_TYPE)) + +#define MP4_IS_HINT_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_HINT_TRACK_TYPE)) + +#define MP4_IS_SYSTEMS_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_CLOCK_TRACK_TYPE) \ + || !strcasecmp(type, MP4_MPEG7_TRACK_TYPE) \ + || !strcasecmp(type, MP4_OCI_TRACK_TYPE) \ + || !strcasecmp(type, MP4_IPMP_TRACK_TYPE) \ + || !strcasecmp(type, MP4_MPEGJ_TRACK_TYPE)) + +/* MP4 Audio track types - see MP4AddAudioTrack()*/ +#define MP4_INVALID_AUDIO_TYPE 0x00 +#define MP4_MPEG1_AUDIO_TYPE 0x6B +#define MP4_MPEG2_AUDIO_TYPE 0x69 +#define MP4_MP3_AUDIO_TYPE MP4_MPEG2_AUDIO_TYPE +#define MP4_MPEG2_AAC_MAIN_AUDIO_TYPE 0x66 +#define MP4_MPEG2_AAC_LC_AUDIO_TYPE 0x67 +#define MP4_MPEG2_AAC_SSR_AUDIO_TYPE 0x68 +#define MP4_MPEG2_AAC_AUDIO_TYPE MP4_MPEG2_AAC_MAIN_AUDIO_TYPE +#define MP4_MPEG4_AUDIO_TYPE 0x40 +#define MP4_PRIVATE_AUDIO_TYPE 0xC0 +#define MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE 0xE0 /* a private definition */ +#define MP4_VORBIS_AUDIO_TYPE 0xE1 /* a private definition */ +#define MP4_AC3_AUDIO_TYPE 0xE2 /* a private definition */ +#define MP4_ALAW_AUDIO_TYPE 0xE3 /* a private definition */ +#define MP4_ULAW_AUDIO_TYPE 0xE4 /* a private definition */ +#define MP4_G723_AUDIO_TYPE 0xE5 /* a private definition */ +#define MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE 0xE6 /* a private definition */ + +/* MP4 MPEG-4 Audio types from 14496-3 Table 1.5.1 */ +#define MP4_MPEG4_INVALID_AUDIO_TYPE 0 +#define MP4_MPEG4_AAC_MAIN_AUDIO_TYPE 1 +#define MP4_MPEG4_AAC_LC_AUDIO_TYPE 2 +#define MP4_MPEG4_AAC_SSR_AUDIO_TYPE 3 +#define MP4_MPEG4_AAC_LTP_AUDIO_TYPE 4 +#define MP4_MPEG4_AAC_HE_AUDIO_TYPE 5 +#define MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE 6 +#define MP4_MPEG4_CELP_AUDIO_TYPE 8 +#define MP4_MPEG4_HVXC_AUDIO_TYPE 9 +#define MP4_MPEG4_TTSI_AUDIO_TYPE 12 +#define MP4_MPEG4_MAIN_SYNTHETIC_AUDIO_TYPE 13 +#define MP4_MPEG4_WAVETABLE_AUDIO_TYPE 14 +#define MP4_MPEG4_MIDI_AUDIO_TYPE 15 +#define MP4_MPEG4_ALGORITHMIC_FX_AUDIO_TYPE 16 + +/* MP4 Audio type utilities following common usage */ +#define MP4_IS_MP3_AUDIO_TYPE(type) \ + ((type) == MP4_MPEG1_AUDIO_TYPE || (type) == MP4_MPEG2_AUDIO_TYPE) + +#define MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \ + (((type) >= MP4_MPEG2_AAC_MAIN_AUDIO_TYPE \ + && (type) <= MP4_MPEG2_AAC_SSR_AUDIO_TYPE)) + +#define MP4_IS_MPEG4_AAC_AUDIO_TYPE(mpeg4Type) \ + (((mpeg4Type) >= MP4_MPEG4_AAC_MAIN_AUDIO_TYPE \ + && (mpeg4Type) <= MP4_MPEG4_AAC_HE_AUDIO_TYPE) \ + || (mpeg4Type) == MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE \ + || (mpeg4Type) == 17) + +#define MP4_IS_AAC_AUDIO_TYPE(type) \ + (MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \ + || (type) == MP4_MPEG4_AUDIO_TYPE) + +/* MP4 Video track types - see MP4AddVideoTrack() */ +#define MP4_INVALID_VIDEO_TYPE 0x00 +#define MP4_MPEG1_VIDEO_TYPE 0x6A +#define MP4_MPEG2_SIMPLE_VIDEO_TYPE 0x60 +#define MP4_MPEG2_MAIN_VIDEO_TYPE 0x61 +#define MP4_MPEG2_SNR_VIDEO_TYPE 0x62 +#define MP4_MPEG2_SPATIAL_VIDEO_TYPE 0x63 +#define MP4_MPEG2_HIGH_VIDEO_TYPE 0x64 +#define MP4_MPEG2_442_VIDEO_TYPE 0x65 +#define MP4_MPEG2_VIDEO_TYPE MP4_MPEG2_MAIN_VIDEO_TYPE +#define MP4_MPEG4_VIDEO_TYPE 0x20 +#define MP4_JPEG_VIDEO_TYPE 0x6C +#define MP4_PRIVATE_VIDEO_TYPE 0xD0 +#define MP4_YUV12_VIDEO_TYPE 0xF0 /* a private definition */ +#define MP4_H263_VIDEO_TYPE 0xF2 /* a private definition */ +#define MP4_H261_VIDEO_TYPE 0xF3 /* a private definition */ + +/* MP4 Video type utilities */ +#define MP4_IS_MPEG1_VIDEO_TYPE(type) \ + ((type) == MP4_MPEG1_VIDEO_TYPE) + +#define MP4_IS_MPEG2_VIDEO_TYPE(type) \ + (((type) >= MP4_MPEG2_SIMPLE_VIDEO_TYPE \ + && (type) <= MP4_MPEG2_442_VIDEO_TYPE) \ + || MP4_IS_MPEG1_VIDEO_TYPE(type)) + +#define MP4_IS_MPEG4_VIDEO_TYPE(type) \ + ((type) == MP4_MPEG4_VIDEO_TYPE) + +/* Mpeg4 Visual Profile Defines - ISO/IEC 14496-2:2001/Amd.2:2002(E) */ +#define MPEG4_SP_L1 (0x1) +#define MPEG4_SP_L2 (0x2) +#define MPEG4_SP_L3 (0x3) +#define MPEG4_SP_L0 (0x8) +#define MPEG4_SSP_L1 (0x11) +#define MPEG4_SSP_L2 (0x12) +#define MPEG4_CP_L1 (0x21) +#define MPEG4_CP_L2 (0x22) +#define MPEG4_MP_L2 (0x32) +#define MPEG4_MP_L3 (0x33) +#define MPEG4_MP_L4 (0x34) +#define MPEG4_NBP_L2 (0x42) +#define MPEG4_STP_L1 (0x51) +#define MPEG4_SFAP_L1 (0x61) +#define MPEG4_SFAP_L2 (0x62) +#define MPEG4_SFBAP_L1 (0x63) +#define MPEG4_SFBAP_L2 (0x64) +#define MPEG4_BATP_L1 (0x71) +#define MPEG4_BATP_L2 (0x72) +#define MPEG4_HP_L1 (0x81) +#define MPEG4_HP_L2 (0x82) +#define MPEG4_ARTSP_L1 (0x91) +#define MPEG4_ARTSP_L2 (0x92) +#define MPEG4_ARTSP_L3 (0x93) +#define MPEG4_ARTSP_L4 (0x94) +#define MPEG4_CSP_L1 (0xa1) +#define MPEG4_CSP_L2 (0xa2) +#define MPEG4_CSP_L3 (0xa3) +#define MPEG4_ACEP_L1 (0xb1) +#define MPEG4_ACEP_L2 (0xb2) +#define MPEG4_ACEP_L3 (0xb3) +#define MPEG4_ACEP_L4 (0xb4) +#define MPEG4_ACP_L1 (0xc1) +#define MPEG4_ACP_L2 (0xc2) +#define MPEG4_AST_L1 (0xd1) +#define MPEG4_AST_L2 (0xd2) +#define MPEG4_AST_L3 (0xd3) +#define MPEG4_S_STUDIO_P_L1 (0xe1) +#define MPEG4_S_STUDIO_P_L2 (0xe2) +#define MPEG4_S_STUDIO_P_L3 (0xe3) +#define MPEG4_S_STUDIO_P_L4 (0xe4) +#define MPEG4_C_STUDIO_P_L1 (0xe5) +#define MPEG4_C_STUDIO_P_L2 (0xe6) +#define MPEG4_C_STUDIO_P_L3 (0xe7) +#define MPEG4_C_STUDIO_P_L4 (0xe8) +#define MPEG4_ASP_L0 (0xF0) +#define MPEG4_ASP_L1 (0xF1) +#define MPEG4_ASP_L2 (0xF2) +#define MPEG4_ASP_L3 (0xF3) +#define MPEG4_ASP_L4 (0xF4) +#define MPEG4_ASP_L5 (0xF5) +#define MPEG4_ASP_L3B (0xF7) +#define MPEG4_FGSP_L0 (0xf8) +#define MPEG4_FGSP_L1 (0xf9) +#define MPEG4_FGSP_L2 (0xfa) +#define MPEG4_FGSP_L3 (0xfb) +#define MPEG4_FGSP_L4 (0xfc) +#define MPEG4_FGSP_L5 (0xfd) + +/* MP4 API declarations */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* file operations */ +#define MP4_CREATE_64BIT_DATA (0x01) +#define MP4_CREATE_64BIT_TIME (0x02) // Quicktime is not compatible with this +#define MP4_CREATE_64BIT (MP4_CREATE_64BIT_DATA | MP4_CREATE_64BIT_TIME) +#define MP4_CREATE_EXTENSIBLE_FORMAT (0x04) + +MP4FileHandle MP4Create( + const char* fileName, + u_int32_t verbosity DEFAULT(0), + u_int32_t flags DEFAULT(0)); +MP4FileHandle MP4CreateEx( + const char *fileName, + u_int32_t verbosity DEFAULT(0), + u_int32_t flags DEFAULT(0), + int add_ftyp DEFAULT(1), + int add_iods DEFAULT(1), + char* majorBrand DEFAULT(0), + u_int32_t minorVersion DEFAULT(0), + char** supportedBrands DEFAULT(0), + u_int32_t supportedBrandsCount DEFAULT(0)); + +MP4FileHandle MP4Modify( + const char* fileName, + u_int32_t verbosity DEFAULT(0), + u_int32_t flags DEFAULT(0)); + +MP4FileHandle MP4Read( + const char* fileName, + u_int32_t verbosity DEFAULT(0)); + +bool MP4Close( + MP4FileHandle hFile); + +bool MP4Optimize( + const char* existingFileName, + const char* newFileName DEFAULT(NULL), + u_int32_t verbosity DEFAULT(0)); + +bool MP4Dump( + MP4FileHandle hFile, + FILE* pDumpFile DEFAULT(NULL), + bool dumpImplicits DEFAULT(0)); + +char* MP4Info( + MP4FileHandle hFile, + MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID)); + +char* MP4FileInfo( + const char* fileName, + MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID)); + +/* file properties */ + +/* specific file properties */ + +u_int32_t MP4GetVerbosity(MP4FileHandle hFile); + +bool MP4SetVerbosity(MP4FileHandle hFile, u_int32_t verbosity); + +MP4Duration MP4GetDuration(MP4FileHandle hFile); + +u_int32_t MP4GetTimeScale(MP4FileHandle hFile); + +bool MP4SetTimeScale(MP4FileHandle hFile, u_int32_t value); + +u_int8_t MP4GetODProfileLevel(MP4FileHandle hFile); + +bool MP4SetODProfileLevel(MP4FileHandle hFile, u_int8_t value); + +u_int8_t MP4GetSceneProfileLevel(MP4FileHandle hFile); + +bool MP4SetSceneProfileLevel(MP4FileHandle hFile, u_int8_t value); + +u_int8_t MP4GetVideoProfileLevel(MP4FileHandle hFile, + MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID)); + +bool MP4SetVideoProfileLevel(MP4FileHandle hFile, u_int8_t value); + +u_int8_t MP4GetAudioProfileLevel(MP4FileHandle hFile); + +bool MP4SetAudioProfileLevel(MP4FileHandle hFile, u_int8_t value); + +u_int8_t MP4GetGraphicsProfileLevel(MP4FileHandle hFile); + +bool MP4SetGraphicsProfileLevel(MP4FileHandle hFile, u_int8_t value); + +/* generic file properties */ +bool MP4HaveAtom(MP4FileHandle hFile, + const char *atomName); + +bool MP4GetIntegerProperty( + MP4FileHandle hFile, + const char* propName, + u_int64_t *retval ); + + +bool MP4GetFloatProperty( + MP4FileHandle hFile, + const char* propName, + float *retvalue); + +bool MP4GetStringProperty( + MP4FileHandle hFile, + const char* propName, + const char **retvalue); + +bool MP4GetBytesProperty( + MP4FileHandle hFile, + const char* propName, + u_int8_t** ppValue, + u_int32_t* pValueSize); + +bool MP4SetIntegerProperty( + MP4FileHandle hFile, + const char* propName, + int64_t value); + +bool MP4SetFloatProperty( + MP4FileHandle hFile, + const char* propName, + float value); + +bool MP4SetStringProperty( + MP4FileHandle hFile, const char* propName, const char* value); + +bool MP4SetBytesProperty( + MP4FileHandle hFile, const char* propName, + const u_int8_t* pValue, u_int32_t valueSize); + +/* track operations */ + +MP4TrackId MP4AddTrack( + MP4FileHandle hFile, + const char* type); + +MP4TrackId MP4AddSystemsTrack( + MP4FileHandle hFile, + const char* type); + +MP4TrackId MP4AddODTrack( + MP4FileHandle hFile); + +MP4TrackId MP4AddSceneTrack( + MP4FileHandle hFile); + +MP4TrackId MP4AddAudioTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE)); + +typedef struct mp4v2_ismacryp_session_params { + u_int32_t scheme_type; + u_int16_t scheme_version; + u_int8_t key_ind_len; + u_int8_t iv_len; + u_int8_t selective_enc; + char *kms_uri; +} mp4v2_ismacrypParams; + + +MP4TrackId MP4AddEncAudioTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + mp4v2_ismacrypParams *icPp, + u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE)); +MP4TrackId MP4AddAmrAudioTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + u_int16_t modeSet, + u_int8_t modeChangePeriod, + u_int8_t framesPerSample, + bool isAmrWB); + +void MP4SetAmrVendor( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int32_t vendor); + +void MP4SetAmrDecoderVersion( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int8_t decoderVersion); + +void MP4SetAmrModeSet(MP4FileHandle hFile, MP4TrackId trakId, uint16_t modeSet); +uint16_t MP4GetAmrModeSet(MP4FileHandle hFile, MP4TrackId trackId); + +MP4TrackId MP4AddHrefTrack(MP4FileHandle hFile, + uint32_t timeScale, + MP4Duration sampleDuration); + +MP4TrackId MP4AddVideoTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE)); + +MP4TrackId MP4AddEncVideoTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + mp4v2_ismacrypParams *icPp, + u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE)); + +MP4TrackId MP4AddH264VideoTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + uint8_t AVCProfileIndication, + uint8_t profile_compat, + uint8_t AVCLevelIndication, + uint8_t sampleLenFieldSizeMinusOne); +bool MP4AddH264SequenceParameterSet(MP4FileHandle hFile, + MP4TrackId trackId, + const uint8_t *pSequence, + uint16_t sequenceLen); +bool MP4AddH264PictureParameterSet(MP4FileHandle hFile, + MP4TrackId trackId, + const uint8_t *pPict, + uint16_t pictLen); +void MP4SetH263Vendor( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int32_t vendor); + +void MP4SetH263DecoderVersion( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int8_t decoderVersion); + +void MP4SetH263Bitrates( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int32_t avgBitrate, + u_int32_t maxBitrate); + +MP4TrackId MP4AddH263VideoTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t h263Level, + u_int8_t h263Profile, + u_int32_t avgBitrate, + u_int32_t maxBitrate); + +MP4TrackId MP4AddHintTrack( + MP4FileHandle hFile, + MP4TrackId refTrackId); + +MP4TrackId MP4CloneTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID)); + +MP4TrackId MP4EncAndCloneTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + mp4v2_ismacrypParams *icPp, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID)); + +MP4TrackId MP4CopyTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + bool applyEdits DEFAULT(false), + MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID)); + +typedef u_int32_t (*encryptFunc_t)(u_int32_t, u_int32_t, u_int8_t*, u_int32_t*, u_int8_t **); + +MP4TrackId MP4EncAndCopyTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + mp4v2_ismacrypParams *icPp, + encryptFunc_t encfcnp, + u_int32_t encfcnparam1, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + bool applyEdits DEFAULT(false), + MP4TrackId dstHintTrackReferenceTrack DEFAULT(MP4_INVALID_TRACK_ID)); + +bool MP4DeleteTrack( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int32_t MP4GetNumberOfTracks( + MP4FileHandle hFile, + const char* type DEFAULT(NULL), + u_int8_t subType DEFAULT(0)); + +MP4TrackId MP4FindTrackId( + MP4FileHandle hFile, + u_int16_t index, + const char* type DEFAULT(NULL), + u_int8_t subType DEFAULT(0)); + +u_int16_t MP4FindTrackIndex( + MP4FileHandle hFile, + MP4TrackId trackId); + +/* track properties */ + +/* specific track properties */ + +bool MP4HaveTrackAtom(MP4FileHandle hFile, + MP4TrackId trackId, + const char *atomname); + +const char* MP4GetTrackType( + MP4FileHandle hFile, + MP4TrackId trackId); + +const char *MP4GetTrackMediaDataName(MP4FileHandle hFile, + MP4TrackId trackId); +MP4Duration MP4GetTrackDuration( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int32_t MP4GetTrackTimeScale( + MP4FileHandle hFile, + MP4TrackId trackId); + +bool MP4SetTrackTimeScale( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int32_t value); + +u_int8_t MP4GetTrackAudioMpeg4Type( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int8_t MP4GetTrackEsdsObjectTypeId( + MP4FileHandle hFile, + MP4TrackId trackId); + +/* returns MP4_INVALID_DURATION if track samples do not have a fixed duration */ +MP4Duration MP4GetTrackFixedSampleDuration( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int32_t MP4GetTrackBitRate( + MP4FileHandle hFile, + MP4TrackId trackId); + +bool MP4GetTrackVideoMetadata(MP4FileHandle hFile, + MP4TrackId trackId, + uint8_t **ppConfig, + uint32_t *pConfigSize); + +bool MP4GetTrackESConfiguration( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int8_t** ppConfig, + u_int32_t* pConfigSize); + +bool MP4SetTrackESConfiguration( + MP4FileHandle hFile, + MP4TrackId trackId, + const u_int8_t* pConfig, + u_int32_t configSize); + +/* h264 information routines */ +bool MP4GetTrackH264ProfileLevel(MP4FileHandle hFile, + MP4TrackId trackId, + uint8_t *pProfile, + uint8_t *pLevel); +bool MP4GetTrackH264SeqPictHeaders(MP4FileHandle hFile, + MP4TrackId trackId, + uint8_t ***pSeqHeaders, + uint32_t **pSeqHeaderSize, + uint8_t ***pPictHeader, + uint32_t **pPictHeaderSize); +bool MP4GetTrackH264LengthSize(MP4FileHandle hFile, + MP4TrackId trackId, + uint32_t *pLength); +MP4SampleId MP4GetTrackNumberOfSamples( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int16_t MP4GetTrackVideoWidth( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int16_t MP4GetTrackVideoHeight( + MP4FileHandle hFile, + MP4TrackId trackId); + +double MP4GetTrackVideoFrameRate( + MP4FileHandle hFile, + MP4TrackId trackId); + +int MP4GetTrackAudioChannels(MP4FileHandle hFile, + MP4TrackId trackId); + +bool MP4IsIsmaCrypMediaTrack( + MP4FileHandle hFile, + MP4TrackId trackId); + +/* generic track properties */ + +bool MP4HaveTrackAtom(MP4FileHandle hFile, + MP4TrackId trackId, + const char *atomName); + +bool MP4GetTrackIntegerProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + u_int64_t *retvalue); + +bool MP4GetTrackFloatProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + float *ret_value); + +bool MP4GetTrackStringProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + const char **retvalue); + +bool MP4GetTrackBytesProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + u_int8_t** ppValue, + u_int32_t* pValueSize); + +bool MP4SetTrackIntegerProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + int64_t value); + +bool MP4SetTrackFloatProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + float value); + +bool MP4SetTrackStringProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + const char* value); + +bool MP4SetTrackBytesProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + const u_int8_t* pValue, + u_int32_t valueSize); + +/* sample operations */ + +bool MP4ReadSample( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId, + /* input/output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + /* output parameters */ + MP4Timestamp* pStartTime DEFAULT(NULL), + MP4Duration* pDuration DEFAULT(NULL), + MP4Duration* pRenderingOffset DEFAULT(NULL), + bool* pIsSyncSample DEFAULT(NULL)); + +/* uses (unedited) time to specify sample instead of sample id */ +bool MP4ReadSampleFromTime( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + /* input/output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + /* output parameters */ + MP4Timestamp* pStartTime DEFAULT(NULL), + MP4Duration* pDuration DEFAULT(NULL), + MP4Duration* pRenderingOffset DEFAULT(NULL), + bool* pIsSyncSample DEFAULT(NULL)); + +bool MP4WriteSample( + MP4FileHandle hFile, + MP4TrackId trackId, + const u_int8_t* pBytes, + u_int32_t numBytes, + MP4Duration duration DEFAULT(MP4_INVALID_DURATION), + MP4Duration renderingOffset DEFAULT(0), + bool isSyncSample DEFAULT(true)); + +bool MP4CopySample( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4SampleId srcSampleId, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID), + MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION)); + +bool MP4EncAndCopySample( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4SampleId srcSampleId, + encryptFunc_t encfcnp, + u_int32_t encfcnparam1, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID), + MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION)); + +/* Note this function is not yet implemented */ +bool MP4ReferenceSample( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4SampleId srcSampleId, + MP4FileHandle dstFile, + MP4TrackId dstTrackId, + MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION)); + +u_int32_t MP4GetSampleSize( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +u_int32_t MP4GetTrackMaxSampleSize( + MP4FileHandle hFile, + MP4TrackId trackId); + +MP4SampleId MP4GetSampleIdFromTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + bool wantSyncSample DEFAULT(false)); + +MP4Timestamp MP4GetSampleTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +MP4Duration MP4GetSampleDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +MP4Duration MP4GetSampleRenderingOffset( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +bool MP4SetSampleRenderingOffset( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId, + MP4Duration renderingOffset); + +int8_t MP4GetSampleSync( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +/* rtp hint track operations */ + +bool MP4GetHintTrackRtpPayload( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + char** ppPayloadName DEFAULT(NULL), + u_int8_t* pPayloadNumber DEFAULT(NULL), + u_int16_t* pMaxPayloadSize DEFAULT(NULL), + char **ppEncodingParams DEFAULT(NULL)); + +#define MP4_SET_DYNAMIC_PAYLOAD 0xff + +bool MP4SetHintTrackRtpPayload( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* pPayloadName, + u_int8_t* pPayloadNumber, + u_int16_t maxPayloadSize DEFAULT(0), + const char *encode_params DEFAULT(NULL), + bool include_rtp_map DEFAULT(true), + bool include_mpeg4_esid DEFAULT(true)); + +const char* MP4GetSessionSdp( + MP4FileHandle hFile); + +bool MP4SetSessionSdp( + MP4FileHandle hFile, + const char* sdpString); + +bool MP4AppendSessionSdp( + MP4FileHandle hFile, + const char* sdpString); + +const char* MP4GetHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4SetHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* sdpString); + +bool MP4AppendHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* sdpString); + +MP4TrackId MP4GetHintTrackReferenceTrackId( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4ReadRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4SampleId hintSampleId, + u_int16_t* pNumPackets DEFAULT(NULL)); + +u_int16_t MP4GetRtpHintNumberOfPackets( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +int8_t MP4GetRtpPacketBFrame( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex); + +int32_t MP4GetRtpPacketTransmitOffset( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex); + +bool MP4ReadRtpPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex, + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + u_int32_t ssrc DEFAULT(0), + bool includeHeader DEFAULT(true), + bool includePayload DEFAULT(true)); + +MP4Timestamp MP4GetRtpTimestampStart( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4SetRtpTimestampStart( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4Timestamp rtpStart); + +bool MP4AddRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4AddRtpVideoHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + bool isBframe DEFAULT(false), + u_int32_t timestampOffset DEFAULT(0)); + +bool MP4AddRtpPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + bool setMbit DEFAULT(false), + int32_t transmitOffset DEFAULT(0)); + +bool MP4AddRtpImmediateData( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const u_int8_t* pBytes, + u_int32_t numBytes); + +bool MP4AddRtpSampleData( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4SampleId sampleId, + u_int32_t dataOffset, + u_int32_t dataLength); + +bool MP4AddRtpESConfigurationPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4WriteRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4Duration duration, + bool isSyncSample DEFAULT(true)); + +/* 3GP specific utilities */ + +bool MP4Make3GPCompliant( + const char* fileName, + u_int32_t verbosity DEFAULT(0), + char* majorBrand DEFAULT(0), + u_int32_t minorVersion DEFAULT(0), + char** supportedBrands DEFAULT(NULL), + u_int32_t supportedBrandsCount DEFAULT(0), + bool deleteIodsAtom DEFAULT(true)); + +/* ISMA specific utilities */ + +bool MP4MakeIsmaCompliant(const char* fileName, + u_int32_t verbosity DEFAULT(0), + bool addIsmaComplianceSdp DEFAULT(true)); + +char* MP4MakeIsmaSdpIod( + u_int8_t videoProfile, + u_int32_t videoBitrate, + u_int8_t* videoConfig, + u_int32_t videoConfigLength, + u_int8_t audioProfile, + u_int32_t audioBitrate, + u_int8_t* audioConfig, + u_int32_t audioConfigLength, + u_int32_t verbosity DEFAULT(0)); + +/* edit list */ + +/* NOTE this section of functionality + * has not yet been fully tested + */ + +MP4EditId MP4AddTrackEdit( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID), + MP4Timestamp startTime DEFAULT(0), + MP4Duration duration DEFAULT(0), + bool dwell DEFAULT(false)); + +bool MP4DeleteTrackEdit( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +u_int32_t MP4GetTrackNumberOfEdits( + MP4FileHandle hFile, + MP4TrackId trackId); + +MP4Timestamp MP4GetTrackEditStart( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +MP4Duration MP4GetTrackEditTotalDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID)); + +MP4Timestamp MP4GetTrackEditMediaStart( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +bool MP4SetTrackEditMediaStart( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + MP4Timestamp startTime); + +MP4Duration MP4GetTrackEditDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +bool MP4SetTrackEditDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + MP4Duration duration); + +int8_t MP4GetTrackEditDwell( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +bool MP4SetTrackEditDwell( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + bool dwell); + +bool MP4ReadSampleFromEditTime( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + /* input/output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + /* output parameters */ + MP4Timestamp* pStartTime DEFAULT(NULL), + MP4Duration* pDuration DEFAULT(NULL), + MP4Duration* pRenderingOffset DEFAULT(NULL), + bool* pIsSyncSample DEFAULT(NULL)); + +MP4SampleId MP4GetSampleIdFromEditTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + MP4Timestamp* pStartTime DEFAULT(NULL), + MP4Duration* pDuration DEFAULT(NULL)); +/* iTunes metadata handling */ +bool MP4MetadataDelete(MP4FileHandle hFile); +bool MP4GetMetadataByIndex(MP4FileHandle hFile, u_int32_t index, + const char** ppName, + u_int8_t** ppValue, u_int32_t* pValueSize); +bool MP4SetMetadataName(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataName(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataName(MP4FileHandle hFile); +bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataArtist(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataArtist(MP4FileHandle hFile); +bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataWriter(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataWriter(MP4FileHandle hFile); +bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataComment(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataComment(MP4FileHandle hFile); +bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataTool(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataTool(MP4FileHandle hFile); +bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataYear(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataYear(MP4FileHandle hFile); +bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataAlbum(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataAlbum(MP4FileHandle hFile); +bool MP4SetMetadataTrack(MP4FileHandle hFile, + u_int16_t track, u_int16_t totalTracks); +bool MP4GetMetadataTrack(MP4FileHandle hFile, + u_int16_t* track, u_int16_t* totalTracks); +bool MP4DeleteMetadataTrack(MP4FileHandle hFile); +bool MP4SetMetadataDisk(MP4FileHandle hFile, + u_int16_t disk, u_int16_t totalDisks); +bool MP4GetMetadataDisk(MP4FileHandle hFile, + u_int16_t* disk, u_int16_t* totalDisks); +bool MP4DeleteMetadataDisk(MP4FileHandle hFile); +bool MP4SetMetadataGenre(MP4FileHandle hFile, const char *genre); +bool MP4GetMetadataGenre(MP4FileHandle hFile, char **genre); +bool MP4DeleteMetadataGenre(MP4FileHandle hFile); +bool MP4SetMetadataGrouping(MP4FileHandle hFile, const char *grouping); +bool MP4GetMetadataGrouping(MP4FileHandle hFile, char **grouping); +bool MP4DeleteMetadataGrouping(MP4FileHandle hFile); +bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo); +bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo); +bool MP4DeleteMetadataTempo(MP4FileHandle hFile); +bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl); +bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl); +bool MP4DeleteMetadataCompilation(MP4FileHandle hFile); +bool MP4SetMetadataCoverArt(MP4FileHandle hFile, + u_int8_t *coverArt, u_int32_t size); +bool MP4GetMetadataCoverArt(MP4FileHandle hFile, + u_int8_t **coverArt, u_int32_t* size); +u_int32_t MP4GetMetadataCoverArtCount(MP4FileHandle hFile); +bool MP4DeleteMetadataCoverArt(MP4FileHandle hFile); +bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name, + u_int8_t* pValue, u_int32_t valueSize); +bool MP4GetMetadataFreeForm(MP4FileHandle hFile, char *name, + u_int8_t** pValue, u_int32_t* valueSize); +bool MP4DeleteMetadataFreeForm(MP4FileHandle hFile, char *name); + + +/* time conversion utilties */ + +/* predefined values for timeScale parameter below */ +#define MP4_SECONDS_TIME_SCALE 1 +#define MP4_MILLISECONDS_TIME_SCALE 1000 +#define MP4_MICROSECONDS_TIME_SCALE 1000000 +#define MP4_NANOSECONDS_TIME_SCALE 1000000000 + +#define MP4_SECS_TIME_SCALE MP4_SECONDS_TIME_SCALE +#define MP4_MSECS_TIME_SCALE MP4_MILLISECONDS_TIME_SCALE +#define MP4_USECS_TIME_SCALE MP4_MICROSECONDS_TIME_SCALE +#define MP4_NSECS_TIME_SCALE MP4_NANOSECONDS_TIME_SCALE + +u_int64_t MP4ConvertFromMovieDuration( + MP4FileHandle hFile, + MP4Duration duration, + u_int32_t timeScale); + +u_int64_t MP4ConvertFromTrackTimestamp( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp timeStamp, + u_int32_t timeScale); + +MP4Timestamp MP4ConvertToTrackTimestamp( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int64_t timeStamp, + u_int32_t timeScale); + +u_int64_t MP4ConvertFromTrackDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Duration duration, + u_int32_t timeScale); + +MP4Duration MP4ConvertToTrackDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int64_t duration, + u_int32_t timeScale); + +char* MP4BinaryToBase16( + const u_int8_t* pData, + u_int32_t dataSize); + +char* MP4BinaryToBase64( + const u_int8_t* pData, + u_int32_t dataSize); + +uint8_t *Base64ToBinary(const char *pData, + uint32_t decodeSize, + uint32_t *pDataSize); + +#ifdef __cplusplus +} +#endif + +/* undefined our utlity macro to avoid conflicts */ +#undef DEFAULT + +#endif /* __MP4_INCLUDED__ */ Added: trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip.h =================================================================== --- trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip.h (rev 0) +++ trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip.h 2007-02-24 11:19:50 UTC (rev 394) @@ -0,0 +1,335 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2000-2005. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dm...@ci... + * Bill May wm...@ci... + */ + +#ifndef __MPEG4IP_INCLUDED__ +#define __MPEG4IP_INCLUDED__ + +/* project wide applicable stuff here */ + + +#ifndef _WIN32 +#ifdef PACKAGE_BUGREPORT +#define TEMP_PACKAGE_BUGREPORT PACKAGE_BUGREPORT +#define TEMP_PACKAGE_NAME PACKAGE_NAME +#define TEMP_PACKAGE_STRING PACKAGE_STRING +#define TEMP_PACKAGE_TARNAME PACKAGE_TARNAME +#define TEMP_PACKAGE_VERSION PACKAGE_VERSION +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#include <mpeg4ip_config.h> +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#define PACKAGE_BUGREPORT TEMP_PACKAGE_BUGREPORT +#define PACKAGE_NAME TEMP_PACKAGE_NAME +#define PACKAGE_STRING TEMP_PACKAGE_STRING +#define PACKAGE_TARNAME TEMP_PACKAGE_TARNAME +#define PACKAGE_VERSION TEMP_PACKAGE_VERSION +#else +#include <mpeg4ip_config.h> +#endif +#endif + +// the mpeg4ip_package and mpeg4ip_version are always in this +// file +#include "mpeg4ip_version.h" + +#ifdef _WIN32 +#include "mpeg4ip_win32.h" +#include "mpeg4ip_version.h" +#else /* UNIX */ +/***************************************************************************** + * UNIX LIKE DEFINES BELOW THIS POINT + *****************************************************************************/ +#ifdef sun +#include <sys/feature_tests.h> +#endif + +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#else +#ifndef sun +#if _FILE_OFFSET_BITS < 64 + #error File offset bits is already set to non-64 value +#endif +#endif +#endif + +#ifndef _LARGEFILE_SOURCE +#define _LARGEFILE_SOURCE +#endif +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> + +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif +#if !defined(HAVE_INTTYPES_H) && !defined(HAVE_STDINT_H) +#error "Don't have stdint.h or inttypes.h - no way to get uint8_t" +#endif + +#include <unistd.h> +#include <fcntl.h> +#include <netinet/in.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <syslog.h> +#include <string.h> +#include <ctype.h> +#include <netdb.h> +#include <sys/stat.h> +#ifdef TIME_WITH_SYS_TIME +#include <sys/time.h> +#include <time.h> +#else +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#else +#include <time.h> +#endif +#endif +#include <sys/param.h> + +#ifdef __cplusplus +extern "C" { +#endif +char *strcasestr(const char *haystack, const char *needle); +#ifdef __cplusplus +} +#endif + +#define OPEN_RDWR O_RDWR +#define OPEN_CREAT O_CREAT +#define OPEN_RDONLY O_RDONLY + +#define closesocket close +#define IOSBINARY ios::bin + +#if SIZEOF_LONG == 8 +#define MAX_UINT64 -1LU +#define D64F "ld" +#define U64F "lu" +#define X64F "lx" + +#define TO_D64(a) (a##L) +#define TO_U64(a) (a##LU) +#else +#define MAX_UINT64 -1LLU +#define D64F "lld" +#define U64F "llu" +#define X64F "llx" + +#define TO_D64(a) (a##LL) +#define TO_U64(a) (a##LLU) +#endif + +#ifdef HAVE_FPOS_T___POS +#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((fpos).__pos) +#define VAR_TO_FPOS(fpos, var) (fpos).__pos = (var) +#else +#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos) +#define VAR_TO_FPOS(fpos, var) (fpos) = (var) +#endif + +#define FOPEN_READ_BINARY "r" +#define FOPEN_WRITE_BINARY "w" +#define UINT64_TO_DOUBLE(a) ((double)(a)) +#endif /* define unix */ + +/***************************************************************************** + * Generic type includes used in the whole package * + *****************************************************************************/ +#define D64 "%"D64F +#define U64 "%"U64F +#define X64 "%"X64F + +#define M_LLU TO_U64(1000) +#define M_64 TO_U64(1000) +#define LLU U64 + +#include <stdarg.h> +typedef void (*error_msg_func_t)(int loglevel, + const char *lib, + const char *fmt, + va_list ap); +typedef void (*lib_message_func_t)(int loglevel, + const char *lib, + const char *fmt, + ...); +#ifndef HAVE_IN_PORT_T +typedef uint16_t in_port_t; +#endif + +#ifndef HAVE_SOCKLEN_T +typedef unsigned int socklen_t; +#endif + +#ifdef sun +#include <limits.h> +#define u_int8_t uint8_t +#define u_int16_t uint16_t +#define u_int32_t uint32_t +#define u_int64_t uint64_t +#define __STRING(expr) #expr +#endif + +#ifndef HAVE_STRSEP +#ifdef __cplusplus +extern "C" { +#endif +char *strsep(char **strp, const char *delim); +#ifdef __cplusplus +} +#endif +#endif + +#ifndef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef INADDR_NONE +#define INADDR_NONE (-1) +#endif + +#define MALLOC_STRUCTURE(a) ((a *)malloc(sizeof(a))) + +#define CHECK_AND_FREE(a) if ((a) != NULL) { free((void *)(a)); (a) = NULL;} + +#define NUM_ELEMENTS_IN_ARRAY(name) ((sizeof((name))) / (sizeof(*(name)))) + +#define ADV_SPACE(a) {while (isspace(*(a)) && (*(a) != '\0'))(a)++;} + +#ifndef HAVE_GTK +typedef char gchar; +typedef unsigned char guchar; + +typedef int gint; +typedef unsigned int guint; + +typedef long glong; +typedef unsigned long gulong; + +typedef double gdouble; + +typedef int gboolean; + +typedef int16_t gint16; +typedef uint16_t guint16; + +typedef int32_t gint32; +typedef uint32_t guint32; + +typedef int64_t gint64; +typedef uint64_t guint64; + +typedef uint8_t guint8; +typedef int8_t gint8; + +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef __cplusplus + +#ifndef bool + #if SIZEOF_BOOL == 8 + typedef uint64_t bool; + #else + #if SIZEOF_BOOL == 4 + typedef uint32_t bool; + #else + #if SIZEOF_BOOL == 2 + typedef uint16_t bool; + #else + typedef unsigned char bool; + #endif + #endif + #endif + #ifndef false + #define false FALSE + #endif + #ifndef true + #define true TRUE + #endif +#endif + +#endif + +#ifndef ROUND +# ifdef HAVE_RINT +# define ROUND(f) rint(f) +# else +# define ROUND(f) (int)(floor((f) + 0.5)) +# endif +#endif + +#ifndef INT16_MAX +# define INT16_MAX (32767) +#endif +#ifndef INT16_MIN +# define INT16_MIN (-32767-1) +#endif + +#ifndef UINT32_MAX +# define UINT32_MAX (4294967295U) +#endif + +#ifndef UINT64_MAX +# define UINT64_MAX TO_U64(0xffffffffffffffff) +#endif + +typedef enum audio_format_t { + AUDIO_FMT_U8 = 0, + AUDIO_FMT_S8, + AUDIO_FMT_U16LSB, + AUDIO_FMT_S16LSB, + AUDIO_FMT_U16MSB, + AUDIO_FMT_S16MSB, + AUDIO_FMT_U16, + AUDIO_FMT_S16, + AUDIO_FMT_FLOAT, + AUDIO_FMT_HW_AC3, +} audio_format_t; + +#endif /* __MPEG4IP_INCLUDED__ */ + Added: trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_version.h =================================================================== --- trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_version.h (rev 0) +++ trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_version.h 2007-02-24 11:19:50 UTC (rev 394) @@ -0,0 +1,6 @@ +#define MPEG4IP_PACKAGE "mpeg4ip" +#define MPEG4IP_VERSION "1.5.0.1" +#define MPEG4IP_MAJOR_VERSION 0x1 +#define MPEG4IP_MINOR_VERSION 0x5 +#define MPEG4IP_CVS_VERSION 0x01 +#define MPEG4IP_HEX_VERSION ((MPEG4IP_MAJOR_VERSION << 16) | (MPEG4IP_MINOR_VERSION << 8) | MPEG4IP_CVS_VERSION) Added: trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_win32.h =================================================================== --- trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_win32.h (rev 0) +++ trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_win32.h 2007-02-24 11:19:50 UTC (rev 394) @@ -0,0 +1,130 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2005. All Rights Reserved. + * + * Contributor(s): + * Bill May wm...@ci... + */ +/* windows defines */ +#ifndef __MPEG4IP_WIN32_H__ +#define __MPEG4IP_WIN32_H__ +#define HAVE_IN_PORT_T +#define HAVE_SOCKLEN_T +#define NEED_SDL_VIDEO_IN_MAIN_THREAD +#define _WIN32_WINNT 0x0400 +#define _WINSOCKAPI_ +#define _INTEGRAL_MAX_BITS 64 +#include <windows.h> +#include <winsock2.h> +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> +#include <time.h> +#include <limits.h> + +typedef unsigned __int64 uint64_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int64 u_int64_t; +typedef unsigned __int32 u_int32_t; +typedef unsigned __int16 u_int16_t; +typedef unsigned __int8 u_int8_t; +typedef __int64 int64_t; +typedef __int32 int32_t; +typedef __int16 int16_t; +typedef __int8 int8_t; +typedef unsigned short in_port_t; +typedef int socklen_t; +typedef int ssize_t; +typedef unsigned int uint; +#define snprintf _snprintf +#define strncasecmp _strnicmp +#define strcasecmp _stricmp + +#include <io.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#define write _write +#define lseek _lseek +#define close _close +#define open _open +#define access _access +#define vsnprintf _vsnprintf +#define stat _stati64 +#define fstat _fstati64 +#define F_OK 0 +#define OPEN_RDWR (_O_RDWR | _O_BINARY) +#define OPEN_CREAT (_O_CREAT | _O_BINARY) +#define OPEN_RDONLY (_O_RDONLY | _O_BINARY) +#define srandom srand +#define random rand + +#define IOSBINARY ios::binary + +#ifdef __cplusplus +extern "C" { +#endif +int gettimeofday(struct timeval *t, void *); +#ifdef __cplusplus +} +#endif + +#define PATH_MAX MAX_PATH +#define MAX_UINT64 -1 +#define D64F "I64d" +#define U64F "I64u" +#define X64F "I64x" + +#define TO_D64(a) (a##I64) +#define TO_U64(a) (a##UI64) + +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#if !__STDC__ && _INTEGRAL_MAX_BITS >= 64 +#define VAR_TO_FPOS(fpos, var) (fpos) = (var) +#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos) +#else +#define VAR_TO_FPOS(fpos, var) (fpos).lopart = ((var) & UINT_MAX); (fpos).hipart = ((var) >> 32) +#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((uint64_t)((fpos).hipart ) << 32 | (fpos).lopart) +#endif + +#define __STRING(expr) #expr + +#define FOPEN_READ_BINARY "rb" +#define FOPEN_WRITE_BINARY "wb" + +#define UINT64_TO_DOUBLE(a) ((double)((int64_t)(a))) +#ifdef __cplusplus +extern "C" { +#endif +char *strcasestr(const char *haystack, const char *needle); +#ifdef __cplusplus +} +#endif + + +#define SIZEOF_BOOL 1 + +#endif Added: trunk/pmplib/lib/gmi/contrib/mp4v2/win32/libmp4v260.lib =================================================================== (Binary files differ) Property changes on: trunk/pmplib/lib/gmi/contrib/mp4v2/win32/libmp4v260.lib ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/pmplib/lib/gmi/contrib/mp4v2/win32/libmp4v260d.lib =================================================================== (Binary files differ) Property changes on: trunk/pmplib/lib/gmi/contrib/mp4v2/win32/libmp4v260d.lib ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/pmplib/lib/gmi/gmi.c =================================================================== --- trunk/pmplib/lib/gmi/gmi.c 2007-02-23 09:38:48 UTC (rev 393) +++ trunk/pmplib/lib/gmi/gmi.c 2007-02-24 11:19:50 UTC (rev 394) @@ -39,6 +39,9 @@ int gmi_mp3(media_info_t* info, const ucs2char_t *filename, const char *charset); static const ucs2char_t ucs2cs_ext_mp3[] = {'.','m','p','3',0}; +int gmi_mp4v2(media_info_t* info, const ucs2char_t *filename, const char *charset); +static const ucs2char_t ucs2cs_ext_m4a[] = {'.','m','4','a',0}; + int gmi_wma(media_info_t* info, const ucs2char_t *filename, const char *charset); static const ucs2char_t ucs2cs_ext_wma[] = {'.','w','m','a',0}; @@ -55,6 +58,7 @@ static gmi_exports_t gmi_exports[] = { {gmi_mp3, ucs2cs_ext_mp3}, + {gmi_mp4v2, ucs2cs_ext_m4a}, {gmi_wma, ucs2cs_ext_wma}, {gmi_vorbis, ucs2cs_ext_ogg}, {gmi_wav, ucs2cs_ext_wav}, Modified: trunk/pmplib/lib/gmi/gmi.vcproj =================================================================== --- trunk/pmplib/lib/gmi/gmi.vcproj 2007-02-23 09:38:48 UTC (rev 393) +++ trunk/pmplib/lib/gmi/gmi.vcproj 2007-02-24 11:19:50 UTC (rev 394) @@ -4,6 +4,7 @@ Version="8.00" Name="gmi" ProjectGUID="{3575EFC2-9051-467A-BEB4-E71E2F8664D7}" + RootNamespace="gmi" Keyword="Win32Proj" > <Platforms> @@ -40,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="$(SolutionDir)include,contrib,contrib\id3tag" + AdditionalIncludeDirectories="$(SolutionDir)include,contrib,contrib\id3tag,contrib\mp4v2" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GMI_EXPORTS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -61,7 +62,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies=".\contrib\id3tag\win32\libid3tagd.lib .\contrib\id3tag\win32\zlibd.lib .\contrib\ogg\win32\ogg_static_d.lib .\contrib\vorbis\win32\vorbis_static_d.lib .\contrib\vorbis\win32\vorbisfile_static_d.lib" + AdditionalDependencies=".\contrib\id3tag\win32\libid3tagd.lib .\contrib\id3tag\win32\zlibd.lib .\contrib\ogg\win32\ogg_static_d.lib .\contrib\vorbis\win32\vorbis_static_d.lib .\contrib\vorbis\win32\vorbisfile_static_d.lib .\contrib\mp4v2\win32\libmp4v260d.lib" OutputFile="$(OutDir)/gmi.dll" LinkIncremental="2" GenerateDebugInformation="true" @@ -192,6 +193,10 @@ > </File> <File + RelativePath=".\gmi_mp4v2.c" + > + </File> + <File RelativePath=".\gmi_vorbis.c" > </File> Added: trunk/pmplib/lib/gmi/gmi_mp4v2.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp4v2.c (rev 0) +++ trunk/pmplib/lib/gmi/gmi_mp4v2.c 2007-02-24 11:19:50 UTC (rev 394) @@ -0,0 +1,142 @@ +/* + * Tag and audio information retrieval by libmp4v2 + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit + * http://www.gnu.org/copyleft/gpl.html . + * + */ + +/* $Id:$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#if defined(WIN32) +/* In Win32 version of libmp4v2, <mp4.h> header also includes <winsock2.h> + * header, which cannot coexist with <winsock.h>. Defining _WINSOCKAPI_ will + * prevent from <winsock.h> being referred to by <windows.h>, which is also + * referred to by <os.h> header (Win32 only). Therefore, this definition + * must be placed before including <os.h>. + */ +#define _WINSOCKAPI_ +/* Add Winsock2 library */ +#pragma comment(lib, "ws2_32.lib") +#endif/*defined(WIN32)*/ + +#include <os.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <pmplib/ucs2char.h> +#include <gmi.h> + +#include <mp4.h> + +#ifdef WIN32 +/* Taken from mpeg4ip-1.5.0.1/lib/gnu/need_for_win32.c */ +#include <sys/timeb.h> + +int gettimeofday (struct timeval *t, void *foo) +{ + struct _timeb temp; + _ftime(&temp); + t->tv_sec = temp.time; + t->tv_usec = temp.millitm * 1000; + return (0); +} +#endif/*WIN32*/ + + + +int gmi_mp4v2(media_info_t* info, const ucs2char_t *filename, const char *charset) +{ + int ret = 0; + uint32_t i, num_tracks = 0; + uint16_t numvalue, numvalue2; + char *value = ucs2dupmbs(filename); + MP4FileHandle mp4file = MP4_INVALID_FILE_HANDLE; + + mp4file = MP4Read(value, 0); + ucs2free(value); + if (mp4file == MP4_INVALID_FILE_HANDLE) { + ret = -1; + goto error_exit; + } + + num_tracks = MP4GetNumberOfTracks(mp4file, NULL, 0); + for (i = 0;i < num_tracks;++i) { + uint32_t tid = MP4FindTrackId(mp4file, (u_int16_t)i, NULL, 0); + const char *type = MP4GetTrackType(mp4file, tid); + + if (type && strcmp(type, MP4_AUDIO_TRACK_TYPE) == 0) { + MP4Duration duration = MP4GetTrackDuration(mp4file, tid); + info->num_samples = (uint64_t)duration; + info->duration = MP4ConvertFromTrackDuration(mp4file, tid, duration, MP4_MSECS_TIME_SCALE); + info->sample_rate = MP4GetTrackTimeScale(mp4file, tid); + info->bitrate = MP4GetTrackBitRate(mp4file, tid); + } + } + + if (MP4GetMetadataName(mp4file, &value) && value != NULL) { + info->title = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataArtist(mp4file, &value) && value != NULL) { + info->artist = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataAlbum(mp4file, &value) && value != NULL) { + info->album = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataAlbum(mp4file, &value) && value != NULL) { + info->album = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataWriter(mp4file, &value) && value != NULL) { + info->composer = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataGenre(mp4file, &value) && value != NULL) { + info->genre = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataYear(mp4file, &value) && value != NULL) { + info->date = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataTrack(mp4file, &numvalue, &numvalue2)) { + info->track_number = numvalue; + info->total_tracks = numvalue2; + } + if (MP4GetMetadataDisk(mp4file, &numvalue, &numvalue2)) { + info->disc_number = numvalue; + info->total_discs = numvalue2; + } + + info->codec = PMPCODEC_MPEG4AUDIO; + +error_exit: + if (mp4file != MP4_INVALID_FILE_HANDLE) { + MP4Close(mp4file); + } + return ret; +} Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-23 09:38:48 UTC (rev 393) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-24 11:19:50 UTC (rev 394) @@ -58,10 +58,6 @@ vorbis_comment* vc = NULL; /* Set the pathname and filename. */ - /* - info->filename = ucs2dup(filename); - info->filesize = filepath_size(filename); - */ /* Open the target file. */ fp = ucs2fopen(filename, "rb"); Modified: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-23 09:38:48 UTC (rev 393) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-24 11:19:50 UTC (rev 394) @@ -46,8 +46,8 @@ "apple_ipod", "Apple", "iPod", "UM", "---", "---", "iPod_Control\\iTunes\\iTunesDB", - ".mp3\0", - {PMPCODEC_MPEGLAYER3, 0, 0, 0, 0, 0, 0, 0}, + ".mp3\0.m4a\0", + {PMPCODEC_MPEGLAYER3, PMPCODEC_MPEG4AUDIO, 0, 0, 0, 0, 0, 0}, "iPod_Control", "iPod_Control\\Music", "Playlists", }, { @@ -164,7 +164,7 @@ mhit_data->type2 = 0x01; break; } - mhit_data->compilation = 0; + mhit_data->compilation = rec->is_compilation ? 1 : 0; mhit_data->rating = 0; mhit_data->last_modified = rec->ts_update; mhit_data->filesize = rec->filesize; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-27 09:45:40
|
Revision: 397 http://svn.sourceforge.net/pmplib/?rev=397&view=rev Author: nyaochi Date: 2007-02-27 01:45:39 -0800 (Tue, 27 Feb 2007) Log Message: ----------- More for iPod support. The POSIX version has been broken. - Added "settle" operation for iPods (*1) - Added symbolic-link emulation represented by M3U8 playlist (*2) - Changed the structure of easypmp_filename_t for the convenience. - Diaplay the codec name of MPEG4 AAC - Option remapping: -s (--setvar) to -a (--setvar) - Option remapping: -x (--help-variable) to -H (--help-variable) *1 Settlement of media files This operation was introduced for Apple iPod players to bring them into the world of EasyPMP. Apple iPods for Windows are actually UMS/MSC device like other players supported by PMPlib, but has the strong requirement for the names of media files: a filename should be something like "F01\ABCD.m4a". In other words, we cannot name music files arbitrarily unlike other UMS/MSC players. In order to solve this problem, the operation "settle" (-s, --settle) was introduced to move/rename media files to the locations/names that are suitable for Apple iPods. At the same time, EasyPMP leaves symbolic links (*2) pointing to the settled music files from their original locations. Take the following example where a user places his/her music files under \Music directory of an iPod. [unsettled music files] \Music\RazorLight\RazorLight\01_In The Morning.m4a \Music\RazorLight\RazorLight\02_Who Needs Love.m4a \Music\RazorLight\RazorLight\03_Hold On.m4a \Music\RazorLight\RazorLight\04_America.m4a After EasyPMP performs a settle operation, the directory structure will be changed as follows. [music links] \Music\RazorLight\RazorLight\01_In The Morning.m4a.m3u8 (--> F02\JDEW.m4a) \Music\RazorLight\RazorLight\02_Who Needs Love.m4a.m3u8 (--> F05\IEJV.m4a) \Music\RazorLight\RazorLight\03_Hold On.m4a.m3u8 (--> F00\ESAV.m4a) \Music\RazorLight\RazorLight\04_America.m4a.m3u8 (--> F03\AWQM.m4a) [settled music files] \iPod_Control\Music\F02\JDEW.m4a \iPod_Control\Music\F05\IEJV.m4a \iPod_Control\Music\F00\ESAV.m4a \iPod_Control\Music\F03\AWQM.m4a This directory structure is perfectly compatible for the iPod player. In addition, the user can still listen to the music through M3U8 playlists placed in the \Music directory. If the user would like to remove the file "02_Who Needs Love.m4a" that was moved to "F05\IEJV.m4a", he/she can simply delete "02_Who Needs Love.m4a.m3u8" and run EasyPMP with -E (--remove-unref) option; EasyPMP will delete "F05\IEJV.m4a", which is not pointed by any symbolic links in the \Music directory. In this way, the user does not have to find out the location of settled music files at all. If the user would like to restore the original music files from the settled files, he or she may run EasyPMP with -x (--unsettle) option. This will take back to the original state of the directory structure. *2 Symbolic link emulation for FAT32 Symbolic (or hard) link is not supported by FAT32. EasyPMP supports symbolic links emulated by M3U8 playlists. The content of an M3U8 playlist is mere the reference to a settled media file. The name of an M3U8 symbolic link must be "(original_name).m3u8)", e.g., "01_track.m4a.m3u8". Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/frontend/easypmp/cui/device.c trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/include/pmplib/filepath.h trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/filepath/filepath.vcproj trunk/pmplib/lib/filepath/filepath_win32.c trunk/pmplib/lib/pmp_ipod/pmp_ipod.c trunk/pmplib/lib/pmp_ipod/pmp_ipod.vcproj trunk/pmplib/lib/ucs2/ucs2char.c trunk/pmplib/lib/ucs2/ucs2char_win32.c Added Paths: ----------- trunk/pmplib/frontend/easypmp/common/settle.c Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-27 09:45:39 UTC (rev 397) @@ -165,10 +165,9 @@ int is_skipping = 0; easypmp_filename_t* target = &fl->elements[i]; pmp_music_record_t* record = &records[i]; - ucs2char_t filename[MAX_PATH]; + const ucs2char_t* filename = target->name; uint32_t timestamp = 0; - filepath_combinepath(filename, MAX_PATH, target->pathname, target->filename); timestamp = (uint32_t)filepath_mtime(filename); // Report the progress. Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-27 09:45:39 UTC (rev 397) @@ -38,11 +38,14 @@ enum { EASYPMPP_START = 0x00010000, EASYPMPP_OPEN = 0x00020000, - EASYPMPP_MUSIC_GMI = 0x00030000, - EASYPMPP_MUSIC_UPDATE = 0x00040000, - EASYPMPP_PLAYLIST_CONVERT = 0x02050000, - EASYPMPP_CLOSE = 0x00060000, - EASYPMPP_END = 0x00070000, + EASYPMPP_REMOVE_UNREF = 0x00030000, + EASYPMPP_SETTLE = 0x00040000, + EASYPMPP_UNSETTLE = 0x00050000, + EASYPMPP_MUSIC_GMI = 0x00060000, + EASYPMPP_MUSIC_UPDATE = 0x00070000, + EASYPMPP_PLAYLIST_CONVERT = 0x02080000, + EASYPMPP_CLOSE = 0x00090000, + EASYPMPP_END = 0x000A0000, EASYPMPSP_START = 0x00000001, EASYPMPSP_PROGRESS = 0x00000002, @@ -70,19 +73,22 @@ #define MAKE_PMP_ERROR(code) (((code) << 16) | EASYPMPE_PMPERROR) enum { - MODE_NONE = 0, - MODE_DATABASE = 0x00000001, + MODE_NONE = 0, + MODE_DATABASE = 0x00000001, MODE_DATABASE_UPDATE = 0x00000002, MODE_DATABASE_REPR = 0x00000004, - MODE_PLAYLIST = 0x00000010, + MODE_PLAYLIST = 0x00000010, MODE_PLAYLIST_RECONVERT = 0x00000100, - MODE_PLAYLIST_FIND = 0x00000200, - MODE_PLAYLIST_SKIP = 0x00000400, - MODE_PLAYLIST_JSPL = 0x00000800, - MODE_LIST_DEVICES = 0x00001000, - MODE_HELP = 0x00010000, - MODE_HELP_VARIABLE = 0x00020000, - MODE_VERSION = 0x00040000, + MODE_PLAYLIST_FIND = 0x00000200, + MODE_PLAYLIST_SKIP = 0x00000400, + MODE_PLAYLIST_JSPL = 0x00000800, + MODE_SETTLE = 0x00001000, + MODE_UNSETTLE = 0x00002000, + MODE_REMOVE_UNREF = 0x00004000, + MODE_LIST_DEVICES = 0x00010000, + MODE_HELP = 0x00100000, + MODE_HELP_VARIABLE = 0x00200000, + MODE_VERSION = 0x00400000, }; typedef struct { @@ -100,13 +106,13 @@ ucs2char_t* path_to_pmp_music; ucs2char_t* path_to_pmp_playlist; + ucs2char_t* path_to_unsettled_music; ucs2char_t* path_to_playlist_source; int subdir_playlist_source; } option_t; typedef struct { - ucs2char_t pathname[MAX_PATH]; - ucs2char_t filename[MAX_PATH]; + ucs2char_t name[MAX_PATH]; } easypmp_filename_t; typedef struct { @@ -121,19 +127,30 @@ int phase, int param_int, double param_float, - ucs2char_t* param_str + const ucs2char_t* param_str ); int easypmp_enumerate_music( easypmp_filelist_t* fl, pmp_t* pmp, + const ucs2char_t* relative_path, const option_t* opt, easypmp_enumerate_progress_t proc, void *instance ); int +easypmp_enumerate_music_links( + easypmp_filelist_t* fl, + pmp_t* pmp, + const ucs2char_t* relative_path, + const option_t* opt, + easypmp_enumerate_progress_t proc, + void *instance + ); + +int easypmp_enumerate_playlist( easypmp_filelist_t* fl, pmp_t* pmp, @@ -176,6 +193,16 @@ easypmp_filelist_t* fl ); +int easypmp_settle( + pmp_t* pmp, + easypmp_filelist_t* musics, + easypmp_filelist_t* musics_unsettled, + easypmp_filelist_t* music_links, + const option_t* opt, + easypmp_progress_t progress, + void *instance + ); + /** @} */ #ifdef __cplusplus Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-27 09:45:39 UTC (rev 397) @@ -77,8 +77,7 @@ // Set path and file. new_filename = &fl->elements[fl->num_elements++]; - ucs2cpy(new_filename->pathname, found_path); - ucs2cpy(new_filename->filename, found_file); + filepath_combinepath(new_filename->name, MAX_PATH, found_path, found_file); } else { // Exit if the filename does not have a supported extension. return 0; @@ -96,6 +95,7 @@ easypmp_enumerate_music( easypmp_filelist_t* fl, pmp_t* pmp, + const ucs2char_t* relative_path, const option_t* opt, easypmp_enumerate_progress_t proc, void *instance @@ -105,7 +105,7 @@ ucs2char_t music_path[MAX_PATH]; // Decode the music path prefix for system path separators - filepath_combinepath(music_path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_music); + filepath_combinepath(music_path, MAX_PATH, pmp->info.path_to_root, relative_path); filepath_addslash(music_path); filepath_decode(music_path); @@ -127,6 +127,96 @@ ); } +static int found_music_link_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; + ucs2char_t *filename = alloca(sizeof(ucs2char_t) * (ucs2len(found_file)+1)); + + if (!filepath_is_link(found_file)) { + // Not a link file. + return 0; + } + + // Remove the extension of link. + ucs2cpy(filename, found_file); + filepath_remove_extension(filename); + + // 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(filename, pmp->info.audio_extensions[i])) { + break; + } + } + + if (i != pmp->info.num_audio_extensions) { + // Supported music file. + easypmp_filename_t* new_filename = NULL; + + // Expand the target array. + fl->elements = (easypmp_filename_t*)realloc( + fl->elements, + sizeof(easypmp_filename_t) * (fl->num_elements+1) + ); + if (!fl->elements) { + return -1; + } + + // Set path and file. + new_filename = &fl->elements[fl->num_elements++]; + filepath_combinepath(new_filename->name, MAX_PATH, found_path, filename); + } else { + // Exit if the filename does not have a supported extension. + return 0; + } + + // Report the progress. + if (ed->proc) { + ed->proc(ed->instance, found_path, found_file, fl->num_elements); + } + + return 0; +} + +int +easypmp_enumerate_music_links( + easypmp_filelist_t* fl, + pmp_t* pmp, + const ucs2char_t* relative_path, + const option_t* opt, + easypmp_enumerate_progress_t proc, + void *instance + ) +{ + enumerate_dat_t ed; + ucs2char_t music_path[MAX_PATH]; + + // Decode the music path prefix for system path separators + filepath_combinepath(music_path, MAX_PATH, pmp->info.path_to_root, relative_path); + filepath_addslash(music_path); + filepath_decode(music_path); + + fl->num_elements = 0; + fl->elements = NULL; + + memset(&ed, 0, sizeof(ed)); + ed.opt = opt; + ed.fl = fl; + ed.pmp = pmp; + ed.proc = proc; + ed.instance = instance; + + return find_file( + music_path, + 1, + found_music_link_file, + &ed + ); +} + static int found_playlist_file(void *instance, const ucs2char_t* found_path, const ucs2char_t* found_file) { enumerate_dat_t* ed = (enumerate_dat_t*)instance; @@ -149,8 +239,7 @@ // Set path and file. new_filename = &fl->elements[fl->num_elements++]; - ucs2cpy(new_filename->pathname, found_path); - ucs2cpy(new_filename->filename, found_file); + filepath_combinepath(new_filename->name, MAX_PATH, found_path, found_file); } else { // Exit if the filename does not have a supported extension. return 0; Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-27 09:45:39 UTC (rev 397) @@ -92,8 +92,9 @@ goto error_exit; } for (i = 0;i < musics->num_elements;++i) { - ucs2cpy(mediafiles[i].path, musics->elements[i].pathname); - ucs2cpy(mediafiles[i].file, musics->elements[i].filename); + ucs2cpy(mediafiles[i].path, musics->elements[i].name); + filepath_remove_filespec(mediafiles[i].path); + ucs2cpy(mediafiles[i].file, filepath_skippath(musics->elements[i].name)); } // Prepare playlist conversion for finding music files. @@ -115,9 +116,10 @@ int n = 0; // Generate the source filename - ucs2cpy(plf_path, plf->pathname); + ucs2cpy(plf_path, plf->name); + filepath_remove_filespec(plf_path); filepath_decode(plf_path); - filepath_combinepath(src, MAX_PATH, plf_path, plf->filename); + filepath_combinepath(src, MAX_PATH, plf_path, filepath_skippath(plf->name)); // Report the source filename. if (progress(instance, EASYPMPP_PLAYLIST_CONVERT | EASYPMPSP_PROGRESS, i, 0, src) != 0) { Added: trunk/pmplib/frontend/easypmp/common/settle.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/settle.c (rev 0) +++ trunk/pmplib/frontend/easypmp/common/settle.c 2007-02-27 09:45:39 UTC (rev 397) @@ -0,0 +1,249 @@ +/* + * EasyPMP settlement operation (currently for iPod). + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit + * http://www.gnu.org/copyleft/gpl.html . + * + */ + +/* $Id:$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ +#ifdef HAVE_STRING_H +#include <string.h> +#endif/*HAVE_STRING_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> +#include <gmi.h> +#include <easypmp.h> + +static void generate_filename(ucs2char_t* filename) +{ + ucs2char_t* p = filename; + *p++ = 'F'; + *p++ = '0'; + *p++ = '0' + (rand() % 10); + *p++ = PATHCHAR; + *p++ = 'A' + (rand() % 26); + *p++ = 'A' + (rand() % 26); + *p++ = 'A' + (rand() % 26); + *p++ = 'A' + (rand() % 26); + *p++ = 0; +} + +static int remove_file_from_list(easypmp_filelist_t* list, int i) +{ + memmove(&list->elements[i], &list->elements[i+1], sizeof(easypmp_filename_t) * (list->num_elements - 1 - i)); + list->elements = (easypmp_filename_t*)realloc( + list->elements, + sizeof(easypmp_filename_t) * (--list->num_elements) + ); + return list->elements == NULL ? -1 : 0; +} + +static int add_file_to_list(easypmp_filelist_t* list, const ucs2char_t* filename) +{ + list->elements = (easypmp_filename_t*)realloc( + list->elements, + sizeof(easypmp_filename_t) * (list->num_elements+1) + ); + if (!list->elements) { + return -1; + } + ucs2cpy(list->elements[list->num_elements++].name, filename); + return 0; +} + +int easypmp_settle( + pmp_t* pmp, + easypmp_filelist_t* musics, + easypmp_filelist_t* musics_unsettled, + easypmp_filelist_t* music_links, + const option_t* opt, + easypmp_progress_t progress, + void *instance + ) +{ + int result = 0; + uint32_t i, j, n; + ucs2char_t link[MAX_PATH]; + ucs2char_t target[MAX_PATH]; + ucs2char_t music[MAX_PATH]; + ucs2char_t directory[MAX_PATH]; + + srand(time(NULL)); + + // Remove music files that are not pointed by any links. + if (opt->verb & MODE_REMOVE_UNREF) { + if (progress(instance, EASYPMPP_REMOVE_UNREF|EASYPMPSP_START, 0, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + + n = 0; + for (i = 0;i < musics->num_elements;++i) { + ucs2cpy(music, musics->elements[i].name); + + // Check the existence of a link referring to the music file. + for (j = 0;j < music_links->num_elements;++j) { + // Obtain the filename pointed by this link. + ucs2cpy(link, music_links->elements[j].name); + if (filepath_followlink(link, target) == 0) { + if (ucs2icmp(music, target) == 0) { + break; + } + } + } + + // Remove the music file if no link is referring to the file. + if (j == music_links->num_elements) { + filepath_removefile(music); + remove_file_from_list(musics, i); + --i; + + if (progress(instance, EASYPMPP_REMOVE_UNREF|EASYPMPSP_PROGRESS, n, 0, music) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + n++; + } + } + + for (i = 0;i < music_links->num_elements;++i) { + ucs2cpy(link, music_links->elements[j].name); + if (filepath_followlink(link, target) != 0) { + filepath_removelinkfile(link); + remove_file_from_list(music_links, i); + --i; + + if (progress(instance, EASYPMPP_REMOVE_UNREF|EASYPMPSP_PROGRESS, n, 0, music) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + n++; + } + } + + if (progress(instance, EASYPMPP_REMOVE_UNREF|EASYPMPSP_END, n, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + } + + // Settle media files to the internal location suitable for the player. + if (opt->verb & MODE_SETTLE) { + if (progress(instance, EASYPMPP_SETTLE|EASYPMPSP_START, 0, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + + n = 0; + for (i = 0;i < musics_unsettled->num_elements;++i) { + // Source music file. + ucs2cpy(music, musics_unsettled->elements[i].name); + + // Destination music file. + do { + filepath_combinepath(target, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_music); + filepath_addslash(target); + generate_filename(target + ucs2len(target)); + filepath_add_extension(target, filepath_extract_extension(music)); + } while (filepath_file_exists(target)); + + // Create the directories for the destination music file. + ucs2cpy(directory, target); + filepath_remove_filespec(directory); + filepath_createdirs(directory); + + // Move the source file to the destination. + filepath_movefile(music, target); + add_file_to_list(musics, target); + remove_file_from_list(musics_unsettled, i); + --i; + + // Create a symbolic link (or shortcut) from the source to the destination. + filepath_linkfile(target, music); + add_file_to_list(music_links, music); + + if (progress(instance, EASYPMPP_SETTLE|EASYPMPSP_PROGRESS, n, 0, music) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + n++; + } + + if (progress(instance, EASYPMPP_SETTLE|EASYPMPSP_END, n, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + } + + if (opt->verb & MODE_UNSETTLE) { + if (progress(instance, EASYPMPP_UNSETTLE|EASYPMPSP_START, 0, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + + n = 0; + for (i = 0;i < music_links->num_elements;++i) { + // Source music link. + ucs2cpy(link, music_links->elements[i].name); + + // Follow the link. + if (filepath_followlink(link, target) == 0) { + // Restore the music file in the original location. + filepath_movefile(target, link); + add_file_to_list(musics_unsettled, link); + + // Remove the settled music file from the music list. + for (j = 0;j < musics->num_elements;++j) { + if (ucs2cmp(musics->elements[j].name, link) == 0) { + remove_file_from_list(musics, j); + break; + } + } + + // Remove the link file. + filepath_removelinkfile(link); + remove_file_from_list(music_links, i); + --i; + + if (progress(instance, EASYPMPP_UNSETTLE|EASYPMPSP_PROGRESS, n, 0, music) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + n++; + } + } + + if (progress(instance, EASYPMPP_UNSETTLE|EASYPMPSP_END, n, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + } + +error_exit: + return result; +} Property changes on: trunk/pmplib/frontend/easypmp/common/settle.c ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-27 09:45:39 UTC (rev 397) @@ -35,11 +35,6 @@ #include "util.h" -/** - * \addtogroup cui - * @{ - */ - // Display a path name using the given string format. void device_show_path(FILE *fp, const char* const format, const ucs2char_t* const path) { @@ -65,10 +60,11 @@ fprintf(fp, " Audio codec(s): "); for (i = 0;i < pmp->info.num_audio_codecs;++i) { switch (pmp->info.audio_codecs[i]) { - case PMPCODEC_MPEGLAYER3: fputs("MP3", fp); break; - case PMPCODEC_WMA: fputs("WMA", fp); break; + case PMPCODEC_MPEGLAYER3: fputs("MP3", fp); break; + case PMPCODEC_MPEG4AUDIO: fputs("AAC (MP4)", fp); break; + case PMPCODEC_WMA: fputs("WMA", fp); break; case PMPCODEC_VORBIS: fputs("Ogg Vorbis", fp); break; - case PMPCODEC_WAV: fputs("WAV", fp); break; + case PMPCODEC_WAV: fputs("WAV", fp); break; } if (i != pmp->info.num_audio_codecs-1) fputs(", ", fp); } @@ -102,4 +98,3 @@ { pmplib_enumerate_devid(pmplib, enumerate_devid_callback, pmplib); } -/** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/frontend/easypmp/cui/easypmp_cui.vcproj 2007-02-27 09:45:39 UTC (rev 397) @@ -4,6 +4,7 @@ Version="8.00" Name="easypmp_cui" ProjectGUID="{FA1F30D4-6100-4379-8506-6CFE023B0AE7}" + RootNamespace="easypmp_cui" Keyword="Win32Proj" > <Platforms> @@ -255,6 +256,10 @@ RelativePath="..\common\playlist.c" > </File> + <File + RelativePath="..\common\settle.c" + > + </File> </Filter> </Files> <Globals> Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-27 09:45:39 UTC (rev 397) @@ -84,7 +84,7 @@ int phase, int param_int, double param_float, - ucs2char_t* param_str + const ucs2char_t* param_str ) { FILE *fpo = stdout; @@ -108,6 +108,42 @@ case EASYPMPP_END: break; + case EASYPMPP_REMOVE_UNREF|EASYPMPSP_START: + fprintf(fpo, "Removing media files if they are pointed from no links\n"); + break; + case EASYPMPP_REMOVE_UNREF|EASYPMPSP_PROGRESS: + easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); + break; + case EASYPMPP_REMOVE_UNREF|EASYPMPSP_END: + console_clearln(fpo); + fprintf(fpo, " %d files were removed\n", param_int); + fprintf(fpo, "\n"); + break; + + case EASYPMPP_SETTLE|EASYPMPSP_START: + fprintf(fpo, "Settling media files to the internal location suitable for the player\n"); + break; + case EASYPMPP_SETTLE|EASYPMPSP_PROGRESS: + easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); + break; + case EASYPMPP_SETTLE|EASYPMPSP_END: + console_clearln(fpo); + fprintf(fpo, " %d files were settled\n", param_int); + fprintf(fpo, "\n"); + break; + + case EASYPMPP_UNSETTLE|EASYPMPSP_START: + fprintf(fpo, "Restoring media files from the internal location of the player\n"); + break; + case EASYPMPP_UNSETTLE|EASYPMPSP_PROGRESS: + easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); + break; + case EASYPMPP_UNSETTLE|EASYPMPSP_END: + console_clearln(fpo); + fprintf(fpo, " %d files were restored\n", param_int); + fprintf(fpo, "\n"); + break; + case EASYPMPP_MUSIC_GMI|EASYPMPSP_START: fprintf(fpo, "Obtaining media information from %d files\n", param_int); break; @@ -196,6 +232,7 @@ pmp_t* pmp = NULL; pmplib_t* pmplib = NULL; easypmp_filelist_t musics, playlists; + easypmp_filelist_t musics_unsettled, music_links; pmp_music_record_t* records = NULL; uint32_t num_records = 0; uint32_t openflag = 0; @@ -369,17 +406,43 @@ // Enumerate music files for database and playlist modes. memset(&musics, 0, sizeof(musics)); - if ((opt.verb & MODE_DATABASE) || (opt.verb & MODE_PLAYLIST)) { + if (opt.verb & (MODE_DATABASE|MODE_PLAYLIST|MODE_SETTLE|MODE_UNSETTLE|MODE_REMOVE_UNREF)) { fprintf(fpo, "Enumerating music files in "); fputucs2str_path(fpo, pmp->info.path_to_root); fputucs2str_path(fpo, pmp->info.path_to_music); fprintf(fpo, "\n"); - easypmp_enumerate_music(&musics, pmp, &opt, easypmp_enumerate_progress, NULL); + easypmp_enumerate_music(&musics, pmp, pmp->info.path_to_music, &opt, easypmp_enumerate_progress, NULL); console_clearln(fpo); fprintf(fpo, " %d music files were found\n", musics.num_elements); fprintf(fpo, "\n"); } + // Enumerate unsettled music files. + memset(&musics_unsettled, 0, sizeof(musics_unsettled)); + if (opt.verb & (MODE_SETTLE|MODE_UNSETTLE|MODE_REMOVE_UNREF)) { + fprintf(fpo, "Enumerating unsettled music files in "); + fputucs2str_path(fpo, pmp->info.path_to_root); + fputucs2str_path(fpo, opt.path_to_unsettled_music); + fprintf(fpo, "\n"); + easypmp_enumerate_music(&musics_unsettled, pmp, opt.path_to_unsettled_music, &opt, easypmp_enumerate_progress, NULL); + console_clearln(fpo); + fprintf(fpo, " %d music files were found\n", musics_unsettled.num_elements); + fprintf(fpo, "\n"); + } + + // Enumerate music links. + memset(&music_links, 0, sizeof(music_links)); + if (opt.verb & (MODE_SETTLE|MODE_UNSETTLE|MODE_REMOVE_UNREF)) { + fprintf(fpo, "Enumerating music links in "); + fputucs2str_path(fpo, pmp->info.path_to_root); + fputucs2str_path(fpo, opt.path_to_unsettled_music); + fprintf(fpo, "\n"); + easypmp_enumerate_music_links(&music_links, pmp, opt.path_to_unsettled_music, &opt, easypmp_enumerate_progress, NULL); + console_clearln(fpo); + fprintf(fpo, " %d music links were found\n", music_links.num_elements); + fprintf(fpo, "\n"); + } + // Enumerate playlist files for playlist mode. memset(&playlists, 0, sizeof(playlists)); if (opt.verb & MODE_PLAYLIST) { @@ -397,14 +460,24 @@ fprintf(fpo, "\n"); } + // Settle/unsettle media files (mostly for iPods). + if (opt.verb & (MODE_SETTLE|MODE_UNSETTLE|MODE_REMOVE_UNREF)) { + easypmp_settle(pmp, &musics, &musics_unsettled, &music_links, &opt, easypmp_progress, NULL); + } + // Update database entries for database mode and JSPL playlists. - if ((opt.verb & MODE_DATABASE) || (opt.verb & MODE_PLAYLIST_JSPL)) { + if (opt.verb & (MODE_DATABASE|MODE_PLAYLIST_JSPL)) { easypmp_database(pmp, &musics, &opt, &records, &num_records, easypmp_progress, NULL); } // Convert playlists. if (opt.verb & MODE_PLAYLIST) { - easypmp_playlist(pmp, &playlists, &musics, &opt, records, num_records, easypmp_progress, NULL); + if (opt.verb & MODE_SETTLE) { + // Playlist referring to music_links. + easypmp_playlist(pmp, &playlists, &music_links, &opt, records, num_records, easypmp_progress, NULL); + } else { + easypmp_playlist(pmp, &playlists, &musics, &opt, records, num_records, easypmp_progress, NULL); + } } // Dump the database if specified. @@ -450,5 +523,9 @@ pmplib = NULL; } option_finish(&opt); +#ifdef _WIN32 + CoUninitialize(); +#endif/*_WIN32*/ + return ret; } Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-27 09:45:39 UTC (rev 397) @@ -79,10 +79,15 @@ fprintf(fp, " -f, --find-missing Correct playlists with corrupt references to media files\n"); fprintf(fp, " -i, --ignore-missing Continue a conversion even if a media file is missing\n"); fprintf(fp, "\n"); + fprintf(fp, "Settlement options (mostly for iPods):\n"); + fprintf(fp, " -s, --settle Settle media files in the location suitable for players\n"); + fprintf(fp, " -x, --unsettle Restore media files in the original location\n"); + fprintf(fp, " -E, --delete-unref Propagate the removal of links to the actual media files\n"); + fprintf(fp, "\n"); fprintf(fp, "Player options:\n"); fprintf(fp, " -l, --list-device Show the list of supported devices and exit\n"); fprintf(fp, " -d, --device Specify a device identifier for the player\n"); - fprintf(fp, " -s, --set=NAME:VALUE Set a variable NAME to VALUE\n"); + fprintf(fp, " -a, --set=NAME:VALUE Set a variable NAME to VALUE\n"); fprintf(fp, "\n"); #ifndef _WIN32 fprintf(fp, "Language-specific options:\n"); @@ -93,7 +98,7 @@ fprintf(fp, "Miscellaneous options:\n"); fprintf(fp, " -v, --version Show version number and exit\n"); fprintf(fp, " -h, --help Show this help message and exit\n"); - fprintf(fp, " -x, --help-variable Show the list of variables and exit\n"); + fprintf(fp, " -H, --help-variable Show the list of variables and exit\n"); } void option_usage_variable(FILE* fp) @@ -109,12 +114,14 @@ void option_init(option_t* opt) { + static const ucs2char_t path[] = {'M','u','s','i','c',0}; memset(opt, 0, sizeof(*opt)); // Set default values here. opt->media_info_source = GMIF_TAG; opt->system_encoding = strdup(ucs2getenc()); opt->music_encoding = strdup("ISO-8859-1"); + opt->path_to_unsettled_music = ucs2dup(path); } void option_finish(option_t* opt) @@ -146,10 +153,10 @@ int this_option_optind = optind ? optind : 1; int option_index = 0; static const struct option long_options[] = { - {"create", no_argument, 0, 'c'}, - {"update", no_argument, 0, 'u'}, - {"source", required_argument, 0, 'z'}, - {"repr", no_argument, 0, 'R'}, + {"create", no_argument, 0, 'c'}, + {"update", no_argument, 0, 'u'}, + {"source", required_argument, 0, 'z'}, + {"repr", no_argument, 0, 'R'}, {"repr-level", required_argument, 0, 'L'}, {"strip-words", required_argument, 0, 't'}, {"playlist", no_argument, 0, 'p'}, @@ -157,22 +164,25 @@ {"reconvert", no_argument, 0, 'r'}, {"find-missing", no_argument, 0, 'f'}, {"ignore-missing", no_argument, 0, 'i'}, + {"settle", no_argument, 0, 's'}, + {"unsettle", no_argument, 0, 'x'}, + {"delete-unref", no_argument, 0, 'E'}, {"list-device", no_argument, 0, 'l'}, - {"device", required_argument, 0, 'd'}, - {"set", required_argument, 0, 's'}, + {"device", required_argument, 0, 'd'}, + {"set", required_argument, 0, 'a'}, #ifndef _WIN32 {"encoding", required_argument, 0, 'e'}, {"tagencoding", required_argument, 0, 'w'}, #endif/*_WIN32*/ - {"version", no_argument, 0, 'v'}, - {"help", no_argument, 0, 'h'}, - {"help-variable", no_argument, 0, 'x'}, + {"version", no_argument, 0, 'v'}, + {"help", no_argument, 0, 'h'}, + {"help-variable", no_argument, 0, 'H'}, {NULL, 0, 0, 0} }; #ifndef _WIN32 - int c = getopt_long(argc, argv, "cuz:RL:t:pP:rfild:xs:e:w:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuz:RL:t:pP:rfisxEld:a:e:w:vhH", long_options, &option_index); #else - int c = getopt_long(argc, argv, "cuz:RL:t:pP:rfild:xs:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuz:RL:t:pP:rfisxEld:a:vhH", long_options, &option_index); #endif/*_WIN32*/ if (c == -1) { break; @@ -230,13 +240,23 @@ opt->verb |= MODE_PLAYLIST_SKIP; break; + case 's': + opt->verb |= MODE_SETTLE; + break; + case 'x': + opt->verb |= MODE_UNSETTLE; + break; + case 'E': + opt->verb |= MODE_REMOVE_UNREF; + break; + case 'l': opt->verb |= MODE_LIST_DEVICES; break; case 'd': strcpy(opt->model, optarg); break; - case 's': + case 'a': if (strncmp("pmp_music:", optarg, 10) == 0) { ucs2free(opt->path_to_pmp_music); opt->path_to_pmp_music = mbsdupucs2(optarg+10); @@ -265,7 +285,7 @@ case 'h': opt->verb |= MODE_HELP; break; - case 'x': + case 'H': opt->verb |= MODE_HELP_VARIABLE; break; case '?': Modified: trunk/pmplib/include/pmplib/filepath.h =================================================================== --- trunk/pmplib/include/pmplib/filepath.h 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/include/pmplib/filepath.h 2007-02-27 09:45:39 UTC (rev 397) @@ -154,6 +154,8 @@ */ FILEPATHAPI const ucs2char_t* filepath_skipadirectory(const ucs2char_t* path); +FILEPATHAPI const ucs2char_t* filepath_extract_extension(const ucs2char_t* path); + /** * Add a file extension to the end of a string. * @@ -277,6 +279,14 @@ FILEPATHAPI int filepath_is_dir(const ucs2char_t *path); /** + * Test if a filepath name is a link to another file. + * + * @param path The filepath name to be tested. + * @retval int True or false. + */ +FILEPATHAPI int filepath_is_link(const ucs2char_t *path); + +/** * Test if a filepath name represents a relative path. * * @param path The filepath name to be tested. @@ -324,6 +334,8 @@ */ FILEPATHAPI uint32_t filepath_size(const ucs2char_t *filename); +FILEPATHAPI int filepath_createdirs(const ucs2char_t* filename); + /** * Remove a file. * @@ -341,6 +353,35 @@ */ FILEPATHAPI int filepath_copyfile(const ucs2char_t* src, const ucs2char_t* dst); +/** + * Move a file. + * + * @param src The name of a source file to be moved. + * @param dst The name of a destination to be created. + * @retval int True if succeeded, false otherwise. + */ +FILEPATHAPI int filepath_movefile(const ucs2char_t* src, const ucs2char_t* dst); + +/** + * Create a link to a file. + * + * @param src The name of a source file to be linked. + * @param link The name of a link file to be created. + * @retval int True if succeeded, false otherwise. + */ +FILEPATHAPI int filepath_linkfile(const ucs2char_t* src, const ucs2char_t* link); + +/** + * Remove a link file. + * + * @param file The name of a link file to be removed. + * @retval int True if succeeded, false otherwise. + */ +FILEPATHAPI int filepath_removelinkfile(const ucs2char_t* file); + +FILEPATHAPI int filepath_followlink(const ucs2char_t* link, ucs2char_t* org); + + /** @} */ Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-27 09:45:39 UTC (rev 397) @@ -203,7 +203,7 @@ 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. */ + /** Relative path to the directory for settled music files. */ ucs2char_t path_to_music[MAX_PATH]; /** Relative path to the playlist directory from the root. */ ucs2char_t path_to_playlist[MAX_PATH]; Modified: trunk/pmplib/lib/filepath/filepath.vcproj =================================================================== --- trunk/pmplib/lib/filepath/filepath.vcproj 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/lib/filepath/filepath.vcproj 2007-02-27 09:45:39 UTC (rev 397) @@ -4,6 +4,7 @@ Version="8.00" Name="filepath" ProjectGUID="{AA8DA82B-C209-4ABE-ABA1-22352962426D}" + RootNamespace="filepath" Keyword="Win32Proj" > <Platforms> Modified: trunk/pmplib/lib/filepath/filepath_win32.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-27 09:45:39 UTC (rev 397) @@ -31,11 +31,15 @@ #include <sys/stat.h> #include <windows.h> +#include <shlobj.h> #include <shlwapi.h> +#pragma comment(lib, "shell32.lib") +#pragma comment(lib, "shlwapi.lib") #include <pmplib/filepath.h> -#pragma comment(lib, "shlwapi.lib") +static const ucs2char_t ucs2cs_link_ext[] = {'.','m','3','u','8',0}; + int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance) { HANDLE hFile = INVALID_HANDLE_VALUE; @@ -133,6 +137,12 @@ return p ? p+1 : NULL; } +const ucs2char_t* filepath_extract_extension(const ucs2char_t* path) +{ + ucs2char_t* p = ucs2rchr(path, '.'); + return p ? p : path; +} + void filepath_strippath(ucs2char_t* path) { PathStripPathW(path); @@ -206,17 +216,88 @@ return ret; } +int filepath_createdirs(const ucs2char_t* filename) +{ + return SHCreateDirectoryExW(NULL, (LPCWSTR)filename, NULL) == ERROR_SUCCESS ? 0 : 1; +} + int filepath_copyfile(const ucs2char_t* src, const ucs2char_t* dst) { return CopyFileW(src, dst, FALSE) ? 0 : -1; } +int filepath_movefile(const ucs2char_t* src, const ucs2char_t* dst) +{ + return MoveFileW(src, dst) ? 0 : -1; +} + int filepath_removefile(const ucs2char_t* file) { SetFileAttributesW(file, FILE_ATTRIBUTE_NORMAL); return DeleteFileW(file); } +int filepath_linkfile(const ucs2char_t* target, const ucs2char_t* link) +{ + /* Create a m3u8 playlist with the target file. */ + FILE *fp = NULL; + ucs2char_t* _link = alloca(sizeof(ucs2char_t) * (ucs2len(link) + ucs2len(ucs2cs_link_ext) + 1)); + + /* Add ".m3u8" extension. */ + ucs2cpy(_link, link); + ucs2cat(_link, ucs2cs_link_ext); + + /* Write the */ + fp = ucs2fopen(_link, "w"); + if (fp) { + char *utf8 = ucs2duputf8((const ucs2char_t*)PathSkipRootW((LPCWSTR)target)); + fputc('\\', fp); + fputs(utf8, fp); + ucs2free(utf8); + fclose(fp); + return 0; + } else { + return -1; + } +} + +int filepath_followlink(const ucs2char_t* link, ucs2char_t* org) +{ + /* Create a m3u8 playlist with the target file. */ + FILE *fp = NULL; + ucs2char_t* _link = (ucs2char_t*)alloca( + sizeof(ucs2char_t) * (ucs2len(link) + ucs2len(ucs2cs_link_ext) + 1)); + + /* Add ".m3u8" extension. */ + ucs2cpy(_link, link); + ucs2cat(_link, ucs2cs_link_ext); + + /* Write the */ + fp = ucs2fopen(_link, "r"); + if (fp) { + char buff[MAX_PATH*4]; + ucs2char_t target[MAX_PATH]; + fgets(buff, sizeof(buff)-1, fp); + utf8toucs2(target, MAX_PATH, buff, strlen(buff)+1); + filepath_combinepath(org, MAX_PATH, link, target); + return 0; + } else { + return -1; + } +} + +int filepath_removelinkfile(const ucs2char_t* file) +{ + ucs2char_t* _link = (ucs2char_t*)alloca( + sizeof(ucs2char_t) * (ucs2len(file) + ucs2len(ucs2cs_link_ext) + 1)); + + /* Add ".m3u8" extension. */ + ucs2cpy(_link, file); + ucs2cat(_link, ucs2cs_link_ext); + + return filepath_removefile(_link); +} + int filepath_encode(ucs2char_t* path) { /* Does nothing for WIN32. */ @@ -260,3 +341,8 @@ } return 0; } + +int filepath_is_link(const ucs2char_t *path) +{ + return filepath_hasext(path, ucs2cs_link_ext); +} Modified: trunk/pmplib/lib/pmp_ipod/pmp_ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/pmp_ipod.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/lib/pmp_ipod/pmp_ipod.c 2007-02-27 09:45:39 UTC (rev 397) @@ -415,7 +415,6 @@ if (pmp->flag & PMPOF_MUSIC_DB_WRITE) { ipod_set(&ipod, pmpmi->records, pmpmi->num_records, pmpmi->playlists, pmpmi->num_playlists); ipod_write(&ipod, itunesdb); - ipod_dump(&ipod, stdout); } exit_this: Modified: trunk/pmplib/lib/pmp_ipod/pmp_ipod.vcproj =================================================================== --- trunk/pmplib/lib/pmp_ipod/pmp_ipod.vcproj 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/lib/pmp_ipod/pmp_ipod.vcproj 2007-02-27 09:45:39 UTC (rev 397) @@ -193,6 +193,10 @@ > </File> <File + RelativePath=".\settledb.c" + > + </File> + <File RelativePath=".\util.c" > </File> @@ -215,6 +219,10 @@ > </File> <File + RelativePath=".\settledb.h" + > + </File> + <File RelativePath=".\util.h" > </File> Modified: trunk/pmplib/lib/ucs2/ucs2char.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/lib/ucs2/ucs2char.c 2007-02-27 09:45:39 UTC (rev 397) @@ -410,3 +410,13 @@ } return dst; } + +char *ucs2duputf8(const ucs2char_t *ucs2str) +{ + size_t mbs_size = ucs2toutf8(NULL, 0, ucs2str, ucs2len(ucs2str)) + 1; + char* dst = (char *)malloc(mbs_size * sizeof(char)); + if (dst) { + ucs2toutf8(dst, mbs_size, ucs2str, ucs2len(ucs2str)+1); + } + return dst; +} Modified: trunk/pmplib/lib/ucs2/ucs2char_win32.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-25 14:16:32 UTC (rev 396) +++ trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-27 09:45:39 UTC (rev 397) @@ -99,8 +99,13 @@ return MultiByteToWideChar(CP_UTF8, 0, mbstr, (int)mbs_len, ucs2str, (int)ucs_len); } +size_t ucs2toutf8(char *mbstr, size_t mbs_len, const ucs2char_t *ucs2str, size_t ucs_len) +{ + return WideCharToMultiByte(CP_UTF8, 0, ucs2str, (int)ucs_len, mbstr, (int)mbs_len, NULL, NULL); +} + wchar_t* mbsdupwcs(const char *mbstr) { /* Just call mbsdupucs2(). */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-27 14:29:39
|
Revision: 399 http://svn.sourceforge.net/pmplib/?rev=399&view=rev Author: nyaochi Date: 2007-02-27 06:29:36 -0800 (Tue, 27 Feb 2007) Log Message: ----------- Fixed a bug in settlement operation. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/settle.c trunk/pmplib/lib/filepath/filepath_win32.c Modified: trunk/pmplib/frontend/easypmp/common/settle.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/settle.c 2007-02-27 14:15:54 UTC (rev 398) +++ trunk/pmplib/frontend/easypmp/common/settle.c 2007-02-27 14:29:36 UTC (rev 399) @@ -20,7 +20,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -103,13 +103,17 @@ } n = 0; - for (i = 0;i < musics->num_elements;++i) { + i = 0; + while (i < musics->num_elements) { ucs2cpy(music, musics->elements[i].name); // Check the existence of a link referring to the music file. for (j = 0;j < music_links->num_elements;++j) { // Obtain the filename pointed by this link. ucs2cpy(link, music_links->elements[j].name); + if (i == 20) { + i = 20; + } if (filepath_followlink(link, target) == 0) { if (ucs2icmp(music, target) == 0) { break; @@ -121,28 +125,31 @@ if (j == music_links->num_elements) { filepath_removefile(music); remove_file_from_list(musics, i); - --i; if (progress(instance, EASYPMPP_REMOVE_UNREF|EASYPMPSP_PROGRESS, n, 0, music) != 0) { result = EASYPMPE_CANCEL; goto error_exit; } n++; + } else { + ++i; } } - for (i = 0;i < music_links->num_elements;++i) { + i = 0; + while (i < music_links->num_elements) { ucs2cpy(link, music_links->elements[j].name); if (filepath_followlink(link, target) != 0) { filepath_removelinkfile(link); remove_file_from_list(music_links, i); - --i; if (progress(instance, EASYPMPP_REMOVE_UNREF|EASYPMPSP_PROGRESS, n, 0, music) != 0) { result = EASYPMPE_CANCEL; goto error_exit; } n++; + } else { + ++i; } } @@ -160,7 +167,8 @@ } n = 0; - for (i = 0;i < musics_unsettled->num_elements;++i) { + i = 0; + while (i < musics_unsettled->num_elements) { // Source music file. ucs2cpy(music, musics_unsettled->elements[i].name); @@ -181,7 +189,6 @@ filepath_movefile(music, target); add_file_to_list(musics, target); remove_file_from_list(musics_unsettled, i); - --i; // Create a symbolic link (or shortcut) from the source to the destination. filepath_linkfile(target, music); @@ -207,7 +214,8 @@ } n = 0; - for (i = 0;i < music_links->num_elements;++i) { + i = 0; + while (i < music_links->num_elements) { // Source music link. ucs2cpy(link, music_links->elements[i].name); @@ -228,13 +236,14 @@ // Remove the link file. filepath_removelinkfile(link); remove_file_from_list(music_links, i); - --i; if (progress(instance, EASYPMPP_UNSETTLE|EASYPMPSP_PROGRESS, n, 0, music) != 0) { result = EASYPMPE_CANCEL; goto error_exit; } n++; + } else { + ++i; } } Modified: trunk/pmplib/lib/filepath/filepath_win32.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-27 14:15:54 UTC (rev 398) +++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-27 14:29:36 UTC (rev 399) @@ -280,6 +280,7 @@ fgets(buff, sizeof(buff)-1, fp); utf8toucs2(target, MAX_PATH, buff, strlen(buff)+1); filepath_combinepath(org, MAX_PATH, link, target); + fclose(fp); return 0; } else { return -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-27 15:20:57
|
Revision: 400 http://svn.sourceforge.net/pmplib/?rev=400&view=rev Author: nyaochi Date: 2007-02-27 07:20:57 -0800 (Tue, 27 Feb 2007) Log Message: ----------- Implemented playlist conversion for iPod players. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/lib/pmp_ipod/ipod.c trunk/pmplib/lib/pmp_ipod/pmp_ipod.c Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-27 14:29:36 UTC (rev 399) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-27 15:20:57 UTC (rev 400) @@ -472,12 +472,7 @@ // Convert playlists. if (opt.verb & MODE_PLAYLIST) { - if (opt.verb & MODE_SETTLE) { - // Playlist referring to music_links. - easypmp_playlist(pmp, &playlists, &music_links, &opt, records, num_records, easypmp_progress, NULL); - } else { - easypmp_playlist(pmp, &playlists, &musics, &opt, records, num_records, easypmp_progress, NULL); - } + easypmp_playlist(pmp, &playlists, &musics, &opt, records, num_records, easypmp_progress, NULL); } // Dump the database if specified. Modified: trunk/pmplib/lib/pmp_ipod/ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-27 14:29:36 UTC (rev 399) +++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-27 15:20:57 UTC (rev 400) @@ -434,6 +434,7 @@ itunesdb_chunk_t *mhod = NULL, *mhip = NULL; chunk_mhyp_t* mhyp_data = (chunk_mhyp_t*)mhyp->data; sorted_index_t* si = (sorted_index_t*)calloc(num_records, sizeof(sorted_index_t)); + const static ucs2char_t ucs2cs_master[] = {'M','a','s','t','e','r',0}; if (!si) { return 1; @@ -454,7 +455,7 @@ mhod = itunesdb_new_child(mhyp); if (mhod) { itunesdb_init(mhod, "mhod", "title"); - itunesdb_set_mhod_string(mhod, L"Nyaopod"); + itunesdb_set_mhod_string(mhod, ucs2cs_master); } /* Construct an "mhod" chunk for title index. */ @@ -526,6 +527,70 @@ return 0; } +static uint32_t get_record_index(const ucs2char_t* filename, const pmp_music_record_t* records, int num_records) +{ + uint32_t i; + + for (i = 0;i < num_records;++i) { + if (ucs2icmp(records[i].filename, filename) == 0) { + break; + } + } + return i; +} + +static int set_playlist(itunesdb_chunk_t* mhyp, const pmp_playlist_t* playlist, const pmp_music_record_t* records, int num_records) +{ + int i; + itunesdb_chunk_t *mhod = NULL, *mhip = NULL; + chunk_mhyp_t* mhyp_data = (chunk_mhyp_t*)mhyp->data; + + mhyp_data->flag_master = 0; + mhyp_data->id = 0x7520EA5FA870F9EA; + mhyp_data->unk3 = 0; + mhyp_data->unk4 = 1; + mhyp_data->sort_order = 1; + + /* Construct an "mhod" chunk for title. */ + mhod = itunesdb_new_child(mhyp); + if (mhod) { + itunesdb_init(mhod, "mhod", "title"); + itunesdb_set_mhod_string(mhod, playlist->name); + } + + /* End of "mhod" chunk(s). */ + mhyp_data->num_mhod = mhyp->num_children; + + /* */ + for (i = 0;i < playlist->num_entries;++i) { + uint32_t index = get_record_index(playlist->entries[i], records, num_records); + + if (index < num_records) { + mhip = itunesdb_new_child(mhyp); + if (mhip) { + chunk_mhip_t* mhip_data = NULL; + itunesdb_init(mhip, "mhip", NULL); + mhip_data = (chunk_mhip_t*)mhip->data; + + mhip_data->flag_podcast_group = 0; + mhip_data->track_id = index; + mhip_data->group_id = index + num_records; + + mhod = itunesdb_new_child(mhip); + if (mhod) { + itunesdb_init(mhod, "mhod", "playlist_order"); + itunesdb_set_mhod_playlist_order(mhod, i+1); + } + + mhip_data->num_mhod = mhip->num_children; + } + } + } + + mhyp_data->num_mhip = mhyp->num_children - mhyp_data->num_mhod; + return 0; +} + result_t ipod_set(ipod_t* ipod, const pmp_music_record_t* records, int num_records, const pmp_playlist_t* playlists, int num_playlists) { int i; @@ -582,19 +647,27 @@ if (mhlp) { itunesdb_init(mhlp, "mhlp", NULL); + /* Create a master playlist. */ mhyp = itunesdb_new_child(mhlp); if (mhyp) { chunk_mhyp_t* mhyp_data = NULL; itunesdb_init(mhyp, "mhyp", NULL); - mhyp_data = (chunk_mhyp_t*)mhyp->data; - set_master_playlist(mhyp, records, num_records); } + + /* Create user's playlists. */ + for (i = 0;i < num_playlists;++i) { + mhyp = itunesdb_new_child(mhlp); + if (mhyp) { + chunk_mhyp_t* mhyp_data = NULL; + itunesdb_init(mhyp, "mhyp", NULL); + set_playlist(mhyp, &playlists[i], records, num_records); + } + } } } mhbd_data->num_children = mhbd->num_children; - ipod->itunesdb = mhbd; return 0; } Modified: trunk/pmplib/lib/pmp_ipod/pmp_ipod.c =================================================================== --- trunk/pmplib/lib/pmp_ipod/pmp_ipod.c 2007-02-27 14:29:36 UTC (rev 399) +++ trunk/pmplib/lib/pmp_ipod/pmp_ipod.c 2007-02-27 15:20:57 UTC (rev 400) @@ -482,5 +482,15 @@ static result_t pmpmusic_set_playlists(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists) { - return PMPERR_NOTIMPLIMENTED; + pmp_t* pmp = music->pmp; + pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; + + /* Free playlists attached to pmpmi. */ + pmplib_playlists_finish(pmpmi->playlists, pmpmi->num_playlists); + + /* Allocate new playlists. */ + pmpmi->playlists = (pmp_playlist_t*)ucs2malloc(sizeof(pmp_playlist_t) * num_playlists); + pmpmi->num_playlists = num_playlists; + pmplib_playlists_clone(pmpmi->playlists, playlists, num_playlists); + return 0;; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |