From 767eb14d4a3d2ae37d4dddcb29ba61af74b81515 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Sat, 18 Jun 2011 13:46:52 +0300 Subject: [PATCH] playlist basic definitions adde --- src/omnplay.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++----- src/ui.c | 4 +- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/src/omnplay.h b/src/omnplay.h index dada024..e2b0ea2 100644 --- a/src/omnplay.h +++ b/src/omnplay.h @@ -51,6 +51,50 @@ typedef enum control_buttons BUTTON_LAST } control_buttons_t; +#define OMNPLAY_PLAYLIST_BLOCK_BEGIN (1 << 0) // 1 +#define OMNPLAY_PLAYLIST_BLOCK_BODY 0 // 0 +#define OMNPLAY_PLAYLIST_BLOCK_END (1 << 1) // 2 +#define OMNPLAY_PLAYLIST_BLOCK_LOOP (1 << 2) // 4 + +typedef enum playlist_item_type +{ + OMNPLAY_PLAYLIST_ITEM_BLOCK_BEGIN = OMNPLAY_PLAYLIST_BLOCK_BEGIN, + + OMNPLAY_PLAYLIST_ITEM_BLOCK_BODY = OMNPLAY_PLAYLIST_BLOCK_BODY, + + OMNPLAY_PLAYLIST_ITEM_BLOCK_END = OMNPLAY_PLAYLIST_BLOCK_END, + + OMNPLAY_PLAYLIST_ITEM_BLOCK_SINGLE = OMNPLAY_PLAYLIST_BLOCK_END | \ + OMNPLAY_PLAYLIST_BLOCK_BODY | \ + OMNPLAY_PLAYLIST_BLOCK_END, + + OMNPLAY_PLAYLIST_ITEM_LOOP_BEGIN = OMNPLAY_PLAYLIST_BLOCK_BEGIN | \ + OMNPLAY_PLAYLIST_BLOCK_LOOP, + + OMNPLAY_PLAYLIST_ITEM_LOOP_BODY = OMNPLAY_PLAYLIST_BLOCK_BODY | \ + OMNPLAY_PLAYLIST_BLOCK_LOOP, + + OMNPLAY_PLAYLIST_ITEM_LOOP_END = OMNPLAY_PLAYLIST_BLOCK_END | \ + OMNPLAY_PLAYLIST_BLOCK_LOOP, + + OMNPLAY_PLAYLIST_ITEM_LOOP_SINGLE = OMNPLAY_PLAYLIST_BLOCK_END | \ + OMNPLAY_PLAYLIST_BLOCK_BODY | \ + OMNPLAY_PLAYLIST_BLOCK_END | \ + OMNPLAY_PLAYLIST_BLOCK_LOOP, +} playlist_item_type_t; + +#define MAX_PLAYLIST_ITEMS 1024 + +typedef struct playlist_item +{ + char id[PATH_MAX]; + char title[PATH_MAX]; + int in; + int dur; + int player; + playlist_item_type_t type; +} playlist_item_t; + #define MAX_PLAYERS 4 struct omnplay_instance; @@ -65,14 +109,15 @@ typedef struct omnplay_player pthread_mutex_t lock; 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_count; +} omnplay_player_t; typedef struct omnplay_instance { GtkWidget *window; - GtkWidget *playlist; - GtkWidget *library; + GtkWidget *playlist_grid; + GtkWidget *library_grid; GtkWidget *buttons[BUTTON_LAST + 1]; struct { @@ -81,8 +126,14 @@ typedef struct omnplay_instance char path[PATH_MAX]; } players; int f_exit; -} -omnplay_instance_t; + struct + { + playlist_item_t item[MAX_PLAYLIST_ITEMS]; + int count; + int ver_curr; + int ver_prev; + } playlist; +} omnplay_instance_t; omnplay_instance_t* omnplay_create(int argc, char** argv); void omnplay_init(omnplay_instance_t* app); diff --git a/src/ui.c b/src/ui.c index 4be761f..ee736a3 100644 --- a/src/ui.c +++ b/src/ui.c @@ -99,7 +99,7 @@ static GtkWidget* pane_library_grid(GtkWidget* top, omnplay_instance_t* app) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (scrolledwindow), - app->library = create_treeview(top, "treeview_library", columns)); + app->library_grid = create_treeview(top, "treeview_library", columns)); return scrolledwindow; } @@ -318,7 +318,7 @@ static GtkWidget* pane_operate_grid(GtkWidget* top, omnplay_instance_t* app) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (scrolledwindow), - app->playlist = create_treeview(top, "treeview_playlist", columns)); + app->playlist_grid = create_treeview(top, "treeview_playlist", columns)); return scrolledwindow; } -- 1.7.4.4