2 * Copyright (C) 2012 Andre Noll <maan@tuebingen.mpg.de>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file check_wav.h Detect, process and cut a wav header. */
9 struct check_wav_context;
12 * These come from the command line arguments.
14 * Different users of the check_wav API have different arg_info structs,
15 * so we need a universal variant for these.
18 /** Number of channels, or the default value. */
20 /** Whether the channel count was given. */
22 /** Same semantics as \a channels_count. */
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;
33 * Copy the wav parameters.
35 * \param dst Usually a pointer to struct wav_params.
36 * \param src Usually a pointer to some args_info struct.
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.
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;
49 #define LLS_COPY_WAV_PARMS(_dst, _pfx, _lpr) \
50 (_dst)->channels_given = lls_opt_given(lls_opt_result( \
51 _pfx ## _OPT_CHANNELS, (_lpr))); \
52 (_dst)->sample_rate_given = lls_opt_given(lls_opt_result( \
53 _pfx ## _OPT_SAMPLE_RATE, (_lpr))); \
54 (_dst)->sample_format_given = lls_opt_given(lls_opt_result( \
55 _pfx ## _OPT_SAMPLE_FORMAT, (_lpr))); \
56 (_dst)->channels_arg = lls_uint32_val(0, lls_opt_result( \
57 _pfx ## _OPT_CHANNELS, (_lpr))); \
58 (_dst)->sample_rate_arg = lls_uint32_val(0, lls_opt_result( \
59 _pfx ## _OPT_SAMPLE_RATE, (_lpr))); \
60 (_dst)->sample_format_arg = lls_uint32_val(0, lls_opt_result( \
61 _pfx ## _OPT_SAMPLE_FORMAT, (_lpr)));
63 struct check_wav_context *check_wav_init(struct btr_node *parent,
64 struct btr_node *child, struct wav_params *params,
65 struct btr_node **cw_btrn);
66 void check_wav_pre_select(struct sched *s, struct check_wav_context *cwc);
67 int check_wav_post_select(struct check_wav_context *cwc);
68 void check_wav_shutdown(struct check_wav_context *cwc);