shithub: opus-tools

Download patch

ref: 3e3132bec1537562b541a3e4bb9fa7676e3e4513
parent: 736d934754c8fc7c765c24f80ba74ed675454039
author: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
date: Thu Aug 4 06:52:05 EDT 2011

s/sample_rate/input_sample_rate/

--- a/src/opus_header.c
+++ b/src/opus_header.c
@@ -113,7 +113,7 @@
    if (!read_chars(&p, &ch, 1))
       return 0;
    h->version = ch;
-   if (!read_uint32(&p, &h->sample_rate))
+   if (!read_uint32(&p, &h->input_sample_rate))
       return 0;
    if (!read_chars(&p, &ch, 1))
       return 0;
@@ -169,7 +169,7 @@
    ch = 0;
    if (!write_chars(&p, &ch, 1))
       return 0;
-   if (!write_uint32(&p, h->sample_rate))
+   if (!write_uint32(&p, h->input_sample_rate))
       return 0;
    ch = h->multi_stream;
    if (!write_chars(&p, &ch, 1))
--- a/src/opus_header.h
+++ b/src/opus_header.h
@@ -5,7 +5,7 @@
 
 typedef struct {
    int version;
-   opus_uint32 sample_rate;
+   opus_uint32 input_sample_rate;
    int multi_stream;
    int channels;
    int preskip;
--- a/src/opusdec.c
+++ b/src/opusdec.c
@@ -202,7 +202,7 @@
 #endif
       info.play.encoding = AUDIO_ENCODING_SLINEAR;
       info.play.precision = 16;
-      info.play.sample_rate = rate;
+      info.play.input_sample_rate = rate;
       info.play.channels = *channels;
       
       if (ioctl(audio_fd, AUDIO_SETINFO, &info) < 0)
@@ -306,7 +306,7 @@
    *channels = header.channels;
 
    if (!*rate)
-      *rate = header.sample_rate;
+      *rate = header.input_sample_rate;
    *preskip = header.preskip;
    st = opus_decoder_create(48000, header.channels);
    if (!st)
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -506,7 +506,7 @@
    if (resampler)
       header.preskip += speex_resampler_get_output_latency(resampler);
    header.multi_stream = 0;
-   header.sample_rate = rate;
+   header.input_sample_rate = rate;
    
    /* Extra samples that need to be read to compensate for the pre-skip */
    extra_samples = (int)header.preskip * (rate/48000.);
@@ -518,10 +518,10 @@
       {
          if (with_cbr)
            fprintf (stderr, "Encoding %.0f kHz %s audio in %.0fms packets at %0.3fkbit/sec (%d bytes per packet, CBR)\n",
-               header.sample_rate/1000., st_string, frame_size/48., bitrate, bytes_per_packet);
+               header.input_sample_rate/1000., st_string, frame_size/48., bitrate, bytes_per_packet);
          else
            fprintf (stderr, "Encoding %.0f kHz %s audio in %.0fms packets at %0.3fkbit/sec (%d bytes per packet maximum)\n",
-               header.sample_rate/1000., st_string, frame_size/48., bitrate, bytes_per_packet);
+               header.input_sample_rate/1000., st_string, frame_size/48., bitrate, bytes_per_packet);
       }
    }
 
@@ -710,7 +710,7 @@
    }
 
    if (!with_cbr && !quiet)
-     fprintf (stderr, "Average rate %0.3fkbit/sec, %d peak bytes per packet\n", (total_bytes*8.0/((float)nb_encoded/header.sample_rate))/1000.0, peak_bytes);
+     fprintf (stderr, "Average rate %0.3fkbit/sec, %d peak bytes per packet\n", (total_bytes*8.0/((float)nb_encoded/header.input_sample_rate))/1000.0, peak_bytes);
 
    opus_encoder_destroy(st);
    ogg_stream_clear(&os);