00001 00021 #ifndef _LIGHTMEDIASCANNER_DB_H_ 00022 #define _LIGHTMEDIASCANNER_DB_H_ 1 00023 00024 #ifdef API 00025 #undef API 00026 #endif 00027 00028 #ifdef __GNUC__ 00029 # if __GNUC__ >= 4 00030 # define API __attribute__ ((visibility("default"))) 00031 # else 00032 # define API 00033 # endif 00034 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) 00035 # define GNUC_NON_NULL(...) __attribute__((nonnull(__VA_ARGS__))) 00036 # else 00037 # define GNUC_NON_NULL(...) 00038 # endif 00039 #else 00040 # define API 00041 # define GNUC_NON_NULL(...) 00042 #endif 00043 00044 #include <lightmediascanner_plugin.h> 00045 #include <lightmediascanner_utils.h> 00046 00047 #ifdef __cplusplus 00048 extern "C" { 00049 #endif 00050 00060 /* Image Records */ 00061 struct lms_gps_info { 00062 double latitude; 00063 double longitude; 00064 double altitude; 00065 }; 00066 00067 struct lms_image_info { 00068 int64_t id; 00069 struct lms_string_size title; 00070 struct lms_string_size artist; 00071 unsigned int date; 00072 unsigned short width; 00073 unsigned short height; 00074 unsigned short orientation; 00075 struct lms_gps_info gps; 00076 }; 00077 00078 typedef struct lms_db_image lms_db_image_t; 00079 00080 API lms_db_image_t *lms_db_image_new(sqlite3 *db) GNUC_NON_NULL(1); 00081 API int lms_db_image_start(lms_db_image_t *ldi) GNUC_NON_NULL(1); 00082 API int lms_db_image_free(lms_db_image_t *ldi) GNUC_NON_NULL(1); 00083 API int lms_db_image_add(lms_db_image_t *ldi, struct lms_image_info *info) GNUC_NON_NULL(1, 2); 00084 00085 /* Audio Records */ 00086 struct lms_audio_info { 00087 int64_t id; 00088 struct lms_string_size title; 00089 struct lms_string_size artist; 00090 struct lms_string_size album; 00091 struct lms_string_size genre; 00092 unsigned int playcnt; 00093 unsigned char trackno; 00094 unsigned char rating; 00095 }; 00096 00097 typedef struct lms_db_audio lms_db_audio_t; 00098 00099 API lms_db_audio_t *lms_db_audio_new(sqlite3 *db) GNUC_NON_NULL(1); 00100 API int lms_db_audio_start(lms_db_audio_t *lda) GNUC_NON_NULL(1); 00101 API int lms_db_audio_free(lms_db_audio_t *lda) GNUC_NON_NULL(1); 00102 API int lms_db_audio_add(lms_db_audio_t *lda, struct lms_audio_info *info) GNUC_NON_NULL(1, 2); 00103 00104 /* Video Records */ 00105 struct lms_video_info { 00106 int64_t id; 00107 struct lms_string_size title; 00108 struct lms_string_size artist; 00109 }; 00110 00111 typedef struct lms_db_video lms_db_video_t; 00112 00113 API lms_db_video_t *lms_db_video_new(sqlite3 *db) GNUC_NON_NULL(1); 00114 API int lms_db_video_start(lms_db_video_t *ldv) GNUC_NON_NULL(1); 00115 API int lms_db_video_free(lms_db_video_t *ldv) GNUC_NON_NULL(1); 00116 API int lms_db_video_add(lms_db_video_t *ldv, struct lms_video_info *info) GNUC_NON_NULL(1, 2); 00117 00118 /* Playlist Records */ 00119 struct lms_playlist_info { 00120 int64_t id; 00121 struct lms_string_size title; 00122 unsigned int n_entries; 00123 }; 00124 00125 typedef struct lms_db_playlist lms_db_playlist_t; 00126 00127 API lms_db_playlist_t *lms_db_playlist_new(sqlite3 *db) GNUC_NON_NULL(1); 00128 API int lms_db_playlist_start(lms_db_playlist_t *ldp) GNUC_NON_NULL(1); 00129 API int lms_db_playlist_free(lms_db_playlist_t *ldp) GNUC_NON_NULL(1); 00130 API int lms_db_playlist_add(lms_db_playlist_t *ldp, struct lms_playlist_info *info) GNUC_NON_NULL(1, 2); 00131 00136 #ifdef __cplusplus 00137 } 00138 #endif 00139 #endif /* _LIGHTMEDIASCANNER_DB_H_ */