shell-recorder: Remove the ability to pause the timeline

https://bugzilla.gnome.org/show_bug.cgi?id=677434
This commit is contained in:
Jasper St. Pierre 2012-06-04 19:32:06 -04:00
parent 11ce6845f2
commit f0474ffccc

View File

@ -20,7 +20,6 @@
typedef enum { typedef enum {
RECORDER_STATE_CLOSED, RECORDER_STATE_CLOSED,
RECORDER_STATE_PAUSED,
RECORDER_STATE_RECORDING RECORDER_STATE_RECORDING
} RecorderState; } RecorderState;
@ -74,9 +73,8 @@ struct _ShellRecorder {
RecorderPipeline *current_pipeline; /* current pipeline */ RecorderPipeline *current_pipeline; /* current pipeline */
GSList *pipelines; /* all pipelines */ GSList *pipelines; /* all pipelines */
GstClockTime start_time; /* When we started recording (adjusted for pauses) */ GstClockTime start_time; /* When we started recording */
GstClockTime last_frame_time; /* Timestamp for the last frame */ GstClockTime last_frame_time; /* Timestamp for the last frame */
GstClockTime pause_time; /* When the pipeline was paused */
/* GSource IDs for different timeouts and idles */ /* GSource IDs for different timeouts and idles */
guint redraw_timeout; guint redraw_timeout;
@ -1615,8 +1613,7 @@ shell_recorder_set_pipeline (ShellRecorder *recorder,
* shell_recorder_record: * shell_recorder_record:
* @recorder: the #ShellRecorder * @recorder: the #ShellRecorder
* *
* Starts recording, or continues a recording that was previously * Starts recording, Starting the recording may fail if the output file
* paused. Starting the recording may fail if the output file
* cannot be opened, or if the output stream cannot be created * cannot be opened, or if the output stream cannot be created
* for other reasons. In that case a warning is printed to * for other reasons. In that case a warning is printed to
* stderr. There is no way currently to get details on how * stderr. There is no way currently to get details on how
@ -1637,22 +1634,11 @@ shell_recorder_record (ShellRecorder *recorder)
g_return_val_if_fail (recorder->stage != NULL, FALSE); g_return_val_if_fail (recorder->stage != NULL, FALSE);
g_return_val_if_fail (recorder->state != RECORDER_STATE_RECORDING, FALSE); g_return_val_if_fail (recorder->state != RECORDER_STATE_RECORDING, FALSE);
if (recorder->current_pipeline) if (!recorder_open_pipeline (recorder))
{ return FALSE;
/* Adjust the start time so that the times in the stream ignore the
* pause
*/
recorder->start_time = recorder->start_time + (get_wall_time() - recorder->pause_time);
recorder->last_frame_time = 0;
}
else
{
if (!recorder_open_pipeline (recorder))
return FALSE;
recorder->start_time = get_wall_time(); recorder->start_time = get_wall_time();
recorder->last_frame_time = 0; recorder->last_frame_time = 0;
}
recorder->state = RECORDER_STATE_RECORDING; recorder->state = RECORDER_STATE_RECORDING;
recorder_add_update_pointer_timeout (recorder); recorder_add_update_pointer_timeout (recorder);
@ -1671,44 +1657,6 @@ shell_recorder_record (ShellRecorder *recorder)
return TRUE; return TRUE;
} }
/**
* shell_recorder_pause:
* @recorder: the #ShellRecorder
*
* Temporarily stop recording. If the specified filename includes
* the %c escape, then the stream is closed and a new stream with
* an incremented counter will be created. Otherwise the stream
* is paused and will be continued when shell_recorder_record()
* is next called.
*/
void
shell_recorder_pause (ShellRecorder *recorder)
{
g_return_if_fail (SHELL_IS_RECORDER (recorder));
g_return_if_fail (recorder->state == RECORDER_STATE_RECORDING);
recorder_remove_update_pointer_timeout (recorder);
/* We want to record one more frame since some time may have
* elapsed since the last frame
*/
clutter_actor_paint (CLUTTER_ACTOR (recorder->stage));
if (recorder->filename_has_count)
recorder_close_pipeline (recorder);
recorder->state = RECORDER_STATE_PAUSED;
recorder->pause_time = get_wall_time();
/* Queue a redraw to remove the recording indicator */
clutter_actor_queue_redraw (CLUTTER_ACTOR (recorder->stage));
if (recorder->repaint_hook_id != 0)
{
clutter_threads_remove_repaint_func (recorder->repaint_hook_id);
recorder->repaint_hook_id = 0;
}
}
/** /**
* shell_recorder_close: * shell_recorder_close:
* @recorder: the #ShellRecorder * @recorder: the #ShellRecorder
@ -1724,10 +1672,23 @@ shell_recorder_close (ShellRecorder *recorder)
g_return_if_fail (SHELL_IS_RECORDER (recorder)); g_return_if_fail (SHELL_IS_RECORDER (recorder));
g_return_if_fail (recorder->state != RECORDER_STATE_CLOSED); g_return_if_fail (recorder->state != RECORDER_STATE_CLOSED);
if (recorder->state == RECORDER_STATE_RECORDING) /* We want to record one more frame since some time may have
shell_recorder_pause (recorder); * elapsed since the last frame
*/
clutter_actor_paint (CLUTTER_ACTOR (recorder->stage));
recorder_remove_update_pointer_timeout (recorder); recorder_remove_update_pointer_timeout (recorder);
recorder_close_pipeline (recorder);
/* Queue a redraw to remove the recording indicator */
clutter_actor_queue_redraw (CLUTTER_ACTOR (recorder->stage));
if (recorder->repaint_hook_id != 0)
{
clutter_threads_remove_repaint_func (recorder->repaint_hook_id);
recorder->repaint_hook_id = 0;
}
recorder_remove_redraw_timeout (recorder); recorder_remove_redraw_timeout (recorder);
recorder_close_pipeline (recorder); recorder_close_pipeline (recorder);