ui_buttons.c ui_buttons.h \
player.c player.h \
playlist.c playlist.h \
+ library.c library.h \
opts.c opts.h
# \
-# playlist.c \
-# library.c \
# whois.c \
# omnplay.cpp omnplay.h
#include "opts.h"
#include "timecode.h"
#include "player.h"
+#include "library.h"
+
+gboolean instance_button_click(instance_t* app, control_buttons_t button)
+{
+#if 0
+ switch(button)
+ {
+ case BUTTON_PLAYLIST_ITEM_ADD:
+ omnplay_playlist_item_add(app, 0);
+ break;
+ case BUTTON_PLAYLIST_ITEM_DEL:
+ omnplay_playlist_item_del(app);
+ break;
+ case BUTTON_PLAYLIST_ITEM_EDIT:
+ omnplay_playlist_item_edit(app);
+ break;
+ case BUTTON_PLAYLIST_LOAD:
+ omnplay_playlist_load(app);
+ break;
+ case BUTTON_PLAYLIST_SAVE:
+ omnplay_playlist_save(app);
+ break;
+ case BUTTON_PLAYLIST_BLOCK_SINGLE:
+ case BUTTON_PLAYLIST_BLOCK_LOOP:
+ omnplay_playlist_block(app, button);
+ break;
+ case BUTTON_PLAYLIST_ITEM_UP:
+ omnplay_playlist_item_swap(app, -1);
+ break;
+ case BUTTON_PLAYLIST_ITEM_DOWN:
+ omnplay_playlist_item_swap(app, +1);
+ break;
+ case BUTTON_PLAYER_CUE:
+ case BUTTON_PLAYER_PLAY:
+ case BUTTON_PLAYER_PAUSE:
+ case BUTTON_PLAYER_STOP:
+ omnplay_ctl(app, button);
+ break;
+ case BUTTON_LIBRARY_ADD:
+ omnplay_library_add(app, 0);
+ break;
+ case BUTTON_LIBRARY_REFRESH:
+ omnplay_library_refresh(app);
+ break;
+ case BUTTON_LIBRARY_FIND:
+ omnplay_library_search(app, 0);
+ break;
+ case BUTTON_LIBRARY_FIND_NEXT:
+ omnplay_library_search(app, 1);
+ break;
+ case BUTTON_PLAYLIST_RELINK:
+ omnplay_playlist_relink(app);
+ break;
+ };
+#endif
+ return TRUE;
+};
+
+static gboolean on_button_click(GtkWidget *button, gpointer user_data)
+{
+ int i;
+ instance_t* app = (instance_t*)user_data;
+
+ for(i = 1; i < BUTTON_LAST; i++)
+ if(app->buttons[i] == button)
+ return instance_button_click(app, (control_buttons_t)i);
+
+ return FALSE;
+};
static gboolean on_main_window_delete_event( GtkWidget *widget, GdkEvent *event, gpointer user_data )
{
for(i = 0; i < app->players.count; i++)
player_run(app, i);
-#if 0
-
/* attach buttons click */
for(i = 1; i < BUTTON_LAST; i++)
gtk_signal_connect(GTK_OBJECT(app->buttons[i]), "clicked",
GTK_SIGNAL_FUNC( on_button_click), app );
/* load library */
- omnplay_library_load(app);
-#endif
+ library_init(app);
#if 0
/* setup drag n drop source/target */
app->f_exit = 1;
+ library_release(app);
+
/* stop unit monitoring threads */
for(i = 0; i < app->players.count; i++)
player_stop(app, i);
{
GtkWidget *window;
GtkWidget *playlist_grid;
- GtkWidget *library_grid;
+ GtkWidget *library_tree;
GtkWidget *buttons[BUTTON_LAST + 1];
GtkWidget *status_label;
struct
} playlist;
struct
{
+ void* handle[2];
playlist_item_t item[MAX_LIBRARY_ITEMS];
int count;
char filename[PATH_MAX];
/*
- * playlist.c -- GTK+ 2 omnplay
- * Copyright (C) 2011 Maksym Veremeyenko <verem@m1stereo.tv>
+ * library.c -- 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
#include <pthread.h>
#include <string.h>
-#include "omnplay.h"
+#include <mvcp/mvcp.h>
+#include <mvcp/mvcp_remote.h>
+
+#include "instance.h"
#include "ui.h"
#include "timecode.h"
+void library_release(instance_t* app)
+{
+ mvcp_close(app->library.handle[0]);
+ mvcp_parser_close(app->library.handle[1]);
+};
+
+void library_init(instance_t* app)
+{
+ /* connect to library */
+ app->library.handle[1] = mvcp_parser_init_remote(app->players.host, 5250);
+ app->library.handle[0] = mvcp_init(app->library.handle[1]);
+ if(mvcp_connect(app->library.handle[0]) != mvcp_ok)
+ {
+ g_warning("library_init: failed to connect to server %s", app->players.host);
+ return;
+ };
+#if 0
+ pthread_mutex_lock(&app->library.lock);
+
+ if(app->library.filename[0])
+ {
+ app->library.count = MAX_LIBRARY_ITEMS;
+ omnplay_library_load_file(app->library.item, &app->library.count, app->library.filename);
+ };
+
+ omnplay_library_sort(app);
+
+ pthread_mutex_unlock(&app->library.lock);
+
+ omnplay_library_draw(app);
+#endif
+};
+
+#if 0
playlist_item_t* omnplay_library_find(omnplay_instance_t* app, char* id)
{
int i;
return r;
};
-void omnplay_library_load(omnplay_instance_t* app)
-{
- pthread_mutex_lock(&app->library.lock);
-
- if(app->library.filename[0])
- {
- app->library.count = MAX_LIBRARY_ITEMS;
- omnplay_library_load_file(app->library.item, &app->library.count, app->library.filename);
- };
-
- omnplay_library_sort(app);
-
- pthread_mutex_unlock(&app->library.lock);
-
- omnplay_library_draw(app);
-};
static void omnplay_library_save_file(playlist_item_t* item, int count, char* filename)
{
pthread_mutex_unlock(&app->library.lock);
};
+
+#endif
--- /dev/null
+/*
+ * library.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
+ * 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 LIBRARY_H
+#define LIBRARY_H
+
+#include "instance.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+void library_init(instance_t* app);
+void library_release(instance_t* app);
+
+#ifdef __cplusplus
+};
+#endif /* __cplusplus */
+
+#endif /* LIBRARY_H */
return treeview;
};
-static GtkWidget* pane_library_grid(GtkWidget* top, instance_t* app)
+static GtkWidget* pane_library_tree(GtkWidget* top, instance_t* app)
{
GtkWidget *scrolledwindow;
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow),
- app->library_grid = create_treeview(top, "treeview_library", library_columns));
+ app->library_tree = create_treeview(top, "treeview_library", library_columns));
return scrolledwindow;
}
/* add grid */
gtk_box_pack_start (GTK_BOX (vbox),
- pane_library_grid(top, app),
+ pane_library_tree(top, app),
TRUE, TRUE, 0);
/* add search buttons */