Debian Codegraph @

maemo/dsp-protocol.h

raw symbols SCIP
1 /**
2 * @file dsp-protocol.h - Definition of functions whose represents
3 * an interface to the DSP PCM Task node protocol.
4 * <p>
5 * Copyright (C) 2006 Nokia Corporation
6 * <p>
7 * Contact: Eduardo Bezerra Valentin <[email protected]>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library 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 GNU
17 * Library General Public License for more details.
18 *
19 * You should have received a copy of the GNU Library General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * */
23 #ifndef _DSP_PROTOCOL_H
24 #define _DSP_PROTOCOL_H
25
26 #define __USE_GNU
27 #include <features.h>
28 #include <pthread.h>
29 #include <semaphore.h>
30 #include "types.h"
31
32 #ifdef HAVE_CONFIG_H
33 #include <config.h>
34 #endif
35
36
37 typedef struct {
38 int fd;
39 char *device;
40 int state;
41 int mute;
42 unsigned int stream_id;
43 unsigned int bridge_buffer_size; /* in bytes */
44 unsigned int mmap_buffer_size; /* in bytes */
45 short int *mmap_buffer;
46 pthread_mutex_t mutex;
47 int sem_set_id;
48 #ifdef USE_RESOURCE_MANAGER
49 void *dbus_connection;
50 #endif
51 } dsp_protocol_t;
52 /* Initialisation phase */
53 int dsp_protocol_create(dsp_protocol_t ** dsp_protocol);
54 int dsp_protocol_open_node(dsp_protocol_t * dsp_protocol, const char *device);
55 int dsp_protocol_send_audio_params(dsp_protocol_t * dsp_protocol,
56 audio_params_data_t * audio_params_data);
57 int dsp_protocol_send_speech_params(dsp_protocol_t * dsp_protocol,
58 speech_params_data_t * audio_params_data);
59
60 /* Execution phase */
61 int dsp_protocol_send_play(dsp_protocol_t * dsp_protocol);
62 int dsp_protocol_send_audio_data(dsp_protocol_t * dsp_protocol,
63 void *data, unsigned short int count);
64 int dsp_protocol_receive_audio_data(dsp_protocol_t * dsp_protocol,
65 void *data, int count);
66
67 int dsp_protocol_send_pause(dsp_protocol_t * dsp_protocol);
68 int dsp_protocol_send_stop(dsp_protocol_t * dsp_protocol);
69
70 /* Deletion phase */
71 int dsp_protocol_close_node(dsp_protocol_t * dsp_protocol);
72 int dsp_protocol_destroy(dsp_protocol_t ** dsp_protocol);
73
74 /* controls */
75 int dsp_protocol_set_volume(dsp_protocol_t * dsp_protocol,
76 unsigned char left, unsigned char right);
77 int dsp_protocol_get_volume(dsp_protocol_t * dsp_protocol,
78 unsigned char *left, unsigned char *right);
79 int dsp_protocol_set_mute(dsp_protocol_t * dsp_protocol, unsigned char mute);
80 int dsp_protocol_get_mute(dsp_protocol_t * dsp_protocol);
81
82 /*miscelaneos*/
83 int dsp_protocol_set_mic_enabled(dsp_protocol_t * dsp_protocol, int enabled);
84 int dsp_protocol_probe_node(dsp_protocol_t * dsp_protocol, const char *device);
85 int safe_strtol(const char *str, long *val);
86
87 #endif /* _DSP_PROTOCOL_H */