Exemple #1
0
static int
iclass_scan (pixma_t * s)
{
  int error, n;
  iclass_t *mf = (iclass_t *) s->subdriver;
  uint8_t *buf, ignore;
  unsigned buf_len, ignore2;

  if (mf->state != state_idle)
    return PIXMA_EBUSY;

  /* clear interrupt packets buffer */
  while (handle_interrupt (s, 0) > 0)
    {
    }

  mf->raw_width = ALIGN_SUP (s->param->w, 32);
  PDBG (pixma_dbg (3, "raw_width = %u\n", mf->raw_width));

  n = IMAGE_BLOCK_SIZE / s->param->line_size + 1;
  buf_len = (n + 1) * s->param->line_size + IMAGE_BLOCK_SIZE;
  if (buf_len > mf->buf_len)
    {
      buf = (uint8_t *) realloc (mf->buf, buf_len);
      if (!buf)
	return PIXMA_ENOMEM;
      mf->buf = buf;
      mf->buf_len = buf_len;
    }
  mf->lineptr = mf->buf;
  mf->blkptr = mf->buf + n * s->param->line_size;
  mf->blk_len = 0;

  error = step1 (s);
  if (error >= 0 && (s->param->adf_pageid == 0 || mf->generation == 1))
    { /* single sheet or first sheet from ADF */
      PDBG (pixma_dbg (3, "*iclass_scan***** start scanning *****\n"));
      error = start_session (s);
      if (error >= 0)
        mf->state = state_scanning;
      if (error >= 0)
        error = select_source (s);
    }
  else if (error >= 0)
    { /* next sheet from ADF */
      PDBG (pixma_dbg (3, "*iclass_scan***** scan next sheet from ADF  *****\n"));
      mf->state = state_scanning;
    }
  if (error >= 0)
    error = send_scan_param (s);
  if (error >= 0)
    error = request_image_block (s, 0, &ignore, &ignore2, &ignore, &ignore2);
  if (error < 0)
    {
      iclass_finish_scan (s);
      return error;
    }
  mf->last_block = 0;
  return 0;
}
Exemple #2
0
Marx_Source_Type *marx_create_source (Param_File_Type *p) /*{{{*/
{
   Marx_Source_Type *st;

   if (-1 == pf_get_parameters (p, Source_Parm_Table))
     return NULL;

   st = (Marx_Source_Type *) marx_malloc (sizeof (Marx_Source_Type));
   if (st == NULL) return st;

   memset ((char *) st, 0, sizeof (Marx_Source_Type));

   /* Scale to mm */
   Source_Distance = Source_Distance * 1000.0;

   /* Convert from minutes to radians */
   Source_Azimuth = Source_Azimuth * (PI / 180.0 / 60.0);
   Source_Elevation = Source_Elevation * (PI / 180.0 / 60.0);

   /* Convert from degrees to radians */
   Source_Ra *= (PI / 180.0);
   Source_Dec *= (PI / 180.0);

   if (-1 == select_source (st, p, Source_Name))
     {
	marx_free ((char *) st);
	return NULL;
     }
   return st;
}
Exemple #3
0
recChannel_t::recChannel_t(
		int ID,			//channel ID
        const char *title, //Window Title
        windowInfo_t *geom //Window info
		):channel_t(ID,title,geom){

    __CONTEXT("recChannel_t::recChannel_t");
   
    int hr = 0;
	frameRate = 0;
	pSource  = NULL;
	pSender  = NULL;
#ifdef _WINDOWS
    fControl = NULL;
    hThread = 0;
    hThreadPos = 0;
#endif
	frameRate = 1.0;
	all = true;


	looper = new looper_t(this);

	Kind = REC;
	
	camInfo = NULL;
	capInfo.heigth = DEFAULT_CAPTURE_HEIGTH;
	capInfo.width  = DEFAULT_CAPTURE_WIDTH;

	if (freeSources())
	{
		for (int j = 0; j < camArray.size(); j++)
		{
			camInfo_t *camInfo= camArray.elementAt(j);
			if (camInfo->getFree() && camInfo->getKind() == CAM)
			{
				sourceId = camInfo->getID();
				memset(sourceFormat, 0, 100);
				all = true;
				hr = select_source(camInfo);
				camInfo->setFree(false);
				break;
			}
		}
	}
	else
	{
		set_file_source(NULL);
	}

	errorCheck(hr);	

	pSender = new sender_t(this);
	channelList->insert(getId(),this);

	rtpSession->assignSender(getId(), false, static_cast<sched_t*>(NULL));
}
Exemple #4
0
inline bool select_next_ip(operation_type operation,
            Turn& turn,
            segment_identifier const& seg_id,
            Iterator& selected)
{
    if (turn.discarded)
    {
        return false;
    }
    bool has_tp = false;
    selected = boost::end(turn.operations);
    for (Iterator it = boost::begin(turn.operations);
        it != boost::end(turn.operations);
        ++it)
    {
        if (it->visited.started())
        {
            selected = it;
            //std::cout << " RETURN";
            return true;
        }

        // In some cases there are two alternatives.
        // For "ii", take the other one (alternate)
        //           UNLESS the other one is already visited
        // For "uu", take the same one (see above);
        // For "cc", take either one, but if there is a starting one,
        //           take that one.
        if (   (it->operation == operation_continue
                && (! has_tp || it->visited.started()
                    )
                )
            || (it->operation == operation
                && ! it->visited.finished()
                && (! has_tp
                    || select_source(operation,
                            it->seg_id.source_index, seg_id.source_index)
                    )
                )
            )
        {
            selected = it;
            debug_traverse(turn, *it, " Candidate");
            has_tp = true;
        }
    }

    if (has_tp)
    {
       debug_traverse(turn, *selected, "  Accepted");
    }


    return has_tp;
}
Exemple #5
0
HRESULT 
recChannel_t::set_file_source(char * fileName)
{
	 __CONTEXT("recChannel_t::set_file_source");
	int hr = 0;

	pControl->StopWhenReady();
	
    // If any valid source is already created

	for (int i = 0; i < camArray.size(); i++)
	{
		camInfo_t *camInfo= camArray.elementAt(i);
		if (fileName != NULL)
		{
			if (camInfogetFree() && strcmp(camInfo->getCamName(), fileName) == 0)
			{
				all = true;
				select_source(camInfo);
				return 0;
			}
		}
		else
		{
	        if (camInfo->getFree() && camInfo->getKind() == TEST)
			{
				all = true;
				select_source(camInfo);
				return 0;
			}
		}
	}

    // if we must create a source

	camInfo_t *camInfo = createFileSource(fileName);
		
    all = true;
	select_source(camInfo);

	return 0;
}
Exemple #6
0
static int
mp730_scan (pixma_t * s)
{
  int error, n;
  mp730_t *mp = (mp730_t *) s->subdriver;
  uint8_t *buf;

  if (mp->state != state_idle)
    return PIXMA_EBUSY;

  /* clear interrupt packets buffer */
  while (handle_interrupt (s, 0) > 0)
    {
    }

  mp->raw_width = calc_raw_width (s, s->param);
  PDBG (pixma_dbg (3, "raw_width = %u\n", mp->raw_width));

  n = IMAGE_BLOCK_SIZE / s->param->line_size + 1;
  buf = (uint8_t *) malloc ((n + 1) * s->param->line_size + IMAGE_BLOCK_SIZE);
  if (!buf)
    return PIXMA_ENOMEM;
  mp->buf = buf;
  mp->lbuf = buf;
  mp->imgbuf = buf + n * s->param->line_size;
  mp->imgbuf_len = 0;

  error = step1 (s);
  if (error >= 0)
    error = start_session (s);
  if (error >= 0)
    mp->state = state_scanning;
  if (error >= 0)
    error = select_source (s);
  if (error >= 0)
    error = send_scan_param (s);
  if (error < 0)
    {
      mp730_finish_scan (s);
      return error;
    }
  mp->last_block = 0;
  return 0;
}
Exemple #7
0
static int
mp750_scan (pixma_t * s)
{
  mp750_t *mp = (mp750_t *) s->subdriver;
  int error;
  uint8_t *buf;
  unsigned size, dpi, spare;

  dpi = s->param->ydpi;
  /* add a stripe shift for 2400dpi */
  mp->stripe_shift = (dpi == 2400) ? 4 : 0;

  if (mp->state != state_idle)
    return PIXMA_EBUSY;

  /* clear interrupt packets buffer */
  while (handle_interrupt (s, 0) > 0)
    {
    }

  /*  if (s->param->channels == 1)
    mp->raw_width = ALIGN_SUP (s->param->w, 12);
  else
    mp->raw_width = ALIGN_SUP (s->param->w, 4);*/

  /* change to use CCD grayscale mode --- why does this give segmentation error at runtime in mp750_check_param? */
  if ((s->param->channels == 3) || (is_ccd_grayscale (s)))
    mp->raw_width = ALIGN_SUP (s->param->w, 4);
  else
    mp->raw_width = ALIGN_SUP (s->param->w, 12);
  /* not sure about MP750, but there is no need for aligning at 12 for the MP760/770, MP780/790 since always use CCD color mode */

  /* modify for stripe shift */
  spare = 2 * calc_component_shifting (s) + 2 * mp->stripe_shift; /* FIXME: or maybe (2*... + 1)? */
  mp->raw_height = s->param->h + spare;
  PDBG (pixma_dbg (3, "raw_width=%u raw_height=%u dpi=%u\n",
		   mp->raw_width, mp->raw_height, dpi));

  /* PDBG (pixma_dbg (4, "line_size=%"PRIu64"\n",s->param->line_size)); */

  mp->line_size = get_cis_ccd_line_size (s); /* scanner hardware line_size multiplied by 3 for CCD grayscale */

  size = 8 + 2 * IMAGE_BLOCK_SIZE + spare * mp->line_size;
  buf = (uint8_t *) malloc (size);
  if (!buf)
    return PIXMA_ENOMEM;
  mp->buf = buf;
  mp->rawimg = buf;
  mp->imgbuf_ofs = spare * mp->line_size;
  mp->imgcol = mp->rawimg + IMAGE_BLOCK_SIZE + 8; /* added to make rgb->gray */
  mp->img = mp->rawimg + IMAGE_BLOCK_SIZE + 8;
  mp->imgbuf_len = IMAGE_BLOCK_SIZE + mp->imgbuf_ofs;
  mp->rawimg_left = 0;
  mp->last_block_size = 0;
  mp->shifted_bytes = -(int) mp->imgbuf_ofs;

  error = step1 (s);
  if (error >= 0)
    error = start_session (s);
  if (error >= 0)
    mp->state = state_warmup;
  if (error >= 0)
    error = select_source (s);
  if (error >= 0)
    error = send_scan_param (s);
  if (error < 0)
    {
      mp750_finish_scan (s);
      return error;
    }
  return 0;
}