]> git.tue.mpg.de Git - paraslash.git/commitdiff
make osx_write work for any bitrate
authorAndre Noll <maan@congo.fml.local>
Sun, 20 Aug 2006 13:42:01 +0000 (15:42 +0200)
committerAndre Noll <maan@congo.fml.local>
Sun, 20 Aug 2006 13:42:01 +0000 (15:42 +0200)
44100Hz was hardcoded which is sad. Use the information from the command line
or the writer node group if available.

Also add a channels count option for future use.

osx_write.ggo [new file with mode: 0644]
osx_writer.c

diff --git a/osx_write.ggo b/osx_write.ggo
new file mode 100644 (file)
index 0000000..7f319fb
--- /dev/null
@@ -0,0 +1,21 @@
+section "osx options"
+#####################
+
+option "channels" c
+#~~~~~~~~~~~~~~~~~~
+"number of channels (only neccessary for raw
+audio)"
+
+       int typestr="num"
+       default="2"
+       optional
+
+option "samplerate" s
+#~~~~~~~~~~~~~~~~~~~~~
+
+"force given sample rate (only neccessary for
+raw audio)"
+
+       int typestr="num"
+       default="44100"
+       optional
index 9ea7ad454aafce0588a00a33f4122914e65f45ee..2af553db4386561ff58cc1652be235f30f8f551a 100644 (file)
@@ -50,6 +50,7 @@ struct private_osx_writer_data {
        sem_t *semaphore;
        osx_buffer *from; /* Current buffers */
        osx_buffer *to;
+       unsigned samplerate;
 };
 
 
@@ -181,6 +182,8 @@ static int osx_writer_open(struct writer_node *wn)
        AudioStreamBasicDescription format;
        char s[10];
        int m, ret;
+       struct writer_node_group *wng = wn->wng;
+       struct osx_write_args_info *conf = wn->conf;
 
        wn->private_data = powd;
        /* where did that default audio output go? */
@@ -209,7 +212,11 @@ static int osx_writer_open(struct writer_node *wn)
         * AND you want the DefaultOutputUnit to do any format conversions
         * necessary from your format to the device's format.
         */
-       format.mSampleRate = 44100.0; /* The sample rate of the audio stream */
+       if (!conf->samplerate_given && wng->samplerate)
+               powd->samplerate = *wng->samplerate;
+       else
+               powd->samplerate = conf->samplerate_arg;
+       format.mSampleRate = powd->samplerate;
        /* The specific encoding type of audio stream*/
        format.mFormatID = kAudioFormatLinearPCM;
        /* flags specific to each format */