Changeset 457:60f64b109d75 in roaraudio for plugins/xmms
- Timestamp:
- 08/12/08 05:52:22 (16 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- plugins/xmms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/xmms/Makefile
r456 r457 10 10 INSTALL_DIR=`xmms-config --output-plugin-dir` 11 11 12 DEFINES=-DDEBUG12 #DEFINES=-DDEBUG 13 13 CFLAGS = -g -Wall -O2 $(DEFINES) $(INCLUDE) -fPIC $(GTK_CFLAFS) $(XMMS_CFLAGS) 14 14 LDFLAGS = -g -shared -lroar $(GTK_LIBS) $(XMMS_LIBS) -
plugins/xmms/roar.c
r456 r457 7 7 #include <stdio.h> 8 8 #include <string.h> 9 #include <pthread.h> 9 10 10 11 #include "xmms/plugin.h" … … 54 55 roar_close, 55 56 NULL, //roar_flush, 56 NULL, //roar_pause,57 roar_pause, 57 58 roar_free, 58 59 roar_playing, … … 74 75 int session; 75 76 int next_test; 77 int pause; 78 int updateing; 76 79 } g_inst; 77 80 … … 83 86 g_inst.state = 0; 84 87 g_inst.server = NULL; 88 g_inst.updateing = 0; 85 89 g_inst.session = ctrlsocket_get_session_id(); 86 90 ROAR_DBG("roar_init(*) = (void)"); … … 93 97 void roar_write(void *ptr, int length) { 94 98 int r; 99 int need_update = 0; 100 pthread_t thread; 101 102 if ( g_inst.next_test < 1 ) { 103 need_update = 1; 104 g_inst.next_test = g_inst.bps; 105 pthread_create(&thread, NULL, (void (*)(void*))roar_chk_metadata, NULL); 106 //roar_socket_nonblock(g_inst.data_fh, ROAR_SOCKET_NONBLOCK); 107 } 108 109 if ( g_inst.pause ) 110 return; 95 111 96 112 while (length) { 97 if ( (r = write(g_inst.data_fh, ptr, length >= 1764 ? 1764: length)) != -1 ) {113 if ( (r = write(g_inst.data_fh, ptr, length >= 17640 ? 17640 : length)) != -1 ) { 98 114 g_inst.written += r; 99 115 ptr += r; … … 101 117 g_inst.next_test -= r; 102 118 } else { 103 return; 119 if ( errno == EAGAIN ) { 120 roar_socket_nonblock(g_inst.data_fh, ROAR_SOCKET_BLOCK); 121 } else { 122 return; 123 } 104 124 } 105 125 } 106 126 107 127 108 if ( g_inst.next_test < 1) {109 roar_chk_metadata();110 g_inst.next_test = g_inst.bps;128 if ( need_update ) { 129 //roar_socket_nonblock(g_inst.data_fh, ROAR_SOCKET_BLOCK); 130 pthread_join(thread, NULL); 111 131 } 112 132 } … … 169 189 170 190 g_inst.written = 0; 191 g_inst.pause = 0; 171 192 172 193 roar_update_metadata(); … … 182 203 } 183 204 184 void roar_pause(short p); 205 void roar_pause(short p) { 206 g_inst.pause = p; 207 } 185 208 186 209 int roar_free(void) { … … 236 259 int pos; 237 260 261 g_inst.updateing++; 262 263 if ( g_inst.updateing > 1 ) { 264 g_inst.updateing--; 265 return -1; 266 } 267 238 268 pos = xmms_remote_get_playlist_pos(g_inst.session); 239 269 … … 269 299 } 270 300 301 g_inst.updateing--; 271 302 return 0; 272 303 }
Note: See TracChangeset
for help on using the changeset viewer.