bd456b66684b34e8e98984033707e9e47854d32f
2 * player.h -- GTK+ 2 melted gui
3 * Copyright (C) 2012 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.
31 #include <gdk/gdkkeysyms.h>
34 #include <mvcp/mvcp.h>
35 #include <mvcp/mvcp_remote.h>
39 static void* player_thread_proc(void* data
)
42 int playlist_start_prev
= 0;
43 // OmPlrStatus st_curr, st_prev;
44 player_t
* player
= (player_t
*)data
;
46 g_warning("omnplay_thread_proc\n");
48 // memset(&st_curr, 0, sizeof(OmPlrStatus));
49 // memset(&st_prev, 0, sizeof(OmPlrStatus));
52 pthread_mutex_lock(&player
->app
->players
.lock
);
53 // r = OmPlrOpen(player->host, player->name, (OmPlrHandle*)&player->handle);
54 pthread_mutex_unlock(&player
->app
->players
.lock
);
57 // g_warning("ERROR: OmPlrOpen(%s, %s) failed with 0x%.8X\n",
58 // player->host, player->name, r);
63 /* setup to do not reconnect */
64 pthread_mutex_lock(&player
->app
->players
.lock
);
65 // OmPlrSetRetryOpen((OmPlrHandle)player->handle, 0);
66 pthread_mutex_unlock(&player
->app
->players
.lock
);
69 // if(player->app->players.path[0])
71 pthread_mutex_lock(&player
->app
->players
.lock
);
72 // r = OmPlrClipSetDirectory((OmPlrHandle)player->handle, player->app->players.path);
73 pthread_mutex_unlock(&player
->app
->players
.lock
);
77 // g_warning("ERROR: OmPlrClipSetDirectory(%s) failed with 0x%.8X\n",
78 // player->app->players.path, r);
80 pthread_mutex_lock(&player
->app
->players
.lock
);
81 // OmPlrClose((OmPlrHandle)player->handle);
82 pthread_mutex_unlock(&player
->app
->players
.lock
);
89 for(r
= 0 ; !player
->app
->f_exit
&& !r
;)
99 pthread_mutex_lock(&player
->app
->players
.lock
);
100 // st_curr.size = sizeof(OmPlrStatus);
101 // r = OmPlrGetPlayerStatus((OmPlrHandle)player->handle, &st_curr);
102 pthread_mutex_unlock(&player
->app
->players
.lock
);
105 g_warning("ERROR: OmPlrGetPlayerStatus failed with 0x%.8X\n", r
);
108 // omnplay_update_status(player, &st_prev , &st_curr, &playlist_start_prev);
109 // playlist_start_prev = player->playlist_start;
110 // memcmp(&st_curr, &st_prev, sizeof(OmPlrStatus));
114 pthread_mutex_lock(&player
->app
->players
.lock
);
115 // OmPlrClose((OmPlrHandle)player->handle);
116 pthread_mutex_unlock(&player
->app
->players
.lock
);
122 void player_run(instance_t
* app
, int idx
)
124 mvcp_parser parser
= mvcp_parser_init_remote(app
->players
.host
, 5250);
125 mvcp command
= mvcp_init(parser
);
127 app
->players
.item
[idx
].thread
= g_thread_create(
128 player_thread_proc
, &app
->players
.item
[idx
], TRUE
, NULL
);
131 void player_stop(instance_t
* app
, int idx
)
133 g_thread_join(app
->players
.item
[idx
].thread
);