From 98240c285751c045752fb59a794bda84f37cde0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 7 May 2013 00:11:57 +0200 Subject: [PATCH] shell-recorder: Optionally return the filename of the recording It is currently not always possible to predict the actual output filename of a recording - the file-template does not necessarily use an absolute path and may contain %d and %t escape sequences. This is OK for fire-and-forget uses like the existing keyboard shortcut, but we will soon expose the functionality on DBus and consumers of that API might very well need to access the file after the recording. So do the same as our screenshot API and add an optional (out) parameter to record(). https://bugzilla.gnome.org/show_bug.cgi?id=696247 --- src/shell-recorder.c | 7 ++++++- src/shell-recorder.h | 3 ++- src/test-recorder.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/shell-recorder.c b/src/shell-recorder.c index 449590caf..aaf585b15 100644 --- a/src/shell-recorder.c +++ b/src/shell-recorder.c @@ -1708,6 +1708,7 @@ shell_recorder_set_pipeline (ShellRecorder *recorder, /** * shell_recorder_record: * @recorder: the #ShellRecorder + * @filename_used: (out) (allow-none): actual filename used for recording * * Starts recording, Starting the recording may fail if the output file * cannot be opened, or if the output stream cannot be created @@ -1724,7 +1725,8 @@ shell_recorder_set_pipeline (ShellRecorder *recorder, * Return value: %TRUE if recording was succesfully started */ gboolean -shell_recorder_record (ShellRecorder *recorder) +shell_recorder_record (ShellRecorder *recorder, + char **filename_used) { g_return_val_if_fail (SHELL_IS_RECORDER (recorder), FALSE); g_return_val_if_fail (recorder->stage != NULL, FALSE); @@ -1733,6 +1735,9 @@ shell_recorder_record (ShellRecorder *recorder) if (!recorder_open_pipeline (recorder)) return FALSE; + if (filename_used) + *filename_used = g_strdup (recorder->current_pipeline->filename); + recorder_connect_stage_callbacks (recorder); recorder->start_time = get_wall_time(); diff --git a/src/shell-recorder.h b/src/shell-recorder.h index 9bff65774..a94d59c8f 100644 --- a/src/shell-recorder.h +++ b/src/shell-recorder.h @@ -36,7 +36,8 @@ void shell_recorder_set_file_template (ShellRecorder *recorder, const char *file_template); void shell_recorder_set_pipeline (ShellRecorder *recorder, const char *pipeline); -gboolean shell_recorder_record (ShellRecorder *recorder); +gboolean shell_recorder_record (ShellRecorder *recorder, + char **filename_used); void shell_recorder_close (ShellRecorder *recorder); void shell_recorder_pause (ShellRecorder *recorder); gboolean shell_recorder_is_recording (ShellRecorder *recorder); diff --git a/src/test-recorder.c b/src/test-recorder.c index 66f8baf0f..86f937942 100644 --- a/src/test-recorder.c +++ b/src/test-recorder.c @@ -48,7 +48,7 @@ on_stage_realized (ClutterActor *stage, { recorder = shell_recorder_new (CLUTTER_STAGE (stage)); shell_recorder_set_file_template (recorder, "test-recorder.webm"); - shell_recorder_record (recorder); + shell_recorder_record (recorder, NULL); } int main (int argc, char **argv)