22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
1 |
/*
|
1424
by Osmo Antero
Version 3.0.0 |
2 |
* Copyright (c) 2011- Osmo Antero.
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
3 |
*
|
4 |
* This library is free software; you can redistribute it and/or
|
|
5 |
* modify it under the terms of the GNU Library General Public
|
|
6 |
* License as published by the Free Software Foundation; either
|
|
239
by Osmo Antero
Moving to GPL3 license. All src/*.c should now comply to GPL3. |
7 |
* version 3 of the License (GPL3), or any later version.
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
8 |
*
|
9 |
* This library is distributed in the hope that it will be useful,
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
463
by Osmo Antero
Updated README and INSTALL files. |
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
239
by Osmo Antero
Moving to GPL3 license. All src/*.c should now comply to GPL3. |
12 |
* See the GNU Library General Public License 3 for more details.
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
13 |
*
|
14 |
* You should have received a copy of the GNU Library General Public
|
|
239
by Osmo Antero
Moving to GPL3 license. All src/*.c should now comply to GPL3. |
15 |
* License 3 along with this program; if not, see /usr/share/common-licenses/GPL file
|
1012.1.5
by David Rabel
GPL boilerplate updated in source files. |
16 |
* or <http://www.gnu.org/licenses/>.
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
17 |
*/
|
18 |
#include "rec-window.h" |
|
19 |
#include "rec-manager.h" |
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
20 |
#include "rec-manager-struct.h" |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
21 |
#include "log.h" |
69
by Osmo Antero
Ported this application to GTK/GDK 3. Using now GSettings (and dconf) instead of GConf2 |
22 |
#include "dconf.h" |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
23 |
#include "utility.h" |
24 |
#include "support.h" |
|
25 |
#include "gst-recorder.h" |
|
3
by Osmo Antero Maatta
Updated some filenames and traslations |
26 |
#include "dbus-player.h" |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
27 |
|
28 |
// Command queue
|
|
29 |
static GAsyncQueue *g_cmd_queue = NULL; |
|
30 |
||
31
by Osmo Antero Maatta
Timer commands are no longer translatable. Timer commands must be in English language. |
31 |
// Last used/saved command
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
32 |
static RecorderCommand *g_last_rec_cmd = NULL; |
33 |
||
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
34 |
// Message thread
|
35 |
static guint g_thread_id = 0; |
|
36 |
||
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
37 |
static void rec_manager_free_command(RecorderCommand *cmd); |
38 |
||
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
39 |
static gboolean rec_manager_command_thread(gpointer user_data); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
40 |
|
41 |
void rec_manager_init() { |
|
42 |
LOG_DEBUG("Init rec-manager.c.\n"); |
|
43 |
||
44 |
// Create a message queue
|
|
1012.1.4
by David Rabel
Replaced http by https wherever it was reasonable. Also replaced some broken links and link that where only redirecting. |
45 |
// Ref: https://www.gtk.org/api/2.6/glib/glib-Asynchronous-Queues.html
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
46 |
g_cmd_queue = g_async_queue_new(); |
47 |
||
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
48 |
// Message thread within GTK's main loop
|
1012.1.4
by David Rabel
Replaced http by https wherever it was reasonable. Also replaced some broken links and link that where only redirecting. |
49 |
// Ref: https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
50 |
g_thread_id = g_timeout_add_full(G_PRIORITY_DEFAULT, 200, rec_manager_command_thread, NULL, NULL); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
51 |
|
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
52 |
// Init recorder.c
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
53 |
rec_module_init(); |
54 |
}
|
|
55 |
||
56 |
void rec_manager_exit() { |
|
57 |
LOG_DEBUG("Clean up rec-manager.c.\n"); |
|
58 |
||
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
59 |
// Clean up recorder.c
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
60 |
rec_module_exit(); |
61 |
||
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
62 |
// Remove command thread
|
63 |
g_source_remove(g_thread_id); |
|
64 |
g_thread_id = 0; |
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
65 |
|
66 |
// Unref message queue
|
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
67 |
if (g_cmd_queue) { |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
68 |
g_async_queue_unref(g_cmd_queue); |
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
69 |
}
|
70 |
g_cmd_queue = NULL; |
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
71 |
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
72 |
// Free g_last_rec_cmd
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
73 |
rec_manager_free_command(g_last_rec_cmd); |
74 |
g_last_rec_cmd = NULL; |
|
75 |
}
|
|
76 |
||
77 |
void rec_manager_print_command(RecorderCommand *cmd) { |
|
78 |
if (!cmd) return; |
|
79 |
||
56
by Osmo Antero
Version 0.5 |
80 |
const gchar *type_str = NULL; |
81 |
||
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
82 |
switch (cmd->type) { |
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
83 |
case RECORDING_STOP: |
84 |
type_str = "RECORDING_STOP"; |
|
85 |
break; |
|
86 |
||
189
by osmoma at gmail
Replaced all GTK3's deprecated methods with new syntax. |
87 |
case RECORDING_CONTINUE: |
88 |
type_str = "RECORDING_CONTINUE"; |
|
89 |
break; |
|
90 |
||
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
91 |
case RECORDING_START: |
92 |
type_str = "RECORDING_START"; |
|
93 |
break; |
|
94 |
||
95 |
case RECORDING_PAUSE: |
|
96 |
type_str = "RECORDING_PAUSE"; |
|
97 |
break; |
|
98 |
||
99 |
case RECORDING_NOTIFY_MSG: |
|
100 |
type_str = "RECORDING_NOTIFY_MSG"; |
|
101 |
break; |
|
102 |
||
404
by Osmo Antero
Removed dependency to libpulse-dev. Using now Gstreamer to get the device list. Completed src/win-settings-pipe.[ch] module. |
103 |
case RECORDING_DEVICE_CHANGED: |
104 |
type_str = "RECORDING_DEVICE_CHANGED"; |
|
105 |
break; |
|
106 |
||
407
by Osmo Antero
Code cleanup. |
107 |
case RECORDING_PROFILE_CHANGED: |
108 |
type_str = "RECORDING_PROFILE_CHANGED"; |
|
109 |
break; |
|
110 |
||
56
by Osmo Antero
Version 0.5 |
111 |
case RECORDING_SHOW_WINDOW: |
112 |
type_str = "RECORDING_SHOW_WINDOW"; |
|
113 |
break; |
|
114 |
||
115 |
case RECORDING_HIDE_WINDOW: |
|
116 |
type_str = "RECORDING_HIDE_WINDOW"; |
|
117 |
break; |
|
118 |
||
119 |
case RECORDING_QUIT_LOOP: |
|
120 |
type_str = "RECORDING_QUIT_LOOP"; |
|
121 |
break; |
|
122 |
||
123 |
case RECORDING_QUIT_APP: |
|
124 |
type_str = "RECORDING_QUIT_APP"; |
|
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
125 |
break; |
126 |
||
127 |
default: |
|
128 |
type_str = "Unknown recording command"; |
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
129 |
}
|
130 |
||
62
by Osmo Antero
The recorder now obeys commands from Banshee Player. |
131 |
// Suppress "not used" message
|
69
by Osmo Antero
Ported this application to GTK/GDK 3. Using now GSettings (and dconf) instead of GConf2 |
132 |
if (type_str) { |
133 |
;
|
|
134 |
}
|
|
56
by Osmo Antero
Version 0.5 |
135 |
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
136 |
if (cmd->type != RECORDING_NOTIFY_MSG) { |
1409
by Osmo Antero
Fix in rec_stop_recording(...) to avoid possible blockage. |
137 |
LOG_DEBUG("%s: %s, %s, %s, time=%d/%d flags=%d\n", type_str, cmd->trackId, cmd->artist, cmd->album, cmd->trackPos, cmd->trackLength, cmd->flags); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
138 |
} else { |
1409
by Osmo Antero
Fix in rec_stop_recording(...) to avoid possible blockage. |
139 |
LOG_DEBUG("%s: %s\n", type_str, cmd->trackId); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
140 |
}
|
141 |
}
|
|
142 |
||
143 |
gint64 rec_manager_get_stream_time() { |
|
144 |
// Get and return current recording time (stream time) in seconds.
|
|
145 |
return rec_get_stream_time(); |
|
146 |
}
|
|
147 |
||
148 |
void rec_manager_update_gui() { |
|
149 |
// Update GUI to reflect the status of recording
|
|
150 |
win_update_gui(); |
|
151 |
}
|
|
152 |
||
198
by osmoma at gmail
Moving to Gstreamer 1.0 + other small changes. |
153 |
void rec_manager_update_level_bar(gdouble norm_rms, gdouble norm_peak) { |
154 |
// Update gtklevelbar
|
|
155 |
win_update_level_bar(norm_rms, norm_peak); |
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
156 |
}
|
157 |
||
7
by Osmo Antero Maatta
Improved timer commands |
158 |
const gchar *rec_manager_get_state_name(gint state) { |
159 |
// Return name of the recording state, state of pipeline.
|
|
1423
by Osmo Antero
Fix problem with duplicate messages from media players. |
160 |
return rec_get_state_name(state); |
161 |
||
7
by Osmo Antero Maatta
Improved timer commands |
162 |
}
|
163 |
||
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
164 |
void rec_manager_flip_recording() { |
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
165 |
// Start, continue or stop recording
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
166 |
|
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
167 |
// Get recording status
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
168 |
gint old_status = -1; |
169 |
gint pending = -1; |
|
170 |
rec_manager_get_state(&old_status, &pending); |
|
171 |
||
172 |
switch (old_status) { |
|
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
173 |
case GST_STATE_PAUSED: |
174 |
// Continue recording
|
|
175 |
rec_manager_continue_recording(); |
|
176 |
break; |
|
177 |
||
178 |
case GST_STATE_PLAYING: |
|
179 |
// Stop recording
|
|
180 |
rec_manager_stop_recording(); |
|
181 |
break; |
|
182 |
||
183 |
default: |
|
470.2.7
by Osmo Antero
Fixed bug with long filenames. |
184 |
// Start recording
|
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
185 |
rec_manager_start_recording(); |
186 |
}
|
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
187 |
}
|
188 |
||
189 |
void rec_manager_set_filename_label(gchar *filename) { |
|
190 |
// Set filename label
|
|
191 |
win_set_filename(filename); |
|
192 |
}
|
|
193 |
||
194 |
void rec_manager_set_time_label(gchar *label_txt) { |
|
195 |
// Set time label
|
|
196 |
win_set_time_label(label_txt); |
|
197 |
}
|
|
198 |
||
199 |
void rec_manager_set_size_label(gchar *label_txt) { |
|
200 |
// Set file size label
|
|
201 |
win_set_size_label(label_txt); |
|
202 |
}
|
|
203 |
||
204 |
void rec_manager_set_error_text(gchar *error_txt) { |
|
205 |
// Set error label
|
|
206 |
win_set_error_text(error_txt); |
|
207 |
}
|
|
208 |
||
209 |
void rec_manager_get_state(gint *status, gint *pending) { |
|
210 |
// Return recording status
|
|
211 |
rec_get_state(status, pending); |
|
212 |
}
|
|
213 |
||
214 |
gchar *rec_manager_get_output_filename() { |
|
215 |
// Return output filename
|
|
216 |
return rec_get_output_filename(); |
|
217 |
}
|
|
218 |
||
56
by Osmo Antero
Version 0.5 |
219 |
void rec_manager_show_window(gboolean show) { |
220 |
// Show or hide application window
|
|
221 |
||
222 |
if (show) |
|
223 |
// Send RECORDING_SHOW_WINDOW message to the queue
|
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
224 |
rec_manager_send_command_ex(RECORDING_SHOW_WINDOW, NULL, 0); |
56
by Osmo Antero
Version 0.5 |
225 |
else
|
226 |
// Send RECORDING_HIDE_WINDOW message to the queue
|
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
227 |
rec_manager_send_command_ex(RECORDING_HIDE_WINDOW, NULL, 0); |
56
by Osmo Antero
Version 0.5 |
228 |
}
|
229 |
||
230 |
void rec_manager_quit_application() { |
|
231 |
// Quit application
|
|
232 |
||
233 |
// Send RECORDING_QUIT_APP message to the queue
|
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
234 |
rec_manager_send_command_ex(RECORDING_QUIT_APP, NULL, 0); |
56
by Osmo Antero
Version 0.5 |
235 |
}
|
236 |
||
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
237 |
void rec_manager_start_recording() { |
238 |
// Start recording
|
|
239 |
||
240 |
// Send RECORDING_START message to the queue
|
|
241 |
// The filename will be auto-generated because the track name is NULL.
|
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
242 |
rec_manager_send_command_ex(RECORDING_START, NULL, 0); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
243 |
}
|
244 |
||
245 |
void rec_manager_stop_recording() { |
|
246 |
// Stop recording
|
|
247 |
||
1423
by Osmo Antero
Fix problem with duplicate messages from media players. |
248 |
// First we must reset the lastly recorded track data.
|
249 |
// Otherwise next PLAY/CONTINUE message from media-player will be understood as duplicate and dropped.
|
|
250 |
// We could let the recorder do this work in its own stop routines, BUT IT WILL NOT work right. WHY?
|
|
1424
by Osmo Antero
Version 3.0.0 |
251 |
// Because the message queue (g_cmd_queue) is asynchronous, AND IT TAKES TIME for the messages pass through.
|
252 |
// During that time, media-player can have sent several new messages. We must be quicker !
|
|
1423
by Osmo Antero
Fix problem with duplicate messages from media players. |
253 |
//
|
1424
by Osmo Antero
Version 3.0.0 |
254 |
// Also rec_manager_stop_recording() is acalled from many places, like the Gtk menu, start/stop Button, from media players.
|
1423
by Osmo Antero
Fix problem with duplicate messages from media players. |
255 |
//
|
256 |
gchar *audio_source = NULL; |
|
257 |
conf_get_string_value("audio-device-id", &audio_source); |
|
258 |
||
259 |
// Reset last track data (that we received from media player)
|
|
260 |
dbus_player_reset_values(audio_source); |
|
261 |
||
262 |
g_free(audio_source); |
|
263 |
||
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
264 |
// Send RECORDING_STOP message to the queue
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
265 |
rec_manager_send_command_ex(RECORDING_STOP, NULL, 0); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
266 |
}
|
267 |
||
268 |
void rec_manager_continue_recording() { |
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
269 |
// Send RECORDING_CONTINUE message to the queue (Continues paused recording. This does not start if recording is off)
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
270 |
rec_manager_send_command_ex(RECORDING_CONTINUE, NULL, 0); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
271 |
}
|
272 |
||
273 |
void rec_manager_pause_recording() { |
|
274 |
// Pause recording
|
|
275 |
||
276 |
// Send RECORDING_PAUSE message to the queue
|
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
277 |
rec_manager_send_command_ex(RECORDING_PAUSE, NULL, 0); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
278 |
}
|
279 |
||
280 |
gboolean rec_manager_is_recording() { |
|
281 |
// Is recording?
|
|
282 |
return rec_is_recording(); |
|
283 |
}
|
|
284 |
||
1423
by Osmo Antero
Fix problem with duplicate messages from media players. |
285 |
gboolean rec_manager_is_paused() { |
286 |
// Is paused?
|
|
287 |
return rec_is_paused(); |
|
288 |
}
|
|
289 |
||
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
290 |
void rec_manager_send_gui_msg(gchar *msg) { |
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
291 |
// Display a message in the GUI (normally a red label in the GUI)
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
292 |
|
293 |
// Send RECORDING_NOTIFY_MSG to the queue
|
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
294 |
rec_manager_send_command_ex(RECORDING_NOTIFY_MSG, msg/*the msg*/, 0); |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
295 |
}
|
296 |
||
297 |
static void rec_manager_free_command(RecorderCommand *cmd) { |
|
298 |
// Free command
|
|
299 |
if (!cmd) return; |
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
300 |
|
301 |
g_free(cmd->title); |
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
302 |
g_free(cmd->artist); |
303 |
g_free(cmd->album); |
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
304 |
g_free(cmd->genre); |
305 |
g_free(cmd->albumArtist); |
|
306 |
g_free(cmd->url); |
|
307 |
g_free(cmd->artUrl); |
|
308 |
g_free(cmd->trackId); |
|
309 |
||
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
310 |
g_free(cmd); |
311 |
}
|
|
312 |
||
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
313 |
void rec_manager_send_command_ex(enum CommandType type, gchar *txt, guint flags) { |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
314 |
// Build the command
|
315 |
RecorderCommand *cmd = g_malloc0(sizeof(RecorderCommand)); |
|
316 |
cmd->type = type; |
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
317 |
cmd->title = g_strdup(txt); // Convey msg or txt in the "title" field. |
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
318 |
cmd->flags = flags; |
319 |
||
1423
by Osmo Antero
Fix problem with duplicate messages from media players. |
320 |
// Send the command. The queue will free the cmd after usage.
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
321 |
rec_manager_send_command(cmd); |
322 |
}
|
|
323 |
||
324 |
void rec_manager_send_command(RecorderCommand *cmd) { |
|
189
by osmoma at gmail
Replaced all GTK3's deprecated methods with new syntax. |
325 |
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
326 |
// Push command to the queue
|
327 |
g_async_queue_push(g_cmd_queue, (gpointer)cmd); |
|
328 |
}
|
|
329 |
||
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
330 |
gboolean rec_manager_command_thread(gpointer user_data) { |
331 |
// Read next command from the queue
|
|
332 |
RecorderCommand *cmd = (RecorderCommand*)g_async_queue_try_pop(g_cmd_queue); |
|
333 |
if (!cmd) { |
|
334 |
// TRUE: Continue calling this function
|
|
335 |
return TRUE; |
|
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
336 |
}
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
337 |
|
338 |
// Debug print
|
|
216
by osmoma at gmail
Making Totem movie player to behave nicely with recorder (a hack). |
339 |
#if defined(ACTIVE_DEBUGGING) || defined(DEBUG_ALL)
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
340 |
rec_manager_print_command(cmd); |
22
by Osmo Antero Maatta
Formatted the code using astyle. See README for instructions. |
341 |
#endif
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
342 |
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
343 |
if (cmd->type == RECORDING_START) { |
1423
by Osmo Antero
Fix problem with duplicate messages from media players. |
344 |
// Save the values in Gsettings so gst-recorder.c can grab
|
345 |
// Please see: data/org.gnome.audio-recorder.gschema.xml
|
|
346 |
conf_save_string_value("track/track-title", check_null(cmd->title)); |
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
347 |
conf_save_int_value("track/track-pos", cmd->trackPos); |
348 |
conf_save_int_value("track/track-len", cmd->trackLength); |
|
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
349 |
conf_save_string_value("track/artist-name", check_null(cmd->artist)); |
350 |
conf_save_string_value("track/album-name", check_null(cmd->album)); |
|
1423
by Osmo Antero
Fix problem with duplicate messages from media players. |
351 |
conf_save_string_value("track/url", check_null(cmd->url)); |
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
352 |
}
|
353 |
||
354 |
// Verify the delete flag and filename
|
|
355 |
gboolean del_flag = FALSE; |
|
356 |
if (cmd->flags == RECORDING_DELETE_FILE) { |
|
357 |
gchar *filename = NULL; |
|
216
by osmoma at gmail
Making Totem movie player to behave nicely with recorder (a hack). |
358 |
conf_get_string_value("track/last-file-name", &filename); |
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
359 |
|
360 |
// Remove path and file extension
|
|
361 |
gchar *path=NULL; |
|
362 |
gchar *base = NULL; |
|
363 |
gchar *ext = NULL; |
|
364 |
split_filename3(filename, &path, &base, &ext); |
|
365 |
||
366 |
// Filenames do match?
|
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
367 |
del_flag = (filename && !g_strcmp0(base, cmd->title)); |
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
368 |
|
369 |
g_free(path); |
|
370 |
g_free(base); |
|
371 |
g_free(ext); |
|
372 |
g_free(filename); |
|
373 |
}
|
|
374 |
||
375 |
switch (cmd->type) { |
|
376 |
case RECORDING_STOP: |
|
377 |
rec_stop_recording(del_flag/*delete file?*/); |
|
378 |
break; |
|
379 |
||
380 |
case RECORDING_START: |
|
381 |
rec_start_recording(); |
|
382 |
break; |
|
383 |
||
384 |
case RECORDING_PAUSE: |
|
385 |
rec_pause_recording(); |
|
386 |
break; |
|
387 |
||
388 |
case RECORDING_CONTINUE: |
|
389 |
rec_continue_recording(); |
|
390 |
break; |
|
391 |
||
392 |
case RECORDING_NOTIFY_MSG: |
|
1268
by Osmo Antero
(work in progress) Changing and adding better field names to support ID3 tagging better. |
393 |
win_set_error_text(cmd->title); |
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
394 |
break; |
395 |
||
404
by Osmo Antero
Removed dependency to libpulse-dev. Using now Gstreamer to get the device list. Completed src/win-settings-pipe.[ch] module. |
396 |
case RECORDING_DEVICE_CHANGED: |
397 |
win_refresh_device_list(); |
|
398 |
break; |
|
399 |
||
407
by Osmo Antero
Code cleanup. |
400 |
case RECORDING_PROFILE_CHANGED: |
401 |
win_refresh_profile_list(); |
|
402 |
break; |
|
403 |
||
173
by Osmo Antero
Support new systems; Ubuntu 12.10, Fedora 18. Improved timer and VAD-modules. Better gst-pipeline. |
404 |
case RECORDING_SHOW_WINDOW: |
405 |
win_show_window(TRUE); |
|
406 |
break; |
|
407 |
||
408 |
case RECORDING_HIDE_WINDOW: |
|
409 |
win_show_window(FALSE); |
|
410 |
break; |
|
411 |
||
412 |
case RECORDING_QUIT_LOOP: |
|
413 |
rec_stop_recording(FALSE); |
|
414 |
break; |
|
415 |
||
416 |
case RECORDING_QUIT_APP: |
|
417 |
rec_stop_recording(FALSE); |
|
418 |
||
419 |
// Quit application
|
|
420 |
win_quit_application(); |
|
421 |
break; |
|
422 |
||
423 |
} // switch ... |
|
424 |
||
425 |
// Free the lastly saved command
|
|
426 |
rec_manager_free_command(g_last_rec_cmd); |
|
427 |
||
428 |
// Save this command
|
|
429 |
g_last_rec_cmd = cmd; |
|
430 |
||
431 |
// TRUE: Continue calling this function
|
|
432 |
return TRUE; |
|
1
by Osmo Antero Maatta
Initial import 17.jan.2011 |
433 |
}
|
434 |
||
435 |
||
436 |