OmPlrStatus st_curr, st_prev;
omnplay_player_t* player = (omnplay_player_t*)data;
+ g_warning("omnplay_thread_proc\n");
+
/* connect */
pthread_mutex_lock(&player->app->players.lock);
r = OmPlrOpen(player->host, player->name, (OmPlrHandle*)&player->handle);
for(r = 0 ; !player->app->f_exit && !r;)
{
/* sleep */
+#ifdef _WIN32
+ Sleep(100);
+#else
usleep(100000);
+#endif
/* get status */
pthread_mutex_lock(&player->app->players.lock);
};
/* update border items */
- if(!start && !(app->playlist.item[start - 1].type & OMNPLAY_PLAYLIST_BLOCK_END))
+ if(start && !(app->playlist.item[start - 1].type & OMNPLAY_PLAYLIST_BLOCK_END))
{
app->playlist.item[start - 1].type = (playlist_item_type_t)(OMNPLAY_PLAYLIST_BLOCK_END
| app->playlist.item[start - 1].type);
idx = idxs[j] - j;
/* fix block types */
- if(idx)
- app->playlist.item[idx - 1].type = (playlist_item_type_t)(app->playlist.item[idx - 1].type |
- OMNPLAY_PLAYLIST_BLOCK_END);
- if(idx + 1 < app->playlist.count)
- app->playlist.item[idx + 1].type = (playlist_item_type_t)(app->playlist.item[idx + 1].type |
- OMNPLAY_PLAYLIST_BLOCK_BEGIN);
+ if( app->playlist.item[idx].type != OMNPLAY_PLAYLIST_ITEM_BLOCK_BODY &&
+ app->playlist.item[idx].type != OMNPLAY_PLAYLIST_ITEM_LOOP_BODY)
+ {
+ if(idx)
+ app->playlist.item[idx - 1].type = (playlist_item_type_t)(app->playlist.item[idx - 1].type |
+ OMNPLAY_PLAYLIST_BLOCK_END);
+ if(idx + 1 < app->playlist.count)
+ app->playlist.item[idx + 1].type = (playlist_item_type_t)(app->playlist.item[idx + 1].type |
+ OMNPLAY_PLAYLIST_BLOCK_BEGIN);
+ };
/* shift playlist items */
memmove
return FALSE;
};
+static gboolean on_library_grid_button(GtkWidget *widget, GdkEventButton *event, gpointer data)
+{
+ if(event->button==1 && event->type==GDK_2BUTTON_PRESS)
+ {
+ omnplay_library_add((omnplay_instance_t* )data, 0);
+ return TRUE;
+ };
+
+ return FALSE;
+};
+
+static gboolean on_playlist_grid_button(GtkWidget *widget, GdkEventButton *event, gpointer data)
+{
+ if(event->button==1 && event->type==GDK_2BUTTON_PRESS)
+ {
+ omnplay_ctl((omnplay_instance_t* )data, BUTTON_PLAYER_CUE);
+ return TRUE;
+ };
+
+ return FALSE;
+};
+
void omnplay_init(omnplay_instance_t* app)
{
int i;
pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
gtk_signal_connect( GTK_OBJECT( app->window ), "delete-event",
gtk_signal_connect(GTK_OBJECT(app->library_grid), "key-press-event",
GTK_SIGNAL_FUNC(on_library_grid_key), app);
+ gtk_signal_connect(GTK_OBJECT(app->playlist_grid), "button-press-event",
+ GTK_SIGNAL_FUNC(on_playlist_grid_button), app);
+
+ gtk_signal_connect(GTK_OBJECT(app->library_grid), "button-press-event",
+ GTK_SIGNAL_FUNC(on_library_grid_button), app);
+
/* create lock */
pthread_mutex_init(&app->players.lock, &attr);
pthread_create(&app->players.item[i].thread, NULL,
omnplay_thread_proc, &app->players.item[i]);
+
/* create lock */
pthread_mutex_init(&app->playlist.lock, &attr);
/* load library */
omnplay_library_load(app);
+
+ pthread_mutexattr_destroy(&attr);
};
void omnplay_release(omnplay_instance_t* app)