mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
camerabin2: Adding missing plugin error messages
Whenever a required plugin is missing, camerabin2 should post a missing plugin message to the bus
This commit is contained in:
parent
1c8e1722eb
commit
56007404b6
3 changed files with 75 additions and 17 deletions
|
@ -56,6 +56,8 @@
|
|||
|
||||
#include <gst/basecamerabinsrc/gstbasecamerasrc.h>
|
||||
#include "gstcamerabin2.h"
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
|
||||
#define GST_CAMERA_BIN_PROCESSING_INC(c) \
|
||||
{ \
|
||||
|
@ -949,12 +951,16 @@ gst_camera_bin_create_elements (GstCameraBin * camera)
|
|||
gboolean new_audio_src = FALSE;
|
||||
gboolean has_audio;
|
||||
gboolean profile_switched = FALSE;
|
||||
const gchar *missing_element_name;
|
||||
|
||||
if (!camera->elements_created) {
|
||||
/* TODO check that elements created in _init were really created */
|
||||
/* TODO add proper missing plugin error handling */
|
||||
|
||||
camera->encodebin = gst_element_factory_make ("encodebin", NULL);
|
||||
if (!camera->encodebin) {
|
||||
missing_element_name = "encodebin";
|
||||
goto missing_element;
|
||||
}
|
||||
camera->encodebin_signal_id = g_signal_connect (camera->encodebin,
|
||||
"element-added", (GCallback) encodebin_element_added, camera);
|
||||
|
||||
|
@ -966,6 +972,14 @@ gst_camera_bin_create_elements (GstCameraBin * camera)
|
|||
camera->audio_queue = gst_element_factory_make ("queue", "audio-queue");
|
||||
camera->audio_convert = gst_element_factory_make ("audioconvert",
|
||||
"audio-convert");
|
||||
if (!camera->audio_convert) {
|
||||
missing_element_name = "audioconvert";
|
||||
goto missing_element;
|
||||
}
|
||||
if (!camera->audio_volume) {
|
||||
missing_element_name = "volume";
|
||||
goto missing_element;
|
||||
}
|
||||
|
||||
if (camera->video_profile == NULL) {
|
||||
GstEncodingContainerProfile *prof;
|
||||
|
@ -1164,6 +1178,15 @@ gst_camera_bin_create_elements (GstCameraBin * camera)
|
|||
camera->elements_created = TRUE;
|
||||
return TRUE;
|
||||
|
||||
missing_element:
|
||||
gst_element_post_message (GST_ELEMENT_CAST (camera),
|
||||
gst_missing_element_message_new (GST_ELEMENT_CAST (camera),
|
||||
missing_element_name));
|
||||
GST_ELEMENT_ERROR (camera, CORE, MISSING_PLUGIN,
|
||||
(_("Missing element '%s' - check your GStreamer installation."),
|
||||
missing_element_name), (NULL));
|
||||
goto fail;
|
||||
|
||||
fail:
|
||||
/* FIXME properly clean up */
|
||||
return FALSE;
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
#include "gstimagecapturebin.h"
|
||||
#include "camerabingeneral.h"
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
|
||||
/* prototypes */
|
||||
|
||||
|
@ -255,6 +257,7 @@ gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
|
|||
{
|
||||
GstElement *colorspace;
|
||||
GstPad *pad = NULL;
|
||||
const gchar *missing_element_name;
|
||||
|
||||
if (imagebin->elements_created)
|
||||
return TRUE;
|
||||
|
@ -263,8 +266,10 @@ gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
|
|||
colorspace =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin),
|
||||
DEFAULT_COLORSPACE, "imagebin-colorspace");
|
||||
if (!colorspace)
|
||||
goto error;
|
||||
if (!colorspace) {
|
||||
missing_element_name = DEFAULT_COLORSPACE;
|
||||
goto missing_element;
|
||||
}
|
||||
|
||||
if (imagebin->user_encoder) {
|
||||
imagebin->encoder = imagebin->user_encoder;
|
||||
|
@ -275,8 +280,10 @@ gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
|
|||
imagebin->encoder =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin),
|
||||
DEFAULT_ENCODER, "imagebin-encoder");
|
||||
if (!imagebin->encoder)
|
||||
goto error;
|
||||
if (!imagebin->encoder) {
|
||||
missing_element_name = DEFAULT_ENCODER;
|
||||
goto missing_element;
|
||||
}
|
||||
}
|
||||
|
||||
if (imagebin->user_muxer) {
|
||||
|
@ -288,15 +295,19 @@ gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
|
|||
imagebin->muxer =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin),
|
||||
DEFAULT_MUXER, "imagebin-muxer");
|
||||
if (!imagebin->muxer)
|
||||
goto error;
|
||||
if (!imagebin->muxer) {
|
||||
missing_element_name = DEFAULT_MUXER;
|
||||
goto missing_element;
|
||||
}
|
||||
}
|
||||
|
||||
imagebin->sink =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (imagebin), DEFAULT_SINK,
|
||||
"imagebin-sink");
|
||||
if (!imagebin->sink)
|
||||
goto error;
|
||||
if (!imagebin->sink) {
|
||||
missing_element_name = DEFAULT_SINK;
|
||||
goto missing_element;
|
||||
}
|
||||
|
||||
g_object_set (imagebin->sink, "location", imagebin->location, "async", FALSE,
|
||||
"post-messages", TRUE, NULL);
|
||||
|
@ -310,6 +321,15 @@ gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin)
|
|||
imagebin->elements_created = TRUE;
|
||||
return TRUE;
|
||||
|
||||
missing_element:
|
||||
gst_element_post_message (GST_ELEMENT_CAST (imagebin),
|
||||
gst_missing_element_message_new (GST_ELEMENT_CAST (imagebin),
|
||||
missing_element_name));
|
||||
GST_ELEMENT_ERROR (imagebin, CORE, MISSING_PLUGIN,
|
||||
(_("Missing element '%s' - check your GStreamer installation."),
|
||||
missing_element_name), (NULL));
|
||||
goto error;
|
||||
|
||||
error:
|
||||
if (pad)
|
||||
gst_object_unref (pad);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "gstviewfinderbin.h"
|
||||
#include "camerabingeneral.h"
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
|
||||
|
@ -147,6 +148,7 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin)
|
|||
GstElement *csp = NULL;
|
||||
GstElement *videoscale = NULL;
|
||||
GstPad *pad = NULL;
|
||||
const gchar *missing_element_name;
|
||||
|
||||
GST_DEBUG_OBJECT (vfbin, "Creating internal elements");
|
||||
|
||||
|
@ -155,14 +157,18 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin)
|
|||
csp =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (vfbin),
|
||||
"ffmpegcolorspace", "vfbin-csp");
|
||||
if (!csp)
|
||||
goto error;
|
||||
if (!csp) {
|
||||
missing_element_name = "ffmpegcolorspace";
|
||||
goto missing_element;
|
||||
}
|
||||
|
||||
videoscale =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (vfbin), "videoscale",
|
||||
"vfbin-videoscale");
|
||||
if (!videoscale)
|
||||
goto error;
|
||||
if (!videoscale) {
|
||||
missing_element_name = "videoscale";
|
||||
goto missing_element;
|
||||
}
|
||||
|
||||
/* add ghostpad */
|
||||
pad = gst_element_get_static_pad (csp, "sink");
|
||||
|
@ -190,10 +196,10 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin)
|
|||
else {
|
||||
vfbin->video_sink = gst_element_factory_make ("autovideosink",
|
||||
"vfbin-sink");
|
||||
GST_ELEMENT_ERROR (vfbin, CORE, MISSING_PLUGIN,
|
||||
(_("Missing element '%s' - check your GStreamer installation."),
|
||||
"autovideosink"), (NULL));
|
||||
goto error;
|
||||
if (!vfbin->video_sink) {
|
||||
missing_element_name = "autovideosink";
|
||||
goto missing_element;
|
||||
}
|
||||
}
|
||||
|
||||
gst_bin_add (GST_BIN_CAST (vfbin), gst_object_ref (vfbin->video_sink));
|
||||
|
@ -213,6 +219,15 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin)
|
|||
|
||||
return TRUE;
|
||||
|
||||
missing_element:
|
||||
gst_element_post_message (GST_ELEMENT_CAST (vfbin),
|
||||
gst_missing_element_message_new (GST_ELEMENT_CAST (vfbin),
|
||||
missing_element_name));
|
||||
GST_ELEMENT_ERROR (vfbin, CORE, MISSING_PLUGIN,
|
||||
(_("Missing element '%s' - check your GStreamer installation."),
|
||||
missing_element_name), (NULL));
|
||||
goto error;
|
||||
|
||||
error:
|
||||
GST_WARNING_OBJECT (vfbin, "Creating internal elements failed");
|
||||
if (pad)
|
||||
|
|
Loading…
Reference in a new issue