From: <ny...@us...> - 2007-01-18 15:06:28
|
Revision: 270 http://svn.sourceforge.net/pmplib/?rev=270&view=rev Author: nyaochi Date: 2007-01-18 07:06:25 -0800 (Thu, 18 Jan 2007) Log Message: ----------- Incremental commit before starting additional E10 database analysis for playlists. Pleylists seem to be integrated in the database although iriver plus 3 generates *.plp file in \Playlists directory. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp/pmp.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj Added Paths: ----------- trunk/pmplib/lib/pmp_iriverplus3/plp.c Removed Paths: ------------- trunk/pmplib/lib/pmp_iriverplus3/playlist.c Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-18 15:06:25 UTC (rev 270) @@ -75,24 +75,24 @@ ) { int result = 0; - /* int i, j, num_succeeded = 0; char *mbs = NULL; - pmp_playlist_t* pmppl = NULL; + pmp_music_t* music = NULL; playlist_mediafile_t* mediafiles = NULL; + pmp_playlist_t* pmppls = NULL; + int num_pmppls = 0; result_t res = 0; callback_data_t cd; + ucs2char_t dstpath[MAX_PATH]; cd.instance = instance; cd.progress = progress; - // Create playlist instance. - res = pmp->create_instance_pl(pmp, &pmppl); - if (!pmppl) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } + // Query the interface to music. + music = pmp->music; + filepath_combinepath(dstpath, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); + // Start playlist processing. if (progress(instance, EASYPMPPLP_START, 0, 0, NULL) != 0) { result = EASYPMPE_CANCEL; @@ -160,11 +160,11 @@ ucs2char_t** contents = NULL; playlist_t* pl = &pls.playlists[k]; ucs2char_t dst[MAX_PATH]; + pmp_playlist_t* pmppl = NULL; // Generate a destination filename. - filepath_combinepath(dst, MAX_PATH, pmp->env.path_to_playlist.path, filepath_skippath(pl->name)); + filepath_combinepath(dst, MAX_PATH, dstpath, filepath_skippath(pl->name)); filepath_remove_extension(dst); - ucs2cat(dst, pmp->env.playlist_ext); // Skipping the existing playlist if (!(opt->verb & MODE_PLAYLIST_RECONVERT)) { @@ -186,7 +186,7 @@ n = playlist_normalize( pl, filepath_skippath(pl->name), - pmp->env.path_to_root.path, + pmp->info.path_to_root, mediafiles, musics->num_elements ); @@ -221,31 +221,32 @@ } } + pmppls = (pmp_playlist_t*)realloc(pmppls, sizeof(pmp_playlist_t) * (num_pmppls+1)); + pmppl = &pmppls[num_pmppls]; + // Allocate a memory block for the contents of the playlist. - contents = (ucs2char_t**)calloc(pl->num_entries, sizeof(ucs2char_t*)); - if (!contents) { + pmppl->entries = (ucs2char_t**)calloc(pl->num_entries, sizeof(ucs2char_t*)); + pmppl->num_entries = pl->num_entries; + pmppl->name = ucs2dup(dst); + + if (!pmppl->entries) { result = EASYPMPE_INSUFFICIENT_MEMORY; goto error_exit; } for (j = 0, n = 0;j < pl->num_entries;++j) { if (pl->entries[j].valid && pl->entries[j].filename[0]) { - contents[n] = ucs2dup(pl->entries[j].filename); + pmppl->entries[n] = ucs2dup(pl->entries[j].filename); ++n; } } - // Write the converted playlist. - pmppl->write(pmppl, dst, contents, n); ++num_succeeded; - - // Free the contents of the playlist. - for (j = 0;j < n;++j) { - ucs2free(contents[j]); - } - free(contents); + ++num_pmppls; } } + music->set_playlists(music, pmppls, num_pmppls); + // Finish playlist conversion. if (progress(instance, EASYPMPPLP_CONVERT | EASYPMPSP_END, num_succeeded, 0, NULL) != 0) { result = EASYPMPE_CANCEL; @@ -259,12 +260,11 @@ } error_exit: + for (i = 0;i < num_pmppls;++i) { + pmp_playlist_finish(&pmppls[i]); + } + free(pmppls); free(mediafiles); - if (pmppl) { - pmppl->release(pmppl); - pmppl = NULL; - } - */ return result; } /** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-18 15:06:25 UTC (rev 270) @@ -336,6 +336,10 @@ openflag |= PMPOF_MUSIC_DB_READ; } + if (opt.verb & MODE_PLAYLIST) { + openflag |= PMPOF_MUSIC_PL_WRITE; + } + // Open the PMP. ret = pmp->open(pmp, openflag); @@ -394,7 +398,7 @@ free(records); } - pmp->close(pmp, 0); + pmp->close(pmp); pmp->release(pmp); pmplib_finish(pmphelp); option_finish(&opt); Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/include/pmp.h 2007-01-18 15:06:25 UTC (rev 270) @@ -271,9 +271,8 @@ /** * Close the PMP device. * @param pmp The pointer to the pmp_t instance. - * @param flag The close flags. */ - result_t (*close)(pmp_t* pmp, uint32_t flag); + result_t (*close)(pmp_t* pmp); }; typedef void pmpdb_readwrite_progress_t(void *instance, uint32_t size, uint32_t total); @@ -304,13 +303,9 @@ typedef struct tag_pmp_music_record_t pmp_music_record_t; typedef struct { - ucs2char_t filename[MAX_PATH]; -} pmp_playlist_entry_t; - -typedef struct { - ucs2char_t name[MAX_PATH]; + ucs2char_t *name; int num_entries; - pmp_playlist_entry_t* entries; + ucs2char_t **entries; } pmp_playlist_t; struct tag_pmp_music_t { @@ -341,11 +336,13 @@ PMPAPI uint32_t pmp_interlocked_increment(uint32_t* count); PMPAPI uint32_t pmp_interlocked_decrement(uint32_t* count); +PMPAPI void pmp_playlist_init(pmp_playlist_t* playlist); +PMPAPI void pmp_playlist_finish(pmp_playlist_t* playlist); +PMPAPI void pmp_playlist_copy(pmp_playlist_t* dst, const pmp_playlist_t* src); - /** * @defgroup pmplib PMPlib Helper API * Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/lib/pmp/pmp.c 2007-01-18 15:06:25 UTC (rev 270) @@ -62,3 +62,30 @@ dst->date = src->date ? ucs2dup(src->date) : NULL; return 0; } + +void pmp_playlist_init(pmp_playlist_t* playlist) +{ + memset(playlist, 0, sizeof(*playlist)); +} + +void pmp_playlist_finish(pmp_playlist_t* playlist) +{ + int i; + for (i = 0;i < playlist->num_entries;++i) { + ucs2free(playlist->entries[i]); + } + ucs2free(playlist->entries); + ucs2free(playlist->name); +} + +void pmp_playlist_copy(pmp_playlist_t* dst, const pmp_playlist_t* src) +{ + int i; + + dst->name = ucs2dup(src->name); + dst->num_entries = src->num_entries; + dst->entries = (ucs2char_t**)ucs2calloc(sizeof(ucs2char_t*) * src->num_entries); + for (i = 0;i < src->num_entries;++i) { + dst->entries[i] = ucs2dup(src->entries[i]); + } +} Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-01-18 15:06:25 UTC (rev 270) @@ -29,12 +29,14 @@ #include <stdio.h> #include <stdlib.h> #include <ucs2char.h> +#include <filepath.h> #include "util.h" #include "ip3db.h" #include "dic.h" #include "dat.h" #include "idx.h" +#include "plp.h" void ip3db_variant_init(ip3db_variant_t* var, int type) { @@ -247,3 +249,51 @@ ip3db_variant_finish(&var[i]); } } + +void ip3db_playlist_init(ip3db_playlist_t* playlist) +{ + memset(playlist, 0, sizeof(*playlist)); +} + +void ip3db_playlist_finish(ip3db_playlist_t* playlist) +{ + int i; + for (i = 0;i < playlist->num_entries;++i) { + ucs2free(playlist->entries[i]); + } + ucs2free(playlist->entries); + ucs2free(playlist->filepath); + ucs2free(playlist->filename); +} + +void ip3db_playlist_copy(ip3db_playlist_t* dst, const ip3db_playlist_t* src) +{ + int i; + + dst->filepath = ucs2dup(src->filepath); + dst->filename = ucs2dup(src->filename); + dst->num_entries = src->num_entries; + dst->entries = (ucs2char_t**)ucs2calloc(sizeof(ucs2char_t*) * src->num_entries); + for (i = 0;i < src->num_entries;++i) { + dst->entries[i] = ucs2dup(src->entries[i]); + } +} + +int ip3db_write_playlists(ip3db_t* db, const ip3db_playlist_t* playlists, int num_playlists, const ucs2char_t *path_to_root) +{ + int i; + + for (i = 0;i < num_playlists;++i) { + ucs2char_t filename[MAX_PATH]; + const ip3db_playlist_t* pl = &playlists[i]; + + ucs2cpy(filename, path_to_root); + ucs2cat(filename, pl->filepath + 1); + ucs2cat(filename, pl->filename); + filepath_backslash(filename); + + plp_write(db, filename, pl->entries, pl->num_entries, path_to_root); + } + + return 0; +} Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2007-01-18 15:06:25 UTC (rev 270) @@ -55,6 +55,8 @@ typedef struct { ucs2char_t* filepath; ucs2char_t* filename; + int num_entries; + ucs2char_t **entries; } ip3db_playlist_t; /** @@ -189,15 +191,14 @@ int ip3db_num_records(ip3db_t* db); ip3db_music_record_t* ip3db_get_record(ip3db_t* db, int i); result_t ip3db_dump(ip3db_t* db, FILE *fpo); -int ip3db_playlist_write( - ip3db_t* db, - const ucs2char_t *filename, - ucs2char_t* const mediafiles[], - int num_mediafiles, - const ucs2char_t *path_to_root - ); +int ip3db_write_playlists(ip3db_t* db, const ip3db_playlist_t* playlists, int num_playlists, const ucs2char_t *path_to_root); + void ip3db_record_init(ip3db_t* db, ip3db_music_record_t* record); void ip3db_record_finish(ip3db_t* db, ip3db_music_record_t* record); +void ip3db_playlist_init(ip3db_playlist_t* playlist); +void ip3db_playlist_finish(ip3db_playlist_t* playlist); +void ip3db_playlist_copy(ip3db_playlist_t* dst, const ip3db_playlist_t* src); + #endif /*_IP3DB_IP3DB_H__*/ Deleted: trunk/pmplib/lib/pmp_iriverplus3/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/playlist.c 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/lib/pmp_iriverplus3/playlist.c 2007-01-18 15:06:25 UTC (rev 270) @@ -1,120 +0,0 @@ -/* - * Playlist reader/writer for iriver E10. - * - * Copyright (c) 2005-2006 Nyaochi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif/*HAVE_CONFIG_H*/ - -#include <os.h> -#include <stdio.h> -#include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> - -#include "serialize.h" -#include "util.h" -#include "ip3db.h" -#include "dat.h" - -static uint32_t findfile(ip3db_t* db, const ucs2char_t *filename, const ucs2char_t *path_to_root) -{ - int i; - const ucs2char_t *filepart = filepath_skippath(filename); - const ucs2char_t *pathfile = filepath_skipdrive(filename, path_to_root); - ucs2char_t *pathname = alloca(sizeof(ucs2char_t) * (ucs2len(pathfile) + 1)); - - ucs2cpy(pathname, pathfile); - filepath_remove_filespec(pathname); - filepath_addslash(pathname); - filepath_slash(pathname); - - for (i = 0;i < db->dat->musics.num_entries;++i) { - dat_entry_t* entry = &db->dat->musics.entries[i]; - if (ucs2icmp(entry->fields[IP3DBF_MUSIC_FILENAME].value.str, filepart) == 0 && - ucs2icmp(entry->fields[IP3DBF_MUSIC_FILEPATH].value.str, pathname) == 0) { - return entry->fields[IP3DBF_MUSIC_UID].value.dword; - } - } - return 0; -} - -int ip3db_playlist_write( - ip3db_t* db, - const ucs2char_t *filename, - ucs2char_t* const mediafiles[], - int num_mediafiles, - const ucs2char_t *path_to_root - ) -{ - int i; - FILE *fp = NULL; - uint32_t* uids = NULL; - uint32_t num_uids = 0; - - for (i = 0;i < num_mediafiles;i++) { - if (mediafiles[i][0]) { - uint32_t uid = 0; - ucs2char_t mediafile[MAX_PATH]; - ucs2cpy(mediafile, mediafiles[i]); - - uid = findfile(db, mediafile, path_to_root); - if (uid <= 0) { - goto error_exit; - } - - uids = realloc(uids, sizeof(uint32_t) * (num_uids+1)); - if (!uids) { - goto error_exit; - } - uids[num_uids++] = uid; - } - } - - fp = ucs2fopen(filename, "wb"); - if (fp) { - size_t size = sizeof(uint32_t) + sizeof(uint32_t) * num_uids; - uint8_t* buffer = (uint8_t*)malloc(size); - uint8_t* p = buffer; - - if (!buffer) { - goto error_exit; - } - - p += serialize_uint32le(p, &num_uids, 1); - for (i = 0;i < (int)num_uids;++i) { - p += serialize_uint32le(p, &uids[i], 1); - } - fwrite(buffer, 1, size, fp); - free(buffer); - fclose(fp); - } else { - return -1; - } - - free(uids); - return 0; - -error_exit: - free(uids); - return -1; -} Copied: trunk/pmplib/lib/pmp_iriverplus3/plp.c (from rev 263, trunk/pmplib/lib/pmp_iriverplus3/playlist.c) =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/plp.c (rev 0) +++ trunk/pmplib/lib/pmp_iriverplus3/plp.c 2007-01-18 15:06:25 UTC (rev 270) @@ -0,0 +1,120 @@ +/* + * Playlist reader/writer for iriver E10. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#include <os.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucs2char.h> +#include <filepath.h> + +#include "serialize.h" +#include "util.h" +#include "ip3db.h" +#include "dat.h" + +static uint32_t findfile(ip3db_t* db, const ucs2char_t *filename, const ucs2char_t *path_to_root) +{ + int i; + const ucs2char_t *filepart = filepath_skippath(filename); + const ucs2char_t *pathfile = filepath_skipdrive(filename, path_to_root); + ucs2char_t *pathname = alloca(sizeof(ucs2char_t) * (ucs2len(pathfile) + 1)); + + ucs2cpy(pathname, pathfile); + filepath_remove_filespec(pathname); + filepath_addslash(pathname); + filepath_slash(pathname); + + for (i = 0;i < db->dat->musics.num_entries;++i) { + dat_entry_t* entry = &db->dat->musics.entries[i]; + if (ucs2icmp(entry->fields[IP3DBF_MUSIC_FILENAME].value.str, filepart) == 0 && + ucs2icmp(entry->fields[IP3DBF_MUSIC_FILEPATH].value.str, pathname) == 0) { + return entry->fields[IP3DBF_MUSIC_UID].value.dword; + } + } + return 0; +} + +int plp_write( + ip3db_t* db, + const ucs2char_t *filename, + ucs2char_t* const mediafiles[], + int num_mediafiles, + const ucs2char_t *path_to_root + ) +{ + int i; + FILE *fp = NULL; + uint32_t* uids = NULL; + uint32_t num_uids = 0; + + for (i = 0;i < num_mediafiles;i++) { + if (mediafiles[i][0]) { + uint32_t uid = 0; + ucs2char_t mediafile[MAX_PATH]; + ucs2cpy(mediafile, mediafiles[i]); + + uid = findfile(db, mediafile, path_to_root); + if (uid <= 0) { + goto error_exit; + } + + uids = realloc(uids, sizeof(uint32_t) * (num_uids+1)); + if (!uids) { + goto error_exit; + } + uids[num_uids++] = uid; + } + } + + fp = ucs2fopen(filename, "wb"); + if (fp) { + size_t size = sizeof(uint32_t) + sizeof(uint32_t) * num_uids; + uint8_t* buffer = (uint8_t*)malloc(size); + uint8_t* p = buffer; + + if (!buffer) { + goto error_exit; + } + + p += serialize_uint32le(p, &num_uids, 1); + for (i = 0;i < (int)num_uids;++i) { + p += serialize_uint32le(p, &uids[i], 1); + } + fwrite(buffer, 1, size, fp); + free(buffer); + fclose(fp); + } else { + return -1; + } + + free(uids); + return 0; + +error_exit: + free(uids); + return -1; +} Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-18 15:06:25 UTC (rev 270) @@ -71,7 +71,7 @@ "System\\E10.SYS", "System\\db.dat", "System\\db.dic", "System\\db.idx", ".mp3\0.ogg\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_VORBIS, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "", "Playlists\\", + "System\\", "Music2\\", "Playlists\\", ".plp", }, { @@ -100,7 +100,7 @@ static uint32_t pmp_add_ref(pmp_t* pmp); static uint32_t pmp_release(pmp_t* pmp); static result_t pmp_open(pmp_t* pmp, uint32_t flag); -static result_t pmp_close(pmp_t* pmp, uint32_t flag); +static result_t pmp_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* pmpdb); @@ -416,17 +416,29 @@ return 0; } -static result_t pmp_close(pmp_t* pmp, uint32_t flag) +static result_t pmp_close(pmp_t* pmp) { result_t ret = 0; - if (pmp->flag & PMPOF_MUSIC_DB_WRITE) { + + // Music database/playlist. + if (pmp->flag & PMPOF_MUSIC_DB_WRITE || pmp->flag & PMPOF_MUSIC_PL_WRITE) { ucs2char_t dat[MAX_PATH], dic[MAX_PATH], idx[MAX_PATH]; pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)pmp->music->instance; - ip3db_set(&pmpmi->ip3db, pmpmi->records, pmpmi->num_records, pmpmi->playlists, pmpmi->num_playlists); + // Register records (and playlists) to the database. + if (pmp->flag & PMPOF_MUSIC_PL_WRITE) { + ip3db_set(&pmpmi->ip3db, pmpmi->records, pmpmi->num_records, pmpmi->playlists, pmpmi->num_playlists); + } else { + ip3db_set(&pmpmi->ip3db, pmpmi->records, pmpmi->num_records, NULL, 0); + } + // Write out the playlist first. + ip3db_write_playlists(&pmpmi->ip3db, pmpmi->playlists, pmpmi->num_playlists, pmp->info.path_to_root); + + // Write out the music database. set_filenames(dat, dic, idx, pmp); - return ip3db_write(&pmpmi->ip3db, dat, dic, idx); + ret = ip3db_write(&pmpmi->ip3db, dat, dic, idx); + } return 0; } @@ -605,14 +617,44 @@ } } -static result_t pmpmusic_set_playlists(pmp_music_t* pmpmusic, const pmp_playlist_t* playlists, uint32_t num_playlists) +static result_t pmpmusic_set_playlists(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists) { - /* - pmppl_internal_t* pmppli = (pmppl_internal_t*)pmppl->instance; - pmp_internal_t* pmpi = (pmp_internal_t*)pmppl->pmp->instance; - if (ip3db_playlist_write(&pmppli->ip3db, filename, files, num_files, pmpi->env.path_to_root) != 0) { - return PMPPLE_WRITE; + uint32_t i, j; + static const ucs2char_t plp_ext[] = {'.','p','l','p',0}; + pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; + + // Free playlists attached to pmpmi. + for (i = 0;i < pmpmi->num_playlists;++i) { + ip3db_playlist_finish(&pmpmi->playlists[i]); } - */ + free(pmpmi->playlists); + + // Allocate a new playlists. + pmpmi->playlists = (ip3db_playlist_t*)calloc(num_playlists, sizeof(ip3db_playlist_t)); + pmpmi->num_playlists = num_playlists; + + // Copy the content of the playlists. + for (i = 0;i < num_playlists;++i) { + ucs2char_t filepath[MAX_PATH]; + const pmp_playlist_t* src = &playlists[i]; + ip3db_playlist_t* dst = &pmpmi->playlists[i]; + + ucs2cpy(filepath, src->name); + ucs2cat(filepath, plp_ext); + + dst->filename = ucs2dup(filepath_skippath(filepath)); + + filepath_remove_filespec(filepath); + filepath_addslash(filepath); + dst->filepath = ucs2dup(filepath_skipdrive(filepath, music->pmp->info.path_to_root)); + filepath_slash(dst->filepath); + + dst->num_entries = src->num_entries; + dst->entries = (ucs2char_t**)ucs2malloc(sizeof(ucs2char_t*) * src->num_entries); + for (j = 0;j < src->num_entries;++j) { + dst->entries[j] = ucs2dup(src->entries[j]); + } + } + return 0; } Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2007-01-17 19:24:46 UTC (rev 269) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2007-01-18 15:06:25 UTC (rev 270) @@ -193,7 +193,7 @@ > </File> <File - RelativePath=".\playlist.c" + RelativePath=".\plp.c" > </File> <File @@ -231,6 +231,10 @@ > </File> <File + RelativePath=".\plp.h" + > + </File> + <File RelativePath=".\serialize.h" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |