|
From: <ny...@us...> - 2007-02-28 12:21:47
|
Revision: 402
http://svn.sourceforge.net/pmplib/?rev=402&view=rev
Author: nyaochi
Date: 2007-02-28 04:21:46 -0800 (Wed, 28 Feb 2007)
Log Message:
-----------
- Implemented database update for iPod players.
- Removed filepath_changeroot function.
- Added an argument to filepath_skiproot to specify the necessity of a path character at the head of the string
returned by the function.
- Added comment field to pmp_t.
- Time stamps are now represented in uint64_t.
- Reduced warnings.
- Removed unnecessary routines.
Modified Paths:
--------------
trunk/pmplib/frontend/easypmp/common/database.c
trunk/pmplib/frontend/easypmp/common/settle.c
trunk/pmplib/frontend/easypmp/cui/console_win32.c
trunk/pmplib/frontend/easypmp/cui/device.c
trunk/pmplib/include/pmplib/filepath.h
trunk/pmplib/include/pmplib/pmp.h
trunk/pmplib/lib/filepath/filepath_win32.c
trunk/pmplib/lib/gmi/gmi_mp4v2.c
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/util.c
trunk/pmplib/lib/pmp_ipod/util.h
trunk/pmplib/lib/pmp_iriverplus2/ip2db.c
trunk/pmplib/lib/pmp_iriverplus2/playlist.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/pmp_iriverplus3.c
trunk/pmplib/lib/pmp_irivnavi/playlist.c
trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c
trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c
trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c
trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c
trunk/pmplib/lib/pmp_portalplayer1/model_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
Modified: trunk/pmplib/frontend/easypmp/common/database.c
===================================================================
--- trunk/pmplib/frontend/easypmp/common/database.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -283,7 +283,7 @@
int easypmp_set_strip_words(option_t* opt, const ucs2char_t* str)
{
- size_t i;
+ int i;
const ucs2char_t *p = 0, *q = 0;
/*
Modified: trunk/pmplib/frontend/easypmp/common/settle.c
===================================================================
--- trunk/pmplib/frontend/easypmp/common/settle.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/frontend/easypmp/common/settle.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -93,7 +93,7 @@
ucs2char_t music[MAX_PATH];
ucs2char_t directory[MAX_PATH];
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
// Remove music files that are not pointed by any links.
if (opt->verb & MODE_REMOVE_UNREF) {
Modified: trunk/pmplib/frontend/easypmp/cui/console_win32.c
===================================================================
--- trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -101,7 +101,7 @@
return (int)(p - line);
} else {
fprintf(fp, "%S\n", line);
- return ucs2len(line);
+ return (int)ucs2len(line);
}
}
Modified: trunk/pmplib/frontend/easypmp/cui/device.c
===================================================================
--- trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -47,7 +47,7 @@
void device_show_information(pmp_t* pmp, FILE *fp)
{
- int i;
+ uint32_t i;
fprintf(fp, "Device identifier: %s\n", pmp->info.decl.id);
fprintf(fp, " Manufacturer: %s\n", pmp->info.decl.manufacturer);
Modified: trunk/pmplib/include/pmplib/filepath.h
===================================================================
--- trunk/pmplib/include/pmplib/filepath.h 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/include/pmplib/filepath.h 2007-02-28 12:21:46 UTC (rev 402)
@@ -125,26 +125,16 @@
* function skips the portion.
* @param root The pointer to the string representing the portion to
* be skipped.
+ * @param pathchar Boolean value to determine whether the resultant
+ * string should starts with a path character or not.
+ * If \a pathchar is non-zero value, the resultant string
+ * will starts with a path character.
* @retval const ucs2char_t* The pointer at the next character after the
* portion \a root ends in \a path.
*/
-FILEPATHAPI const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root);
+FILEPATHAPI const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root, int pathchar);
/**
- * Skip a portion in filepath name, assuming it as the root directory.
- *
- * The resultant string will begin with a path character.
- *
- * @param path The pointer to the filepath name from which this
- * function skips the portion.
- * @param root The pointer to the string representing the portion to
- * be skipped.
- * @retval const ucs2char_t* The pointer at the next character after the
- * portion \a root ends in \a path.
- */
-FILEPATHAPI const ucs2char_t* filepath_changeroot(const ucs2char_t* path, const ucs2char_t* root);
-
-/**
* Skip a directory name in filepath name.
*
* @param path The pointer to the filepath name from which this
Modified: trunk/pmplib/include/pmplib/pmp.h
===================================================================
--- trunk/pmplib/include/pmplib/pmp.h 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/include/pmplib/pmp.h 2007-02-28 12:21:46 UTC (rev 402)
@@ -129,7 +129,9 @@
#define PMPCODEC_NONE PMPFOURCC(' ',' ',' ',' ')
/** MPEG Audio Layer III. */
#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','A','3')
-/** MPEG 4. */
+/** MPEG AAC. */
+#define PMPCODEC_MPEGAAC PMPFOURCC('A','A','C',' ')
+/** MPEG 4 Audio. */
#define PMPCODEC_MPEG4AUDIO PMPFOURCC('M','P','4','A')
/** Windows Media Audio. */
#define PMPCODEC_WMA PMPFOURCC('W','M','A',' ')
@@ -377,6 +379,13 @@
ucs2char_t *date;
/**
+ * Comment.
+ * e.g., "Encoded with LAME"
+ * @assert @code comment != NULL @endcode
+ */
+ ucs2char_t *comment;
+
+ /**
* Compilation flag.
* e.g., 1 for compilation album.
*/
@@ -437,8 +446,8 @@
uint32_t bitrate;
/**
- * Duration in seconds.
- * e.g., 260
+ * Duration in miliseconds.
+ * e.g., 260000
*/
uint32_t duration;
@@ -456,9 +465,9 @@
/**
* Timestamp of the last update of the music file.
- * The value is equivalent to \c st.st_mtime after \c stat(&st, filename);
+ * The value represents the elapsed seconds from 1970-01-01T00:00:00 (UTC).
*/
- uint32_t ts_update;
+ uint64_t ts_update;
/**
* Rating.
@@ -474,13 +483,15 @@
/**
* Timestamp of the recent playback on the device.
+ * The value represents the elapsed seconds from 1970-01-01T00:00:00 (UTC).
*/
- uint32_t ts_playback;
+ uint64_t ts_playback;
/**
* timestamp when the track was imported.
+ * The value represents the elapsed seconds from 1970-01-01T00:00:00 (UTC).
*/
- uint32_t ts_import;
+ uint64_t ts_import;
};
/**
Modified: trunk/pmplib/lib/filepath/filepath_win32.c
===================================================================
--- trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -106,10 +106,17 @@
return dst;
}
-const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root)
+const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root, int pathchar)
{
- if (ucs2ncmp(path, root, ucs2len(root)) == 0) {
- return path + ucs2len(root);
+ /* Make sure the _root ends with a PATHCHAR. */
+ ucs2char_t* _root = alloca(sizeof(ucs2char_t) * (ucs2len(root) + 2));
+ ucs2cpy(_root, root);
+ filepath_addslash(_root);
+
+ if (ucs2ncmp(path, _root, ucs2len(_root)) == 0) {
+ const ucs2char_t* p = path + ucs2len(_root);
+ if (pathchar) --p;
+ return p < path ? path : p;
} else {
return path;
}
@@ -121,16 +128,6 @@
return p ? p+1 : path;
}
-const ucs2char_t* filepath_changeroot(const ucs2char_t* path, const ucs2char_t* root)
-{
- const ucs2char_t* p = filepath_skiproot(path, root);
- if (p == NULL) p = path;
- if (path < p && p[-1] == '\\') {
- --p;
- }
- return p;
-}
-
const ucs2char_t* filepath_skipadirectory(const ucs2char_t* path)
{
ucs2char_t* p = ucs2chr(path, '\\');
Modified: trunk/pmplib/lib/gmi/gmi_mp4v2.c
===================================================================
--- trunk/pmplib/lib/gmi/gmi_mp4v2.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/gmi/gmi_mp4v2.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -89,7 +89,7 @@
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->duration = (uint32_t)MP4ConvertFromTrackDuration(mp4file, tid, duration, MP4_MSECS_TIME_SCALE);
info->sample_rate = MP4GetTrackTimeScale(mp4file, tid);
info->bitrate = MP4GetTrackBitRate(mp4file, tid);
}
Modified: trunk/pmplib/lib/pmp_ipod/ipod.c
===================================================================
--- trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_ipod/ipod.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -32,6 +32,7 @@
#include <string.h>
#endif/*HAVE_STRING_H*/
#include <pmplib/ucs2char.h>
+#include <pmplib/filepath.h>
#include <pmplib/pmp.h>
#include "serialize.h"
@@ -248,7 +249,12 @@
return 0;
}
-static int set_music_record(itunesdb_chunk_t* mhit, const pmp_music_record_t* rec, uint32_t uid)
+static int set_music_record(
+ itunesdb_chunk_t* mhit,
+ const pmp_music_record_t* rec,
+ uint32_t uid,
+ const ucs2char_t* path_to_root
+ )
{
itunesdb_chunk_t* mhod = NULL;
chunk_mhit_t* mhit_data = (chunk_mhit_t*)mhit->data;
@@ -267,8 +273,8 @@
break;
}
mhit_data->compilation = rec->is_compilation ? 1 : 0;
- mhit_data->rating = 0;
- mhit_data->last_modified = rec->ts_update;
+ mhit_data->rating = rec->rating;
+ mhit_data->last_modified = (uint32_t)from_time((time_t)rec->ts_update);
mhit_data->filesize = rec->filesize;
mhit_data->duration = rec->duration;
mhit_data->track_number = rec->track_number;
@@ -278,7 +284,7 @@
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->date_added = (uint32_t)from_time((time_t)rec->ts_import);
mhit_data->dbid = 0;
mhit_data->unk9 = 0xFFFF;
switch (rec->codec) {
@@ -343,10 +349,12 @@
}
/* Construct an "mhod" chunk for comment. */
- mhod = itunesdb_new_child(mhit);
- if (mhod) {
- itunesdb_init(mhod, "mhod", "comment");
- itunesdb_set_mhod_string(mhod, L"Some comment");
+ if (rec->comment && *rec->comment) {
+ mhod = itunesdb_new_child(mhit);
+ if (mhod) {
+ itunesdb_init(mhod, "mhod", "comment");
+ itunesdb_set_mhod_string(mhod, rec->comment);
+ }
}
/* Construct an "mhod" chunk for location. */
@@ -354,11 +362,11 @@
mhod = itunesdb_new_child(mhit);
if (mhod) {
ucs2char_t pathname[MAX_PATH], *p = NULL;
- itunesdb_init(mhod, "mhod", "location");
- ucs2cpy(pathname, rec->filename + 2);
+ ucs2cpy(pathname, filepath_skiproot(rec->filename, path_to_root, 1));
for (p = pathname;*p;++p) {
if (*p == PATHCHAR) *p = ':';
}
+ itunesdb_init(mhod, "mhod", "location");
itunesdb_set_mhod_string(mhod, pathname);
}
}
@@ -367,6 +375,87 @@
return 0;
}
+static int get_music_record(
+ itunesdb_chunk_t* mhit,
+ pmp_music_record_t* rec,
+ uint32_t uid,
+ const ucs2char_t* path_to_root
+ )
+{
+ uint32_t i;
+ itunesdb_chunk_t* mhod = NULL;
+ chunk_mhit_t* mhit_data = (chunk_mhit_t*)mhit->data;
+
+ switch (mhit_data->filetype) {
+ case 0x4D503320:
+ rec->codec = PMPCODEC_MPEGLAYER3;
+ rec->is_vbr = mhit_data->type1 ? 1 : 0;
+ break;
+ case 0x41414320:
+ rec->codec = PMPCODEC_MPEGAAC;
+ break;
+ case 0x4D344120:
+ rec->codec = PMPCODEC_MPEG4AUDIO;
+ break;
+ }
+
+ rec->is_compilation = mhit_data->compilation ? 1 : 0;
+ rec->rating = mhit_data->rating;
+ rec->ts_update = (uint64_t)to_time(mhit_data->last_modified);
+ rec->filesize = mhit_data->filesize;
+ rec->duration = mhit_data->duration;
+ rec->track_number = mhit_data->track_number;
+ rec->total_tracks = mhit_data->total_tracks;
+ //rec->date =
+ rec->bitrate = mhit_data->bitrate * 1000;
+ rec->sample_rate = mhit_data->samplerate;
+ rec->disc_number = mhit_data->disc_number;
+ rec->total_discs = mhit_data->total_discs;
+ rec->ts_import = (uint64_t)to_time(mhit_data->date_added);
+ switch (rec->codec) {
+ case PMPCODEC_MPEGLAYER3:
+ switch (mhit_data->unk14_1) {
+ case 0x0016: rec->codec_version = 200; break;
+ case 0x0020: rec->codec_version = 205; break;
+ default: rec->codec_version = 100; break;
+ }
+ break;
+ }
+ rec->num_samples = mhit_data->num_samples;
+
+ for (i = 0;i < mhit->num_children;++i) {
+ mhod = &mhit->childlen[i];
+ if (itunesdb_ischunk(mhod, "mhod", "title")) {
+ itunesdb_get_mhod_string(mhod, &rec->title);
+ } else if (itunesdb_ischunk(mhod, "mhod", "artist")) {
+ itunesdb_get_mhod_string(mhod, &rec->artist);
+ } else if (itunesdb_ischunk(mhod, "mhod", "album")) {
+ itunesdb_get_mhod_string(mhod, &rec->album);
+ } else if (itunesdb_ischunk(mhod, "mhod", "genre")) {
+ itunesdb_get_mhod_string(mhod, &rec->genre);
+ } else if (itunesdb_ischunk(mhod, "mhod", "comment")) {
+ itunesdb_get_mhod_string(mhod, &rec->comment);
+ } else if (itunesdb_ischunk(mhod, "mhod", "location")) {
+ ucs2char_t *location = NULL;
+ itunesdb_get_mhod_string(mhod, &location);
+ if (location) {
+ size_t length = 0;
+ ucs2char_t* p = NULL;
+ for (p = location;*p;++p) {
+ if (*p == ':') *p = PATHCHAR;
+ }
+ length = ucs2len(path_to_root) + ucs2len(location) + 3;
+ rec->filename = ucs2calloc(sizeof(ucs2char_t) * length);
+ if (rec->filename) {
+ filepath_combinepath(rec->filename, length, path_to_root, location);
+ }
+ ucs2free(location);
+ }
+ }
+ }
+ return 0;
+}
+
static int comp_string(const ucs2char_t* x, const ucs2char_t*y)
{
int ret = 0;
@@ -560,7 +649,7 @@
static uint32_t get_record_index(const ucs2char_t* filename, const pmp_music_record_t* records, int num_records)
{
- uint32_t i;
+ int i;
for (i = 0;i < num_records;++i) {
if (ucs2icmp(records[i].filename, filename) == 0) {
@@ -593,8 +682,8 @@
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);
+ for (i = 0;i < (int)playlist->num_entries;++i) {
+ int index = (int)get_record_index(playlist->entries[i], records, num_records);
if (index < num_records) {
mhip = itunesdb_new_child(mhyp);
@@ -622,7 +711,14 @@
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)
+result_t ipod_set(
+ ipod_t* ipod,
+ const pmp_music_record_t* records,
+ int num_records,
+ const pmp_playlist_t* playlists,
+ int num_playlists,
+ const ucs2char_t* path_to_root
+ )
{
int i;
itunesdb_chunk_t *mhbd = NULL, *mhsd = NULL;
@@ -659,7 +755,7 @@
itunesdb_init(mhit, "mhit", NULL);
/* This will fill "mhit" chunk and create "mhod" chunks. */
- set_music_record(mhit, rec, i);
+ set_music_record(mhit, rec, i, path_to_root);
}
}
}
@@ -702,3 +798,59 @@
ipod->itunesdb = mhbd;
return 0;
}
+
+result_t ipod_get(
+ ipod_t* ipod,
+ pmp_music_record_t* records,
+ int *num_records,
+ pmp_playlist_t* playlists,
+ int *num_playlists,
+ const ucs2char_t* path_to_root
+ )
+{
+ uint32_t i, j, k;
+ itunesdb_chunk_t* mhbd = ipod->itunesdb;
+ itunesdb_chunk_t *mhsd = NULL;
+ itunesdb_chunk_t *mhlt = NULL, *mhit = NULL;
+ itunesdb_chunk_t *mhlp = NULL, *mhyp = NULL;
+
+ /* Initialize the numbers with zero. */
+ if (!records) *num_records = 0;
+ if (!playlists) *num_playlists = 0;
+
+ if (mhbd && strncmp(mhbd->id, "mhbd", 4) == 0) {
+ for (i = 0;i < mhbd->num_children;++i) {
+ mhsd = &mhbd->childlen[i];
+ if (mhsd && strncmp(mhsd->id, "mhsd", 4) == 0) {
+ chunk_mhsd_t* mhsd_data = (chunk_mhsd_t*)mhsd->data;
+ if (mhsd_data->type == 1) {
+ /* Track list. */
+ for (j = 0;j < mhsd->num_children;++j) {
+ mhlt = &mhsd->childlen[j];
+ if (mhlt && strncmp(mhlt->id, "mhlt", 4) == 0) {
+ if (records) {
+ /* Make sure the array has sufficient entries. */
+ if (*num_records < (int)mhlt->num_children) {
+ return PMPERR_INSUFFICIENTMEMORY;
+ }
+ /* Obtain media records. */
+ for (k = 0;k < mhlt->num_children;++k) {
+ mhit = &mhlt->childlen[k];
+ if (mhit && strncmp(mhit->id, "mhit", 4) == 0) {
+ get_music_record(mhit, &records[k], k, path_to_root);
+ }
+ }
+ } else {
+ /* Return the number of records. */
+ *num_records = mhlt->num_children;
+ }
+ }
+ }
+ } else if (mhsd_data->type == 2) {
+ /* Playlist list. */
+ }
+ }
+ }
+ }
+ return 0;
+}
Modified: trunk/pmplib/lib/pmp_ipod/ipod.h
===================================================================
--- trunk/pmplib/lib/pmp_ipod/ipod.h 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_ipod/ipod.h 2007-02-28 12:21:46 UTC (rev 402)
@@ -58,9 +58,24 @@
void ipod_init(ipod_t* ipod);
void ipod_finish(ipod_t* ipod);
-result_t ipod_set(ipod_t* ipod, const pmp_music_record_t* records, int num_records, const pmp_playlist_t* playlists, int num_playlists);
result_t ipod_read(ipod_t* ipod, const ucs2char_t* itunesdb, const ucs2char_t* playcounts);
result_t ipod_write(ipod_t* ipod, const ucs2char_t* itunesdb);
result_t ipod_dump(ipod_t* ipod, FILE *fpo);
+result_t ipod_set(
+ ipod_t* ipod,
+ const pmp_music_record_t* records,
+ int num_records,
+ const pmp_playlist_t* playlists,
+ int num_playlists,
+ const ucs2char_t* path_to_root
+ );
+result_t ipod_get(
+ ipod_t* ipod,
+ pmp_music_record_t* records,
+ int *num_records,
+ pmp_playlist_t* playlists,
+ int *num_playlists,
+ const ucs2char_t* path_to_root
+ );
#endif/*__IPOD_H__*/
Modified: trunk/pmplib/lib/pmp_ipod/itunesdb.c
===================================================================
--- trunk/pmplib/lib/pmp_ipod/itunesdb.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_ipod/itunesdb.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -633,6 +633,17 @@
}
}
+int itunesdb_ischunk(itunesdb_chunk_t* chunk, const char *name, const char *subtype)
+{
+ if (strncmp(name, "mhod", 4) == 0) {
+ chunk_mhod_t* mhod = (chunk_mhod_t*)chunk->data;
+ const itunesdb_mhoddecl_t* decl = find_mhoddecl(chunk);
+ return (decl && strcmp(decl->name, subtype) == 0) ? 1 : 0;
+ } else {
+ return (strncmp(chunk->id, name, 4) == 0);
+ }
+}
+
void itunesdb_finish(itunesdb_chunk_t* chunk)
{
uint32_t i;
@@ -847,6 +858,24 @@
return 0;
}
+int itunesdb_get_mhod_string(itunesdb_chunk_t* chunk, ucs2char_t** value)
+{
+ chunk_mhod_t* mhod = (chunk_mhod_t*)chunk->data;
+ chunk_mhod_string_t* str = &mhod->data.str;
+
+ /* Make sure this is an "mhod" chunk. */
+ if (strncmp(chunk->id, "mhod", 4) != 0) {
+ return 1;
+ }
+
+ /* Store the string value. */
+ ucs2free(*value);
+ *value = (ucs2char_t*)ucs2calloc(str->size + sizeof(ucs2char_t));
+ ucs2ncpy(*value, str->value, str->size / sizeof(ucs2char_t));
+ return 0;
+}
+
+
int itunesdb_set_mhod_index(itunesdb_chunk_t* chunk, uint32_t type, sorted_index_t* si, uint32_t n)
{
uint32_t i;
Modified: trunk/pmplib/lib/pmp_ipod/itunesdb.h
===================================================================
--- trunk/pmplib/lib/pmp_ipod/itunesdb.h 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_ipod/itunesdb.h 2007-02-28 12:21:46 UTC (rev 402)
@@ -19,7 +19,7 @@
*
*/
-/* $Id:$ */
+/* $Id$ */
#ifndef __ITUNESDB_H__
#define __ITUNESDB_H__
@@ -253,6 +253,8 @@
*/
int itunesdb_init(itunesdb_chunk_t* chunk, const char *identifer, const char *subtype);
+int itunesdb_ischunk(itunesdb_chunk_t* chunk, const char *name, const char *subtype);
+
/**
* Create a new chunk and append it to the children of the parent chunk.
* @param chunk The chunk where a new child will be appended.
@@ -274,6 +276,8 @@
*/
int itunesdb_set_mhod_string(itunesdb_chunk_t* chunk, const ucs2char_t* str);
+int itunesdb_get_mhod_string(itunesdb_chunk_t* chunk, ucs2char_t** str);
+
/**
* Set sorted index to "mhod" chunk.
* @param chunk The pointer to "mhod" chunk.
Modified: trunk/pmplib/lib/pmp_ipod/pmp_ipod.c
===================================================================
--- trunk/pmplib/lib/pmp_ipod/pmp_ipod.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_ipod/pmp_ipod.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -327,83 +327,63 @@
static uint32_t pmpmusic_open(pmp_music_t* music)
{
- //ip3db_t ip3db;
+ ipod_t ipod;
result_t ret = 0;
pmp_t* pmp = music->pmp;
pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance;
+ ucs2char_t itunesdb[MAX_PATH], playcounts[MAX_PATH];
- /*
- // Initialize IP3DB.
- ip3db_init(&ip3db);
+ // Initialize ipod library.
+ ipod_init(&ipod);
- // Free the existing records.
- pmplib_records_finish(pmpmi->records, pmpmi->num_records);
- pmpmi->records = 0;
- pmpmi->num_records = 0;
+ // Read the music database.
+ set_filenames(itunesdb, playcounts, music->pmp);
- // 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;
+ if (pmp->flag & (PMPOF_MUSIC_DB_READ|PMPOF_MUSIC_PL_READ)) {
+ int num_records = 0, num_playlists = 0;
- // Read the music database.
- set_filenames(dat, dic, idx, pmp);
- ret = ip3db_read(&ip3db, dat, dic, idx);
- if (ret) {
- goto exit_this;
+ ipod_read(&ipod, itunesdb, playcounts);
+ ipod_get(&ipod, NULL, &num_records, NULL, &num_playlists, pmp->info.path_to_root);
+
+ // Allocate records.
+ if (pmp->flag & PMPOF_MUSIC_DB_READ) {
+ if (0 < num_records) {
+ ucs2free(pmpmi->records);
+ pmpmi->records = (pmp_music_record_t*)ucs2calloc(sizeof(pmp_music_record_t) * num_records);
+ if (!pmpmi->records) {
+ ret = PMPERR_INSUFFICIENTMEMORY;
+ goto exit_this;
+ }
+ pmpmi->num_records = num_records;
+ }
+ } else {
+ ucs2free(pmpmi->records);
+ pmpmi->records = 0;
+ pmpmi->num_records = 0;
}
- // 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;
+ // Allocate playlists.
+ if (pmp->flag & PMPOF_MUSIC_PL_READ) {
+ if (0 < num_playlists) {
+ ucs2free(pmpmi->playlists);
+ pmpmi->playlists = (pmp_playlist_t*)ucs2calloc(sizeof(pmp_playlist_t) * num_playlists);
+ if (!pmpmi->playlists) {
+ ret = PMPERR_INSUFFICIENTMEMORY;
+ goto exit_this;
+ }
+ pmpmi->num_playlists = num_playlists;
}
- 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;
+ } else {
+ ucs2free(pmpmi->playlists);
+ pmpmi->playlists = 0;
+ pmpmi->num_playlists = 0;
}
+
+ ipod_get(&ipod, pmpmi->records, &num_records, pmpmi->playlists, &num_playlists, pmp->info.path_to_root);
}
- */
exit_this:
- //ip3db_finish(&ip3db);
+ ipod_finish(&ipod);
return ret;
}
@@ -422,7 +402,7 @@
set_filenames(itunesdb, playcounts, music->pmp);
if (pmp->flag & PMPOF_MUSIC_DB_WRITE) {
- ipod_set(&ipod, pmpmi->records, pmpmi->num_records, pmpmi->playlists, pmpmi->num_playlists);
+ ipod_set(&ipod, pmpmi->records, pmpmi->num_records, pmpmi->playlists, pmpmi->num_playlists, pmp->info.path_to_root);
ipod_write(&ipod, itunesdb);
}
Modified: trunk/pmplib/lib/pmp_ipod/util.c
===================================================================
--- trunk/pmplib/lib/pmp_ipod/util.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_ipod/util.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -19,7 +19,7 @@
*
*/
-/* $Id:$ */
+/* $Id$ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -153,23 +153,12 @@
return 0;
}
-void filepath_slash(ucs2char_t* path)
+time_t to_time(uint64_t t)
{
- while (*path) {
- if (*path == 0x005C) {
- *path = 0x002F;
- }
- path++;
- }
+ return (time_t)((2082844800 < t) ? (t - 2082844800) : 0);
}
-void filepath_backslash(ucs2char_t* path)
+uint64_t from_time(time_t t)
{
- while (*path) {
- if (*path == 0x002F) {
- *path = 0x005C;
- }
- path++;
- }
+ return (uint64_t)t + 2082844800;
}
-
Modified: trunk/pmplib/lib/pmp_ipod/util.h
===================================================================
--- trunk/pmplib/lib/pmp_ipod/util.h 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_ipod/util.h 2007-02-28 12:21:46 UTC (rev 402)
@@ -35,7 +35,7 @@
int fread_all(FILE *fp, uint8_t** ptr_buffer, long* ptr_size);
-void filepath_slash(ucs2char_t* path);
-void filepath_backslash(ucs2char_t* path);
+time_t to_time(uint64_t t);
+uint64_t from_time(time_t t);
#endif/*__IP3DB_UTIL_H__*/
Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c
===================================================================
--- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -196,7 +196,7 @@
}
dst->entry_number = j+1;
- dst->pathname = ucs2dup(filepath_changeroot(src->filename, path_to_root));
+ dst->pathname = ucs2dup(filepath_skiproot(src->filename, path_to_root, 1));
filepath_remove_filespec(dst->pathname);
filepath_encode(dst->pathname);
dst->filename = ucs2dup(filepath_skippath(src->filename));
@@ -206,7 +206,7 @@
dst->genre = ucs2dup(src->genre ? src->genre : ucs2cs_unknown);
dst->rating = src->rating;
dst->play_count = src->play_count;
- dst->recent_play = src->ts_playback;
+ dst->recent_play = (uint32_t)src->ts_playback;
dst->track_number = src->track_number;
if (src->date) {
dst->year = ucs2toi(src->date);
@@ -215,7 +215,7 @@
dst->duration = src->duration / 1000;
dst->sample_rate = src->sample_rate;
dst->bitrate = src->bitrate;
- dst->timestamp = src->ts_update;
+ dst->timestamp = (uint32_t)src->ts_update;
++j;
}
Modified: trunk/pmplib/lib/pmp_iriverplus2/playlist.c
===================================================================
--- trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -58,7 +58,7 @@
filepath_decode(decoded_filename);
// 2. As above, with mount point prefix stripped.
- ucs2cpy(decoded_filepathname, filepath_changeroot(decoded_filename, path_to_root));
+ ucs2cpy(decoded_filepathname, filepath_skiproot(decoded_filename, path_to_root, 1));
// 3. As above, but with filename stripped.
ucs2cpy(decoded_pathname, decoded_filepathname);
Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c
===================================================================
--- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -305,7 +305,7 @@
static sort_index_t* dat_uidmap_create(dat_list_t* list)
{
- int i;
+ uint32_t i;
sort_index_t* si = (sort_index_t*)malloc(sizeof(sort_index_t) * list->num_entries);
if (si) {
@@ -574,7 +574,7 @@
static uint32_t findfile(dat_t* dat, const ucs2char_t *filename)
{
- int i;
+ uint32_t i;
const ucs2char_t *filepart = NULL;
ucs2char_t *pathname = alloca(sizeof(ucs2char_t) * (ucs2len(filename) + 1));
@@ -767,7 +767,7 @@
qsort(objects, num_objects, sizeof(objects[0]), comp_pathname);
/* Loop for the records. */
- for (i = 0;i < num_objects;++i) {
+ for (i = 0;i < (int)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
Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c
===================================================================
--- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -145,7 +145,8 @@
static size_t dic_table_serialize(uint8_t* buffer, uint32_t start, dic_table_t* list, int is_storing)
{
- uint32_t i, next;
+ int i;
+ uint32_t next;
uint8_t *p = buffer + start;
p += serialize_uint32be(p, &list->unknown0, is_storing);
Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c
===================================================================
--- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -160,7 +160,7 @@
static uint32_t avlnode_new(avl_t* avl, size_t keysize)
{
- uint32_t offset = avl_allocate(avl, sizeof(avlnode_t) + keysize);
+ uint32_t offset = (uint32_t)avl_allocate(avl, sizeof(avlnode_t) + keysize);
avlnode_t* a = avlnode(avl, offset);
a->left = 0;
a->right = 0;
Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c
===================================================================
--- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -576,7 +576,7 @@
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));
+ ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], filepath_skiproot(src->filename, pmp->info.path_to_root, 1));
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);
@@ -600,7 +600,7 @@
}
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_CLUSA], (uint32_t)src->ts_update);
ip3db_variant_set_dword(&dst[IP3DBF_MUSIC_UID], (uint32_t)i+1);
}
@@ -708,7 +708,7 @@
static result_t pmpmusic_set_playlists(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists)
{
- uint32_t i, j;
+ int i, j;
static const ucs2char_t rootdir[] = {PATHCHAR,0};
static const ucs2char_t plp_ext[] = {'.','p','l','p',0};
pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance;
@@ -724,7 +724,7 @@
pmpmi->num_playlists = num_playlists;
// Copy the content of the playlists.
- for (i = 0;i < num_playlists;++i) {
+ for (i = 0;i < (int)num_playlists;++i) {
ucs2char_t filepath[MAX_PATH];
const pmp_playlist_t* src = &playlists[i];
ip3db_playlist_t* dst = &pmpmi->playlists[i];
@@ -735,7 +735,7 @@
filepath_combinepath(filepath, MAX_PATH, rootdir, music->pmp->info.path_to_playlist);
filepath_addslash(filepath);
- dst->filepath = ucs2dup(filepath_changeroot(filepath, music->pmp->info.path_to_root));
+ dst->filepath = ucs2dup(filepath_skiproot(filepath, music->pmp->info.path_to_root, 1));
filepath_slash(dst->filepath);
dst->num_entries = src->num_entries;
@@ -743,7 +743,7 @@
for (j = 0;j < src->num_entries;++j) {
ucs2char_t filename[MAX_PATH];
- ucs2cpy(filename, filepath_changeroot(src->entries[j], music->pmp->info.path_to_root));
+ ucs2cpy(filename, filepath_skiproot(src->entries[j], music->pmp->info.path_to_root, 1));
filepath_slash(filename);
dst->entries[j] = ucs2dup(filename);
}
Modified: trunk/pmplib/lib/pmp_irivnavi/playlist.c
===================================================================
--- trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -63,7 +63,7 @@
if (mediafiles[i][0]) {
char *mbs = NULL;
ucs2char_t filename[MAX_PATH];
- ucs2cpy(filename, filepath_changeroot(mediafiles[i], path_to_root));
+ ucs2cpy(filename, filepath_skiproot(mediafiles[i], path_to_root, 1));
filepath_encode(filename);
Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c
===================================================================
--- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -478,12 +478,12 @@
// Set record fields.
record_init(dst);
- dst->filename = ucs2dupmbs(filepath_changeroot(src->filename, music->pmp->info.path_to_root));
+ dst->filename = ucs2dupmbs(filepath_skiproot(src->filename, music->pmp->info.path_to_root, 1));
dst->title = src->title ? ucs2dupmbs(src->title) : ucs2dupmbs(filepath_skippath(src->filename));;
dst->artist = ucs2dupmbs(src->artist ? src->artist : ucs2cs_unknown);
dst->album = ucs2dupmbs(src->album ? src->album : ucs2cs_unknown);
dst->genre = ucs2dupmbs(src->genre ? src->genre : ucs2cs_unknown);
- dst->timestamp = src->ts_update;
+ dst->timestamp = (uint32_t)src->ts_update;
++j;
}
Modified: trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c
===================================================================
--- trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -100,7 +100,7 @@
// Set fields.
dst->status = 0;
dst->unknown1 = 0;
- dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root));
+ dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root, 0));
filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
@@ -112,7 +112,7 @@
dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown);
dst->fields[PP1DB_DATFIELD_RATING].value.dword = src->rating;
dst->fields[PP1DB_DATFIELD_PLAYCOUNT].value.dword = src->play_count;
- dst->fields[PP1DB_DATFIELD_RECENTPLAY].value.dword = src->ts_playback;
+ dst->fields[PP1DB_DATFIELD_RECENTPLAY].value.dword = (uint32_t)src->ts_playback;
dst->fields[PP1DB_DATFIELD_UNKNOWN3].value.dword = 0;
dst->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword = src->track_number;
if (src->date) {
@@ -124,7 +124,7 @@
dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate;
dst->fields[PP1DB_DATFIELD_UNKNOWN4].value.dword = 0;
dst->fields[PP1DB_DATFIELD_UNKNOWN5].value.str = ucs2dup(ucs2cs_empty);
- dst->fields[PP1DB_DATFIELD_UNKNOWN6].value.dword = src->ts_update;
+ dst->fields[PP1DB_DATFIELD_UNKNOWN6].value.dword = (uint32_t)src->ts_update;
dst->fields[PP1DB_DATFIELD_UNKNOWN7].value.str = ucs2dup(ucs2cs_empty);
return 0;
}
Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c
===================================================================
--- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -86,7 +86,7 @@
// Set fields.
dst->status = 0;
dst->unknown1 = 0;
- dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root));
+ dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root, 0));
filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c
===================================================================
--- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -74,7 +74,7 @@
// Set fields.
dst->status = 0;
dst->unknown1 = 0;
- dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root));
+ dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root, 0));
filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
Modified: trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c
===================================================================
--- trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -85,7 +85,7 @@
// Set fields.
dst->status = 0;
dst->unknown1 = 0;
- dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root));
+ dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root, 0));
filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
Modified: trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c
===================================================================
--- trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -90,7 +90,7 @@
// Set fields.
dst->status = 0;
dst->unknown1 = 0;
- dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root));
+ dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root, 0));
filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
Modified: trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c
===================================================================
--- trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -92,7 +92,7 @@
// Set fields.
dst->status = 0;
dst->unknown1 = 0;
- dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root));
+ dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root, 0));
filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
@@ -110,7 +110,7 @@
dst->fields[PP1DB_DATFIELD_YEAR].value.dword = ucs2toi(src->date);
}
dst->fields[PP1DB_DATFIELD_FILESIZE].value.dword = src->filesize;
- dst->fields[PP1DB_DATFIELD_UNKNOWN4].value.dword = src->ts_update;
+ dst->fields[PP1DB_DATFIELD_UNKNOWN4].value.dword = (uint32_t)src->ts_update;
dst->fields[PP1DB_DATFIELD_UNKNOWN5].value.str = ucs2dup(ucs2cs_empty);
dst->fields[PP1DB_DATFIELD_UNKNOWN6].value.str = ucs2dup(ucs2cs_empty);
dst->fields[PP1DB_DATFIELD_UNKNOWN7].value.str = ucs2dup(ucs2cs_empty);
Modified: trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c
===================================================================
--- trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -105,7 +105,7 @@
// Set fields.
dst->status = 0;
dst->unknown1 = 0;
- dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root));
+ dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root, 0));
filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str);
Modified: trunk/pmplib/lib/pmp_portalplayer1/playlist.c
===================================================================
--- trunk/pmplib/lib/pmp_portalplayer1/playlist.c 2007-02-28 08:17:04 UTC (rev 401)
+++ trunk/pmplib/lib/pmp_portalplayer1/playlist.c 2007-02-28 12:21:46 UTC (rev 402)
@@ -85,7 +85,7 @@
for (i = 0;i < num_mediafiles;i++) {
if (mediafiles[i][0]) {
ucs2char_t filename[MAX_PATH];
- ucs2cpy(filename, filepath_skiproot(mediafiles[i], path_to_root));
+ ucs2cpy(filename, filepath_skiproot(mediafiles[i], path_to_root, 0));
filepath_encode(filename);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|