2 * omnplay.h -- GTK+ 2 melted gui
3 * Copyright (C) 2012 Maksym Veremeyenko <verem@m1stereo.tv>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #endif /* __cplusplus */
30 #define PRODUCT_NAME "Melted GUI"
32 typedef enum control_buttons
34 BUTTON_PLAYLIST_ITEM_ADD
= 1,
35 BUTTON_PLAYLIST_ITEM_DEL
,
36 BUTTON_PLAYLIST_ITEM_EDIT
,
41 BUTTON_PLAYLIST_BLOCK_SINGLE
,
42 BUTTON_PLAYLIST_BLOCK_LOOP
,
44 BUTTON_PLAYLIST_ITEM_UP
,
45 BUTTON_PLAYLIST_ITEM_DOWN
,
53 BUTTON_LIBRARY_REFRESH
,
56 BUTTON_LIBRARY_FIND_NEXT
,
58 BUTTON_PLAYLIST_RELINK
,
63 #define PLAYLIST_BLOCK_BEGIN 1
64 #define PLAYLIST_BLOCK_BODY 0
65 #define PLAYLIST_BLOCK_END 2
66 #define PLAYLIST_BLOCK_LOOP 4
68 typedef enum playlist_item_type
71 PLAYLIST_ITEM_BLOCK_BEGIN
= PLAYLIST_BLOCK_BEGIN
,
73 PLAYLIST_ITEM_BLOCK_BODY
= PLAYLIST_BLOCK_BODY
,
75 PLAYLIST_ITEM_BLOCK_END
= PLAYLIST_BLOCK_END
,
77 PLAYLIST_ITEM_BLOCK_SINGLE
= PLAYLIST_BLOCK_BEGIN
|
81 PLAYLIST_ITEM_LOOP_BEGIN
= PLAYLIST_BLOCK_BEGIN
|
84 PLAYLIST_ITEM_LOOP_BODY
= PLAYLIST_BLOCK_BODY
|
87 PLAYLIST_ITEM_LOOP_END
= PLAYLIST_BLOCK_END
|
90 PLAYLIST_ITEM_LOOP_SINGLE
= PLAYLIST_BLOCK_BEGIN
|
94 } playlist_item_type_t
;
96 #define MAX_PLAYLIST_ITEMS 1024
97 #define MAX_LIBRARY_ITEMS 10240
98 #define PLAYLIST_ITEM_ERROR_LIB 1
99 #define PLAYLIST_ITEM_ERROR_CUE 2
102 * @anchor playlist_item_t
106 typedef struct playlist_item
109 char id
[PATH_MAX
]; /**< id of item, i.e. internal id or filename */
110 char title
[PATH_MAX
]; /**< title */
113 int player
; /**< player index that item currenly associated, -1 otherwise */
114 playlist_item_type_t type
; /**< block type of item */
115 int int_idx
; /**< internal playlist index */
117 int error
; /**< flag indicates if any error occured with item */
122 #define MAX_PLAYERS 4
124 struct instance_desc
;
126 typedef struct player_desc
132 GtkWidget
*label_status
, *label_state
, *label_tc_cur
, *label_tc_rem
, *label_clip
;
133 struct instance_desc
*app
;
138 typedef struct instance_desc
141 GtkWidget
*playlist_grid
;
142 GtkWidget
*library_tree
;
143 GtkWidget
*buttons
[BUTTON_LAST
+ 1];
144 GtkWidget
*status_label
;
147 player_t item
[MAX_PLAYERS
];
151 pthread_mutex_t lock
;
156 playlist_item_t item
[MAX_PLAYLIST_ITEMS
];
160 pthread_mutex_t lock
;
162 GdkPixbuf
*block_icons
[8];
171 playlist_item_t item
[MAX_LIBRARY_ITEMS
];
173 char filename
[PATH_MAX
];
174 char whois
[PATH_MAX
];
175 pthread_mutex_t lock
;
176 GThread
* refresh_thread
;
183 playlist_item_t item
[MAX_LIBRARY_ITEMS
];
188 instance_t
* instance_create(int argc
, char** argv
);
189 void instance_init(instance_t
* app
);
190 void instance_release(instance_t
* app
);
191 void instance_destroy(instance_t
* app
);
194 void omnplay_library_load(omnplay_instance_t
* app
);
195 void omnplay_library_save(omnplay_instance_t
* app
);
196 void omnplay_library_refresh(omnplay_instance_t
* app
);
197 void omnplay_library_draw(omnplay_instance_t
* app
);
199 typedef void (*omnplay_get_content_cb_proc
)(omnplay_instance_t
* app
, playlist_item_t
*items
, void* data
);
200 int omnplay_get_content(omnplay_instance_t
* app
, playlist_item_t
*items
, int limit
,
201 omnplay_get_content_cb_proc proc
, void* data
);
202 int omnplay_whois_list(omnplay_instance_t
* app
, playlist_item_t
*items
, int* plimit
);
203 int omnplay_library_load_file(playlist_item_t
* items
, int *pcount
, char* filename
);
204 playlist_item_t
* omnplay_library_find(omnplay_instance_t
* app
, char* id
);
205 int omnplay_library_normalize_item(omnplay_instance_t
* app
, playlist_item_t
* item
);
206 int omnplay_library_relink_item(omnplay_instance_t
* app
, playlist_item_t
* item
);
207 playlist_item_t
* omnplay_library_get_selected(omnplay_instance_t
* app
, int *count
);
208 void omnplay_playlist_normalize(omnplay_instance_t
* app
);
209 void omnplay_library_search(omnplay_instance_t
* app
, int next
);
210 void omnplay_set_status(omnplay_instance_t
* app
, char* str
);
211 int* omnplay_selected_idxs_playlist(omnplay_instance_t
* app
);
217 #endif /* __cplusplus */
219 #endif /* INSTANCE_H */