mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
rpicamsrc: deviceprovider: check if camera is detected and supported
This commit is contained in:
parent
8e9c8663f8
commit
27c35a8ff3
3 changed files with 18 additions and 3 deletions
|
@ -1094,7 +1094,7 @@ static int raspicamcontrol_get_mem_gpu(void)
|
|||
* @param supported None-zero if software supports the camera
|
||||
* @param detected None-zero if a camera has been detected
|
||||
*/
|
||||
static void raspicamcontrol_get_camera(int *supported, int *detected)
|
||||
void raspicamcontrol_get_camera(int *supported, int *detected)
|
||||
{
|
||||
char response[80] = "";
|
||||
if (vc_gencmd(response, sizeof response, "get_camera") == 0)
|
||||
|
|
|
@ -147,6 +147,7 @@ void raspicamcontrol_dump_parameters(const RASPICAM_CAMERA_PARAMETERS *params);
|
|||
void raspicamcontrol_set_defaults(RASPICAM_CAMERA_PARAMETERS *params);
|
||||
|
||||
void raspicamcontrol_check_configuration(int min_gpu_mem);
|
||||
void raspicamcontrol_get_camera(int *supported, int *detected);
|
||||
|
||||
// Individual setting functions
|
||||
int raspicamcontrol_set_saturation(MMAL_COMPONENT_T *camera, int saturation);
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#if GST_CHECK_VERSION (1,4,0)
|
||||
|
||||
#include "RaspiCapture.h"
|
||||
|
||||
/* FIXME: translations */
|
||||
#define _(s) s
|
||||
|
||||
|
@ -54,15 +56,27 @@ gst_rpi_cam_src_device_provider_class_init (GstRpiCamSrcDeviceProviderClass * kl
|
|||
static void
|
||||
gst_rpi_cam_src_device_provider_init (GstRpiCamSrcDeviceProvider * provider)
|
||||
{
|
||||
/* nothing to do here yet */
|
||||
raspicapture_init ();
|
||||
}
|
||||
|
||||
static GList *
|
||||
gst_rpi_cam_src_device_provider_probe (GstDeviceProvider * provider)
|
||||
{
|
||||
GstRpiCamSrcDevice *device;
|
||||
int supported = 0, detected = 0;
|
||||
|
||||
raspicamcontrol_get_camera (&supported, &detected);
|
||||
|
||||
if (!detected) {
|
||||
GST_INFO ("No Raspberry Pi camera module detected.");
|
||||
return NULL;
|
||||
} else if (!supported) {
|
||||
GST_WARNING ("Raspberry Pi camera module not supported, make sure to enable it.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GST_INFO ("Raspberry Pi camera module detected and supported.");
|
||||
|
||||
/* FIXME: check if camera module is usable and supported */
|
||||
device = gst_rpi_cam_src_device_new ();
|
||||
|
||||
return g_list_append (NULL, device);
|
||||
|
|
Loading…
Reference in a new issue