Audio-Play-MPG123

 view release on metacpan or  search on metacpan

mpg123/mpg123.c  view on Meta::CPAN

	waitpid (buffer_pid, NULL, 0);
	xfermem_done (buffermem);
    }
    else {
#endif
	audio_flush(param.outmode, &ai);
	free (pcm_sample);
#ifndef NOXFERMEM
    }
#endif

    switch(param.outmode) {
    case DECODE_AUDIO:
	audio_close(&ai);
	break;
    case DECODE_WAV:
	wav_close();
	break;
    case DECODE_AU:
	au_close();
	break;
    case DECODE_CDR:
	cdr_close();
	break;
    }
   
    return 0;
}

static void print_title(void)
{
    fprintf(stderr,"High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2 and 3.\n");
    fprintf(stderr,"Version %s (%s). Written and copyrights by Michael Hipp.\n", prgVersion, prgDate);
    fprintf(stderr,"Uses code from various people. See 'README' for more!\n");
    fprintf(stderr,"THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!\n");
}

static void usage(char *dummy)  /* print syntax & exit */
{
    print_title();
    fprintf(stderr,"\nusage: %s [option(s)] [file(s) | URL(s) | -]\n", prgName);
    fprintf(stderr,"supported options [defaults in brackets]:\n");
    fprintf(stderr,"   -v    increase verbosity level       -q    quiet (don't print title)\n");
    fprintf(stderr,"   -t    testmode (no output)           -s    write to stdout\n");
    fprintf(stderr,"   -w <filename> write Output as WAV file\n");
    fprintf(stderr,"   -k n  skip first n frames [0]        -n n  decode only n frames [all]\n");
    fprintf(stderr,"   -c    check range violations         -y    DISABLE resync on errors\n");
    fprintf(stderr,"   -b n  output buffer: n Kbytes [0]    -f n  change scalefactor [32768]\n");
    fprintf(stderr,"   -r n  set/force samplerate [auto]    -g n  set audio hardware output gain\n");
    fprintf(stderr,"   -os,-ol,-oh  output to built-in speaker,line-out connector,headphones\n");
#ifdef NAS
    fprintf(stderr,"                                        -a d  set NAS server\n");
#elif defined(SGI)
    fprintf(stderr,"                                        -a [1..4] set RAD device\n");
#else
    fprintf(stderr,"                                        -a d  set audio device\n");
#endif
    fprintf(stderr,"   -2    downsample 1:2 (22 kHz)        -4    downsample 1:4 (11 kHz)\n");
    fprintf(stderr,"   -d n  play every n'th frame only     -h n  play every frame n times\n");
    fprintf(stderr,"   -0    decode channel 0 (left) only   -1    decode channel 1 (right) only\n");
    fprintf(stderr,"   -m    mix both channels (mono)       -p p  use HTTP proxy p [$HTTP_PROXY]\n");
#ifdef SET_RT
    fprintf(stderr,"   -@ f  read filenames/URLs from f     -T get realtime priority\n");
#else
    fprintf(stderr,"   -@ f  read filenames/URLs from f\n");
#endif
    fprintf(stderr,"   -z    shuffle play (with wildcards)  -Z    random play\n");
    fprintf(stderr,"   -u a  HTTP authentication string     -E f  Equalizer, data from file\n");
#ifdef TERM_CONTROL
    fprintf(stderr,"   -C    enable control keys\n");
#endif
    fprintf(stderr,"See the manpage %s(1) or call %s with --longhelp for more information.\n", prgName,prgName);
    exit(1);
}

static void long_usage(char *d)
{
    FILE *o = stderr;

    print_title();
    fprintf(stderr,"\nusage: %s [option(s)] [file(s) | URL(s) | -]\n", prgName);
    fprintf(stderr,"supported options:\n");
    fprintf(o,"\n -k <n> --skip <n>         \n");
    fprintf(o," -a <f> --audiodevice <f>  \n");
    fprintf(o," -2     --2to1             2:1 Downsampling\n");
    fprintf(o," -4     --4to1             4:1 Downsampling\n");
    fprintf(o," -t     --test             \n");
    fprintf(o," -s     --stdout           \n");
    fprintf(o," -S     --STDOUT           Play AND output stream (not implemented yet)\n");
    fprintf(o," -c     --check            \n");
    fprintf(o," -v[*]  --verbose          Increase verboselevel\n");
    fprintf(o," -q     --quiet            Enables quiet mode\n");
    fprintf(o,"        --title            Prints filename in xterm title bar\n"),
    fprintf(o," -y     --resync           DISABLES resync on error\n");
    fprintf(o," -0     --left --single0   Play only left channel\n");
    fprintf(o," -1     --right --single1  Play only right channel\n");
    fprintf(o," -m     --mono --mix       Mix stereo to mono\n");
    fprintf(o,"        --stereo           Duplicate mono channel\n");
    fprintf(o,"        --reopen           Force close/open on audiodevice\n");
    fprintf(o," -g     --gain             Set audio hardware output gain\n");
    fprintf(o," -r     --rate             Force a specific audio output rate\n");
    fprintf(o,"        --pitch <p>        Pitchs the output by factor <p>\n");
    fprintf(o,"        --8bit             Force 8 bit output\n");
    fprintf(o," -o h   --headphones       Output on headphones\n");
    fprintf(o," -o s   --speaker          Output on speaker\n");
    fprintf(o," -o l   --lineout          Output to lineout\n");
    fprintf(o," -f <n> --scale <n>        Scale output samples (soft gain)\n");
    fprintf(o," -n     --frames <n>       Play only <n> frames of every stream\n");
    fprintf(o," -b <n> --buffer <n>       Set play buffer (\"output cache\")\n");
#ifdef TERM_CONTROL
    fprintf(o," -C     --control          Enable control keys\n");
#endif
#if 0
    fprintf(o," -R     --remote		Generic remote interface\n");
#endif
    fprintf(o," -d     --doublespeed      Play only every second frame\n");
    fprintf(o," -h     --halfspeed        Play every frame twice\n");
    fprintf(o," -p <f> --proxy <f>        Set WWW proxy\n");
    fprintf(o," -@ <f> --list <f>         Play songs in <f> file-list\n");
    fprintf(o," -z     --shuffle          Shuffle song-list before playing\n");
    fprintf(o," -Z     --random           full random play\n");



( run in 0.693 second using v1.01-cache-2.11-cpan-ad19def0cd9 )