23
|
1 /* Libvisual - The audio visualisation framework.
|
|
2 *
|
|
3 * Copyright (C) 2004, 2005 Dennis Smit <ds@nerds-incorporated.org>
|
|
4 *
|
|
5 * Authors: Dennis Smit <ds@nerds-incorporated.org>
|
|
6 *
|
|
7 * $Id:
|
|
8 *
|
|
9 * This program is free software; you can redistribute it and/or modify
|
|
10 * it under the terms of the GNU Lesser General Public License as
|
|
11 * published by the Free Software Foundation; either version 2.1
|
|
12 * of the License, or (at your option) any later version.
|
|
13 *
|
|
14 * This program is distributed in the hope that it will be useful,
|
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 * GNU Lesser General Public License for more details.
|
|
18 *
|
|
19 * You should have received a copy of the GNU Lesser General Public License
|
|
20 * along with this program; if not, write to the Free Software
|
|
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
22 */
|
|
23
|
|
24 #ifndef _LV_INPUT_H
|
|
25 #define _LV_INPUT_H
|
|
26
|
|
27 #include <libvisual/lv_audio.h>
|
|
28 #include <libvisual/lv_plugin.h>
|
|
29 #include <libvisual/lv_common.h>
|
|
30
|
|
31 #ifdef __cplusplus
|
|
32 extern "C" {
|
|
33 #endif /* __cplusplus */
|
|
34
|
|
35 #define VISUAL_INPUT(obj) (VISUAL_CHECK_CAST ((obj), 0, VisInput))
|
|
36
|
|
37 typedef struct _VisInput VisInput;
|
|
38
|
|
39 /**
|
|
40 * Callback function that is set using visual_input_set_callback should use this signature.
|
|
41 *
|
|
42 * @see visual_input_set_callback
|
|
43 *
|
|
44 * @arg input Pointer to the VisInput structure.
|
|
45 *
|
|
46 * @arg audio Pointer to the VisAudio containing all the audio information, and in which
|
|
47 * data needs to be set within the callback.
|
|
48 *
|
|
49 * @arg priv Private field to be used by the client. The library will never touch this.
|
|
50 */
|
|
51 typedef int (*VisInputUploadCallbackFunc)(VisInput *input, VisAudio *audio, void *priv);
|
|
52
|
|
53 /**
|
|
54 * The VisInput structure encapsulates the input plugin and provides
|
|
55 * abstract interfaces to the input. The VisInput system provides
|
|
56 * PCM data to the visualisation elements of libvisual. This can be done
|
|
57 * through both plugins and callback functions.
|
|
58 *
|
|
59 * Members in the structure shouldn't be accessed directly but instead
|
|
60 * it's adviced to use the methods provided.
|
|
61 *
|
|
62 * @see visual_input_new
|
|
63 */
|
|
64 struct _VisInput {
|
|
65 VisObject object; /**< The VisObject data. */
|
|
66
|
|
67 VisPluginData *plugin; /**< Pointer to the plugin itself. */
|
|
68 VisAudio *audio; /**< Pointer to the VisAudio structure
|
|
69 * that contains the audio analyse
|
|
70 * results.
|
|
71 * @see visual_audio_analyse */
|
|
72 VisInputUploadCallbackFunc callback; /**< Callback function when a callback
|
|
73 * is used instead of a plugin. */
|
|
74 };
|
|
75
|
|
76 /* prototypes */
|
|
77 VisPluginData *visual_input_get_plugin (VisInput *input);
|
|
78
|
|
79 VisList *visual_input_get_list (void);
|
|
80 const char *visual_input_get_next_by_name (const char *name);
|
|
81 const char *visual_input_get_prev_by_name (const char *name);
|
|
82 int visual_input_valid_by_name (const char *name);
|
|
83
|
|
84 VisInput *visual_input_new (const char *inputname);
|
|
85
|
|
86 int visual_input_realize (VisInput *input);
|
|
87
|
|
88 int visual_input_set_callback (VisInput *input, VisInputUploadCallbackFunc callback, void *priv);
|
|
89
|
|
90 int visual_input_run (VisInput *input);
|
|
91
|
|
92 #ifdef __cplusplus
|
|
93 }
|
|
94 #endif /* __cplusplus */
|
|
95
|
|
96 #endif /* _LV_INPUT_H */
|