1 /* vim: set ts=4 sw=4 et: */
5 * Copyright (C) 2006 Nokia Corporation
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef _MAEMO_RECORDER_H_
24 #define _MAEMO_RECORDER_H_
28 #include <hildon/hildon-program.h>
29 #include <hildon/hildon-window.h>
30 #include <gconf/gconf-client.h>
36 #define SERVICE_NAME "maemo_recorder"
37 #define SERVICE_NAME_FULL "com.nokia.maemo_recorder"
39 #define DEFAULT_CHANNELS 1
40 #define DEFAULT_RATE 16000
42 #define GST_TYPE_ILBC "audio/x-iLBC"
43 #define ILBC_RATE DEFAULT_RATE
46 * 15.2 kbps (SI kilo) for 20 ms frames
47 * 38 bytes / frame, 50 frames / sec
49 /* 13.33 kbps for 30 ms frames */
50 #define ILBC_BITRATE_20 15200
51 #define ILBC_BITRATE_30 13300
53 /* 8000 Hz * 8 bits/sample */
54 #define PCMA_BITRATE 64000
55 #define PCMU_BITRATE 64000
57 #define GST_TYPE_PCMA "audio/x-alaw"
58 #define GST_TYPE_PCMU "audio/x-mulaw"
59 #define GST_TYPE_PCM "audio/x-raw-int"
60 #define PCM_RATE 16000
63 #define PCM_ENDIANNESS 1234
84 #define FORMAT_NAME_WAV "WAV"
85 #define FORMAT_NAME_PCMA "PCM A-law"
86 #define FORMAT_NAME_PCMU "PCM \u03BC-law"
88 #define FORMAT_NAME_PCMU "PCM mu-law"
90 #define FORMAT_NAME_PCM "PCM raw"
91 #define FORMAT_NAME_ILBC "iLBC"
93 #define PLAY_ICON "/usr/share/pixmaps/recorder/play.png"
94 #define REC_ICON "/usr/share/pixmaps/recorder/record.png"
95 #define STOP_ICON "/usr/share/pixmaps/recorder/stop.png"
97 /* TODO: this kind of struct might be more handy when passing around audioformat info */
99 struct _AudioFormatSpec
112 typedef struct _AudioFormatSpec AudioFormatSpec;
121 typedef struct _mainViewStr
124 GtkWidget *fileNameEntry;
125 GtkWidget *lengthEntry;
126 GtkWidget *stateEntry;
127 GtkWidget *formatEntry;
128 GtkObject *adjustment;
132 typedef struct _AppDataStr
135 HildonWindow *mainView;
137 mainViewStr mainViewData;
139 /* gstreamer components */
140 GstElement *pipeline;
141 GstElement *recPipeline;
142 GstElement *playPipeline;
144 gint playPipelineType;
146 osso_context_t *osso;
147 GConfClient *gconf_client;
149 gchar * openFileName;
150 gchar * saveFileName;
153 AudioFormat filter; /* selected recording format */
154 AudioFormat file_format; /* format of the recorded file or file currently open */
156 GtkWidget* radio_pcma;
157 GtkWidget* radio_ilbc;
158 GtkWidget* radio_pcm;
159 GtkWidget* radiotype;
162 GtkWidget *buttonSave;
163 GtkWidget *buttonSaveAs;
164 GtkWidget *buttonPlay;
165 GtkWidget *buttonRec;
167 guint recUpdateId; /* g_source_id for rec update timeout func */
168 gchar *mimeURI; /* uri to open via mime cb */
172 void setAppState(AppData *app, AppState state);
173 AppState getAppState(AppData *app);
176 AudioFormatSpec * audio_format_spec_new(void);
177 void audio_format_spec_free(AudioFormatSpec *af);
180 #endif /* _MAEMO_RECORDER_H_ */