shell-recorder: Make drawing the cursor optional
As with screenshots, showing the cursor in a recording may not be desirable, so add a property to control whether the cursor is drawn or not. https://bugzilla.gnome.org/show_bug.cgi?id=696247
This commit is contained in:
parent
c61573a8b7
commit
dc3082e66d
@ -68,6 +68,7 @@ struct _ShellRecorder {
|
||||
|
||||
CoglHandle recording_icon; /* icon shown while playing */
|
||||
|
||||
gboolean draw_cursor;
|
||||
cairo_surface_t *cursor_image;
|
||||
int cursor_hot_x;
|
||||
int cursor_hot_y;
|
||||
@ -112,6 +113,8 @@ static void recorder_set_pipeline (ShellRecorder *recorder,
|
||||
const char *pipeline);
|
||||
static void recorder_set_file_template (ShellRecorder *recorder,
|
||||
const char *file_template);
|
||||
static void recorder_set_draw_cursor (ShellRecorder *recorder,
|
||||
gboolean draw_cursor);
|
||||
|
||||
static void recorder_pipeline_set_caps (RecorderPipeline *pipeline);
|
||||
static void recorder_pipeline_closed (RecorderPipeline *pipeline);
|
||||
@ -121,7 +124,8 @@ enum {
|
||||
PROP_STAGE,
|
||||
PROP_FRAMERATE,
|
||||
PROP_PIPELINE,
|
||||
PROP_FILE_TEMPLATE
|
||||
PROP_FILE_TEMPLATE,
|
||||
PROP_DRAW_CURSOR
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(ShellRecorder, shell_recorder, G_TYPE_OBJECT);
|
||||
@ -275,6 +279,7 @@ shell_recorder_init (ShellRecorder *recorder)
|
||||
|
||||
recorder->state = RECORDER_STATE_CLOSED;
|
||||
recorder->framerate = DEFAULT_FRAMES_PER_SECOND;
|
||||
recorder->draw_cursor = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -575,6 +580,7 @@ recorder_record_frame (ShellRecorder *recorder)
|
||||
|
||||
GST_BUFFER_PTS(buffer) = now - recorder->start_time;
|
||||
|
||||
if (recorder->draw_cursor)
|
||||
recorder_draw_cursor (recorder, buffer);
|
||||
|
||||
shell_recorder_src_add_buffer (SHELL_RECORDER_SRC (recorder->current_pipeline->src), buffer);
|
||||
@ -1017,6 +1023,18 @@ recorder_set_file_template (ShellRecorder *recorder,
|
||||
g_object_notify (G_OBJECT (recorder), "file-template");
|
||||
}
|
||||
|
||||
static void
|
||||
recorder_set_draw_cursor (ShellRecorder *recorder,
|
||||
gboolean draw_cursor)
|
||||
{
|
||||
if (draw_cursor == recorder->draw_cursor)
|
||||
return;
|
||||
|
||||
recorder->draw_cursor = draw_cursor;
|
||||
|
||||
g_object_notify (G_OBJECT (recorder), "draw-cursor");
|
||||
}
|
||||
|
||||
static void
|
||||
shell_recorder_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -1039,6 +1057,9 @@ shell_recorder_set_property (GObject *object,
|
||||
case PROP_FILE_TEMPLATE:
|
||||
recorder_set_file_template (recorder, g_value_get_string (value));
|
||||
break;
|
||||
case PROP_DRAW_CURSOR:
|
||||
recorder_set_draw_cursor (recorder, g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1067,6 +1088,9 @@ shell_recorder_get_property (GObject *object,
|
||||
case PROP_FILE_TEMPLATE:
|
||||
g_value_set_string (value, recorder->file_template);
|
||||
break;
|
||||
case PROP_DRAW_CURSOR:
|
||||
g_value_set_boolean (value, recorder->draw_cursor);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1115,6 +1139,14 @@ shell_recorder_class_init (ShellRecorderClass *klass)
|
||||
"The filename template to use for output files",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DRAW_CURSOR,
|
||||
g_param_spec_boolean ("draw-cursor",
|
||||
"Draw Cursor",
|
||||
"Whether to record the cursor",
|
||||
TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
/* Sets the GstCaps (video format, in this case) on the stream
|
||||
@ -1689,6 +1721,15 @@ shell_recorder_set_file_template (ShellRecorder *recorder,
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
shell_recorder_set_draw_cursor (ShellRecorder *recorder,
|
||||
gboolean draw_cursor)
|
||||
{
|
||||
g_return_if_fail (SHELL_IS_RECORDER (recorder));
|
||||
|
||||
recorder_set_draw_cursor (recorder, draw_cursor);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_recorder_set_pipeline:
|
||||
* @recorder: the #ShellRecorder
|
||||
|
@ -36,6 +36,8 @@ void shell_recorder_set_file_template (ShellRecorder *recorder,
|
||||
const char *file_template);
|
||||
void shell_recorder_set_pipeline (ShellRecorder *recorder,
|
||||
const char *pipeline);
|
||||
void shell_recorder_set_draw_cursor (ShellRecorder *recorder,
|
||||
gboolean draw_cursor);
|
||||
void shell_recorder_set_area (ShellRecorder *recorder,
|
||||
int x,
|
||||
int y,
|
||||
|
Loading…
Reference in New Issue
Block a user