]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - check_wav.h
Move wav detection code to a separate file.
[paraslash.git] / check_wav.h
diff --git a/check_wav.h b/check_wav.h
new file mode 100644 (file)
index 0000000..102e951
--- /dev/null
@@ -0,0 +1,43 @@
+struct check_wav_task;
+
+/**
+ * These come from the command line arguments.
+ *
+ * Different users of the check_wav API have different arg_info structs,
+ * so we need a universal variant for these.
+ */
+struct wav_params {
+       /** Number of channels, or the default value. */
+       int channels_arg;
+       /** Whether the channel count was given. */
+       int channels_given;
+       /** Same semantics as \a channels_count. */
+       int sample_rate_arg;
+       /** Whether the sample rate was given. */
+       int sample_rate_given;
+       /** Same semantics as \a sample_rate. */
+       int sample_format_arg;
+       /** Whether the sample format was given. */
+       int sample_format_given;
+};
+
+/**
+ * Copy the wav parameters.
+ *
+ * \param dst Usually a pointer to struct wav_params.
+ * \param src Usually a pointer to some args_info struct.
+ *
+ * This can not be implemented as a function since the type of the structure
+ * pointed to by \a src depends on the application.
+ */
+#define COPY_WAV_PARMS(dst, src) \
+       (dst)->channels_arg = (src)->channels_arg; \
+       (dst)->channels_given = (src)->channels_given; \
+       (dst)->sample_rate_arg = (src)->sample_rate_arg; \
+       (dst)->sample_rate_given = (src)->sample_rate_given; \
+       (dst)->sample_format_arg = (src)->sample_format_arg; \
+       (dst)->sample_format_given = (src)->sample_format_given;
+
+struct check_wav_task *check_wav_init(struct sched *s, struct btr_node *parent,
+               struct wav_params *params, struct btr_node **cwt_btrn);
+void check_wav_shutdown(struct check_wav_task *cwt);