rework for newer player
[melted_gui] / src / instance.h
index 22e2dff..8cd0378 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * omnplay.h -- GTK+ 2 omnplay
- * Copyright (C) 2011 Maksym Veremeyenko <verem@m1stereo.tv>
+ * omnplay.h -- GTK+ 2 melted gui
+ * Copyright (C) 2012 Maksym Veremeyenko <verem@m1stereo.tv>
  *
  * 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
@@ -17,8 +17,8 @@
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef OMNPLAY_H
-#define OMNPLAY_H
+#ifndef INSTANCE_H
+#define INSTANCE_H
 
 #include <pthread.h>
 
@@ -27,6 +27,8 @@ extern "C"
 {
 #endif /* __cplusplus */
 
+#define PRODUCT_NAME "Melted GUI"
+
 typedef enum control_buttons
 {
     BUTTON_PLAYLIST_ITEM_ADD = 1,
@@ -58,37 +60,37 @@ typedef enum control_buttons
     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
+#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
-    OMNPLAY_PLAYLIST_ITEM_BLOCK_BEGIN   =       OMNPLAY_PLAYLIST_BLOCK_BEGIN,
+    PLAYLIST_ITEM_BLOCK_BEGIN   =       PLAYLIST_BLOCK_BEGIN,
     // 0
-    OMNPLAY_PLAYLIST_ITEM_BLOCK_BODY    =       OMNPLAY_PLAYLIST_BLOCK_BODY,
+    PLAYLIST_ITEM_BLOCK_BODY    =       PLAYLIST_BLOCK_BODY,
     // 2
-    OMNPLAY_PLAYLIST_ITEM_BLOCK_END     =       OMNPLAY_PLAYLIST_BLOCK_END,
+    PLAYLIST_ITEM_BLOCK_END     =       PLAYLIST_BLOCK_END,
     // 3
-    OMNPLAY_PLAYLIST_ITEM_BLOCK_SINGLE  =       OMNPLAY_PLAYLIST_BLOCK_BEGIN    |
-                                                OMNPLAY_PLAYLIST_BLOCK_BODY     |
-                                                OMNPLAY_PLAYLIST_BLOCK_END,
+    PLAYLIST_ITEM_BLOCK_SINGLE  =       PLAYLIST_BLOCK_BEGIN    |
+                                        PLAYLIST_BLOCK_BODY     |
+                                        PLAYLIST_BLOCK_END,
     // 5
-    OMNPLAY_PLAYLIST_ITEM_LOOP_BEGIN    =       OMNPLAY_PLAYLIST_BLOCK_BEGIN    |
-                                                OMNPLAY_PLAYLIST_BLOCK_LOOP,
+    PLAYLIST_ITEM_LOOP_BEGIN    =       PLAYLIST_BLOCK_BEGIN    |
+                                        PLAYLIST_BLOCK_LOOP,
     // 4
-    OMNPLAY_PLAYLIST_ITEM_LOOP_BODY     =       OMNPLAY_PLAYLIST_BLOCK_BODY     |
-                                                OMNPLAY_PLAYLIST_BLOCK_LOOP,
+    PLAYLIST_ITEM_LOOP_BODY     =       PLAYLIST_BLOCK_BODY     |
+                                        PLAYLIST_BLOCK_LOOP,
     // 6
-    OMNPLAY_PLAYLIST_ITEM_LOOP_END      =       OMNPLAY_PLAYLIST_BLOCK_END      |
-                                                OMNPLAY_PLAYLIST_BLOCK_LOOP,
+    PLAYLIST_ITEM_LOOP_END      =       PLAYLIST_BLOCK_END      |
+                                        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_LOOP_SINGLE   =       PLAYLIST_BLOCK_BEGIN    |
+                                        PLAYLIST_BLOCK_BODY     |
+                                        PLAYLIST_BLOCK_END      |
+                                        PLAYLIST_BLOCK_LOOP,
 } playlist_item_type_t;
 
 #define MAX_PLAYLIST_ITEMS      1024
@@ -112,22 +114,22 @@ typedef struct playlist_item
 
 #define MAX_PLAYERS 4
 
-struct omnplay_instance;
+struct instance_desc;
 
-typedef struct omnplay_player
+typedef struct player_desc
 {
     int idx;
-    char name[PATH_MAX];
-    char host[PATH_MAX];
+//    char name[PATH_MAX];
+    int unit;
     void* handle;
     GThread* thread;
     GtkWidget *label_status, *label_state, *label_tc_cur, *label_tc_rem, *label_clip;
-    struct omnplay_instance *app;
+    struct instance_desc *app;
     int playlist_start;
     int playlist_length;
-} omnplay_player_t;
+} player_t;
 
-typedef struct omnplay_instance
+typedef struct instance_desc
 {
     GtkWidget *window;
     GtkWidget *playlist_grid;
@@ -136,9 +138,9 @@ typedef struct omnplay_instance
     GtkWidget *status_label;
     struct
     {
-        omnplay_player_t item[MAX_PLAYERS];
+        player_t item[MAX_PLAYERS];
         int count;
-        char path[PATH_MAX];
+        char host[PATH_MAX];
         pthread_mutex_t lock;
     } players;
     int f_exit;
@@ -169,22 +171,19 @@ typedef struct omnplay_instance
         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);
+} 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);
@@ -199,8 +198,10 @@ 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 /* OMNPLAY_H */
+#endif /* INSTANCE_H */