Пример #1
0
//--------------------------------------------------------------
int _McDelete(void *rpc_buf)
{
	g_nameParam_t *nP = (g_nameParam_t *)rpc_buf;

#ifdef DEBUG
	DPRINTF("mcserv: _McDelete port%d slot%d file %s flags %d\n", nP->port, nP->slot, nP->name, nP->flags);
#endif

	return McDelete(nP->port, nP->slot, nP->name, nP->flags);
}
Пример #2
0
static gboolean
gst_euresys_stop (GstBaseSrc * src)
{
  GstEuresys *euresys = GST_EURESYS (src);
  MCSTATUS status = 0;

  GST_DEBUG_OBJECT (euresys, "stop");

  /* Stop the acquisition */
  McSetParamInt (euresys->hChannel, MC_ChannelState, MC_ChannelState_IDLE);

  /* Delete the channel */
  if (euresys->hChannel)
    McDelete (euresys->hChannel);
  euresys->hChannel = 0;

  euresys->dropped_frame_count = 0;
  euresys->last_time_code = -1;

  return TRUE;
}
Пример #3
0
static gboolean
gst_euresys_start (GstBaseSrc * bsrc)
{
  GstEuresys *euresys = GST_EURESYS (bsrc);
  MCSTATUS status = 0;

  GST_DEBUG_OBJECT (euresys, "start");

  status =
      McGetParamInt (MC_BOARD + euresys->boardIdx, MC_BoardType,
      &euresys->boardType);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to get board type.")), (NULL));
    return FALSE;
  }

  /* Only Windows supports error message boxes */
  /* McSetParamInt (MC_CONFIGURATION, MC_ErrorHandling, MC_ErrorHandling_MSGBOX); */

  /* Set error log file */
  /* McSetParamStr (MC_CONFIGURATION, MC_ErrorLog, "mc_error.log"); */

  /* Create a channel */
  status = McCreate (MC_CHANNEL, &euresys->hChannel);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, FAILED,
        (("Failed to create channel.")), (NULL));
    return FALSE;
  }

  /* Link the channel to a board */
  status = McSetParamInt (euresys->hChannel, MC_DriverIndex, euresys->boardIdx);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to link channel to board.")), (NULL));
    goto error;
  }

  /* Select the video connector */
  status =
      McSetParamInt (euresys->hChannel, MC_Connector,
      gst_euresys_connector_map[euresys->connector]);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to set connector to channel.")), (NULL));
    goto error;
  }

  /* Select the video signal type */
  status =
      McSetParamInt (euresys->hChannel, MC_Camera,
      gst_euresys_camera_map[euresys->cameraType]);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to set camera type = %d."), euresys->cameraType), (NULL));
    goto error;
  }

  /* Set the color format */
  status =
      McSetParamInt (euresys->hChannel, MC_ColorFormat,
      gst_euresys_color_format_map[euresys->colorFormat]);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to set color format = %d."), euresys->colorFormat), (NULL));
    goto error;
  }

  /* Set the pixel timing */
  status =
      McSetParamInt (euresys->hChannel, MC_PixelTiming,
      gst_euresys_pixel_timing_map[euresys->pixelTiming]);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to set pixel timing = %d."), euresys->pixelTiming), (NULL));
    goto error;
  }

  /* Acquire images continuously */
  status = McSetParamInt (euresys->hChannel, MC_SeqLength_Fr, MC_INDETERMINATE);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to set sequence length to indeterminate value.")), (NULL));
    goto error;
  }

  /* Set number of buffers in ring */
  status =
      McSetParamInt (euresys->hChannel, MC_SurfaceCount,
      euresys->num_capture_buffers);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to set surface count.")), (NULL));
    goto error;
  }

  /* Enable signals */
  status =
      McSetParamInt (euresys->hChannel,
      MC_SignalEnable + MC_SIG_SURFACE_PROCESSING, MC_SignalEnable_ON);
  status |=
      McSetParamInt (euresys->hChannel,
      MC_SignalEnable + MC_SIG_ACQUISITION_FAILURE, MC_SignalEnable_ON);
  if (status != MC_OK) {
    GST_ELEMENT_ERROR (euresys, RESOURCE, SETTINGS,
        (("Failed to enable signals.")), (NULL));
    goto error;
  }

  return TRUE;

error:
  if (euresys->hChannel) {
    McDelete (euresys->hChannel);
    euresys->hChannel = 0;
  }
  return FALSE;
}