wmadec: Properly handle empty outputs.
[paraslash.git] / check_wav.h
1 /*
2 * Copyright (C) 2012 Andre Noll <maan@tuebingen.mpg.de>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** \file check_wav.h Detect, process and cut a wav header. */
8
9 struct check_wav_context;
10
11 /**
12 * These come from the command line arguments.
13 *
14 * Different users of the check_wav API have different arg_info structs,
15 * so we need a universal variant for these.
16 */
17 struct wav_params {
18 /** Number of channels, or the default value. */
19 int channels_arg;
20 /** Whether the channel count was given. */
21 int channels_given;
22 /** Same semantics as \a channels_count. */
23 int sample_rate_arg;
24 /** Whether the sample rate was given. */
25 int sample_rate_given;
26 /** Same semantics as \a sample_rate. */
27 int sample_format_arg;
28 /** Whether the sample format was given. */
29 int sample_format_given;
30 };
31
32 /**
33 * Copy the wav parameters.
34 *
35 * \param dst Usually a pointer to struct wav_params.
36 * \param src Usually a pointer to some args_info struct.
37 *
38 * This can not be implemented as a function since the type of the structure
39 * pointed to by \a src depends on the application.
40 */
41 #define COPY_WAV_PARMS(dst, src) \
42 (dst)->channels_arg = (src)->channels_arg; \
43 (dst)->channels_given = (src)->channels_given; \
44 (dst)->sample_rate_arg = (src)->sample_rate_arg; \
45 (dst)->sample_rate_given = (src)->sample_rate_given; \
46 (dst)->sample_format_arg = (src)->sample_format_arg; \
47 (dst)->sample_format_given = (src)->sample_format_given;
48
49 struct check_wav_context *check_wav_init(struct btr_node *parent,
50 struct btr_node *child, struct wav_params *params,
51 struct btr_node **cw_btrn);
52 void check_wav_pre_select(struct sched *s, struct check_wav_context *cwc);
53 int check_wav_post_select(struct check_wav_context *cwc);
54 void check_wav_shutdown(struct check_wav_context *cwc);