pleorasrc: run gst-indent
This commit is contained in:
parent
5546ea432a
commit
bcb80f3b87
@ -109,7 +109,8 @@ static GstStaticPadTemplate gst_pleorasrc_src_template =
|
|||||||
GST_STATIC_PAD_TEMPLATE ("src",
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS (VIDEO_CAPS_MAKE_BAYER16 ("{ bggr16, grbg16, rggb16, gbrg16 }") ";"
|
GST_STATIC_CAPS (VIDEO_CAPS_MAKE_BAYER16
|
||||||
|
("{ bggr16, grbg16, rggb16, gbrg16 }") ";"
|
||||||
VIDEO_CAPS_MAKE_BAYER8 ("{ bggr, grbg, rggb, gbrg }") ";"
|
VIDEO_CAPS_MAKE_BAYER8 ("{ bggr, grbg, rggb, gbrg }") ";"
|
||||||
GST_VIDEO_CAPS_MAKE ("{ GRAY16_LE, GRAY16_BE, GRAY8, UYVY, YUY2, RGB }")
|
GST_VIDEO_CAPS_MAKE ("{ GRAY16_LE, GRAY16_BE, GRAY8, UYVY, YUY2, RGB }")
|
||||||
)
|
)
|
||||||
@ -169,9 +170,9 @@ gst_pleorasrc_class_init (GstPleoraSrcClass * klass)
|
|||||||
g_param_spec_int ("timeout", "Timeout (ms)",
|
g_param_spec_int ("timeout", "Timeout (ms)",
|
||||||
"Timeout in ms (0 to use default)", 0, G_MAXINT, DEFAULT_PROP_TIMEOUT,
|
"Timeout in ms (0 to use default)", 0, G_MAXINT, DEFAULT_PROP_TIMEOUT,
|
||||||
(GParamFlags) (G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)));
|
(GParamFlags) (G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DETECTION_TIMEOUT,
|
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||||
g_param_spec_int ("detection-timeout", "Detection Timeout (ms)",
|
PROP_DETECTION_TIMEOUT, g_param_spec_int ("detection-timeout",
|
||||||
"Timeout in ms to detect GigE cameras", 100,
|
"Detection Timeout (ms)", "Timeout in ms to detect GigE cameras", 100,
|
||||||
60000, DEFAULT_PROP_DETECTION_TIMEOUT,
|
60000, DEFAULT_PROP_DETECTION_TIMEOUT,
|
||||||
(GParamFlags) (G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)));
|
(GParamFlags) (G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)));
|
||||||
g_object_class_install_property (gobject_class, PROP_MULTICAST_GROUP,
|
g_object_class_install_property (gobject_class, PROP_MULTICAST_GROUP,
|
||||||
@ -182,8 +183,7 @@ gst_pleorasrc_class_init (GstPleoraSrcClass * klass)
|
|||||||
GST_PARAM_MUTABLE_READY)));
|
GST_PARAM_MUTABLE_READY)));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
|
||||||
g_param_spec_int ("port", "Multicast port",
|
g_param_spec_int ("port", "Multicast port",
|
||||||
"The port of the multicast group.", 0,
|
"The port of the multicast group.", 0, 65535, DEFAULT_PROP_PORT,
|
||||||
65535, DEFAULT_PROP_PORT,
|
|
||||||
(GParamFlags) (G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)));
|
(GParamFlags) (G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_RECEIVER_ONLY,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_RECEIVER_ONLY,
|
||||||
g_param_spec_boolean ("receiver-only", "Receiver only",
|
g_param_spec_boolean ("receiver-only", "Receiver only",
|
||||||
@ -223,7 +223,7 @@ gst_pleorasrc_init (GstPleoraSrc * src)
|
|||||||
src->num_capture_buffers = DEFAULT_PROP_NUM_CAPTURE_BUFFERS;
|
src->num_capture_buffers = DEFAULT_PROP_NUM_CAPTURE_BUFFERS;
|
||||||
src->timeout = DEFAULT_PROP_TIMEOUT;
|
src->timeout = DEFAULT_PROP_TIMEOUT;
|
||||||
src->detection_timeout = DEFAULT_PROP_DETECTION_TIMEOUT;
|
src->detection_timeout = DEFAULT_PROP_DETECTION_TIMEOUT;
|
||||||
src->multicast_group= g_strdup (DEFAULT_PROP_MULTICAST_GROUP);
|
src->multicast_group = g_strdup (DEFAULT_PROP_MULTICAST_GROUP);
|
||||||
src->port = DEFAULT_PROP_PORT;
|
src->port = DEFAULT_PROP_PORT;
|
||||||
src->receiver_only = DEFAULT_PROP_RECEIVER_ONLY;
|
src->receiver_only = DEFAULT_PROP_RECEIVER_ONLY;
|
||||||
|
|
||||||
@ -533,34 +533,35 @@ gst_pleorasrc_setup_device (GstPleoraSrc * src)
|
|||||||
|
|
||||||
/* open as controller by connecting to device */
|
/* open as controller by connecting to device */
|
||||||
if (!src->receiver_only) {
|
if (!src->receiver_only) {
|
||||||
GST_DEBUG_OBJECT (src, "Trying to connect to device '%s'",
|
GST_DEBUG_OBJECT (src, "Trying to connect to device '%s'",
|
||||||
device_info->GetDisplayID ().GetAscii ());
|
device_info->GetDisplayID ().GetAscii ());
|
||||||
|
|
||||||
src->device = PvDevice::CreateAndConnect (device_info, &pvRes);
|
src->device = PvDevice::CreateAndConnect (device_info, &pvRes);
|
||||||
if (src->device == NULL) {
|
if (src->device == NULL) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
|
||||||
("Unable to create and connect to device"), (NULL));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
GST_DEBUG_OBJECT (src, "Connected to device");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device_info->GetType() == PvDeviceInfoTypeGEV ||
|
|
||||||
device_info->GetType() == PvDeviceInfoTypePleoraProtocol) {
|
|
||||||
GST_DEBUG_OBJECT (src, "Opening multicast stream");
|
|
||||||
PvStreamGEV *stream = new PvStreamGEV;
|
|
||||||
// FIXME: need to add prop for enabling multicast
|
|
||||||
stream->Open(device_info->GetConnectionID(), src->multicast_group, src->port);
|
|
||||||
src->stream = stream;
|
|
||||||
} else {
|
|
||||||
src->stream =
|
|
||||||
PvStream::CreateAndOpen (device_info->GetConnectionID (), &pvRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src->stream == NULL) {
|
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||||
("Unable to create and connect to device"), (NULL));
|
("Unable to create and connect to device"), (NULL));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
GST_DEBUG_OBJECT (src, "Connected to device");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device_info->GetType () == PvDeviceInfoTypeGEV ||
|
||||||
|
device_info->GetType () == PvDeviceInfoTypePleoraProtocol) {
|
||||||
|
GST_DEBUG_OBJECT (src, "Opening multicast stream");
|
||||||
|
PvStreamGEV *stream = new PvStreamGEV;
|
||||||
|
// FIXME: need to add prop for enabling multicast
|
||||||
|
stream->Open (device_info->GetConnectionID (), src->multicast_group,
|
||||||
|
src->port);
|
||||||
|
src->stream = stream;
|
||||||
|
} else {
|
||||||
|
src->stream =
|
||||||
|
PvStream::CreateAndOpen (device_info->GetConnectionID (), &pvRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (src->stream == NULL) {
|
||||||
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||||
|
("Unable to create and connect to device"), (NULL));
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (src, "Stream created for device");
|
GST_DEBUG_OBJECT (src, "Stream created for device");
|
||||||
|
|
||||||
@ -820,28 +821,29 @@ gst_pleorasrc_start (GstBaseSrc * bsrc)
|
|||||||
|
|
||||||
/* command stream to start */
|
/* command stream to start */
|
||||||
if (!src->receiver_only) {
|
if (!src->receiver_only) {
|
||||||
PvGenParameterArray *lDeviceParams = src->device->GetParameters ();
|
PvGenParameterArray *lDeviceParams = src->device->GetParameters ();
|
||||||
PvGenCommand *start_cmd =
|
PvGenCommand *start_cmd =
|
||||||
dynamic_cast < PvGenCommand * >(lDeviceParams->Get ("AcquisitionStart"));
|
dynamic_cast <
|
||||||
|
PvGenCommand * >(lDeviceParams->Get ("AcquisitionStart"));
|
||||||
|
|
||||||
if (start_cmd == NULL) {
|
if (start_cmd == NULL) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
|
GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
|
||||||
("Failed to get device AcquisitionStart parameter"), (NULL));
|
("Failed to get device AcquisitionStart parameter"), (NULL));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
pvRes = src->device->StreamEnable ();
|
pvRes = src->device->StreamEnable ();
|
||||||
if (!pvRes.IsOK ()) {
|
if (!pvRes.IsOK ()) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Failed to enable stream"),
|
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Failed to enable stream"),
|
||||||
(NULL));
|
(NULL));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
pvRes = start_cmd->Execute ();
|
pvRes = start_cmd->Execute ();
|
||||||
if (!pvRes.IsOK ()) {
|
if (!pvRes.IsOK ()) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Failed to start acquisition"),
|
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Failed to start acquisition"),
|
||||||
(NULL));
|
(NULL));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -874,11 +876,11 @@ gst_pleorasrc_stop (GstBaseSrc * bsrc)
|
|||||||
GST_DEBUG_OBJECT (src, "stop");
|
GST_DEBUG_OBJECT (src, "stop");
|
||||||
|
|
||||||
if (!src->receiver_only) {
|
if (!src->receiver_only) {
|
||||||
PvGenParameterArray *lDeviceParams = src->device->GetParameters ();
|
PvGenParameterArray *lDeviceParams = src->device->GetParameters ();
|
||||||
PvGenCommand *lStop =
|
PvGenCommand *lStop =
|
||||||
dynamic_cast < PvGenCommand * >(lDeviceParams->Get ("AcquisitionStop"));
|
dynamic_cast < PvGenCommand * >(lDeviceParams->Get ("AcquisitionStop"));
|
||||||
lStop->Execute ();
|
lStop->Execute ();
|
||||||
src->device->StreamDisable ();
|
src->device->StreamDisable ();
|
||||||
}
|
}
|
||||||
src->pipeline->Stop ();
|
src->pipeline->Stop ();
|
||||||
|
|
||||||
@ -1026,8 +1028,8 @@ pvbuffer_release (void *data)
|
|||||||
{
|
{
|
||||||
VideoFrame *frame = (VideoFrame *) data;
|
VideoFrame *frame = (VideoFrame *) data;
|
||||||
if (frame->src->pipeline) {
|
if (frame->src->pipeline) {
|
||||||
// TODO: should use a mutex in case _stop is being called at the same time
|
// TODO: should use a mutex in case _stop is being called at the same time
|
||||||
frame->src->pipeline->ReleaseBuffer (frame->buffer);
|
frame->src->pipeline->ReleaseBuffer (frame->buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1045,34 +1047,37 @@ gst_pleorasrc_create (GstPushSrc * psrc, GstBuffer ** buf)
|
|||||||
GST_LOG_OBJECT (src, "create");
|
GST_LOG_OBJECT (src, "create");
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
pvRes = src->pipeline->RetrieveNextBuffer (&pvbuffer, src->timeout, &opRes);
|
pvRes = src->pipeline->RetrieveNextBuffer (&pvbuffer, src->timeout, &opRes);
|
||||||
if (!pvRes.IsOK()) {
|
if (!pvRes.IsOK ()) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Failed to retrieve buffer in timeout (%d ms): 0x%04x, '%s'", src->timeout, pvRes.GetCode(), pvRes.GetDescription().GetAscii()), (NULL));
|
GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
|
||||||
return GST_FLOW_ERROR;
|
("Failed to retrieve buffer in timeout (%d ms): 0x%04x, '%s'",
|
||||||
}
|
src->timeout, pvRes.GetCode (),
|
||||||
|
pvRes.GetDescription ().GetAscii ()), (NULL));
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
// continue if we get a bad frame
|
||||||
|
if (!opRes.IsOK ()) {
|
||||||
|
GST_WARNING_OBJECT (src, "Failed to get buffer: 0x%04x, '%s'",
|
||||||
|
opRes.GetCode (), opRes.GetCodeString ().GetAscii ());
|
||||||
|
src->pipeline->ReleaseBuffer (pvbuffer);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// continue if we get a bad frame
|
if (pvbuffer->GetPayloadType () != PvPayloadTypeImage) {
|
||||||
if (!opRes.IsOK()) {
|
/* TODO: are non-image buffers normal? */
|
||||||
GST_WARNING_OBJECT(src, "Failed to get buffer: 0x%04x, '%s'", opRes.GetCode(), opRes.GetCodeString().GetAscii());
|
GST_ERROR_OBJECT (src, "Got buffer with non-image data");
|
||||||
src->pipeline->ReleaseBuffer(pvbuffer);
|
GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
|
||||||
continue;
|
("Got buffer with non-image data"), (NULL));
|
||||||
}
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (pvbuffer->GetPayloadType () != PvPayloadTypeImage) {
|
pvimage = pvbuffer->GetImage ();
|
||||||
/* TODO: are non-image buffers normal? */
|
|
||||||
GST_ERROR_OBJECT (src, "Got buffer with non-image data");
|
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
|
|
||||||
("Got buffer with non-image data"), (NULL));
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
pvimage = pvbuffer->GetImage ();
|
break;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *caps_string =
|
const char *caps_string =
|
||||||
gst_pleorasrc_pixel_type_to_gst_caps_string (pvimage->GetPixelType ());
|
gst_pleorasrc_pixel_type_to_gst_caps_string (pvimage->GetPixelType ());
|
||||||
|
|
||||||
/* TODO: cache previous caps_string */
|
/* TODO: cache previous caps_string */
|
||||||
if (caps_string != NULL) {
|
if (caps_string != NULL) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user