shithub: alienpatch

ref: f5516e57ec8a9eb3ccf0f526c8b1b3a612a5f86a
dir: /opus-tools-defaults/

View raw version
diff 1d5e00558c79cf9a4266124d393cfbc879df7475 uncommitted
--- a/src/audio-in.c
+++ b/src/audio-in.c
@@ -671,8 +671,8 @@
                this length so that we do not misinterpret any additional
                chunks after this as audio.  Also use this length to report
                percent progress. */
-            wav->totalsamples = opt->total_samples_per_channel =
-                len/(format.channels*samplesize);
+            wav->totalsamples = len/(format.channels*samplesize);
+            opt->total_samples_per_channel = wav->totalsamples;
         }
         else
         {
--- a/src/opusdec.c
+++ b/src/opusdec.c
@@ -445,27 +445,13 @@
     defined HAVE_SYS_AUDIOIO_H || defined WIN32 || defined _WIN32
    printf("Usage: opusdec [options] input [output]\n");
 #else
-   printf("Usage: opusdec [options] input output\n");
+   printf("Usage: opusdec [options]\n");
 #endif
-   printf("\n");
-   printf("Decode audio in Opus format to Wave or raw PCM\n");
-   printf("\n");
-   printf("input can be:\n");
-   printf("  file:filename.opus   Opus URL\n");
-   printf("  filename.opus        Opus file\n");
-   printf("  -                    stdin\n");
-   printf("\n");
-   printf("output can be:\n");
-   printf("  filename.wav         Wave file\n");
-   printf("  filename.*           Raw PCM file (any extension other than .wav)\n");
-   printf("  -                    stdout (raw; unless --force-wav)\n");
 #if defined HAVE_LIBSNDIO || defined HAVE_SYS_SOUNDCARD_H || \
     defined HAVE_MACHINE_SOUNDCARD_H || defined HAVE_SOUNDCARD_H || \
     defined HAVE_SYS_AUDIOIO_H || defined WIN32 || defined _WIN32
    printf("  (default)            Play audio\n");
 #endif
-   printf("\n");
-   printf("Options:\n");
    printf(" -h, --help            Show this help\n");
    printf(" -V, --version         Show version information\n");
    printf(" --quiet               Suppress program output\n");
@@ -477,7 +463,6 @@
    printf(" --force-wav           Force Wave header on output\n");
    printf(" --packet-loss n       Simulate n %% random packet loss\n");
    printf(" --save-range file     Save check values for every frame to a file\n");
-   printf("\n");
 }
 
 void version(void)
@@ -692,7 +677,7 @@
    int file_output;
    int old_li=-1;
    int li;
-   int quiet = 0;
+   int quiet = 1;
    int forcewav = 0;
    ogg_int64_t nb_read_total=0;
    ogg_int64_t link_read=0;
@@ -718,10 +703,10 @@
    float loss_percent=-1;
    float manual_gain=0;
    int force_rate=0;
-   int force_stereo=0;
+   int force_stereo=1;
    int requested_channels=-1;
    int channels=-1;
-   int rate=0;
+   int rate=44100;
    int wav_format=0;
    int dither=1;
    int fp=0;
@@ -810,13 +795,7 @@
          goto done;
       }
    }
-   if (argc_utf8-optind!=2 && argc_utf8-optind!=1)
-   {
-      usage();
-      exit_code=1;
-      goto done;
-   }
-   inFile=argv_utf8[optind];
+   inFile="-";
 
    /*Output to a file or playback?*/
    file_output=argc_utf8-optind==2;
@@ -833,7 +812,7 @@
      }
      wav_format|=forcewav;
    } else {
-     outFile=NULL;
+     outFile="-";
      wav_format=0;
      /*If playing to audio out, default the rate to 48000
        instead of the original rate. The original rate is
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -117,20 +117,12 @@
 
 static void usage(void)
 {
-  printf("Usage: opusenc [options] input_file output_file.opus\n");
-  printf("\n");
-  printf("Encode audio using Opus.\n");
+  printf("Usage: opusenc [options]\n");
 #if defined(HAVE_LIBFLAC)
   printf("The input format can be Wave, AIFF, FLAC, Ogg/FLAC, or raw PCM.\n");
 #else
   printf("The input format can be Wave, AIFF, or raw PCM.\n");
 #endif
-  printf("\ninput_file can be:\n");
-  printf("  filename.wav      file\n");
-  printf("  -                 stdin\n");
-  printf("\noutput_file can be:\n");
-  printf("  filename.opus     compressed file\n");
-  printf("  -                 stdout\n");
   printf("\nGeneral options:\n");
   printf(" -h, --help         Show this help\n");
   printf(" -V, --version      Show version information\n");
@@ -431,7 +423,7 @@
   time_t             last_spin=0;
   int                last_spin_len=0;
   /*Settings*/
-  int                quiet=0;
+  int                quiet=1;
   opus_int32         bitrate=-1;
   opus_int32         rate=48000;
   opus_int32         frame_size=960;
@@ -474,12 +466,12 @@
   in_format=NULL;
   inopt.channels=chan;
   inopt.channels_format=CHANNELS_FORMAT_DEFAULT;
-  inopt.rate=rate;
+  inopt.rate=44100;
   /* 0 dB gain is recommended unless you know what you're doing */
   inopt.gain=0;
   inopt.samplesize=16;
   inopt.endianness=0;
-  inopt.rawmode=0;
+  inopt.rawmode=1;
   inopt.rawmode_f=0;
   inopt.ignorelength=0;
   inopt.copy_comments=1;
@@ -827,12 +819,8 @@
     fatal("Invalid bit-depth:\n"
       "--raw-bits must be 32 for float sample format\n");
   }
-  if (argc_utf8-optind!=2) {
-    usage();
-    exit(1);
-  }
-  inFile=argv_utf8[optind];
-  outFile=argv_utf8[optind+1];
+  inFile="-";
+  outFile="-";
 
   if (cline_size > 0) {
     ret = ope_comments_add(inopt.comments, "ENCODER_OPTIONS", ENCODER_string);