libnjb.h | libnjb.h | |||
---|---|---|---|---|
/* src/libnjb.h. Generated by configure. */ | ||||
#ifndef __LIBNJB__H | #ifndef __LIBNJB__H | |||
#define __LIBNJB__H | #define __LIBNJB__H | |||
/* Undefine if libnjb was compiled for libusb support */ | #define LIBNJB_VERSION 1.2 | |||
#define LIBNJB_COMPILED_FOR_LIBUSB 1 | #define LIBNJB_COMPILED_FOR_LIBUSB 1 | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#ifdef __WIN32__ | ||||
/* Windows specific code, types that do not exist in Windows | ||||
* sys/types.h | ||||
*/ | ||||
typedef char int8_t; | ||||
typedef unsigned char u_int8_t; | ||||
typedef short int16_t; | ||||
typedef unsigned short u_int16_t; | ||||
typedef int int32_t; | ||||
typedef unsigned int u_int32_t; | ||||
typedef unsigned __int64 u_int64_t; | ||||
#endif | ||||
#include <stdio.h> | #include <stdio.h> | |||
#include <string.h> | ||||
#ifdef LIBNJB_COMPILED_FOR_LIBUSB | ||||
#include <usb.h> | #include <usb.h> | |||
#else | ||||
#include <dev/usb/usb.h> | ||||
#endif | ||||
#define NJB_MAX_DEVICES 0xFF | #define NJB_MAX_DEVICES 0xFF | |||
/* Enumerators to identify different jukeboxes */ | /* Enumerators to identify different jukeboxes */ | |||
#define NJB_DEVICE_NJB1 0x00 | #define NJB_DEVICE_NJB1 0x00 | |||
#define NJB_DEVICE_NJB2 0x01 | #define NJB_DEVICE_NJB2 0x01 | |||
#define NJB_DEVICE_NJB3 0x02 | #define NJB_DEVICE_NJB3 0x02 | |||
#define NJB_DEVICE_NJBZEN 0x03 | #define NJB_DEVICE_NJBZEN 0x03 | |||
#define NJB_DEVICE_NJBZEN2 0x04 | #define NJB_DEVICE_NJBZEN2 0x04 | |||
#define NJB_DEVICE_NJBZENNX 0x05 | #define NJB_DEVICE_NJBZENNX 0x05 | |||
#define NJB_DEVICE_NJBZENXTRA 0x06 | #define NJB_DEVICE_NJBZENXTRA 0x06 | |||
#define NJB_DEVICE_DELLDJ 0x07 | #define NJB_DEVICE_DELLDJ 0x07 | |||
#define NJB_DEVICE_NJBZENTOUCH 0x08 | ||||
#define NJB_POWER_BATTERY 0x00 | #define NJB_POWER_BATTERY 0x00 | |||
#define NJB_POWER_AC_CHARGED 0x01 | #define NJB_POWER_AC_CHARGED 0x01 | |||
#define NJB_POWER_AC_CHARGING 0x03 | #define NJB_POWER_AC_CHARGING 0x03 | |||
#define ID_DATA_ASCII 0 | #define ID_DATA_ASCII 0 | |||
#define ID_DATA_BIN 1 | #define ID_DATA_BIN 1 | |||
#define ID_DATA_UNI 2 | ||||
#define NJB_CODEC_MP3 "MP3" | #define NJB_CODEC_MP3 "MP3" | |||
#define NJB_CODEC_WMA "WMA" | #define NJB_CODEC_WMA "WMA" | |||
#define NJB_CODEC_WAV "WAV" | #define NJB_CODEC_WAV "WAV" | |||
#define FR_SIZE "FILE SIZE" | #define FR_SIZE "FILE SIZE" | |||
#define FR_LENGTH "LENGTH" | #define FR_LENGTH "LENGTH" | |||
#define FR_CODEC "CODEC" | #define FR_CODEC "CODEC" | |||
#define FR_TITLE "TITLE" | #define FR_TITLE "TITLE" | |||
#define FR_ALBUM "ALBUM" | #define FR_ALBUM "ALBUM" | |||
#define FR_GENRE "GENRE" | #define FR_GENRE "GENRE" | |||
#define FR_ARTIST "ARTIST" | #define FR_ARTIST "ARTIST" | |||
#define FR_TRACK "TRACK NUM" | #define FR_TRACK "TRACK NUM" | |||
#define FR_FNAME "FNAME" | #define FR_FNAME "FNAME" | |||
#define FR_YEAR "YEAR" | #define FR_YEAR "YEAR" | |||
#define FR_PROTECTED "PlayOnly" | #define FR_PROTECTED "PlayOnly" | |||
/* These two are used by Notmad on NJB1, not Creative */ | ||||
#define FR_BITRATE "BITRATE" | ||||
#define FR_COMMENT "COMMENT" | ||||
/* Sound adjustment parameters */ | /* Sound adjustment parameters - deprecated: use new EAX API */ | |||
/* These are to be moved into protocol.h and only used internally */ | ||||
#define NJB_SOUND_SET_VOLUME 0x01 | #define NJB_SOUND_SET_VOLUME 0x01 | |||
#define NJB_SOUND_SET_BASS 0x02 | #define NJB_SOUND_SET_BASS 0x02 | |||
#define NJB_SOUND_SET_TREBLE 0x03 | #define NJB_SOUND_SET_TREBLE 0x03 | |||
#define NJB_SOUND_SET_MUTING 0x04 | #define NJB_SOUND_SET_MUTING 0x04 | |||
#define NJB_SOUND_SET_MIDRANGE 0x05 | #define NJB_SOUND_SET_MIDRANGE 0x05 | |||
#define NJB_SOUND_SET_MIDFREQ 0x06 | #define NJB_SOUND_SET_MIDFREQ 0x06 | |||
#define NJB_SOUND_SET_EAX 0x07 | #define NJB_SOUND_SET_EAX 0x07 | |||
#define NJB_SOUND_SET_EAXAMT 0x08 | #define NJB_SOUND_SET_EAXAMT 0x08 | |||
#define NJB_SOUND_SET_HEADPHONE 0x09 | #define NJB_SOUND_SET_HEADPHONE 0x09 | |||
#define NJB_SOUND_SET_REAR 0x0A | #define NJB_SOUND_SET_REAR 0x0A | |||
skipping to change at line 100 | skipping to change at line 112 | |||
#define EO_SRCFILE 23 /* can't read source file */ | #define EO_SRCFILE 23 /* can't read source file */ | |||
#define EO_INVALID 24 /* invalid arguments */ | #define EO_INVALID 24 /* invalid arguments */ | |||
#define EO_AGAIN 25 /* resource temporarily unavailable */ | #define EO_AGAIN 25 /* resource temporarily unavailable */ | |||
/* Debug flags */ | /* Debug flags */ | |||
#define DD_USBCTL 1 | #define DD_USBCTL 1 | |||
#define DD_USBBLKLIM 2 | #define DD_USBBLKLIM 2 | |||
#define DD_USBBLK 4 | #define DD_USBBLK 4 | |||
#define DD_SUBTRACE 8 | #define DD_SUBTRACE 8 | |||
#define DD_BSDKDEBUG 16 | ||||
/* Unicode flags */ | /* Unicode flags */ | |||
#define NJB_UC_8859 0 | #define NJB_UC_8859 0 | |||
#define NJB_UC_UTF8 1 | #define NJB_UC_UTF8 1 | |||
/* NJB structure definitions */ | /* NJB structure definitions */ | |||
typedef struct { | typedef struct { | |||
unsigned char id[16]; /* Move all of this into njb_t eventually */ | unsigned char id[16]; /* Move all of this into njb_t eventually */ | |||
skipping to change at line 129 | skipping to change at line 140 | |||
} njbid_t; | } njbid_t; | |||
typedef struct { | typedef struct { | |||
unsigned char id[16]; | unsigned char id[16]; | |||
u_int64_t count; | u_int64_t count; | |||
} njblibctr_t; | } njblibctr_t; | |||
#define OWNER_STRING_LENGTH 128 | #define OWNER_STRING_LENGTH 128 | |||
typedef unsigned char owner_string[OWNER_STRING_LENGTH + 1]; | typedef unsigned char owner_string[OWNER_STRING_LENGTH + 1]; | |||
#ifndef LIBNJB_COMPILED_FOR_LIBUSB | ||||
typedef struct { | ||||
int fd; | ||||
char *dev; | ||||
size_t pmax; | ||||
} njb_if_t; | ||||
#endif | ||||
typedef struct njb_t njb_t; | typedef struct njb_t njb_t; | |||
typedef struct songid_frame_t songid_frame_t; | typedef struct songid_frame_t songid_frame_t; | |||
typedef struct songid_t songid_t; | typedef struct songid_t songid_t; | |||
typedef struct playlist_track_struct playlist_track_t; | typedef struct playlist_track_struct playlist_track_t; | |||
typedef struct playlist_struct playlist_t; | typedef struct playlist_struct playlist_t; | |||
typedef struct datafile_struct datafile_t; | typedef struct datafile_struct datafile_t; | |||
typedef struct eax_struct njb_eax_t; | ||||
struct njb_t { | struct njb_t { | |||
#ifdef LIBNJB_COMPILED_FOR_LIBUSB | ||||
struct usb_device *device; | struct usb_device *device; | |||
usb_dev_handle *dev; | usb_dev_handle *dev; | |||
int bulkep; | int bulkep; | |||
int intrep; | int intrep; | |||
usb_dev_handle *ctl; /* made protocol.c port easier */ | ||||
usb_dev_handle *bin; | ||||
usb_dev_handle *bout; | ||||
usb_dev_handle *iin; | ||||
usb_dev_handle *iout; | ||||
#else | ||||
njb_if_t ctl; | ||||
njb_if_t bin; | ||||
njb_if_t bout; | ||||
njb_if_t iin; | ||||
njb_if_t iout; | ||||
struct usb_device_info info; | ||||
#endif | ||||
int device_type; /* what kind of jukebox it is */ | int device_type; /* what kind of jukebox it is */ | |||
unsigned char id[16]; | unsigned char id[16]; | |||
char idstring[33]; | char idstring[33]; | |||
u_int64_t libcount; | ||||
int session_updated; | ||||
int extrarun_on_rename; /* Used during renaming of tracks in series | ||||
3 protocol */ | ||||
int get_extended_tag_info; /* Get extended tags */ | ||||
int reset_get_track_tag; | ||||
int reset_get_playlist; | ||||
int reset_get_datafile_tag; | ||||
int updated; | int updated; | |||
u_int32_t xfersize; | u_int32_t xfersize; | |||
char *tmpdir; | void *protocol_state; /* dereferenced and maintained individually by | |||
unsigned char *protocol_state; /* dereferenced and maintained indivi | protocol implementations */ | |||
dually by protocol implementations */ | ||||
u_int8_t fwMajor; /* should eventually be moved here from njbid_t */ | u_int8_t fwMajor; /* should eventually be moved here from njbid_t */ | |||
u_int8_t fwMinor; | u_int8_t fwMinor; | |||
u_int8_t fwRel; | u_int8_t fwRel; | |||
}; | }; | |||
/* Song/track tag definitions */ | /* Song/track tag definitions */ | |||
struct songid_frame_t { | struct songid_frame_t { | |||
u_int16_t type; | u_int16_t type; | |||
u_int16_t labelsz; | u_int16_t labelsz; | |||
skipping to change at line 236 | skipping to change at line 218 | |||
struct datafile_struct { | struct datafile_struct { | |||
char *filename; | char *filename; | |||
u_int32_t timestamp; | u_int32_t timestamp; | |||
u_int32_t dfid; | u_int32_t dfid; | |||
u_int32_t msdw; | u_int32_t msdw; | |||
u_int32_t lsdw; | u_int32_t lsdw; | |||
datafile_t *nextdf; | datafile_t *nextdf; | |||
}; | }; | |||
/* EAX block definition */ | /* EAX block definition - deprecated: use new EAX API */ | |||
typedef struct | typedef struct { | |||
{ | ||||
u_int8_t volume; | u_int8_t volume; | |||
u_int8_t volumemin; | u_int8_t volumemin; | |||
u_int8_t volumemax; | u_int8_t volumemax; | |||
int16_t muted; | int16_t muted; | |||
int16_t eq_status; | int16_t eq_status; | |||
int8_t bass; | int8_t bass; | |||
int8_t bassmin; | int8_t bassmin; | |||
int8_t bassmax; | int8_t bassmax; | |||
int8_t midrange; | int8_t midrange; | |||
int8_t midrangemin; | int8_t midrangemin; | |||
skipping to change at line 269 | skipping to change at line 250 | |||
char **effects; | char **effects; | |||
u_int8_t *effamts; | u_int8_t *effamts; | |||
u_int8_t nphone; | u_int8_t nphone; | |||
u_int8_t actphone; | u_int8_t actphone; | |||
char **phonemodes; | char **phonemodes; | |||
u_int8_t nrear; | u_int8_t nrear; | |||
u_int8_t actrear; | u_int8_t actrear; | |||
char **rears; | char **rears; | |||
} eax_t; | } eax_t; | |||
typedef struct | /* EAX API type */ | |||
{ | struct eax_struct { | |||
u_int16_t number; | ||||
char *name; | ||||
/* | ||||
* The "exclusive" attribute signifies if this effect can be used | ||||
* in parallell with other EAX effects, | ||||
* GUI:s shall make sure all other effects are reset to default | ||||
* values when one effect is chosen. | ||||
*/ | ||||
u_int8_t exclusive; /* 0x00 = not exclusive, 0x01 = exclusive */ | ||||
/* | ||||
* The visual group for this effect - | ||||
* effects appearing after each other are grouped if their | ||||
* group numbers are identical | ||||
*/ | ||||
u_int8_t group; | ||||
/* If this effect has several different settings */ | ||||
u_int8_t selectable; /* 0x00 = not selectable, 0x01 = selectable */ | ||||
u_int16_t current_selectionvalue; | ||||
u_int16_t min_selectionvalue; | ||||
u_int16_t max_selectionvalue; | ||||
char **selection_names; /* Array with names for these selections */ | ||||
/* If this effect can be slided on a scale */ | ||||
u_int8_t scaleable; /* 0x00 = not scalable, 0x01 = scalable */ | ||||
int16_t current_scalevalue; | ||||
int16_t min_scalevalue; | ||||
int16_t max_scalevalue; | ||||
njb_eax_t *next; /* Only to be used inside of libnjb */ | ||||
}; | ||||
/* Time set/read struct */ | ||||
typedef struct { | ||||
int16_t year; | int16_t year; | |||
int16_t month; | int16_t month; | |||
int16_t day; | int16_t day; | |||
int16_t weekday; | int16_t weekday; | |||
int16_t hours; | int16_t hours; | |||
int16_t minutes; | int16_t minutes; | |||
int16_t seconds; | int16_t seconds; | |||
} njb_time_t; | } njb_time_t; | |||
/* Struct to hold key/value pairs */ | ||||
typedef struct njb_keyval_t njb_keyval_t; | ||||
struct njb_keyval_t { | ||||
char key[5]; | ||||
u_int32_t value1; | ||||
u_int32_t value2; | ||||
unsigned char deviceid[16]; | ||||
njb_keyval_t *next; | ||||
}; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* NJB commands */ | /* NJB commands */ | |||
typedef int XferCallback(u_int64_t sent, u_int64_t total, | typedef int XferCallback(u_int64_t sent, u_int64_t total, | |||
const char* buf, unsigned len, void *data); | const char* buf, unsigned len, void *data); | |||
int NJB_Set_TmpDir (njb_t *njb, const char *dir); | ||||
const char *NJB_Get_TmpDir (njb_t *njb); | ||||
int NJB_Discover(njb_t *njbs, int limit, int *n); | int NJB_Discover(njb_t *njbs, int limit, int *n); | |||
int NJB_Open(njb_t *njb); | int NJB_Open(njb_t *njb); | |||
void NJB_Close(njb_t *njb); | void NJB_Close(njb_t *njb); | |||
int NJB_Capture (njb_t *njb); | int NJB_Capture (njb_t *njb); | |||
int NJB_Release (njb_t *njb); | int NJB_Release (njb_t *njb); | |||
njbid_t *NJB_Ping(njb_t *njb); | njbid_t *NJB_Ping(njb_t *njb); | |||
void NJB_Get_Extended_Tags (njb_t *njb, int extended); | void NJB_Get_Extended_Tags (njb_t *njb, int extended); | |||
void NJB_Reset_Get_Track_Tag (njb_t *njb); | void NJB_Reset_Get_Track_Tag (njb_t *njb); | |||
songid_t *NJB_Get_Track_Tag (njb_t *njb); | songid_t *NJB_Get_Track_Tag (njb_t *njb); | |||
void NJB_Reset_Get_Playlist (njb_t *njb); | void NJB_Reset_Get_Playlist (njb_t *njb); | |||
playlist_t *NJB_Get_Playlist (njb_t *njb); | playlist_t *NJB_Get_Playlist (njb_t *njb); | |||
int NJB_Get_Disk_Usage (njb_t *njb, u_int64_t *btotal, u_int64_t *bfree); | int NJB_Get_Disk_Usage (njb_t *njb, u_int64_t *btotal, u_int64_t *bfree); | |||
char *NJB_Get_Owner_String (njb_t *njb); | char *NJB_Get_Owner_String (njb_t *njb); | |||
int NJB_Set_Owner_String (njb_t *njb, const char *name); | int NJB_Set_Owner_String (njb_t *njb, const char *name); | |||
void NJB_Reset_Get_Datafile_Tag (njb_t *njb); | void NJB_Reset_Get_Datafile_Tag (njb_t *njb); | |||
datafile_t *NJB_Get_Datafile_Tag (njb_t *njb); | datafile_t *NJB_Get_Datafile_Tag (njb_t *njb); | |||
eax_t *NJB_Get_EAX (njb_t *njb); | eax_t *NJB_Get_EAX (njb_t *njb); /* Deprecated, use new EAX API */ | |||
int NJB_Refresh_EAX (njb_t *njb, eax_t *eax); | int NJB_Refresh_EAX (njb_t *njb, eax_t *eax); /* Deprecated, use new EAX AP | |||
I */ | ||||
void NJB_Reset_Get_EAX_Type (njb_t *njb); | ||||
njb_eax_t *NJB_Get_EAX_Type (njb_t *njb); | ||||
void NJB_Destroy_EAX_Type (njb_eax_t *eax); | ||||
void NJB_Adjust_EAX (njb_t *njb, | ||||
u_int16_t eaxid, | ||||
u_int16_t patchindex, | ||||
int16_t scalevalue); | ||||
njb_time_t *NJB_Get_Time(njb_t *njb); | njb_time_t *NJB_Get_Time(njb_t *njb); | |||
int NJB_Set_Time(njb_t *njb, njb_time_t *time); | int NJB_Set_Time(njb_t *njb, njb_time_t *time); | |||
void NJB_Destroy_Time(njb_time_t *time); | ||||
int NJB_Set_Bitmap(njb_t *njb, const char * pbm_file); | int NJB_Set_Bitmap(njb_t *njb, const char * pbm_file); | |||
int NJB_Delete_Playlist (njb_t *njb, u_int32_t plid); | int NJB_Delete_Playlist (njb_t *njb, u_int32_t plid); | |||
int NJB_Update_Playlist (njb_t *njb, playlist_t *pl); | int NJB_Update_Playlist (njb_t *njb, playlist_t *pl); | |||
int NJB_Delete_Track (njb_t *njb, u_int32_t trackid); | int NJB_Delete_Track (njb_t *njb, u_int32_t trackid); | |||
int NJB_Delete_Datafile (njb_t *njb, u_int32_t fileid); | int NJB_Delete_Datafile (njb_t *njb, u_int32_t fileid); | |||
#define NJB_Get_File NJB_Get_Track | #define NJB_Get_File NJB_Get_Track | |||
int NJB_Get_Track (njb_t *njb, u_int32_t trackid, u_int32_t size, | int NJB_Get_Track (njb_t *njb, u_int32_t trackid, u_int32_t size, | |||
const char *path, XferCallback *callback, void *data); | const char *path, XferCallback *callback, void *data); | |||
int NJB_Send_Track (njb_t *njb, const char *path, const char *codec, | int NJB_Send_Track (njb_t *njb, const char *path, const char *codec, | |||
const char *title, const char *album, const char *genre, | const char *title, const char *album, const char *genre, | |||
skipping to change at line 340 | skipping to change at line 368 | |||
int NJB_Play_Track (njb_t *njb, u_int32_t trackid); | int NJB_Play_Track (njb_t *njb, u_int32_t trackid); | |||
int NJB_Queue_Track (njb_t *njb, u_int32_t trackid); | int NJB_Queue_Track (njb_t *njb, u_int32_t trackid); | |||
int NJB_Stop_Play (njb_t *njb); | int NJB_Stop_Play (njb_t *njb); | |||
int NJB_Pause_Play (njb_t *njb); | int NJB_Pause_Play (njb_t *njb); | |||
int NJB_Resume_Play (njb_t *njb); | int NJB_Resume_Play (njb_t *njb); | |||
int NJB_Seek_Track (njb_t *njb, u_int32_t position); | int NJB_Seek_Track (njb_t *njb, u_int32_t position); | |||
int NJB_Elapsed_Time (njb_t *njb, u_int16_t *elapsed, int *change); | int NJB_Elapsed_Time (njb_t *njb, u_int16_t *elapsed, int *change); | |||
int NJB_Adjust_Sound(njb_t *njb, u_int8_t effect, u_int16_t value); | int NJB_Adjust_Sound(njb_t *njb, u_int8_t effect, u_int16_t value); | |||
void NJB_Set_Debug (int debug_flags); | void NJB_Set_Debug (int debug_flags); | |||
void NJB_Set_Unicode (int unicode_flag); | void NJB_Set_Unicode (int unicode_flag); | |||
njb_keyval_t *NJB_Get_Keys(njb_t *njb); | ||||
/* Error functions */ | /* Error functions */ | |||
void njb_error_reset_geterror (void); | void njb_error_reset_geterror (void); | |||
const char *njb_error_geterror (void); | const char *njb_error_geterror (void); | |||
const char *njb_error_string (int err); | const char *njb_error_string (int err); | |||
void njb_error_dump (FILE *fp); | void njb_error_dump (FILE *fp); | |||
/* Song/track tag functions */ | /* Song/track tag functions */ | |||
skipping to change at line 425 | skipping to change at line 454 | |||
void datafile_dump(datafile_t *df, FILE *fp); | void datafile_dump(datafile_t *df, FILE *fp); | |||
datafile_t *datafile_unpack (unsigned char *data, size_t nbytes); | datafile_t *datafile_unpack (unsigned char *data, size_t nbytes); | |||
unsigned char *datafile_pack (datafile_t *df, u_int32_t *size); | unsigned char *datafile_pack (datafile_t *df, u_int32_t *size); | |||
u_int64_t datafile_size (datafile_t *df); | u_int64_t datafile_size (datafile_t *df); | |||
void datafile_set_size (datafile_t *df, u_int64_t size); | void datafile_set_size (datafile_t *df, u_int64_t size); | |||
void datafile_set_time (datafile_t *df, time_t ts); | void datafile_set_time (datafile_t *df, time_t ts); | |||
int datafile_set_name (datafile_t *df, const char *filename); | int datafile_set_name (datafile_t *df, const char *filename); | |||
unsigned char *datafile_pack3 (njb_t *njb, datafile_t *df, u_int32_t *size) ; | unsigned char *datafile_pack3 (njb_t *njb, datafile_t *df, u_int32_t *size) ; | |||
/* EAX functions */ | /* EAX functions */ | |||
eax_t *eax_unpack(void *data, size_t nbytes); | ||||
eax_t *eax_unpack3(void *data); | ||||
void eax_destroy(eax_t *eax); | void eax_destroy(eax_t *eax); | |||
void eax_refresh(eax_t *eax, unsigned char *data, size_t numbytes); | ||||
/* Time functions */ | /* Time functions */ | |||
njb_time_t *time_unpack(void *data); | njb_time_t *time_unpack(void *data); | |||
njb_time_t *time_unpack3(void *data); | njb_time_t *time_unpack3(void *data); | |||
void *time_pack(njb_time_t *time); | void *time_pack(njb_time_t *time); | |||
void *time_pack3(njb_time_t *time); | void *time_pack3(njb_time_t *time); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
End of changes. 26 change blocks. | ||||
56 lines changed or deleted | 81 lines changed or added | |||