コード例 #1
0
int MmeYuvGrabber::consume(const u_char* buffer, int length)
{
	suppress(buffer, frame_);
	saveblks(buffer);
	YuvFrame f(media_ts(), frame_, crvec_, outw_, outh_);
	return (target_->consume(&f));
}
コード例 #2
0
ファイル: grabber-win32DS.cpp プロジェクト: pierz/vic
int DirectShowGrabber::grab() {
   int rval;

   /*
   debug_msg("DirectShowGrabber::grab: thread=%x w=%d h=%d frame_=%p fsize_=%d in=%dx%d out=%dx%d\n",
             GetCurrentThreadId(),
             basewidth_, baseheight_, frame_, framesize_,
             inw_, inh_, outw_, outh_);
   */

   WaitForSingleObject(cb_mutex_, INFINITE);

   if( last_frame_ == NULL || capturing_ == 0 ) {
      ReleaseMutex(cb_mutex_);
      return FALSE;
   }

   converter_->convert((u_int8_t*)last_frame_, basewidth_ / decimate_,
                       baseheight_ / decimate_, frame_, outw_, outh_, TRUE);

   last_frame_ = NULL;

   suppress(frame_);
   saveblks(frame_);
   YuvFrame f(media_ts(), frame_, crvec_, outw_, outh_);

   rval = (target_->consume(&f));

   // release block so that callback can get new frame
   ReleaseMutex(cb_mutex_);

   return rval;
}
コード例 #3
0
ファイル: grabber-xv.cpp プロジェクト: pierz/vic
int XvGrabber::grab()
{
	capwin_->capture(frame_);
	suppress(frame_);
	saveblks(frame_);
	YuvFrame f(media_ts(), frame_, crvec_, outw_, outh_);
	return (target_->consume(&f));
}
コード例 #4
0
int MmeJpegGrabber::consume(const u_char* p, int length)
{
/*    fprintf(stderr, "vic: Called MmeJpegGrabber::consume()\n"); */
	/*
	 * We should get a better timestamp XXX
	 */
	JpegFrame f(media_ts(), (u_char*)p, length, q_, 0, inw_, inh_);
	return (target_->consume(&f));
}
コード例 #5
0
ファイル: media-timer.cpp プロジェクト: uclmediatools/vic
/*
 * compute media time corresponding to the current unix time.
 * in this generic routine, this is the same as media_ts() but,
 * if a grabber has hardware or kernel timestamping, this routine
 * must compute the correspondence between the hardware timestamp
 * and the unix clock and appropriately offset the timestamp to
 * correspond to the current clock.  (This information if vital
 * for cross-media synchronization.)
 */
u_int32_t MediaTimer::ref_ts()
{
    return (media_ts());
}
コード例 #6
0
ファイル: grabber-video4linux.cpp プロジェクト: pierz/vic
int V4lGrabber::grab()
{
    char *fr = NULL;

    // debug_msg((sync_count % 2) ? "o" : "e");

    if (have_mmap) {
	fr = mem + (gb_buffers.offsets[(sync_count % 2) ? 1 : 0]);

	if (-1 == ioctl(fd_, VIDIOCSYNC, (sync_count % 2) ? &one : &zero) < 0) {
	    perror("ioctl VIDIOCSYNC");
	    printf("Syncerror SyncCount %d\n", sync_count);
	}
	else {
	    sync_count++;
	}
    }
    else {
	/* FIXME: read() */
    }

    switch (cformat_) {
    case CF_411:
    case CF_CIF:
/*		    
	if (have_422)         
	    packed422_to_planar411((char*)frame_,fr);
	else {
	   //  have_420P 
	   // vcvt_420p_411p(width_, height_, (char *)fr, frame_);  
	   // erwartet wird scheinbar 420P und nicht 411P  *wunder* 
	   memcpy((void *)frame_, (const void *)fr, (size_t)height_*width_*3/2);
	}
	break;						
	*/

	//  barz: bttv using packed422_to_planar411
	if (have_420P)
	    memcpy((void *) frame_, (const void *) fr,
		   (size_t) height_ * width_ * 3 / 2);
	else
	    packed422_to_planar411((char *) frame_, fr);
	break;

    case CF_422:
	if (have_422P)
	    memcpy((void *) frame_, (const void *) fr,
		   (size_t) height_ * width_ * 2);
	else if (have_422) {
	    packed422_to_planar422((char *) frame_, fr);
	}
	else {
	    //  have_420P 
	    vcvt_420p_422p(width_, height_, (char *) fr, frame_);
	}
	break;
    }

    // FIXED by barz 2006/9/19: not grab immediately after start
    if (sync_count > 1) {

	if (have_mmap) {
	    if (-1 ==
		ioctl(fd_, VIDIOCMCAPTURE,
		      (grab_count % 2) ? &gb_odd : &gb_even))
		perror("ioctl VIDIOMCAPTURE");
	    else
		grab_count++;
	}
    }

    suppress(frame_);
    saveblks(frame_);
    YuvFrame f(media_ts(), frame_, crvec_, outw_, outh_);
    return (target_->consume(&f));
}