]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - osx_write.c
write: Make get_btr_value() return void.
[paraslash.git] / osx_write.c
index bcff09f781bc3c1e703a4cc4bcce91f5c8ff5628..65a5adc79db3164ded3ef5a79070eb0ee71a43b4 100644 (file)
@@ -57,7 +57,7 @@ struct private_osx_write_data {
        /** the post_select writes audio data here */
        struct osx_buffer *to;
        /** sample rate of the current audio stream */
-       unsigned samplerate;
+       unsigned sample_rate;
        /** number of channels of the current audio stream */
        unsigned channels;
 };
@@ -172,7 +172,7 @@ static int osx_write_open(struct writer_node *wn)
        AudioStreamBasicDescription format;
        int ret;
        struct btr_node *btrn = wn->btrn;
-       struct osx_write_args_info *conf = wn->conf;
+       int32_t val;
 
        wn->private_data = powd;
        /* where did that default audio output go? */
@@ -193,18 +193,10 @@ static int osx_write_open(struct writer_node *wn)
        if (AudioUnitInitialize(powd->audio_unit))
                goto e1;
        powd->play = 0;
-       powd->samplerate = conf->samplerate_arg;
-       powd->channels = conf->channels_arg;
-       if (!conf->samplerate_given) {
-               int32_t rate;
-               if (get_btr_samplerate(btrn, &rate) >= 0)
-                       powd->samplerate = rate;
-       }
-       if (!conf->channels_given) {
-               int32_t ch;
-               if (get_btr_channels(btrn, &ch) >= 0)
-                       powd->channels = ch;
-       }
+       get_btr_sample_rate(btrn, &val);
+       powd->sample_rate = val;
+       get_btr_channels(btrn, &val);
+       powd->channels = val;
        /*
         * Choose PCM format. We tell the Output Unit what format we're going
         * to supply data to it. This is necessary if you're providing data
@@ -212,7 +204,7 @@ static int osx_write_open(struct writer_node *wn)
         * any format conversions necessary from your format to the device's
         * format.
         */
-       format.mSampleRate = powd->samplerate;
+       format.mSampleRate = powd->sample_rate;
        /* The specific encoding type of audio stream */
        format.mFormatID = kAudioFormatLinearPCM;
        /* flags specific to each format */
@@ -324,7 +316,7 @@ static void osx_write_pre_select(struct sched *s, struct task *t)
                sched_min_delay(s);
        if (ret <= 0 || numbytes < wn->min_iqs)
                return;
-       divisor = powd->samplerate * wn->min_iqs / numbytes;
+       divisor = powd->sample_rate * wn->min_iqs / numbytes;
        if (divisor)
                tv_divide(divisor, &tmp, &delay);
        sched_request_timeout(&delay, s);