-
Notifications
You must be signed in to change notification settings - Fork 0
/
madplay.c
824 lines (669 loc) · 19.4 KB
/
madplay.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
/*
* madplay - MPEG audio decoder and player
* Copyright (C) 2000-2004 Robert Leslie
*
* 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
*
* $Id: madplay.c,v 1.86 2004/02/23 21:34:53 rob Exp $
*/
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include "global.h"
/* include this first to avoid conflicts with MinGW __argc et al. */
# include "getopt.h"
# include <locale.h>
# include <stdio.h>
# include <stdarg.h>
# include <stdlib.h>
# include <string.h>
# ifdef HAVE_ASSERT_H
# include <assert.h>
# endif
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
# ifdef HAVE_FCNTL_H
# include <fcntl.h>
# endif
# include <ctype.h>
# include <mad.h>
# include "gettext.h"
# include "version.h"
# include "audio.h"
# include "player.h"
# define FADE_DEFAULT "0:05"
# if defined(EXPERIMENTAL)
static int external_mix;
static int experimental;
# endif
static
struct option const options[] = {
{ "adjust-volume", required_argument, 0, 'A' },
{ "amplify", required_argument, 0, 'a' },
{ "ancillary-output", required_argument, 0, -'a' },
{ "attenuate", required_argument, 0, 'a' },
{ "bit-depth", required_argument, 0, 'b' },
{ "display-time", required_argument, 0, -'t' },
{ "downsample", no_argument, 0, -'d' },
{ "fade-in", optional_argument, 0, -'i' },
{ "help", no_argument, 0, 'h' },
{ "ignore-crc", no_argument, 0, 'i' },
{ "left", no_argument, 0, '1' },
{ "license", no_argument, 0, -'l' },
{ "mono", no_argument, 0, 'm' },
{ "no-dither", no_argument, 0, 'd' },
{ "output", required_argument, 0, 'o' },
{ "pre-amp", required_argument, 0, 'a' },
{ "quiet", no_argument, 0, 'q' },
{ "repeat", optional_argument, 0, 'r' },
{ "replay-gain", optional_argument, 0, 'G' },
{ "right", no_argument, 0, '2' },
{ "sample-rate", required_argument, 0, 'R' },
{ "show-tags-only", no_argument, 0, 'T' },
{ "shuffle", no_argument, 0, 'z' },
{ "start", required_argument, 0, 's' },
{ "stereo", no_argument, 0, 'S' },
{ "time", required_argument, 0, 't' },
{ "verbose", no_argument, 0, 'v' },
{ "version", no_argument, 0, 'V' },
{ "very-quiet", no_argument, 0, 'Q' },
# if defined(USE_TTY)
{ "tty-control", no_argument, 0, -'c' },
{ "no-tty-control", no_argument, 0, -'C' },
# endif
# if 0
{ "cross-fade", no_argument, 0, 'x' },
{ "fade-out", optional_argument, 0, -'o' },
{ "gap", required_argument, 0, 'g' },
# endif
# if defined(EXPERIMENTAL)
{ "external-mix", no_argument, &external_mix, 1 },
{ "experimental", no_argument, &experimental, 1 },
# endif
{ 0 }
};
char const *argv0;
# define EPUTS(str) fputs(str, stream)
/*
* NAME: show_usage()
* DESCRIPTION: display usage message
*/
static
void show_usage(int verbose)
{
FILE *stream = verbose ? stdout : stderr;
fprintf(stream, _("Usage: %s [OPTIONS] FILE [...]\n"), argv0);
if (!verbose) {
fprintf(stream, _("Try `%s --help' for more information.\n"), argv0);
return;
}
EPUTS(_("Decode and play MPEG audio FILE(s).\n"));
/* the following usage text should agree with the option names */
EPUTS(_("\nVerbosity:\n"));
EPUTS(_(" -v, --verbose show status while decoding\n"));
EPUTS(_(" -q, --quiet be quiet but show warnings\n"));
EPUTS(_(" -Q, --very-quiet "
"be quiet and do not show warnings\n"));
EPUTS(_(" --display-time=MODE "
"use default verbose time display MODE\n"
" (remaining, current, overall)\n"));
EPUTS(_("\nDecoding:\n"));
EPUTS(_(" --downsample reduce sample rate 2:1\n"));
EPUTS(_(" -i, --ignore-crc ignore CRC errors\n"));
EPUTS(_(" --ancillary-output=PATH write ancillary data to PATH\n"));
EPUTS(_("\nAudio output:\n"));
EPUTS(_(" -o, --output=[TYPE:]PATH "
"write output to PATH with format TYPE (below)\n"));
EPUTS(_(" -b, --bit-depth=DEPTH request DEPTH bits per sample\n"));
EPUTS(_(" -R, --sample-rate=HERTZ "
"request HERTZ samples per second\n"));
EPUTS(_(" -d, --no-dither "
"do not dither output PCM samples\n"));
fprintf(stream,
_(" --fade-in[=DURATION] "
"fade-in songs over DURATION (default %s)\n"), FADE_DEFAULT);
# if 0
fprintf(stream,
_(" --fade-out[=DURATION] "
"fade-out songs over DURATION (default %s)\n"), FADE_DEFAULT);
EPUTS(_(" -g, --gap=DURATION set inter-song gap to DURATION\n"));
EPUTS(_(" -x, --cross-fade "
"cross-fade songs (use with negative gap)\n"));
# endif
EPUTS(_(" -a, --attenuate=DECIBELS "
"attenuate signal by DECIBELS (-)\n"));
EPUTS(_(" -a, --amplify=DECIBELS amplify signal by DECIBELS (+)\n"));
EPUTS(_(" -A, --adjust-volume=DECIBELS "
"override per-file volume adjustments\n"));
EPUTS(_(" -G, --replay-gain[=PROFILE] "
"enable Replay Gain volume adjustments using\n"
" PROFILE (radio, audiophile)\n"));
EPUTS(_("\nChannel selection:\n"));
EPUTS(_(" -1, --left "
"output first (left) channel only\n"));
EPUTS(_(" -2, --right "
"output second (right) channel only\n"));
EPUTS(_(" -m, --mono "
"mix left and right channels for monaural output\n"));
EPUTS(_(" -S, --stereo force stereo output\n"));
# if defined(EXPERIMENTAL)
EPUTS(_("\nExperimental:\n"));
EPUTS(_(" --external-mix "
"output pre-synthesis samples for external mixer\n"));
EPUTS(_(" --experimental enable experimental filter\n"));
# endif
EPUTS(_("\nPlayback:\n"));
EPUTS(_(" -s, --start=TIME "
"skip to begin at TIME (HH:MM:SS.DDD)\n"));
EPUTS(_(" -t, --time=DURATION "
"play only for DURATION (HH:MM:SS.DDD)\n"));
EPUTS(_(" -z, --shuffle randomize file list\n"));
EPUTS(_(" -r, --repeat[=MAX] "
"play files MAX times, or indefinitely\n"));
# if defined(USE_TTY)
EPUTS(_(" --tty-control enable keyboard controls\n"));
EPUTS(_(" --no-tty-control disable keyboard controls\n"));
# endif
EPUTS(_("\nMiscellaneous:\n"));
EPUTS(_(" -T, --show-tags-only "
"show ID3/encoder tags only (do not decode)\n"));
EPUTS(_(" -V, --version display version number and exit\n"));
EPUTS(_(" --license "
"show copyright/license message and exit\n"));
EPUTS(_(" -h, --help display this help and exit\n"));
EPUTS(_("\nSupported output formats:\n"));
EPUTS(_(" cdda "
"CD audio, 16-bit big-endian 44100 Hz stereo PCM (*.cdr, *.cda)\n"));
EPUTS(_(" aiff Audio IFF, [16-bit] PCM (*.aif, *.aiff)\n"));
EPUTS(_(" wave Microsoft RIFF/WAVE, [16-bit] PCM (*.wav)\n"));
fprintf(stream,
_(" snd Sun/NeXT audio, 8-bit ISDN %s (*.au, *.snd)\n"),
_("mu-law"));
EPUTS(_(" raw binary [16-bit] host-endian linear PCM\n"));
EPUTS(_(" hex ASCII hexadecimal [24-bit] linear PCM\n"));
# if defined(HAVE_LIBESD)
EPUTS(_(" esd "
"Enlightened Sound Daemon [16-bit] (give speaker host as PATH)\n"));
# endif
# if defined(HAVE_LIBAUDIO)
EPUTS(_(" nas "
"Network Audio System [16-bit] (give server name as PATH)\n"));
# endif
EPUTS(_(" null no output (decode only)\n"));
}
# undef EPUTS
/*
* NAME: verror()
* DESCRIPTION: print error message with program title prefix
*/
static
void verror(char const *message, va_list args)
{
fprintf(stderr, "%s: ", argv0);
vfprintf(stderr, message, args);
fputc('\n', stderr);
}
/*
* NAME: warn()
* DESCRIPTION: print warning message
*/
static
void warn(char const *message, ...)
{
va_list args;
va_start(args, message);
verror(message, args);
va_end(args);
}
/*
* NAME: die()
* DESCRIPTION: exit with failure status after printing message
*/
static
void die(char const *message, ...)
{
va_list args;
va_start(args, message);
verror(message, args);
va_end(args);
exit(1);
}
/*
* NAME: parse_time()
* DESCRIPTION: parse a time specification string
*/
static
int parse_time(mad_timer_t *timer, char const *str)
{
mad_timer_t time, accum = mad_timer_zero;
signed long decimal;
unsigned long seconds, fraction, fracpart;
int minus;
while (isspace((unsigned char) *str))
++str;
do {
seconds = fraction = fracpart = 0;
switch (*str) {
case '-':
++str;
minus = 1;
break;
case '+':
++str;
default:
minus = 0;
}
do {
decimal = strtol(str, (char **) &str, 10);
if (decimal < 0)
return -1;
seconds += decimal;
if (*str == ':') {
seconds *= 60;
++str;
}
}
while (*str >= '0' && *str <= '9');
if (*str == '.'
# if defined(HAVE_LOCALECONV)
|| *str == *localeconv()->decimal_point
# endif
) {
char const *ptr;
decimal = strtol(++str, (char **) &ptr, 10);
if (decimal < 0)
return -1;
fraction = decimal;
for (fracpart = 1; str != ptr; ++str)
fracpart *= 10;
}
else if (*str == '/') {
++str;
decimal = strtol(str, (char **) &str, 10);
if (decimal < 0)
return -1;
fraction = seconds;
fracpart = decimal;
seconds = 0;
}
mad_timer_set(&time, seconds, fraction, fracpart);
if (minus)
mad_timer_negate(&time);
mad_timer_add(&accum, time);
}
while (*str == '-' || *str == '+');
while (isspace((unsigned char) *str))
++str;
if (*str != 0)
return -1;
*timer = accum;
return 0;
}
/*
* NAME: get_time()
* DESCRIPTION: parse a time value or die
*/
static
mad_timer_t get_time(char const *str, int positive, char const *name)
{
mad_timer_t time;
if (parse_time(&time, str) == -1)
die(_("invalid %s specification \"%s\""), name, str);
if (positive && mad_timer_sign(time) <= 0)
die(_("%s must be positive"), name);
return time;
}
/*
* NAME: parse_decibels()
* DESCRIPTION: parse a decibel value specification string
*/
static
int parse_decibels(double *db, char const *str)
{
*db = strtod(str, (char **) &str);
while (isspace((unsigned char) *str))
++str;
if (strncasecmp(str, "dB", 2) == 0) {
str += 2;
while (isspace((unsigned char) *str))
++str;
}
if (*str != 0)
return -1;
return 0;
}
/*
* NAME: get_decibels()
* DESCRIPTION: parse a decibel value into a linear ratio or die
*/
static
double get_decibels(char const *str)
{
double db;
if (parse_decibels(&db, str) == -1)
die(_("invalid decibel specification \"%s\""), str);
if (db < DB_MIN || db > DB_MAX)
die(_("decibel value must be in the range %+d to %+d dB"), DB_MIN, DB_MAX);
return db;
}
/*
* NAME: parse_hertz()
* DESCRIPTION: parse a hertz specification string
*/
static
int parse_hertz(double *hz, char const *str)
{
*hz = strtod(str, (char **) &str);
while (isspace((unsigned char) *str))
++str;
if (*str == 'k' || *str == 'K') {
*hz *= 1000;
do
++str;
while (isspace((unsigned char) *str));
}
if (strncasecmp(str, "Hz", 2) == 0) {
str += 2;
while (isspace((unsigned char) *str))
++str;
}
if (*str != 0)
return -1;
return 0;
}
/*
* NAME: get_hertz()
* DESCRIPTION: parse a hertz value or die
*/
static
unsigned int get_hertz(char const *str)
{
double hz;
enum {
HZ_MIN = 1000,
HZ_MAX = 0xffff
};
if (parse_hertz(&hz, str) == -1)
die(_("invalid hertz specification \"%s\""), str);
if (hz < HZ_MIN || hz > HZ_MAX)
die(_("hertz value must be in the range %u to %u Hz"), HZ_MIN, HZ_MAX);
return (unsigned int) (hz + 0.5);
}
/*
* NAME: get_options()
* DESCRIPTION: parse command-line options or die
*/
static
void get_options(int argc, char *argv[], struct player *player)
{
int opt, index;
int ttyset = 0, preamp = 0;
while ((opt = getopt_long(argc, argv,
"vqQ" /* verbosity options */
"i" /* decoding options */
"o:b:R:da:A:G::" /* audio output options */
# if 0
"g:x"
# endif
"12mS" /* channel selection options */
"s:t:zr::" /* playback options */
"TVh", /* miscellaneous options */
options, &index)) != -1) {
switch (opt) {
case 0:
break;
case '1':
case '2':
player->output.select = PLAYER_CHANNEL_LEFT + (opt - '1');
break;
case 'a':
player->output.attamp_db = get_decibels(optarg);
preamp = 1;
break;
case 'A':
player->output.voladj_db = get_decibels(optarg);
player->options |= PLAYER_OPTION_IGNOREVOLADJ;
break;
case -'a':
if (player->ancillary.path)
die(_("multiple output destinations not supported"));
player->ancillary.path = optarg;
break;
case 'b':
opt = atoi(optarg);
if (opt <= 0)
die(_("invalid bit depth \"%s\""), optarg);
player->output.precision_in = opt;
break;
# if defined(USE_TTY)
case -'c':
player->options |= PLAYER_OPTION_TTYCONTROL;
ttyset = 1;
break;
case -'C':
player->options &= ~PLAYER_OPTION_TTYCONTROL;
ttyset = 1;
break;
# endif
case 'd':
player->output.mode = AUDIO_MODE_ROUND;
break;
case -'d':
player->options |= PLAYER_OPTION_DOWNSAMPLE;
break;
# if 0
case 'g':
player->gap = get_time(optarg, 0, _("gap time"));
player->options |= PLAYER_OPTION_GAP;
break;
# endif
case 'G':
player->output.replay_gain |= PLAYER_RGAIN_ENABLED;
if (optarg) {
size_t len;
len = strlen(optarg);
if (len && strncmp(optarg, "audiophile", len) == 0)
player->output.replay_gain |= PLAYER_RGAIN_AUDIOPHILE;
else if (len && strncmp(optarg, "radio", len) == 0)
;
else
die(_("invalid Replay Gain argument \"%s\""), optarg);
}
if (!preamp)
player->output.attamp_db = +6; /* default pre-amp */
break;
case 'h':
show_usage(1);
exit(0);
case 'i':
player->options |= PLAYER_OPTION_IGNORECRC;
break;
case -'i':
player->fade_in = get_time(optarg ? optarg : FADE_DEFAULT, 1,
_("fade-in time"));
player->options |= PLAYER_OPTION_FADEIN;
break;
case -'l':
ver_license(stdout);
exit(0);
case 'm':
player->output.select = PLAYER_CHANNEL_MONO;
break;
case 'o':
if (player->output.path)
die(_("multiple output destinations not supported"));
player->output.path = optarg;
player->output.command = audio_output(&player->output.path);
if (player->output.command == 0)
die(_("unknown output format type for \"%s\""), optarg);
if (!ttyset)
player->options &= ~PLAYER_OPTION_TTYCONTROL;
break;
# if 0
case -'o':
player->fade_out = get_time(optarg ? optarg : FADE_DEFAULT, 1,
_("fade-out time"));
player->options |= PLAYER_OPTION_FADEOUT;
break;
# endif
case 'q':
player->verbosity = -1;
if (!ttyset)
player->options &= ~PLAYER_OPTION_TTYCONTROL;
break;
case 'Q':
player->verbosity = -2;
if (!ttyset)
player->options &= ~PLAYER_OPTION_TTYCONTROL;
break;
case 'r':
if (optarg == 0)
player->repeat = -1;
else {
player->repeat = atoi(optarg);
if (player->repeat <= 0)
die(_("invalid repeat count \"%s\""), optarg);
}
break;
case 'R':
player->output.speed_request = get_hertz(optarg);
break;
case 's':
player->global_start = get_time(optarg, 0, _("start time"));
player->options |= PLAYER_OPTION_SKIP;
break;
case 'S':
player->output.select = PLAYER_CHANNEL_STEREO;
break;
case 't':
player->global_stop = get_time(optarg, 1, _("playing time"));
player->options |= PLAYER_OPTION_TIMED;
break;
case -'t':
{
size_t len;
len = strlen(optarg);
if (len && strncmp(optarg, "remaining", len) == 0)
player->stats.show = STATS_SHOW_REMAINING;
else if (len && strncmp(optarg, "current", len) == 0)
player->stats.show = STATS_SHOW_CURRENT;
else if (len && strncmp(optarg, "overall", len) == 0)
player->stats.show = STATS_SHOW_OVERALL;
else
die(_("invalid display time argument \"%s\""), optarg);
}
break;
case 'T':
player->options |= PLAYER_OPTION_SHOWTAGSONLY;
break;
case 'v':
player->verbosity = +1;
break;
case 'V':
ver_version(stdout);
fprintf(stderr, "`%s --license' %s.\n", argv0,
_("for license and warranty information"));
exit(0);
# if 0
case 'x':
player->options |= PLAYER_OPTION_CROSSFADE;
break;
# endif
case 'z':
player->options |= PLAYER_OPTION_SHUFFLE;
break;
case '?':
show_usage(0);
exit(1);
default:
assert(!"option handler");
}
}
if (optind == argc) {
show_usage(0);
exit(2);
}
}
/*
* NAME: main()
* DESCRIPTION: program entry point
*/
int main(int argc, char *argv[])
{
struct player player;
int result = 0;
argv0 = argv[0];
/* ensure binary standard I/O */
# if defined(_WIN32)
_setmode(_fileno(stdin), _O_BINARY);
_setmode(_fileno(stdout), _O_BINARY);
# endif
/* internationalization support */
# if defined(ENABLE_NLS)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
# endif
/* initialize and get options */
player_init(&player);
# if !defined(__CYGWIN__) /* Cygwin support for this is currently buggy */
/* check for default tty control */
if (isatty(STDIN_FILENO))
player.options |= PLAYER_OPTION_TTYCONTROL;
# endif
get_options(argc, argv, &player);
/* main processing */
if (player.verbosity >= 0)
ver_banner(stderr);
if (player.options & PLAYER_OPTION_CROSSFADE) {
if (!(player.options & PLAYER_OPTION_GAP))
warn(_("cross-fade ignored without gap"));
else if (mad_timer_sign(player.gap) >= 0)
warn(_("cross-fade ignored without negative gap"));
}
if (player.output.replay_gain & PLAYER_RGAIN_ENABLED) {
if (player.options & PLAYER_OPTION_IGNOREVOLADJ)
warn(_("volume adjustment ignored with Replay Gain enabled"));
else
player.options |= PLAYER_OPTION_IGNOREVOLADJ;
}
if ((player.options & PLAYER_OPTION_SHOWTAGSONLY) &&
player.repeat != 1) {
warn(_("ignoring repeat"));
player.repeat = 1;
}
/* make stop time absolute */
if (player.options & PLAYER_OPTION_TIMED)
mad_timer_add(&player.global_stop, player.global_start);
/* get default audio output module */
if (player.output.command == 0 &&
!(player.options & PLAYER_OPTION_SHOWTAGSONLY))
player.output.command = audio_output(0);
# if defined(EXPERIMENTAL)
if (external_mix) {
player.options |= PLAYER_OPTION_EXTERNALMIX;
player.output.command = 0;
}
if (experimental)
player.options |= PLAYER_OPTION_EXPERIMENTAL;
# endif
/* run the player */
if (player_run(&player, argc - optind, (char const **) &argv[optind]) == -1)
result = 4;
/* finish up */
player_finish(&player);
return result;
}