recorder: rename "filename" property to "file-template"
The filename property is actually a template string with substitution variables, not a filename. This commit renames for clarity. https://bugzilla.gnome.org/show_bug.cgi?id=680647
This commit is contained in:
parent
92033ce0f5
commit
fbeb446ed7
@ -41,7 +41,7 @@ const Recorder = new Lang.Class({
|
|||||||
recorder.set_framerate(this._recorderSettings.get_int('framerate'));
|
recorder.set_framerate(this._recorderSettings.get_int('framerate'));
|
||||||
/* Translators: this is a filename used for screencast recording */
|
/* Translators: this is a filename used for screencast recording */
|
||||||
// xgettext:no-c-format
|
// xgettext:no-c-format
|
||||||
recorder.set_filename(_("Screencast from %d %t") + '.' + this._recorderSettings.get_string('file-extension'));
|
recorder.set_file_template(_("Screencast from %d %t") + '.' + this._recorderSettings.get_string('file-extension'));
|
||||||
let pipeline = this._recorderSettings.get_string('pipeline');
|
let pipeline = this._recorderSettings.get_string('pipeline');
|
||||||
|
|
||||||
if (!pipeline.match(/^\s*$/))
|
if (!pipeline.match(/^\s*$/))
|
||||||
|
@ -65,7 +65,7 @@ struct _ShellRecorder {
|
|||||||
|
|
||||||
int framerate;
|
int framerate;
|
||||||
char *pipeline_description;
|
char *pipeline_description;
|
||||||
char *filename;
|
char *file_template;
|
||||||
|
|
||||||
/* We might have multiple pipelines that are finishing encoding
|
/* We might have multiple pipelines that are finishing encoding
|
||||||
* to go along with the current pipeline where we are recording.
|
* to go along with the current pipeline where we are recording.
|
||||||
@ -98,8 +98,8 @@ static void recorder_set_framerate (ShellRecorder *recorder,
|
|||||||
int framerate);
|
int framerate);
|
||||||
static void recorder_set_pipeline (ShellRecorder *recorder,
|
static void recorder_set_pipeline (ShellRecorder *recorder,
|
||||||
const char *pipeline);
|
const char *pipeline);
|
||||||
static void recorder_set_filename (ShellRecorder *recorder,
|
static void recorder_set_file_template (ShellRecorder *recorder,
|
||||||
const char *filename);
|
const char *file_template);
|
||||||
|
|
||||||
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);
|
||||||
@ -109,7 +109,7 @@ enum {
|
|||||||
PROP_STAGE,
|
PROP_STAGE,
|
||||||
PROP_FRAMERATE,
|
PROP_FRAMERATE,
|
||||||
PROP_PIPELINE,
|
PROP_PIPELINE,
|
||||||
PROP_FILENAME
|
PROP_FILE_TEMPLATE
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(ShellRecorder, shell_recorder, G_TYPE_OBJECT);
|
G_DEFINE_TYPE(ShellRecorder, shell_recorder, G_TYPE_OBJECT);
|
||||||
@ -278,7 +278,7 @@ shell_recorder_finalize (GObject *object)
|
|||||||
|
|
||||||
recorder_set_stage (recorder, NULL);
|
recorder_set_stage (recorder, NULL);
|
||||||
recorder_set_pipeline (recorder, NULL);
|
recorder_set_pipeline (recorder, NULL);
|
||||||
recorder_set_filename (recorder, NULL);
|
recorder_set_file_template (recorder, NULL);
|
||||||
|
|
||||||
g_object_unref (recorder->grabber);
|
g_object_unref (recorder->grabber);
|
||||||
|
|
||||||
@ -905,22 +905,22 @@ recorder_set_pipeline (ShellRecorder *recorder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
recorder_set_filename (ShellRecorder *recorder,
|
recorder_set_file_template (ShellRecorder *recorder,
|
||||||
const char *filename)
|
const char *file_template)
|
||||||
{
|
{
|
||||||
if (filename == recorder->filename ||
|
if (file_template == recorder->file_template ||
|
||||||
(filename && recorder->filename && strcmp (recorder->filename, filename) == 0))
|
(file_template && recorder->file_template && strcmp (recorder->file_template, file_template) == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (recorder->current_pipeline)
|
if (recorder->current_pipeline)
|
||||||
shell_recorder_close (recorder);
|
shell_recorder_close (recorder);
|
||||||
|
|
||||||
if (recorder->filename)
|
if (recorder->file_template)
|
||||||
g_free (recorder->filename);
|
g_free (recorder->file_template);
|
||||||
|
|
||||||
recorder->filename = g_strdup (filename);
|
recorder->file_template = g_strdup (file_template);
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (recorder), "filename");
|
g_object_notify (G_OBJECT (recorder), "file-template");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -942,8 +942,8 @@ shell_recorder_set_property (GObject *object,
|
|||||||
case PROP_PIPELINE:
|
case PROP_PIPELINE:
|
||||||
recorder_set_pipeline (recorder, g_value_get_string (value));
|
recorder_set_pipeline (recorder, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
case PROP_FILENAME:
|
case PROP_FILE_TEMPLATE:
|
||||||
recorder_set_filename (recorder, g_value_get_string (value));
|
recorder_set_file_template (recorder, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -970,8 +970,8 @@ shell_recorder_get_property (GObject *object,
|
|||||||
case PROP_PIPELINE:
|
case PROP_PIPELINE:
|
||||||
g_value_set_string (value, recorder->pipeline_description);
|
g_value_set_string (value, recorder->pipeline_description);
|
||||||
break;
|
break;
|
||||||
case PROP_FILENAME:
|
case PROP_FILE_TEMPLATE:
|
||||||
g_value_set_string (value, recorder->filename);
|
g_value_set_string (value, recorder->file_template);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -1015,9 +1015,9 @@ shell_recorder_class_init (ShellRecorderClass *klass)
|
|||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_FILENAME,
|
PROP_FILE_TEMPLATE,
|
||||||
g_param_spec_string ("filename",
|
g_param_spec_string ("file-template",
|
||||||
"Filename",
|
"File Template",
|
||||||
"The filename template to use for output files",
|
"The filename template to use for output files",
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
@ -1143,7 +1143,7 @@ recorder_open_outfile (ShellRecorder *recorder)
|
|||||||
int flags;
|
int flags;
|
||||||
int outfile = -1;
|
int outfile = -1;
|
||||||
|
|
||||||
pattern = recorder->filename;
|
pattern = recorder->file_template;
|
||||||
if (!pattern)
|
if (!pattern)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -1545,9 +1545,9 @@ shell_recorder_set_framerate (ShellRecorder *recorder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shell_recorder_set_filename:
|
* shell_recorder_set_file_template:
|
||||||
* @recorder: the #ShellRecorder
|
* @recorder: the #ShellRecorder
|
||||||
* @filename: the filename template to use for output files,
|
* @file_template: the filename template to use for output files,
|
||||||
* or %NULL for the defalt value.
|
* or %NULL for the defalt value.
|
||||||
*
|
*
|
||||||
* Sets the filename that will be used when creating output
|
* Sets the filename that will be used when creating output
|
||||||
@ -1563,12 +1563,12 @@ shell_recorder_set_framerate (ShellRecorder *recorder,
|
|||||||
* The default value is 'shell-%d%u-%c.ogg'.
|
* The default value is 'shell-%d%u-%c.ogg'.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
shell_recorder_set_filename (ShellRecorder *recorder,
|
shell_recorder_set_file_template (ShellRecorder *recorder,
|
||||||
const char *filename)
|
const char *file_template)
|
||||||
{
|
{
|
||||||
g_return_if_fail (SHELL_IS_RECORDER (recorder));
|
g_return_if_fail (SHELL_IS_RECORDER (recorder));
|
||||||
|
|
||||||
recorder_set_filename (recorder, filename);
|
recorder_set_file_template (recorder, file_template);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1583,7 +1583,7 @@ shell_recorder_set_filename (ShellRecorder *recorder,
|
|||||||
* should have an unconnected sink pad where the recorded
|
* should have an unconnected sink pad where the recorded
|
||||||
* video is recorded. It will normally have a unconnected
|
* video is recorded. It will normally have a unconnected
|
||||||
* source pad; output from that pad will be written into the
|
* source pad; output from that pad will be written into the
|
||||||
* output file. (See shell_recorder_set_filename().) However
|
* output file. (See shell_recorder_set_file_template().) However
|
||||||
* the pipeline can also take care of its own output - this
|
* the pipeline can also take care of its own output - this
|
||||||
* might be used to send the output to an icecast server
|
* might be used to send the output to an icecast server
|
||||||
* via shout2send or similar.
|
* via shout2send or similar.
|
||||||
|
@ -32,8 +32,8 @@ ShellRecorder *shell_recorder_new (ClutterStage *stage);
|
|||||||
|
|
||||||
void shell_recorder_set_framerate (ShellRecorder *recorder,
|
void shell_recorder_set_framerate (ShellRecorder *recorder,
|
||||||
int framerate);
|
int framerate);
|
||||||
void shell_recorder_set_filename (ShellRecorder *recorder,
|
void shell_recorder_set_file_template (ShellRecorder *recorder,
|
||||||
const char *filename);
|
const char *file_template);
|
||||||
void shell_recorder_set_pipeline (ShellRecorder *recorder,
|
void shell_recorder_set_pipeline (ShellRecorder *recorder,
|
||||||
const char *pipeline);
|
const char *pipeline);
|
||||||
gboolean shell_recorder_record (ShellRecorder *recorder);
|
gboolean shell_recorder_record (ShellRecorder *recorder);
|
||||||
|
@ -46,7 +46,7 @@ on_stage_realized (ClutterActor *stage,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
recorder = shell_recorder_new (CLUTTER_STAGE (stage));
|
recorder = shell_recorder_new (CLUTTER_STAGE (stage));
|
||||||
shell_recorder_set_filename (recorder, "test-recorder.ogg");
|
shell_recorder_set_file_template (recorder, "test-recorder.ogg");
|
||||||
shell_recorder_record (recorder);
|
shell_recorder_record (recorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user