]> git.tue.mpg.de Git - paraslash.git/commitdiff
Cosmetics: Rename samplerate to sample_rate.
authorAndre Noll <maan@systemlinux.org>
Wed, 30 Jun 2010 12:09:56 +0000 (14:09 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 13 Jul 2010 12:39:15 +0000 (14:39 +0200)
A subsequent patch will introduce sample_format which looks much nicer
than sampleformat. So let's use the underscored variant throughout.

14 files changed:
aacdec_filter.c
alsa_write.c
ggo/alsa_write.m4
ggo/oss_write.ggo
ggo/osx_write.ggo
mp3dec_filter.c
oggdec_filter.c
oss_write.c
osx_write.c
wav_filter.c
wmadec_filter.c
write.c
write_common.c
write_common.h

index f33f21eb7a63479e87c17cafb1d7fad0f6bce19b..79c8bb660a9a94708b1d540d00d35b4795e0ba24 100644 (file)
@@ -52,7 +52,7 @@ struct private_aacdec_data {
        /** The number of channels of the current stream. */
        unsigned int channels;
        /** Current sample rate in Hz. */
-       unsigned int samplerate;
+       unsigned int sample_rate;
 };
 
 static int aacdec_execute(struct btr_node *btrn, const char *cmd, char **result)
@@ -60,10 +60,10 @@ static int aacdec_execute(struct btr_node *btrn, const char *cmd, char **result)
        struct filter_node *fn = btr_context(btrn);
        struct private_aacdec_data *padd = fn->private_data;
 
-       if (!strcmp(cmd, "samplerate")) {
-               if (padd->samplerate == 0)
+       if (!strcmp(cmd, "sample_rate")) {
+               if (padd->sample_rate == 0)
                        return -E_BTR_NAVAIL;
-               *result = make_message("%u", padd->samplerate);
+               *result = make_message("%u", padd->sample_rate);
                return 1;
        }
        if (!strcmp(cmd, "channels")) {
@@ -140,10 +140,10 @@ next_buffer:
                                        &channels) < 0)
                                goto out;
                }
-               padd->samplerate = rate;
+               padd->sample_rate = rate;
                padd->channels = channels;
                PARA_INFO_LOG("rate: %u, channels: %d\n",
-                       padd->samplerate, padd->channels);
+                       padd->sample_rate, padd->channels);
                padd->initialized = 1;
        }
        if (padd->decoder_length > 0) {
index 7a4b868d251f0ee780647f72457b1c3162549bf0..240d51230fc2533e98de8cb6bbfc73ede69004bf 100644 (file)
@@ -45,10 +45,10 @@ struct private_alsa_write_data {
        /* Number of frames that fit into the buffer. */
        snd_pcm_uframes_t buffer_frames;
        /**
-        * The samplerate given by command line option or the decoder
+        * The sample rate given by command line option or the decoder
         * of the writer node group.
         */
-       unsigned samplerate;
+       unsigned sample_rate;
        /**
         * The number of channels, given by command line option or the
         * decoder of the writer node group.
@@ -86,7 +86,7 @@ static int alsa_init(struct private_alsa_write_data *pad,
                        pad->channels) < 0)
                return -E_CHANNEL_COUNT;
        if (snd_pcm_hw_params_set_rate_near(pad->handle, hwparams,
-                       &pad->samplerate, NULL) < 0)
+                       &pad->sample_rate, NULL) < 0)
                return -E_SET_RATE;
        err = snd_pcm_hw_params_get_buffer_time_max(hwparams,
                &pad->buffer_time, NULL);
@@ -110,7 +110,7 @@ static int alsa_init(struct private_alsa_write_data *pad,
                start_threshold = 1;
        else
                start_threshold = PARA_MIN(pad->buffer_frames,
-                       (snd_pcm_uframes_t)pad->samplerate);
+                       (snd_pcm_uframes_t)pad->sample_rate);
        if (snd_pcm_sw_params_set_start_threshold(pad->handle, swparams,
                        start_threshold) < 0)
                return -E_START_THRESHOLD;
@@ -232,19 +232,19 @@ again:
                if (bytes == 0) /* no data available */
                        return;
                /* defaults */
-               pad->samplerate = conf->samplerate_arg;
+               pad->sample_rate = conf->sample_rate_arg;
                pad->channels = conf->channels_arg;
-               if (!conf->samplerate_given) { /* config option trumps btr_exec */
+               if (!conf->sample_rate_given) { /* config option trumps btr_exec */
                        int32_t rate;
-                       if (get_btr_samplerate(btrn, &rate) >= 0)
-                               pad->samplerate = rate;
+                       if (get_btr_sample_rate(btrn, &rate) >= 0)
+                               pad->sample_rate = rate;
                }
                if (!conf->channels_given) {
                        int32_t ch;
                        if (get_btr_channels(btrn, &ch) >= 0)
                                pad->channels = ch;
                }
-               PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels, pad->samplerate);
+               PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels, pad->sample_rate);
                ret = alsa_init(pad, wn->conf);
                if (ret < 0)
                        goto err;
index afcefccfacbc3af3d6ccb077db9d81d2aa6151a5..54d0f72fdfe8de2930054d5adb755a8449c50041 100644 (file)
@@ -25,7 +25,7 @@ details="
        of channels will be obtained from other resources.
 "
 
-option "samplerate" s
+option "sample_rate" s
 #~~~~~~~~~~~~~~~~~~~~~
 "force given sample rate"
 int typestr="num"
index 6068218679fe74e3ca05f715e2e0ef602da9f148..1f6f582595b2ff3d2dbfb138e3e85b346032e9e1 100644 (file)
@@ -18,7 +18,7 @@ details="
        of channels will be obtained from other resources.
 "
 
-option "samplerate" s
+option "sample_rate" s
 #~~~~~~~~~~~~~~~~~~~~~
 "force given sample rate"
 int typestr="num"
index 33c495abf90fc2777b4171f224e5b9725c81b32d..8dca821245422fcb5aba2b963566cc9d8cdb9187 100644 (file)
@@ -13,7 +13,7 @@ details = "
        default="2"
        optional
 
-option "samplerate" s
+option "sample_rate" s
 #~~~~~~~~~~~~~~~~~~~~~
 
 "force given sample rate (only neccessary for
index 35448da7e22f67c84e2fb08d8f1ba6b15de2d49f..f03fbb76d4c004f1b439bb26bbfbe6414d7b07cf 100644 (file)
@@ -50,7 +50,7 @@ struct private_mp3dec_data {
        /** The number of channels of the current stream. */
        unsigned int channels;
        /** Current sample rate in Hz. */
-       unsigned int samplerate;
+       unsigned int sample_rate;
 };
 
 static int need_bad_data_delay(struct private_mp3dec_data *pmd,
@@ -165,7 +165,7 @@ next_frame:
                goto next_buffer;
        }
        fn->min_iqs = 0;
-       pmd->samplerate = pmd->frame.header.samplerate;
+       pmd->sample_rate = pmd->frame.header.samplerate;
        pmd->channels = MAD_NCHANNELS(&pmd->frame.header);
        ret = mad_frame_decode(&pmd->frame, &pmd->stream);
        if (ret != 0) {
@@ -236,10 +236,10 @@ static int mp3dec_execute(struct btr_node *btrn, const char *cmd, char **result)
        struct filter_node *fn = btr_context(btrn);
        struct private_mp3dec_data *pmd = fn->private_data;
 
-       if (!strcmp(cmd, "samplerate")) {
-               if (pmd->samplerate == 0)
+       if (!strcmp(cmd, "sample_rate")) {
+               if (pmd->sample_rate == 0)
                        return -E_BTR_NAVAIL;
-               *result = make_message("%u", pmd->samplerate);
+               *result = make_message("%u", pmd->sample_rate);
                return 1;
        }
        if (!strcmp(cmd, "channels")) {
index 541b0b236452f1c52fc53d0d0476c9207adf0cfa..8a40ce0c56192041bac5edcc9e00a76dd82dcaa8 100644 (file)
@@ -35,8 +35,8 @@ struct private_oggdec_data {
        /** The number of channels of the current stream. */
        unsigned int channels;
        /** Current sample rate in Hz. */
-       unsigned int samplerate;
        struct timeval stream_start;
+       unsigned int sample_rate;
 };
 
 static size_t cb_read(void *buf, size_t size, size_t nmemb, void *datasource)
@@ -121,10 +121,10 @@ static int oggdec_execute(struct btr_node *btrn, const char *cmd, char **result)
        struct filter_node *fn = btr_context(btrn);
        struct private_oggdec_data *pod = fn->private_data;
 
-       if (!strcmp(cmd, "samplerate")) {
-               if (pod->samplerate == 0)
+       if (!strcmp(cmd, "sample_rate")) {
+               if (pod->sample_rate == 0)
                        return -E_BTR_NAVAIL;
-               *result = make_message("%u", pod->samplerate);
+               *result = make_message("%u", pod->sample_rate);
                return 1;
        }
        if (!strcmp(cmd, "channels")) {
@@ -178,10 +178,10 @@ open:
        if (oret < 0)
                goto out;
        pod->channels = ov_info(pod->vf, 0)->channels;
-       pod->samplerate = ov_info(pod->vf, 0)->rate;
+       pod->sample_rate = ov_info(pod->vf, 0)->rate;
        tv_add(now, &(struct timeval)EMBRACE(0, 300 * 1000), &pod->stream_start);
        PARA_NOTICE_LOG("%d channels, %d Hz\n", pod->channels,
-               pod->samplerate);
+               pod->sample_rate);
        ret = 1;
 out:
        if (ret <= 0) {
index 6525afa48fca41a9f42d01f36d36315f054c3cf5..6ca1e16eaf62d33a54d58456d43779fb055c3bec 100644 (file)
@@ -69,7 +69,7 @@ static void oss_close(struct writer_node *wn)
  * incorrectly believe that the device is still in 44.1 kHz mode when actually
  * the speed is decreased to 22.05 kHz.
  */
-static int oss_init(struct writer_node *wn, unsigned samplerate, unsigned channels)
+static int oss_init(struct writer_node *wn, unsigned sample_rate, unsigned channels)
 {
        int ret, format = FORMAT;
        unsigned ch, rate;
@@ -115,15 +115,15 @@ static int oss_init(struct writer_node *wn, unsigned samplerate, unsigned channe
         * device, the the highest possible speed is automatically used. The
         * value actually used is returned as the new value of the argument.
         */
-       rate = samplerate;
+       rate = sample_rate;
        ret = ioctl(powd->fd, SNDCTL_DSP_SPEED, &rate);
        if (ret < 0) {
                ret = -ERRNO_TO_PARA_ERROR(errno);
                goto err;
        }
-       if (rate != samplerate) {
-               unsigned min = PARA_MIN(rate, samplerate),
-                       max = PARA_MAX(rate, samplerate);
+       if (rate != sample_rate) {
+               unsigned min = PARA_MIN(rate, sample_rate),
+                       max = PARA_MAX(rate, sample_rate);
                /*
                 * Check whether the returned sample rate differs significantly
                 * from the requested one.
@@ -132,7 +132,7 @@ static int oss_init(struct writer_node *wn, unsigned samplerate, unsigned channe
                if (100 * max > 110 * min) /* more than 10% deviation */
                        goto err;
                PARA_NOTICE_LOG("using %dHz rather than %dHz\n", rate,
-                       samplerate);
+                       sample_rate);
        }
        wn->min_iqs = powd->bytes_per_frame;
        return 1;
@@ -160,10 +160,10 @@ static void oss_post_select(__a_unused struct sched *s,
        if (powd->fd < 0) {
                int32_t rate, ch;
                ret = -1;
-               if (!conf->samplerate_given) /* config option trumps btr_exec */
-                       ret = get_btr_samplerate(wn->btrn, &rate);
+               if (!conf->sample_rate_given) /* config option trumps btr_exec */
+                       ret = get_btr_sample_rate(wn->btrn, &rate);
                if (ret < 0)
-                       rate = conf->samplerate_arg;
+                       rate = conf->sample_rate_arg;
                ret = -1;
                if (!conf->channels_given)
                        ret = get_btr_channels(wn->btrn, &ch);
index bcff09f781bc3c1e703a4cc4bcce91f5c8ff5628..cde7fcea867ef4bb35b9799f2c0b59dce455085e 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;
 };
@@ -193,17 +193,17 @@ 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->sample_rate = conf->sample_rate_arg;
        powd->channels = conf->channels_arg;
-       if (!conf->samplerate_given) {
+       if (!conf->sample_rate_given) {
                int32_t rate;
-               if (get_btr_samplerate(btrn, &rate) >= 0)
-                       powd->samplerate = rate;
+               get_btr_sample_rate(btrn, &rate);
+               powd->sample_rate = rate;
        }
        if (!conf->channels_given) {
                int32_t ch;
-               if (get_btr_channels(btrn, &ch) >= 0)
-                       powd->channels = ch;
+               get_btr_channels(btrn, &ch);
+               powd->channels = ch;
        }
        /*
         * Choose PCM format. We tell the Output Unit what format we're going
@@ -212,7 +212,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 +324,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);
index abd850b2499429ab5e992b771b4144d371a9d987..63c7b7eb6752ed50126c6b5a3d9900d9a1f8030e 100644 (file)
 /** Always write 16 bit header. */
 #define BITS 16
 
-static void make_wav_header(unsigned int channels, unsigned int samplerate,
+static void make_wav_header(unsigned int channels, unsigned int sample_rate,
                char *headbuf)
 {
 
        unsigned int size = 0x7fffffff;
-       int bytespersec = channels * samplerate * BITS / 8;
+       int bytespersec = channels * sample_rate * BITS / 8;
        int align = channels * BITS / 8;
 
-       PARA_DEBUG_LOG("writing wave header: %d channels, %d KHz\n", channels, samplerate);
+       PARA_DEBUG_LOG("writing wave header: %d channels, %d KHz\n", channels, sample_rate);
        memset(headbuf, 0, WAV_HEADER_LEN);
        memcpy(headbuf, "RIFF", 4);
        write_u32(headbuf + 4, size - 8);
@@ -41,7 +41,7 @@ static void make_wav_header(unsigned int channels, unsigned int samplerate,
        write_u32(headbuf + 16, 16); /* 16 + extra format bytes (zero) */
        write_u16(headbuf + 20, 1);     /* format (1 == PCM/uncompressed) */
        write_u16(headbuf + 22, channels);
-       write_u32(headbuf + 24, samplerate);
+       write_u32(headbuf + 24, sample_rate);
        write_u32(headbuf + 28, bytespersec);
        write_u16(headbuf + 32, align); /* number of bytes per sample slice */
        write_u16(headbuf + 34, BITS); /* significant bits per sample */
@@ -92,7 +92,7 @@ static void wav_post_select(__a_unused struct sched *s, struct task *t)
                        goto err;
                return;
        }
-       ret = btr_exec_up(btrn, "samplerate", &buf);
+       ret = btr_exec_up(btrn, "sample_rate", &buf);
        if (ret < 0) {
                ret = -E_WAV_BAD_FC;
                goto err;
index 45fda79e7e7359a0535bd0a932ec03ad944b23fe..88165b9a073222e8779e15965caba59023c1520b 100644 (file)
@@ -1208,7 +1208,7 @@ static int wmadec_execute(struct btr_node *btrn, const char *cmd, char **result)
        struct filter_node *fn = btr_context(btrn);
        struct private_wmadec_data *pwd = fn->private_data;
 
-       if (!strcmp(cmd, "samplerate")) {
+       if (!strcmp(cmd, "sample_rate")) {
                if (pwd->ahi.sample_rate == 0)
                        return -E_BTR_NAVAIL;
                *result = make_message("%u", pwd->ahi.sample_rate);
diff --git a/write.c b/write.c
index 416408a1f4cfe606d858ea833f4531225c3d90db..7dc9f85ce3223b24678214b526dd76e35c1d2dcf 100644 (file)
--- a/write.c
+++ b/write.c
@@ -37,7 +37,7 @@ struct check_wav_task {
        /** Number of channels specified in wav header given by \a buf. */
        unsigned channels;
        /** Sample rate specified in wav header given by \a buf. */
-       unsigned samplerate;
+       unsigned sample_rate;
        /** The task structure used by the scheduler. */
        struct task task;
        struct btr_node *btrn;
@@ -72,10 +72,10 @@ static int check_wav_exec(struct btr_node *btrn, const char *cmd, char **result)
        struct check_wav_task *cwt = btr_context(btrn);
 
 
-       if (!strcmp(cmd, "samplerate")) {
+       if (!strcmp(cmd, "sample_rate")) {
                if (cwt->state != CWS_HAVE_HEADER)
                        return -E_BTR_NAVAIL;
-               *result = make_message("%d", cwt->samplerate);
+               *result = make_message("%d", cwt->sample_rate);
                return 1;
        }
        if (!strcmp(cmd, "channels")) {
@@ -107,7 +107,7 @@ static void check_wav_post_select(__a_unused struct sched *s, struct task *t)
                goto pushdown;
        cwt->min_iqs = 0;
        cwt->channels = 2;
-       cwt->samplerate = 44100;
+       cwt->sample_rate = 44100;
        if (a[0] != 'R' || a[1] != 'I' || a[2] != 'F' || a[3] != 'F') {
                PARA_NOTICE_LOG("wav header not found\n");
                cwt->state = CWS_NO_HEADER;
@@ -118,8 +118,8 @@ static void check_wav_post_select(__a_unused struct sched *s, struct task *t)
        cwt->state = CWS_HAVE_HEADER;
        sprintf(t->status, "check wav: have header");
        cwt->channels = (unsigned) a[22];
-       cwt->samplerate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24);
-       PARA_INFO_LOG("channels: %d, sample rate: %d\n", cwt->channels, cwt->samplerate);
+       cwt->sample_rate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24);
+       PARA_INFO_LOG("channels: %d, sample rate: %d\n", cwt->channels, cwt->sample_rate);
        btr_consume(btrn, WAV_HEADER_LEN);
 pushdown:
        btr_pushdown(btrn);
index 1da78b5137fda429c80490abc77e548a1a3f812b..0d30eb8018583b278d79ef6df40a02bb2d771053 100644 (file)
@@ -160,11 +160,11 @@ static int get_btr_value(struct btr_node *btrn, const char *key, int32_t *result
 }
 
 /*
- * Ask parent btr nodes for the samplerate of the current stream.
+ * Ask parent btr nodes for the sample rate of the current stream.
  */
-int get_btr_samplerate(struct btr_node *btrn, int32_t *result)
+int get_btr_sample_rate(struct btr_node *btrn, int32_t *result)
 {
-       return get_btr_value(btrn, "samplerate", result);
+       return get_btr_value(btrn, "sample_rate", result);
 }
 
 /*
index b6f66fa6c27182f99d510c57363b05724ad168fb..785161efba2c651f0c1a1cbafa804e1bcb89f066 100644 (file)
@@ -4,7 +4,7 @@
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
-/** \file write_common.h exported symbols from write_common.c */
+/** \file write_common.h Exported symbols from write_common.c */
 
 void writer_init(void);
 void *check_writer_arg(const char *wa, int *writer_num);
@@ -12,5 +12,5 @@ void print_writer_helps(int detailed);
 void register_writer_node(struct writer_node *wn, struct btr_node *parent);
 int setup_writer_node(const char *arg, struct btr_node *parent,
                struct writer_node *wn);
-int get_btr_samplerate(struct btr_node *btrn, int32_t *result);
+int get_btr_sample_rate(struct btr_node *btrn, int32_t *result);
 int get_btr_channels(struct btr_node *btrn, int32_t *result);