playlist.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __PLAYLIST_H__
00025 #define __PLAYLIST_H__
00026
00027 #ifdef PLAYLIST_EXPORTS
00028 #define PLAYLISTAPI __declspec(dllexport)
00029 #else
00030 #define PLAYLISTAPI
00031 #endif
00032
00033 #include <pmplib/pmp.h>
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038
00039 enum {
00040 PLAYLIST_NONE = 0,
00041 PLAYLIST_JSPL = 1,
00042 };
00043
00044 enum {
00045 PLCALLBACK_NONE,
00046 PLCALLBACK_JSPL_MESSAGE,
00047 PLCALLBACK_JSPL_ERROR,
00048 PLCALLBACK_JSPL_ERROR_POS,
00049 PLCALLBACK_JSPL_ERROR_LINE,
00050 };
00051
00052 enum {
00053 PLAYLIST_SUCCESS = 0,
00054 PLAYLIST_E_FAIL = 0x80000000,
00055 PLAYLIST_E_OUTOFMEMORY,
00056 PLAYLIST_E_JSINITENGINE,
00057 PLAYLIST_E_JSINITMEDIA,
00058 PLAYLIST_E_JSEVALSCRIPT,
00059 PLAYLIST_E_JSMAINNOTFOUND,
00060 PLAYLIST_E_JSCALLMAIN,
00061 PLAYLIST_E_JSINVALIDARRAY,
00062 PLAYLIST_E_JSINVALIDCAST,
00063 PLAYLIST_E_JSINVALIDOBJECT,
00064 PLAYLIST_E_JSINVALIDTRACK,
00065 };
00066
00067
00068 typedef void (*playlist_callback_t)(void *instance, int level, ucs2char_t* message);
00069
00070 struct tag_playlist_entry {
00071 ucs2char_t filename[MAX_PATH];
00072 int valid;
00073 int order;
00074 };
00075 typedef struct tag_playlist_entry playlist_entry_t;
00076
00077 struct tag_playlist {
00078 ucs2char_t name[MAX_PATH];
00079 int num_entries;
00080 playlist_entry_t* entries;
00081 };
00082 typedef struct tag_playlist playlist_t;
00083
00084 struct tag_playlists {
00085 int num_playlists;
00086 playlist_t* playlists;
00087 };
00088 typedef struct tag_playlists playlists_t;
00089
00090 typedef struct {
00091 ucs2char_t path[MAX_PATH];
00092 ucs2char_t file[MAX_PATH];
00093 } playlist_mediafile_t;
00094
00095 PLAYLISTAPI
00096 void
00097 playlist_init(
00098 playlists_t* pls
00099 );
00100
00101 PLAYLISTAPI
00102 void
00103 playlist_finish(
00104 playlists_t *pls
00105 );
00106
00107 PLAYLISTAPI
00108 int
00109 playlist_read(
00110 playlists_t* pls,
00111 const ucs2char_t* filename,
00112 const ucs2char_t* path_to_include,
00113 pmp_music_record_t* records,
00114 int num_records,
00115 playlist_callback_t callback,
00116 void *instance
00117 );
00118
00119 PLAYLISTAPI
00120 int
00121 playlist_add_playlist(
00122 playlists_t* pls,
00123 const ucs2char_t* name
00124 );
00125
00126 PLAYLISTAPI
00127 int
00128 playlist_find_playlist(
00129 playlists_t* pls,
00130 const ucs2char_t* name
00131 );
00132
00133 PLAYLISTAPI
00134 int
00135 playlist_append(
00136 playlist_t* pl,
00137 const ucs2char_t* filename,
00138 int userdata
00139 );
00140
00141 PLAYLISTAPI
00142 int
00143 playlist_is_supported(
00144 const ucs2char_t* filename,
00145 int flag
00146 );
00147
00148 PLAYLISTAPI
00149 void
00150 playlist_normalize_prepare(
00151 playlist_mediafile_t* mediafiles,
00152 int num_mediafiles
00153 );
00154
00155 PLAYLISTAPI
00156 int
00157 playlist_normalize(
00158 playlist_t* pl,
00159 const ucs2char_t* path_to_playlist,
00160 const ucs2char_t* path_to_root,
00161 playlist_mediafile_t* mediafiles,
00162 int num_mediafiles
00163 );
00164
00165 PLAYLISTAPI
00166 void
00167 playlist_shuffle(
00168 playlist_t* pl
00169 );
00170
00171 #ifdef __cplusplus
00172 }
00173 #endif
00174
00175 #endif