camerabin2: Remove redundant image-queue

Encodebin is used for image encoding and it already contains
a queue, so we can remove camerabin2 image queue.
This commit is contained in:
Thiago Santos 2011-08-03 13:57:09 -03:00
parent cc9e490313
commit a68b1f049c
2 changed files with 12 additions and 15 deletions

View file

@ -440,8 +440,6 @@ gst_camera_bin_dispose (GObject * object)
gst_object_unref (camerabin->imagesink); gst_object_unref (camerabin->imagesink);
if (camerabin->image_encodebin) if (camerabin->image_encodebin)
gst_object_unref (camerabin->image_encodebin); gst_object_unref (camerabin->image_encodebin);
if (camerabin->imagebin_queue)
gst_object_unref (camerabin->imagebin_queue);
if (camerabin->imagebin_capsfilter) if (camerabin->imagebin_capsfilter)
gst_object_unref (camerabin->imagebin_capsfilter); gst_object_unref (camerabin->imagebin_capsfilter);
@ -1183,6 +1181,9 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
missing_element_name = "encodebin"; missing_element_name = "encodebin";
goto missing_element; goto missing_element;
} }
/* durations have no meaning for image captures */
g_object_set (camera->image_encodebin, "queue-time-max", (guint64) 0, NULL);
camera->image_encodebin_signal_id = camera->image_encodebin_signal_id =
g_signal_connect (camera->image_encodebin, "element-added", g_signal_connect (camera->image_encodebin, "element-added",
(GCallback) encodebin_element_added, camera); (GCallback) encodebin_element_added, camera);
@ -1215,29 +1216,21 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
camera->image_profile_switch = TRUE; camera->image_profile_switch = TRUE;
} }
camera->imagebin_queue =
gst_element_factory_make ("queue", "imagebin-queue");
camera->viewfinderbin_queue = camera->viewfinderbin_queue =
gst_element_factory_make ("queue", "viewfinderbin-queue"); gst_element_factory_make ("queue", "viewfinderbin-queue");
g_object_set (camera->viewfinderbin_queue, "leaky", 2, "silent", TRUE, g_object_set (camera->viewfinderbin_queue, "leaky", 2, "silent", TRUE,
NULL); NULL);
g_object_set (camera->imagebin_queue, "max-size-time", (guint64) 0,
"silent", TRUE, NULL);
gst_bin_add_many (GST_BIN_CAST (camera), gst_bin_add_many (GST_BIN_CAST (camera),
gst_object_ref (camera->video_encodebin), gst_object_ref (camera->video_encodebin),
gst_object_ref (camera->videosink), gst_object_ref (camera->videosink),
gst_object_ref (camera->image_encodebin), gst_object_ref (camera->image_encodebin),
gst_object_ref (camera->imagesink), gst_object_ref (camera->imagesink),
gst_object_ref (camera->imagebin_queue),
gst_object_ref (camera->viewfinderbin_queue), NULL); gst_object_ref (camera->viewfinderbin_queue), NULL);
/* Linking can be optimized TODO */ /* Linking can be optimized TODO */
gst_element_link (camera->video_encodebin, camera->videosink); gst_element_link (camera->video_encodebin, camera->videosink);
gst_element_link_many (camera->imagebin_queue, camera->imagebin_capsfilter,
NULL);
gst_element_link (camera->image_encodebin, camera->imagesink); gst_element_link (camera->image_encodebin, camera->imagesink);
gst_element_link_many (camera->viewfinderbin_queue, gst_element_link_many (camera->viewfinderbin_queue,
camera->viewfinderbin_capsfilter, camera->viewfinderbin, NULL); camera->viewfinderbin_capsfilter, camera->viewfinderbin, NULL);
@ -1344,8 +1337,13 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
G_CALLBACK (gst_camera_bin_src_notify_readyforcapture), camera); G_CALLBACK (gst_camera_bin_src_notify_readyforcapture), camera);
gst_element_link_pads (camera->src, "vfsrc", camera->viewfinderbin_queue, gst_element_link_pads (camera->src, "vfsrc", camera->viewfinderbin_queue,
"sink"); "sink");
gst_element_link_pads (camera->src, "imgsrc", camera->imagebin_queue,
"sink"); if (!gst_element_link_pads (camera->src, "imgsrc",
camera->imagebin_capsfilter, "sink")) {
GST_ERROR_OBJECT (camera,
"Failed to link camera source's imgsrc pad to image bin capsfilter");
goto fail;
}
if (!gst_element_link_pads (camera->src, "vidsrc", if (!gst_element_link_pads (camera->src, "vidsrc",
camera->videobin_capsfilter, "sink")) { camera->videobin_capsfilter, "sink")) {
GST_ERROR_OBJECT (camera, GST_ERROR_OBJECT (camera,
@ -1359,8 +1357,8 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
} }
gst_camera_bin_check_and_replace_filter (camera, &camera->image_filter, gst_camera_bin_check_and_replace_filter (camera, &camera->image_filter,
camera->user_image_filter, camera->imagebin_queue, camera->user_image_filter, camera->src, camera->imagebin_capsfilter,
camera->imagebin_capsfilter, NULL); "imgsrc");
gst_camera_bin_check_and_replace_filter (camera, &camera->video_filter, gst_camera_bin_check_and_replace_filter (camera, &camera->video_filter,
camera->user_video_filter, camera->src, camera->videobin_capsfilter, camera->user_video_filter, camera->src, camera->videobin_capsfilter,
"vidsrc"); "vidsrc");

View file

@ -63,7 +63,6 @@ struct _GstCameraBin2
GstElement *image_encodebin; GstElement *image_encodebin;
gulong image_encodebin_signal_id; gulong image_encodebin_signal_id;
GstElement *imagesink; GstElement *imagesink;
GstElement *imagebin_queue;
GstElement *imagebin_capsfilter; GstElement *imagebin_capsfilter;
GstElement *video_filter; GstElement *video_filter;