/* * omnplay.h -- GTK+ 2 melted gui * Copyright (C) 2012 Maksym Veremeyenko * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef INSTANCE_H #define INSTANCE_H #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define PRODUCT_NAME "Melted GUI" typedef enum control_buttons { BUTTON_PLAYLIST_ITEM_ADD = 1, BUTTON_PLAYLIST_ITEM_DEL, BUTTON_PLAYLIST_ITEM_EDIT, BUTTON_PLAYLIST_LOAD, BUTTON_PLAYLIST_SAVE, BUTTON_PLAYLIST_BLOCK_SINGLE, BUTTON_PLAYLIST_BLOCK_LOOP, BUTTON_PLAYLIST_ITEM_UP, BUTTON_PLAYLIST_ITEM_DOWN, BUTTON_PLAYER_CUE, BUTTON_PLAYER_PLAY, BUTTON_PLAYER_PAUSE, BUTTON_PLAYER_STOP, BUTTON_LIBRARY_ADD, BUTTON_LIBRARY_REFRESH, BUTTON_LIBRARY_FIND, BUTTON_LIBRARY_FIND_NEXT, BUTTON_PLAYLIST_RELINK, BUTTON_LAST } control_buttons_t; #define PLAYLIST_BLOCK_BEGIN 1 #define PLAYLIST_BLOCK_BODY 0 #define PLAYLIST_BLOCK_END 2 #define PLAYLIST_BLOCK_LOOP 4 typedef enum playlist_item_type { // 1 PLAYLIST_ITEM_BLOCK_BEGIN = PLAYLIST_BLOCK_BEGIN, // 0 PLAYLIST_ITEM_BLOCK_BODY = PLAYLIST_BLOCK_BODY, // 2 PLAYLIST_ITEM_BLOCK_END = PLAYLIST_BLOCK_END, // 3 PLAYLIST_ITEM_BLOCK_SINGLE = PLAYLIST_BLOCK_BEGIN | PLAYLIST_BLOCK_BODY | PLAYLIST_BLOCK_END, // 5 PLAYLIST_ITEM_LOOP_BEGIN = PLAYLIST_BLOCK_BEGIN | PLAYLIST_BLOCK_LOOP, // 4 PLAYLIST_ITEM_LOOP_BODY = PLAYLIST_BLOCK_BODY | PLAYLIST_BLOCK_LOOP, // 6 PLAYLIST_ITEM_LOOP_END = PLAYLIST_BLOCK_END | PLAYLIST_BLOCK_LOOP, // 7 PLAYLIST_ITEM_LOOP_SINGLE = PLAYLIST_BLOCK_BEGIN | PLAYLIST_BLOCK_BODY | PLAYLIST_BLOCK_END | 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 /** * @anchor playlist_item_t * * fu */ typedef struct playlist_item { /*@{*/ char id[PATH_MAX]; /**< id of item, i.e. internal id or filename */ char title[PATH_MAX]; /**< title */ int in; int dur; int player; /**< player index that item currenly associated, -1 otherwise */ playlist_item_type_t type; /**< block type of item */ int int_idx; /**< internal playlist index */ // int omn_offset; int error; /**< flag indicates if any error occured with item */ int del; /**< */ /*@}*/ } playlist_item_t; #define MAX_PLAYERS 4 struct instance_desc; typedef struct player_desc { int idx; int unit; void* handle; GThread* thread; GtkWidget *label_status, *label_state, *label_tc_cur, *label_tc_rem, *label_clip; struct instance_desc *app; int playlist_start; int playlist_length; } player_t; typedef struct instance_desc { GtkWidget *window; GtkWidget *playlist_grid; GtkWidget *library_tree; GtkWidget *buttons[BUTTON_LAST + 1]; GtkWidget *status_label; struct { player_t item[MAX_PLAYERS]; int count; char host[PATH_MAX]; int port; pthread_mutex_t lock; } players; int f_exit; 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 { int port; void* handle[2]; GdkPixbuf *icons[8]; 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; } instance_t; instance_t* instance_create(int argc, char** argv); void instance_init(instance_t* app); void instance_release(instance_t* app); void instance_destroy(instance_t* app); #if 0 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); #endif #ifdef __cplusplus }; #endif /* __cplusplus */ #endif /* INSTANCE_H */