2 * omnplay.h -- GTK+ 2 omnplay
3 * Copyright (C) 2011 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.
26 #endif /* __cplusplus */
28 typedef enum control_buttons
30 BUTTON_PLAYLIST_ITEM_ADD
= 1,
31 BUTTON_PLAYLIST_ITEM_DEL
,
32 BUTTON_PLAYLIST_ITEM_EDIT
,
37 BUTTON_PLAYLIST_BLOCK_SINGLE
,
38 BUTTON_PLAYLIST_BLOCK_LOOP
,
40 BUTTON_PLAYLIST_ITEM_UP
,
41 BUTTON_PLAYLIST_ITEM_DOWN
,
49 BUTTON_LIBRARY_REFRESH
,
54 #define OMNPLAY_PLAYLIST_BLOCK_BEGIN 1
55 #define OMNPLAY_PLAYLIST_BLOCK_BODY 0
56 #define OMNPLAY_PLAYLIST_BLOCK_END 2
57 #define OMNPLAY_PLAYLIST_BLOCK_LOOP 4
59 typedef enum playlist_item_type
62 OMNPLAY_PLAYLIST_ITEM_BLOCK_BEGIN
= OMNPLAY_PLAYLIST_BLOCK_BEGIN
,
64 OMNPLAY_PLAYLIST_ITEM_BLOCK_BODY
= OMNPLAY_PLAYLIST_BLOCK_BODY
,
66 OMNPLAY_PLAYLIST_ITEM_BLOCK_END
= OMNPLAY_PLAYLIST_BLOCK_END
,
68 OMNPLAY_PLAYLIST_ITEM_BLOCK_SINGLE
= OMNPLAY_PLAYLIST_BLOCK_BEGIN
|
69 OMNPLAY_PLAYLIST_BLOCK_BODY
|
70 OMNPLAY_PLAYLIST_BLOCK_END
,
72 OMNPLAY_PLAYLIST_ITEM_LOOP_BEGIN
= OMNPLAY_PLAYLIST_BLOCK_BEGIN
|
73 OMNPLAY_PLAYLIST_BLOCK_LOOP
,
75 OMNPLAY_PLAYLIST_ITEM_LOOP_BODY
= OMNPLAY_PLAYLIST_BLOCK_BODY
|
76 OMNPLAY_PLAYLIST_BLOCK_LOOP
,
78 OMNPLAY_PLAYLIST_ITEM_LOOP_END
= OMNPLAY_PLAYLIST_BLOCK_END
|
79 OMNPLAY_PLAYLIST_BLOCK_LOOP
,
81 OMNPLAY_PLAYLIST_ITEM_LOOP_SINGLE
= OMNPLAY_PLAYLIST_BLOCK_BEGIN
|
82 OMNPLAY_PLAYLIST_BLOCK_BODY
|
83 OMNPLAY_PLAYLIST_BLOCK_END
|
84 OMNPLAY_PLAYLIST_BLOCK_LOOP
,
85 } playlist_item_type_t
;
87 #define MAX_PLAYLIST_ITEMS 1024
88 #define MAX_LIBRARY_ITEMS 10240
89 #define PLAYLIST_ITEM_ERROR_LIB 1
90 #define PLAYLIST_ITEM_ERROR_CUE 2
92 typedef struct playlist_item
99 playlist_item_type_t type
;
105 #define MAX_PLAYERS 4
107 struct omnplay_instance
;
109 typedef struct omnplay_player
116 GtkWidget
*label_status
, *label_state
, *label_tc_cur
, *label_tc_rem
, *label_clip
;
117 struct omnplay_instance
*app
;
122 typedef struct omnplay_instance
125 GtkWidget
*playlist_grid
;
126 GtkWidget
*library_grid
;
127 GtkWidget
*buttons
[BUTTON_LAST
+ 1];
130 omnplay_player_t item
[MAX_PLAYERS
];
133 pthread_mutex_t lock
;
138 playlist_item_t item
[MAX_PLAYLIST_ITEMS
];
142 pthread_mutex_t lock
;
144 GdkPixbuf
*block_icons
[8];
148 playlist_item_t item
[MAX_LIBRARY_ITEMS
];
150 char filename
[PATH_MAX
];
151 char whois
[PATH_MAX
];
152 pthread_mutex_t lock
;
154 } omnplay_instance_t
;
156 omnplay_instance_t
* omnplay_create(int argc
, char** argv
);
157 void omnplay_init(omnplay_instance_t
* app
);
158 void omnplay_release(omnplay_instance_t
* app
);
159 void omnplay_destroy(omnplay_instance_t
* app
);
160 void omnplay_playlist_load(omnplay_instance_t
* app
);
161 void omnplay_playlist_save(omnplay_instance_t
* app
);
162 void omnplay_playlist_draw(omnplay_instance_t
* app
);
163 void omnplay_playlist_draw_item(omnplay_instance_t
* app
, int idx
);
164 void omnplay_playlist_draw_item_rem(omnplay_instance_t
* app
, int idx
, char* rem
);
165 void omnplay_library_load(omnplay_instance_t
* app
);
166 void omnplay_library_save(omnplay_instance_t
* app
);
167 void omnplay_library_refresh(omnplay_instance_t
* app
);
168 void omnplay_library_draw(omnplay_instance_t
* app
);
169 typedef void (*omnplay_get_content_cb_proc
)(omnplay_instance_t
* app
, playlist_item_t
*items
, void* data
);
170 int omnplay_get_content(omnplay_instance_t
* app
, playlist_item_t
*items
, int limit
,
171 omnplay_get_content_cb_proc proc
, void* data
);
172 int omnplay_whois_list(omnplay_instance_t
* app
, playlist_item_t
*items
, int* plimit
);
173 int omnplay_library_load_file(playlist_item_t
* items
, int *pcount
, char* filename
);
174 playlist_item_t
* omnplay_library_find(omnplay_instance_t
* app
, char* id
);
175 void omnplay_library_normalize_item(omnplay_instance_t
* app
, playlist_item_t
* item
);
179 #endif /* __cplusplus */
181 #endif /* OMNPLAY_H */