camerabin: Fix source updates with user filters

Take the case into account when user filters have been set before the
source gets updated.

Note that the further linking of the filters, if present, happens below
in the `gst_camera_bin_check_and_replace_filter()` calls.

The audio filter is still affected by the same issue but left out for
now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5527>
This commit is contained in:
Robert Mader 2023-10-22 11:06:27 +02:00 committed by Sebastian Dröge
parent db77deef00
commit de92a6c7f2

View file

@ -1751,24 +1751,52 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
"notify::ready-for-capture", "notify::ready-for-capture",
G_CALLBACK (gst_camera_bin_src_notify_readyforcapture), camera); G_CALLBACK (gst_camera_bin_src_notify_readyforcapture), camera);
if (!gst_element_link_pads (camera->src, "vfsrc", if (camera->viewfinder_filter) {
camera->viewfinderbin_queue, "sink")) { if (!gst_element_link_pads (camera->src, "vfsrc",
GST_ERROR_OBJECT (camera, camera->viewfinder_filter, NULL)) {
"Failed to link camera source's vfsrc pad to viewfinder queue"); GST_ERROR_OBJECT (camera,
goto fail; "Failed to link camera source's vfsrc pad to viewfinder filter");
goto fail;
}
} else {
if (!gst_element_link_pads (camera->src, "vfsrc",
camera->viewfinderbin_queue, "sink")) {
GST_ERROR_OBJECT (camera,
"Failed to link camera source's vfsrc pad to viewfinder queue");
goto fail;
}
} }
if (!gst_element_link_pads (camera->src, "imgsrc", if (camera->image_filter) {
camera->imagebin_capsfilter, "sink")) { if (!gst_element_link_pads (camera->src, "imgsrc",
GST_ERROR_OBJECT (camera, camera->image_filter, NULL)) {
"Failed to link camera source's imgsrc pad to image bin capsfilter"); GST_ERROR_OBJECT (camera,
goto fail; "Failed to link camera source's imgsrc pad to image filter");
goto fail;
}
} else {
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",
camera->videobin_capsfilter, "sink")) { if (camera->video_filter) {
GST_ERROR_OBJECT (camera, if (!gst_element_link_pads (camera->src, "vidsrc",
"Failed to link camera source's vidsrc pad to video bin capsfilter"); camera->video_filter, NULL)) {
goto fail; GST_ERROR_OBJECT (camera,
"Failed to link camera source's vidsrc pad to video filter");
goto fail;
}
} else {
if (!gst_element_link_pads (camera->src, "vidsrc",
camera->videobin_capsfilter, "sink")) {
GST_ERROR_OBJECT (camera,
"Failed to link camera source's vidsrc pad to video bin capsfilter");
goto fail;
}
} }
gst_pad_add_probe (imgsrc, GST_PAD_PROBE_TYPE_BUFFER, gst_pad_add_probe (imgsrc, GST_PAD_PROBE_TYPE_BUFFER,