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-widgets/hildon-program.h>
29 #include <hildon-widgets/hildon-window.h>
35 #define SERVICE_NAME "maemo_recorder"
36 #define SERVICE_NAME_FULL "com.nokia.maemo_recorder"
38 #define DEFAULT_CHANNELS 1
39 #define DEFAULT_RATE 8000
41 #define GST_TYPE_ILBC "audio/x-iLBC"
42 #define ILBC_RATE DEFAULT_RATE
45 * 15.2 kbps (SI kilo) for 20 ms frames
46 * 38 bytes / frame, 50 frames / sec
48 /* 13.33 kbps for 30 ms frames */
49 #define ILBC_BITRATE_20 15200
50 /* 8000 Hz * 8 bits/sample */
51 #define PCMA_BITRATE 64000
52 #define PCMU_BITRATE 64000
54 #define GST_TYPE_PCMA "audio/x-alaw"
55 #define GST_TYPE_PCMU "audio/x-mulaw"
56 #define GST_TYPE_PCM "audio/x-raw-int"
60 #define PCM_ENDIANNESS 1234
81 /* TODO: this kind of struct might be more handy when passing around audioformat info */
83 struct _AudioFormatSpec
96 typedef struct _AudioFormatSpec AudioFormatSpec;
105 typedef struct _mainViewStr
108 GtkWidget *fileNameEntry;
109 GtkWidget *lengthEntry;
110 GtkWidget *stateEntry;
111 GtkObject *adjustment;
115 typedef struct _AppDataStr
118 HildonWindow *mainView;
120 mainViewStr mainViewData;
122 /* gstreamer components */
123 GstElement *pipeline;
124 GstElement *recPipeline;
125 GstElement *playPipeline;
127 gint playPipelineType;
129 osso_context_t *osso;
131 gchar * openFileName;
132 gchar * saveFileName;
135 AudioFormat filter; /* selected recording format */
136 AudioFormat file_format; /* format of the recorded file or file currently open */
138 GtkWidget* radio_pcma;
139 GtkWidget* radio_ilbc;
140 GtkWidget* radio_pcm;
141 GtkWidget* radiotype;
144 GtkWidget *buttonSave;
145 GtkWidget *buttonSaveAs;
146 GtkWidget *buttonPlay;
147 GtkWidget *buttonRec;
149 struct timeval recStartTv; /* timeval when recording started */
150 guint recUpdateId; /* g_source_id for rec update timeout func */
151 gchar *mimeURI; /* uri to open via mime cb */
155 void setAppState(AppData *app, AppState state);
156 AppState getAppState(AppData *app);
159 AudioFormatSpec * audio_format_spec_new(void);
160 void audio_format_spec_free(AudioFormatSpec *af);
163 #endif /* _MAEMO_RECORDER_H_ */