X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fomnplay.h;h=22e2dff7ff9636ffd3a107cf66f673e9ad315919;hb=HEAD;hp=dada0246a750c49924e9493fd71c3be8b8725930;hpb=eaa0b6e58efd48409c418327cd150f8658b186c7;p=omnplay diff --git a/src/omnplay.h b/src/omnplay.h index dada024..22e2dff 100644 --- a/src/omnplay.h +++ b/src/omnplay.h @@ -20,6 +20,8 @@ #ifndef OMNPLAY_H #define OMNPLAY_H +#include + #ifdef __cplusplus extern "C" { @@ -48,9 +50,66 @@ typedef enum control_buttons BUTTON_LIBRARY_ADD, BUTTON_LIBRARY_REFRESH, + BUTTON_LIBRARY_FIND, + BUTTON_LIBRARY_FIND_NEXT, + + BUTTON_PLAYLIST_RELINK, + BUTTON_LAST } control_buttons_t; +#define OMNPLAY_PLAYLIST_BLOCK_BEGIN 1 +#define OMNPLAY_PLAYLIST_BLOCK_BODY 0 +#define OMNPLAY_PLAYLIST_BLOCK_END 2 +#define OMNPLAY_PLAYLIST_BLOCK_LOOP 4 + +typedef enum playlist_item_type +{ + // 1 + OMNPLAY_PLAYLIST_ITEM_BLOCK_BEGIN = OMNPLAY_PLAYLIST_BLOCK_BEGIN, + // 0 + OMNPLAY_PLAYLIST_ITEM_BLOCK_BODY = OMNPLAY_PLAYLIST_BLOCK_BODY, + // 2 + OMNPLAY_PLAYLIST_ITEM_BLOCK_END = OMNPLAY_PLAYLIST_BLOCK_END, + // 3 + OMNPLAY_PLAYLIST_ITEM_BLOCK_SINGLE = OMNPLAY_PLAYLIST_BLOCK_BEGIN | + OMNPLAY_PLAYLIST_BLOCK_BODY | + OMNPLAY_PLAYLIST_BLOCK_END, + // 5 + OMNPLAY_PLAYLIST_ITEM_LOOP_BEGIN = OMNPLAY_PLAYLIST_BLOCK_BEGIN | + OMNPLAY_PLAYLIST_BLOCK_LOOP, + // 4 + OMNPLAY_PLAYLIST_ITEM_LOOP_BODY = OMNPLAY_PLAYLIST_BLOCK_BODY | + OMNPLAY_PLAYLIST_BLOCK_LOOP, + // 6 + OMNPLAY_PLAYLIST_ITEM_LOOP_END = OMNPLAY_PLAYLIST_BLOCK_END | + OMNPLAY_PLAYLIST_BLOCK_LOOP, + // 7 + OMNPLAY_PLAYLIST_ITEM_LOOP_SINGLE = OMNPLAY_PLAYLIST_BLOCK_BEGIN | + OMNPLAY_PLAYLIST_BLOCK_BODY | + OMNPLAY_PLAYLIST_BLOCK_END | + OMNPLAY_PLAYLIST_BLOCK_LOOP, +} playlist_item_type_t; + +#define MAX_PLAYLIST_ITEMS 1024 +#define MAX_LIBRARY_ITEMS 10240 +#define PLAYLIST_ITEM_ERROR_LIB 1 +#define PLAYLIST_ITEM_ERROR_CUE 2 + +typedef struct playlist_item +{ + char id[PATH_MAX]; + char title[PATH_MAX]; + int in; + int dur; + int player; + playlist_item_type_t type; + int omn_idx; + int omn_offset; + int error; + int del; +} playlist_item_t; + #define MAX_PLAYERS 4 struct omnplay_instance; @@ -61,33 +120,84 @@ typedef struct omnplay_player char name[PATH_MAX]; char host[PATH_MAX]; void* handle; - pthread_t thread; - pthread_mutex_t lock; + GThread* thread; GtkWidget *label_status, *label_state, *label_tc_cur, *label_tc_rem, *label_clip; struct omnplay_instance *app; -} -omnplay_player_t; + int playlist_start; + int playlist_length; +} omnplay_player_t; typedef struct omnplay_instance { GtkWidget *window; - GtkWidget *playlist; - GtkWidget *library; + GtkWidget *playlist_grid; + GtkWidget *library_grid; GtkWidget *buttons[BUTTON_LAST + 1]; + GtkWidget *status_label; struct { omnplay_player_t item[MAX_PLAYERS]; int count; char path[PATH_MAX]; + pthread_mutex_t lock; } players; int f_exit; -} -omnplay_instance_t; + struct + { + playlist_item_t item[MAX_PLAYLIST_ITEMS]; + int count; + int ver_curr; + int ver_prev; + pthread_mutex_t lock; + char* path; + GdkPixbuf *block_icons[8]; + } playlist; + struct + { + playlist_item_t item[MAX_LIBRARY_ITEMS]; + int count; + char filename[PATH_MAX]; + char whois[PATH_MAX]; + pthread_mutex_t lock; + GThread* refresh_thread; + GtkWidget *search; + int id_display_rate; + int id_display_idx; + } library; + struct + { + playlist_item_t item[MAX_LIBRARY_ITEMS]; + int count; + } clipboard; +} omnplay_instance_t; omnplay_instance_t* omnplay_create(int argc, char** argv); void omnplay_init(omnplay_instance_t* app); void omnplay_release(omnplay_instance_t* app); void omnplay_destroy(omnplay_instance_t* app); +void omnplay_playlist_load(omnplay_instance_t* app); +void omnplay_playlist_save(omnplay_instance_t* app); +void omnplay_playlist_relink(omnplay_instance_t* app); +void omnplay_playlist_draw(omnplay_instance_t* app); +void omnplay_playlist_draw_item(omnplay_instance_t* app, int idx); +void omnplay_playlist_draw_item_rem(omnplay_instance_t* app, int idx, char* rem); +void omnplay_library_load(omnplay_instance_t* app); +void omnplay_library_save(omnplay_instance_t* app); +void omnplay_library_refresh(omnplay_instance_t* app); +void omnplay_library_draw(omnplay_instance_t* app); +typedef void (*omnplay_get_content_cb_proc)(omnplay_instance_t* app, playlist_item_t *items, void* data); +int omnplay_get_content(omnplay_instance_t* app, playlist_item_t *items, int limit, + omnplay_get_content_cb_proc proc, void* data); +int omnplay_whois_list(omnplay_instance_t* app, playlist_item_t *items, int* plimit); +int omnplay_library_load_file(playlist_item_t* items, int *pcount, char* filename); +playlist_item_t* omnplay_library_find(omnplay_instance_t* app, char* id); +int omnplay_library_normalize_item(omnplay_instance_t* app, playlist_item_t* item); +int omnplay_library_relink_item(omnplay_instance_t* app, playlist_item_t* item); +playlist_item_t* omnplay_library_get_selected(omnplay_instance_t* app, int *count); +void omnplay_playlist_normalize(omnplay_instance_t* app); +void omnplay_library_search(omnplay_instance_t* app, int next); +void omnplay_set_status(omnplay_instance_t* app, char* str); +int* omnplay_selected_idxs_playlist(omnplay_instance_t* app); #ifdef __cplusplus };