mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
camerabin2: remove abbreviations from videorecordingbin
This commit is contained in:
parent
7409211055
commit
78dc07987e
1 changed files with 34 additions and 33 deletions
|
@ -69,13 +69,13 @@ static void
|
||||||
gst_video_recording_bin_set_property (GObject * object, guint prop_id,
|
gst_video_recording_bin_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstVideoRecordingBin *vidbin = GST_VIDEO_RECORDING_BIN_CAST (object);
|
GstVideoRecordingBin *videobin = GST_VIDEO_RECORDING_BIN_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_LOCATION:
|
case PROP_LOCATION:
|
||||||
vidbin->location = g_value_dup_string (value);
|
videobin->location = g_value_dup_string (value);
|
||||||
if (vidbin->sink) {
|
if (videobin->sink) {
|
||||||
g_object_set (vidbin->sink, "location", vidbin->location, NULL);
|
g_object_set (videobin->sink, "location", videobin->location, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -88,11 +88,11 @@ static void
|
||||||
gst_video_recording_bin_get_property (GObject * object, guint prop_id,
|
gst_video_recording_bin_get_property (GObject * object, guint prop_id,
|
||||||
GValue * value, GParamSpec * pspec)
|
GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstVideoRecordingBin *vidbin = GST_VIDEO_RECORDING_BIN_CAST (object);
|
GstVideoRecordingBin *videobin = GST_VIDEO_RECORDING_BIN_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_LOCATION:
|
case PROP_LOCATION:
|
||||||
g_value_set_string (value, vidbin->location);
|
g_value_set_string (value, videobin->location);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -135,61 +135,62 @@ gst_video_recording_bin_class_init (GstVideoRecordingBinClass * klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_video_recording_bin_init (GstVideoRecordingBin * video_recordingbin,
|
gst_video_recording_bin_init (GstVideoRecordingBin * videobin,
|
||||||
GstVideoRecordingBinClass * video_recordingbin_class)
|
GstVideoRecordingBinClass * videobin_class)
|
||||||
{
|
{
|
||||||
video_recordingbin->ghostpad =
|
videobin->ghostpad =
|
||||||
gst_ghost_pad_new_no_target_from_template ("sink",
|
gst_ghost_pad_new_no_target_from_template ("sink",
|
||||||
gst_static_pad_template_get (&sink_template));
|
gst_static_pad_template_get (&sink_template));
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (video_recordingbin),
|
gst_element_add_pad (GST_ELEMENT_CAST (videobin), videobin->ghostpad);
|
||||||
video_recordingbin->ghostpad);
|
|
||||||
|
|
||||||
video_recordingbin->location = g_strdup (DEFAULT_LOCATION);
|
videobin->location = g_strdup (DEFAULT_LOCATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_video_recording_bin_create_elements (GstVideoRecordingBin * vrbin)
|
gst_video_recording_bin_create_elements (GstVideoRecordingBin * videobin)
|
||||||
{
|
{
|
||||||
GstElement *csp;
|
GstElement *colorspace;
|
||||||
GstElement *enc;
|
GstElement *encoder;
|
||||||
GstElement *mux;
|
GstElement *muxer;
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
GstPad *pad = NULL;
|
GstPad *pad = NULL;
|
||||||
|
|
||||||
if (vrbin->elements_created)
|
if (videobin->elements_created)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* create elements */
|
/* create elements */
|
||||||
csp = gst_element_factory_make ("ffmpegcolorspace", "vrbin-csp");
|
colorspace =
|
||||||
if (!csp)
|
gst_element_factory_make ("ffmpegcolorspace", "videobin-colorspace");
|
||||||
|
if (!colorspace)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
enc = gst_element_factory_make ("theoraenc", "vrbin-enc");
|
encoder = gst_element_factory_make ("theoraenc", "videobin-encoder");
|
||||||
if (!enc)
|
if (!encoder)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
mux = gst_element_factory_make ("oggmux", "vrbin-mux");
|
muxer = gst_element_factory_make ("oggmux", "videobin->muxer");
|
||||||
if (!mux)
|
if (!muxer)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
sink = gst_element_factory_make ("filesink", "vrbin-sink");
|
sink = gst_element_factory_make ("filesink", "videobin-sink");
|
||||||
if (!sink)
|
if (!sink)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
vrbin->sink = gst_object_ref (sink);
|
videobin->sink = gst_object_ref (sink);
|
||||||
g_object_set (sink, "location", vrbin->location, "async", FALSE, NULL);
|
g_object_set (sink, "location", videobin->location, "async", FALSE, NULL);
|
||||||
|
|
||||||
/* add and link */
|
/* add and link */
|
||||||
gst_bin_add_many (GST_BIN_CAST (vrbin), csp, enc, mux, sink, NULL);
|
gst_bin_add_many (GST_BIN_CAST (videobin), colorspace, encoder, muxer, sink,
|
||||||
if (!gst_element_link_many (csp, enc, mux, sink, NULL))
|
NULL);
|
||||||
|
if (!gst_element_link_many (colorspace, encoder, muxer, sink, NULL))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* add ghostpad */
|
/* add ghostpad */
|
||||||
pad = gst_element_get_static_pad (csp, "sink");
|
pad = gst_element_get_static_pad (colorspace, "sink");
|
||||||
if (!gst_ghost_pad_set_target (GST_GHOST_PAD (vrbin->ghostpad), pad))
|
if (!gst_ghost_pad_set_target (GST_GHOST_PAD (videobin->ghostpad), pad))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
vrbin->elements_created = TRUE;
|
videobin->elements_created = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -203,11 +204,11 @@ gst_video_recording_bin_change_state (GstElement * element,
|
||||||
GstStateChange trans)
|
GstStateChange trans)
|
||||||
{
|
{
|
||||||
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
||||||
GstVideoRecordingBin *vrbin = GST_VIDEO_RECORDING_BIN_CAST (element);
|
GstVideoRecordingBin *videobin = GST_VIDEO_RECORDING_BIN_CAST (element);
|
||||||
|
|
||||||
switch (trans) {
|
switch (trans) {
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
if (!gst_video_recording_bin_create_elements (vrbin)) {
|
if (!gst_video_recording_bin_create_elements (videobin)) {
|
||||||
return GST_STATE_CHANGE_FAILURE;
|
return GST_STATE_CHANGE_FAILURE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue