Example #1
0
File: ao_a.c Project: 1c0n/xbmc
void show_ao_device_info(FILE *fp)
{
  int driver_count;
  ao_info **devices;
  int i;

  ao_initialize();

  fputs("Output device name (ao only):" NLS
"  -o device    ", fp);

  devices  = ao_driver_info_list(&driver_count);
  if (driver_count < 1) {
	  fputs("*no device found*" NLS, fp);
  }
  else {
	  fputs("[ ", fp);
	  for(i = 0; i < driver_count; i++) {
		  if (devices[i]->type == AO_TYPE_LIVE)
			  fprintf(fp, "%s ", devices[i]->short_name);
	  }
	  fputs("]", fp);
  }
  ao_shutdown();
}
Example #2
0
static void usage(const char *progname) {
    struct params default_par = DEFAULT_PARAMS;
    const char *default_driver = "???";

    {
        ao_info *info = ao_driver_info(driver_id);
        if (info)
            default_driver = info->short_name;
    }

    printf("vgmstream123 " VERSION ", built " __DATE__ "\n"
        "\n"
        "Usage: %s [options] INFILE ...\n"
        "Play streamed audio from video games.\n"
        "\n"
        "Options:\n"
        "    -d DRV      Use output driver DRV [%s]; available drivers:\n"
        "                ",
        progname,
        default_driver);

    {
        ao_info **info_list;
        int driver_count = 0;
        int i;

        info_list = ao_driver_info_list(&driver_count);

        for (i = 0; i < driver_count; i++)
            printf("%s ", info_list[i]->short_name);
    }

    printf("\n"
        "    -f OUTFILE  Set output filename for a file driver specified with -d\n"
        "    -o KEY:VAL  Pass option KEY with value VAL to the output driver\n"
        "                (see https://www.xiph.org/ao/doc/drivers.html)\n"
        "    -b N        Use an audio buffer of N kilobytes [%d]\n"
        "    -@ LSTFILE  Read playlist from LSTFILE\n"
        "    -h          Print this help\n"
        "    -r          Repeat playback indefinitely\n"
        "    -v          Display stream metadata and playback progress\n"
        "    -S N        Play substream with index N [%d]\n"
        "\n"
        "Options for looped streams:\n"
        "    -L N        Play loop N times [%d]\n"
        "    -M MINTIME  Loop for a playback time of at least MINTIME seconds\n"
        "    -F FTIME    End playback with a fade-out of FTIME seconds [%.1f]\n"
        "    -D FDELAY   Delay fade-out for an additional FDELAY seconds [%.1f]\n"
        "\n"
        "INFILE can be any stream file type supported by vgmstream, or an .m3u/.m3u8\n"
        "playlist referring to same. This program supports the \"EXT-X-VGMSTREAM\" tag\n"
        "in playlists, and files compressed with gzip/bzip2/xz.\n",
        buffer_size_kb,
        default_par.stream_index,
        default_par.loop_count,
        default_par.fade_time,
        default_par.fade_delay
    );
}
void cmdline_usage (void)
{
  int i, driver_count;
  ao_info **devices = ao_driver_info_list(&driver_count);

  printf ( 
         _("ogg123 from %s %s\n"
	 " by the Xiph.org Foundation (http://www.xiph.org/)\n\n"
	 "Usage: ogg123 [<options>] <input file> ...\n\n"
	 "  -h, --help     this help\n"
	 "  -V, --version  display Ogg123 version\n"
	 "  -d, --device=d uses 'd' as an output device\n"
	 "      Possible devices are ('*'=live, '@'=file):\n"
	 "        "), PACKAGE, VERSION);
  
  for(i = 0; i < driver_count; i++) {
    printf ("%s", devices[i]->short_name);
    if (devices[i]->type == AO_TYPE_LIVE)
      printf ("*");
    else if (devices[i]->type == AO_TYPE_FILE)
      printf ("@");
    printf (" ");
  }

  printf ("\n");
  
  printf (
	 _("  -f, --file=filename  Set the output filename for a previously\n"
	 "      specified file device (with -d).\n"
	 "  -k n, --skip n  Skip the first 'n' seconds (or hh:mm:ss format)\n"
	 "  -K n, --end n   End at 'n' seconds (or hh:mm:ss format)\n"
	 "  -o, --device-option=k:v passes special option k with value\n"
	 "      v to previously specified device (with -d).  See\n"
	 "      man page for more info.\n"
	 "  -@, --list=filename   Read playlist of files and URLs from \"filename\"\n"
	 "  -b n, --buffer n  Use an input buffer of 'n' kilobytes\n"
	 "  -p n, --prebuffer n  Load n%% of the input buffer before playing\n"
	 "  -v, --verbose  Display progress and other status information\n"
	 "  -q, --quiet    Don't display anything (no title)\n"
	 "  -x n, --nth    Play every 'n'th block\n"
	 "  -y n, --ntimes Repeat every played block 'n' times\n"
	 "  -z, --shuffle  Shuffle play\n"
	 "\n"
	 "ogg123 will skip to the next song on SIGINT (Ctrl-C); two SIGINTs within\n"
	 "s milliseconds make ogg123 terminate.\n"
	 "  -l, --delay=s  Set s [milliseconds] (default 500).\n"));
}
Example #4
0
static void show_ao_device_info(FILE *fp)
{
  int driver_count;
  ao_info **devices;
  int i;

  ao_initialize();

  devices  = ao_driver_info_list(&driver_count);
  if (driver_count < 1) {
	  fputs("*no device found*" NLS, fp);
  }
  else {
	  for(i = 0; i < driver_count; i++) {
		  if (devices[i]->type == AO_TYPE_LIVE)
			  fprintf(fp, "%d %s \n", ao_driver_id(devices[i]->short_name), devices[i]->short_name);
	  }
  }
  ao_shutdown();
}
Example #5
0
static int open_output(void)
{
  int driver_id, ret = 0;

  int driver_count;
  ao_info **devices;
  int i;

  ao_initialize();

  opt_ao_device_id = -2;
  devices  = ao_driver_info_list(&driver_count);
  if (driver_count > 0) {
    for(i = 0; i < driver_count; i++) {
      if(  (devices[i]->type == AO_TYPE_LIVE) 
      && (dpm.name != NULL) && (strcmp(dpm.name, devices[i]->short_name) == 0)  ){
        opt_ao_device_id = ao_driver_id(dpm.name);
      }
      
    }
  }

  if (opt_ao_device_id == -2){
    if(dpm.name != NULL)
      ret = sscanf(dpm.name, "%d", &opt_ao_device_id);
    if ( dpm.name == NULL || ret == 0 || ret == EOF)
      opt_ao_device_id = -2;
    }
    if (opt_ao_device_id == -1){
      ao_shutdown();
      show_ao_device_info(stdout);
      return -1;
    }



  if (opt_ao_device_id==-2) {
    driver_id = ao_default_driver_id();
  }
  else {
    ao_info *device;

    driver_id = opt_ao_device_id;
    if ((device = ao_driver_info(driver_id)) == NULL) {
      ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: driver is not supported.",
		dpm.name);
      return -1;
    }
    if (device->type == AO_TYPE_FILE) {
      ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: file output is not supported.",
		dpm.name);
      return -1;
    }
  }

  if (driver_id == -1) {
    ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
	      dpm.name, strerror(errno));
    return -1;
  }

  /* They can't mean these */
  dpm.encoding &= ~(PE_ULAW|PE_ALAW|PE_BYTESWAP);

  ao_sample_format_ctx.channels = (dpm.encoding & PE_MONO) ? 1 : 2;
  ao_sample_format_ctx.rate = dpm.rate;
  ao_sample_format_ctx.byte_format = AO_FMT_NATIVE;
  ao_sample_format_ctx.bits = (dpm.encoding & PE_24BIT) ? 24 : 0;
  ao_sample_format_ctx.bits = (dpm.encoding & PE_16BIT) ? 16 : 0;
  if (ao_sample_format_ctx.bits == 0)
    ao_sample_format_ctx.bits = 8;

  if ((ao_device_ctx = ao_open_live(driver_id, &ao_sample_format_ctx, NULL /* no options */)) == NULL) {
    ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s",
	      dpm.name, strerror(errno));
    return -1;
  }
  return 0;
}
Example #6
0
void cmdline_usage (void)
{
  int i, j, driver_count;
  ao_info **devices = ao_driver_info_list(&driver_count);

  printf (_("ogg123 from %s %s\n"
         " by the Xiph.Org Foundation (http://www.xiph.org/)\n\n"), PACKAGE, VERSION);

  printf (_("Usage: ogg123 [options] file ...\n"
	    "Play Ogg audio files and network streams.\n\n"));
 
  printf (_("Available codecs: "));

#ifdef HAVE_LIBFLAC
  printf (_("FLAC, "));
#endif

#ifdef HAVE_LIBSPEEX
  printf (_("Speex, "));
#endif

  printf (_("Ogg Vorbis.\n\n"));

  printf (_("Output options\n"));
  printf (_("  -d dev, --device dev    Use output device \"dev\". Available devices:\n"));
  printf ("                          ");
  printf (_("Live:"));

  for(i = 0, j = 0; i < driver_count; i++) {
    if (devices[i]->type == AO_TYPE_LIVE) {
      printf ("%c %s", LIST_SEP(j), devices[i]->short_name);
      j++;
    }
  }
  printf ("\n                          ");
  printf (_("File:"));
  for(i = 0, j = 0; i < driver_count; i++) {
    if (devices[i]->type == AO_TYPE_FILE) {
      printf ("%c %s", LIST_SEP(j), devices[i]->short_name);
      j++;
    }
  }
  printf ("\n\n");

  printf (_("  -f file, --file file    Set the output filename for a file device\n"
	    "                          previously specified with --device.\n"));
  printf ("\n");
  printf (_("  --audio-buffer n        Use an output audio buffer of 'n' kilobytes\n"));
  printf (_("  -o k:v, --device-option k:v\n"
	    "                          Pass special option 'k' with value 'v' to the\n"
	    "                          device previously specified with --device. See\n"
	    "                          the ogg123 man page for available device options.\n"));
  printf ("\n");

  printf (_("Playlist options\n"));
  printf (_("  -@ file, --list file    Read playlist of files and URLs from \"file\"\n"));
  printf (_("  -r, --repeat            Repeat playlist indefinitely\n"));
  printf (_("  -R, --remote            Use remote control interface\n"));
  printf (_("  -z, --shuffle           Shuffle list of files before playing\n"));
  printf (_("  -Z, --random            Play files randomly until interrupted\n"));
  printf ("\n");

  printf (_("Input options\n"));
  printf (_("  -b n, --buffer n        Use an input buffer of 'n' kilobytes\n"));
  printf (_("  -p n, --prebuffer n     Load n%% of the input buffer before playing\n"));
  printf ("\n");

  printf (_("Decode options\n"));
  printf (_("  -k n, --skip n          Skip the first 'n' seconds (or hh:mm:ss format)\n"));
  printf (_("  -K n, --end n           End at 'n' seconds (or hh:mm:ss format)\n"));
  printf (_("  -x n, --nth n           Play every 'n'th block\n"));
  printf (_("  -y n, --ntimes n        Repeat every played block 'n' times\n"));
  printf ("\n");

  printf (_("Miscellaneous options\n"));
  printf (_("  -l s, --delay s         Set termination timeout in milliseconds. ogg123\n"
	    "                          will skip to the next song on SIGINT (Ctrl-C),\n"
	    "                          and will terminate if two SIGINTs are received\n"
	    "                          within the specified timeout 's'. (default 500)\n"));
  printf ("\n");
  printf (_("  -h, --help              Display this help\n"));
  printf (_("  -q, --quiet             Don't display anything (no title)\n"));
  printf (_("  -v, --verbose           Display progress and other status information\n"));
  printf (_("  -V, --version           Display ogg123 version\n"));
  printf ("\n");

}