15
15
along with this program; if not, write to the Free Software
16
16
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
$Id: core.c 586 2007-02-18 09:30:01Z tszilagyi $
18
$Id: core.c 690 2007-06-24 11:53:48Z peterszilagyi $
21
21
#include <config.h>
234
236
return (track == track_prev + 1) ? 1 : 0;
236
238
#endif /* HAVE_CDDA */
241
/* roll back sample_offset samples, if possible */
243
rollback(rb_t * rb, file_decoder_t * fdec, double src_ratio) {
245
sample_offset = rb_read_space(rb) /
246
(2 * sample_size) * src_ratio;
247
if (sample_offset < fdec->fileinfo.total_samples - fdec->samples_left)
248
file_decoder_seek(fdec, fdec->fileinfo.total_samples - fdec->samples_left - sample_offset);
250
file_decoder_seek(fdec, 0);
255
send_meta(metadata_t * meta) {
257
char send_cmd = CMD_METABLOCK;
258
rb_write(rb_disk2gui, &send_cmd, 1);
259
rb_write(rb_disk2gui, (char *)&meta, sizeof(metadata_t *));
279
303
fprintf(stderr, "disk thread: error: file_decoder_new() failed\n");
306
file_decoder_set_meta_cb(fdec, send_meta);
283
308
if ((!readbuf) || (!framebuf)) {
284
309
fprintf(stderr, "disk thread: malloc error\n");
424
449
send_cmd = CMD_FLUSH;
425
450
rb_write(rb_disk2out, &send_cmd, 1);
427
/* roll back sample_offset samples, if possible */
428
sample_offset = rb_read_space(rb) /
429
(2 * sample_size) * src_ratio;
431
fdec->fileinfo.total_samples - fdec->samples_left)
432
file_decoder_seek(fdec,
433
fdec->fileinfo.total_samples - fdec->samples_left
436
file_decoder_seek(fdec, 0);
452
rollback(rb, fdec, src_ratio);
453
if (fdec->is_stream) {
454
file_decoder_pause(fdec);
439
458
info->is_streaming = 1;
459
if (fdec->is_stream) {
460
file_decoder_resume(fdec);
442
464
/* send FINISH to output thread, then goto exit */
453
475
/* send a FLUSH command to output thread */
454
476
send_cmd = CMD_FLUSH;
455
477
rb_write(rb_disk2out, &send_cmd, 1);
479
if (fdec->is_stream && !info->is_streaming) {
480
file_decoder_pause(fdec);
457
483
/* send dummy STATUS to gui, to set pos slider to zero */
458
484
disk_thread_status.samples_left = 0;
1983
2009
"\nOptions for file loading:\n"
1984
2010
"-E, --enqueue: Don't clear the contents of the playlist when adding new items.\n"
2011
"-t[<name>], --tab[=<name>]: Add files to the specified playlist tab.\n"
1986
2013
"\nIf you don't specify a session number via --session, the files will be opened by "
1987
2014
"the new\ninstance, otherwise they will be sent to the already running instance you "
2087
2114
int remote_quit = 0;
2088
2115
char * voladj_arg = NULL;
2090
char * optstring = "vho:d:c:n:p:r:a::RP:DY:s::l:m:N:BLUTFEV:Q";
2117
char * optstring = "vho:d:c:n:p:r:a::RP:DY:s::l:m:N:BLUTFEV:Qt::";
2091
2118
struct option long_options[] = {
2092
2119
{ "version", 0, 0, 'v' },
2093
2120
{ "help", 0, 0, 'h' },
2102
2129
{ "priority", 1, 0, 'P' },
2103
2130
{ "disk-realtime", 0, 0, 'D' },
2104
2131
{ "disk-priority", 1, 0, 'Y' },
2105
{ "srctype", 2, 0, 's' },
2132
{ "srctype", 2, 0, 's' },
2106
2133
{ "show-pl", 1, 0, 'l' },
2107
2134
{ "show-ms", 1, 0, 'm' },
2135
{ "tab", 2, 0, 't' },
2109
2137
{ "session", 1, 0, 'N' },
2110
2138
{ "back", 0, 0, 'B' },
2463
2505
no_session = 0;
2464
2506
buf[0] = RCMD_VOLADJ;
2466
strncat(buf, voladj_arg, MAXLEN-1);
2508
strncat(buf, voladj_arg, MAXLEN-2);
2467
2509
send_message_to_session(no_session, buf, strlen(buf));
2468
2510
close_app_socket();
2475
2517
char fullname[MAXLEN];
2477
2519
if ((no_session != -1) && (no_session != aqualung_session_id)) {
2478
2521
for (i = optind; argv[i] != NULL; i++) {
2480
2523
normalize_filename(argv[i], fullname);
2482
if ((enqueue) || (i > optind)) {
2483
buffer[0] = RCMD_ENQUEUE;
2485
strncat(buffer, fullname, MAXLEN-1);
2486
send_message_to_session(no_session, buffer, strlen(buffer));
2488
buffer[0] = RCMD_LOAD;
2490
strncat(buffer, fullname, MAXLEN-1);
2491
send_message_to_session(no_session, buffer, strlen(buffer));
2525
buffer[0] = RCMD_ADD_FILE;
2527
strncat(buffer, fullname, MAXLEN-2);
2528
send_message_to_session(no_session, buffer, strlen(buffer));
2531
if (argv[optind] != NULL) {
2533
buffer[0] = RCMD_ADD_COMMIT;
2534
buffer[1] = (enqueue) ? 1 : 0;
2535
buffer[2] = (play) ? 1 : 0;
2536
buffer[3] = (tab_name != NULL) ? 1 : 0;
2539
if (tab_name != NULL) {
2540
strncat(buffer + 4, tab_name, MAXLEN-5);
2496
send_message_to_session(no_session, &rcmd, 1);
2543
send_message_to_session(no_session, buffer, 4 + strlen(buffer + 4));