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
52dd030087
commit
ab60c31629
@ -68,6 +68,7 @@ struct _ShellRecorder {
|
|||||||
|
|
||||||
CoglHandle recording_icon; /* icon shown while playing */
|
CoglHandle recording_icon; /* icon shown while playing */
|
||||||
|
|
||||||
|
gboolean draw_cursor;
|
||||||
cairo_surface_t *cursor_image;
|
cairo_surface_t *cursor_image;
|
||||||
int cursor_hot_x;
|
int cursor_hot_x;
|
||||||
int cursor_hot_y;
|
int cursor_hot_y;
|
||||||
@ -112,6 +113,8 @@ static void recorder_set_pipeline (ShellRecorder *recorder,
|
|||||||
const char *pipeline);
|
const char *pipeline);
|
||||||
static void recorder_set_file_template (ShellRecorder *recorder,
|
static void recorder_set_file_template (ShellRecorder *recorder,
|
||||||
const char *file_template);
|
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_set_caps (RecorderPipeline *pipeline);
|
||||||
static void recorder_pipeline_closed (RecorderPipeline *pipeline);
|
static void recorder_pipeline_closed (RecorderPipeline *pipeline);
|
||||||
@ -121,7 +124,8 @@ enum {
|
|||||||
PROP_STAGE,
|
PROP_STAGE,
|
||||||
PROP_FRAMERATE,
|
PROP_FRAMERATE,
|
||||||
PROP_PIPELINE,
|
PROP_PIPELINE,
|
||||||
PROP_FILE_TEMPLATE
|
PROP_FILE_TEMPLATE,
|
||||||
|
PROP_DRAW_CURSOR
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(ShellRecorder, shell_recorder, G_TYPE_OBJECT);
|
G_DEFINE_TYPE(ShellRecorder, shell_recorder, G_TYPE_OBJECT);
|
||||||
@ -275,6 +279,7 @@ shell_recorder_init (ShellRecorder *recorder)
|
|||||||
|
|
||||||
recorder->state = RECORDER_STATE_CLOSED;
|
recorder->state = RECORDER_STATE_CLOSED;
|
||||||
recorder->framerate = DEFAULT_FRAMES_PER_SECOND;
|
recorder->framerate = DEFAULT_FRAMES_PER_SECOND;
|
||||||
|
recorder->draw_cursor = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -575,7 +580,8 @@ recorder_record_frame (ShellRecorder *recorder)
|
|||||||
|
|
||||||
GST_BUFFER_PTS(buffer) = now - recorder->start_time;
|
GST_BUFFER_PTS(buffer) = now - recorder->start_time;
|
||||||
|
|
||||||
recorder_draw_cursor (recorder, buffer);
|
if (recorder->draw_cursor)
|
||||||
|
recorder_draw_cursor (recorder, buffer);
|
||||||
|
|
||||||
shell_recorder_src_add_buffer (SHELL_RECORDER_SRC (recorder->current_pipeline->src), buffer);
|
shell_recorder_src_add_buffer (SHELL_RECORDER_SRC (recorder->current_pipeline->src), buffer);
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
@ -1017,6 +1023,18 @@ recorder_set_file_template (ShellRecorder *recorder,
|
|||||||
g_object_notify (G_OBJECT (recorder), "file-template");
|
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
|
static void
|
||||||
shell_recorder_set_property (GObject *object,
|
shell_recorder_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -1039,6 +1057,9 @@ shell_recorder_set_property (GObject *object,
|
|||||||
case PROP_FILE_TEMPLATE:
|
case PROP_FILE_TEMPLATE:
|
||||||
recorder_set_file_template (recorder, g_value_get_string (value));
|
recorder_set_file_template (recorder, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_DRAW_CURSOR:
|
||||||
|
recorder_set_draw_cursor (recorder, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -1067,6 +1088,9 @@ shell_recorder_get_property (GObject *object,
|
|||||||
case PROP_FILE_TEMPLATE:
|
case PROP_FILE_TEMPLATE:
|
||||||
g_value_set_string (value, recorder->file_template);
|
g_value_set_string (value, recorder->file_template);
|
||||||
break;
|
break;
|
||||||
|
case PROP_DRAW_CURSOR:
|
||||||
|
g_value_set_boolean (value, recorder->draw_cursor);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -1115,6 +1139,14 @@ shell_recorder_class_init (ShellRecorderClass *klass)
|
|||||||
"The filename template to use for output files",
|
"The filename template to use for output files",
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_READWRITE));
|
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
|
/* 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:
|
* shell_recorder_set_pipeline:
|
||||||
* @recorder: the #ShellRecorder
|
* @recorder: the #ShellRecorder
|
||||||
|
@ -36,6 +36,8 @@ void shell_recorder_set_file_template (ShellRecorder *recorder,
|
|||||||
const char *file_template);
|
const char *file_template);
|
||||||
void shell_recorder_set_pipeline (ShellRecorder *recorder,
|
void shell_recorder_set_pipeline (ShellRecorder *recorder,
|
||||||
const char *pipeline);
|
const char *pipeline);
|
||||||
|
void shell_recorder_set_draw_cursor (ShellRecorder *recorder,
|
||||||
|
gboolean draw_cursor);
|
||||||
void shell_recorder_set_area (ShellRecorder *recorder,
|
void shell_recorder_set_area (ShellRecorder *recorder,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
|
Loading…
Reference in New Issue
Block a user