Changeset 16766 for trunk/Cosy/videodev
- Timestamp:
- 06/07/13 23:30:10 (12 years ago)
- Location:
- trunk/Cosy/videodev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosy/videodev/MVideo.cc
r8869 r16766 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 1/2008 <mailto:t bretz@astro.uni-wuerzburg.de>18 ! Author(s): Thomas Bretz 1/2008 <mailto:thomas.bretz@epfl.ch> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-20 0820 ! Copyright: MAGIC Software Development, 2000-2011 21 21 ! 22 22 ! … … 28 28 // 29 29 // Interface to Video4Linux at a simple level 30 // 31 // V4L2 spcifications from http://v4l2spec.bytesex.org/spec/ 30 32 // 31 33 ///////////////////////////////////////////////////////////////////////////// … … 84 86 void MVideo::Reset() 85 87 { 88 fInputs.clear(); 89 fStandards.clear(); 90 86 91 memset(&fCaps, 0, sizeof(fCaps)); 87 92 memset(&fChannel, 0, sizeof(fChannel)); 88 memset(&fBuffer, 0, sizeof(fBuffer));93 // memset(&fBuffer, 0, sizeof(fBuffer)); 89 94 memset(&fAbil, 0, sizeof(fAbil)); 90 95 … … 113 118 // FIXME: This call is a possible source for a hangup 114 119 const int rc = ioctl(fFileDesc, req, opt); 115 if (rc>=0) 116 return rc; 120 if (rc==0) 121 return 0; 122 123 if (errno==EINVAL) 124 return 1; 125 126 if (!allowirq && errno==EAGAIN) 127 return -4; 128 129 cout <<"errno="<< errno << endl; 117 130 118 131 // errno== 4: Interrupted system call (e.g. by alarm()) … … 331 344 } 332 345 346 template<class S> 347 Bool_t MVideo::Enumerate(vector<S> &vec, int request) 348 { 349 for (int i=0; ; i++) 350 { 351 S input; 352 input.index = i; 353 354 const int rc = Ioctl(request, &input); 355 if (rc<0) 356 return kFALSE; 357 if (rc==1) 358 return kTRUE; 359 360 vec.push_back(input); 361 } 362 363 return kFALSE; 364 } 365 366 void MVideo::PrintInputs() const 367 { 368 gLog << all; 369 for (vector<v4l2_input>::const_iterator it=fInputs.begin(); it!=fInputs.end(); it++) 370 { 371 gLog << "Input #" << it->index << endl; 372 gLog << " - " << it->name << endl; 373 gLog << " - " << (it->type==V4L2_INPUT_TYPE_CAMERA?"Camera":"Tuner") << endl; 374 gLog << " - TV Standard: " << hex << it->std << dec << endl; 375 376 gLog << " - Status: 0x" << hex << it->status; 377 if (it->status&V4L2_IN_ST_NO_POWER) 378 gLog << " NoPower"; 379 if (it->status&V4L2_IN_ST_NO_SIGNAL) 380 gLog << " NoSignal"; 381 if (it->status&V4L2_IN_ST_NO_COLOR) 382 gLog << " NoColor"; 383 if (it->status&V4L2_IN_ST_NO_H_LOCK) 384 gLog << " NoHLock"; 385 if (it->status&V4L2_IN_ST_COLOR_KILL) 386 gLog << " ColorKill"; 387 gLog << endl; 388 389 /* 390 TV Standard 391 =========== 392 #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) 393 #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) 394 #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) 395 #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) 396 #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) 397 #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) 398 #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) 399 #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) 400 401 #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) 402 #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) 403 #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) 404 #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) 405 V4L2_STD_PAL_60 is a hybrid standard with 525 lines, 60 Hz refresh rate, and PAL color modulation with a 4.43 MHz color subcarrier. Some PAL video recorders can play back NTSC tapes in this mode for display on a 50/60 Hz agnostic PAL TV. 406 407 #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) 408 #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) 409 #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) 410 V4L2_STD_NTSC_443 is a hybrid standard with 525 lines, 60 Hz refresh rate, and NTSC color modulation with a 4.43 MHz color subcarrier. 411 412 #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) 413 414 #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) 415 #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) 416 #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) 417 #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) 418 #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) 419 #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) 420 #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) 421 #define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) 422 423 424 // ATSC/HDTV 425 #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) 426 #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) 427 V4L2_STD_ATSC_8_VSB and V4L2_STD_ATSC_16_VSB are U.S. terrestrial digital TV standards. Presently the V4L2 API does not support digital TV. See also the Linux DVB API at http://linuxtv.org. 428 429 #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B | V4L2_STD_PAL_B1 | V4L2_STD_PAL_G) 430 #define V4L2_STD_B (V4L2_STD_PAL_B | V4L2_STD_PAL_B1 | V4L2_STD_SECAM_B) 431 #define V4L2_STD_GH (V4L2_STD_PAL_G | V4L2_STD_PAL_H | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H) 432 #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D | V4L2_STD_PAL_D1 | V4L2_STD_PAL_K) 433 #define V4L2_STD_PAL (V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_H | V4L2_STD_PAL_I) 434 #define V4L2_STD_NTSC (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_M_KR) 435 #define V4L2_STD_MN (V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | V4L2_STD_NTSC) 436 #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D | V4L2_STD_SECAM_K | V4L2_STD_SECAM_K1) 437 #define V4L2_STD_DK (V4L2_STD_PAL_DK | V4L2_STD_SECAM_DK) 438 #define V4L2_STD_SECAM (V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H | V4L2_STD_SECAM_DK | V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC) 439 #define V4L2_STD_525_60 (V4L2_STD_PAL_M | V4L2_STD_PAL_60 | V4L2_STD_NTSC | V4L2_STD_NTSC_443) 440 #define V4L2_STD_625_50 (V4L2_STD_PAL | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | V4L2_STD_SECAM) 441 #define V4L2_STD_UNKNOWN 0 442 #define V4L2_STD_ALL (V4L2_STD_525_60 | V4L2_STD_625_50) 443 */ 444 445 /* 446 Status: 447 ======= 448 General 449 V4L2_IN_ST_NO_POWER 0x00000001 Attached device is off. 450 V4L2_IN_ST_NO_SIGNAL 0x00000002 451 V4L2_IN_ST_NO_COLOR 0x00000004 The hardware supports color decoding, but does not detect color modulation in the signal. 452 453 Analog Video 454 V4L2_IN_ST_NO_H_LOCK 0x00000100 No horizontal sync lock. 455 V4L2_IN_ST_COLOR_KILL 0x00000200 A color killer circuit automatically disables color decoding when it detects no color modulation. When this flag is set the color killer is enabled and has shut off color decoding. 456 457 Digital Video 458 V4L2_IN_ST_NO_SYNC 0x00010000 No synchronization lock. 459 V4L2_IN_ST_NO_EQU 0x00020000 No equalizer lock. 460 V4L2_IN_ST_NO_CARRIER 0x00040000 Carrier recovery failed. 461 462 VCR and Set-Top Box 463 V4L2_IN_ST_MACROVISION 0x01000000 Macrovision is an analog copy prevention system mangling the video signal to confuse video recorders. When this flag is set Macrovision has been detected. 464 V4L2_IN_ST_NO_ACCESS 0x02000000 Conditional access denied. 465 V4L2_IN_ST_VTR 0x04000000 VTR time constant. [?] 466 */ 467 } 468 } 469 470 void MVideo::PrintStandards() const 471 { 472 gLog << all; 473 for (vector<v4l2_standard>::const_iterator it=fStandards.begin(); it!=fStandards.end(); it++) 474 { 475 gLog << "Index #" << it->index << endl; 476 gLog << " - TV Standard: " << it->name << hex << "(" << it->id << ")" << dec << endl; 477 gLog << " - FPS: " << it->frameperiod.numerator << "/" << it->frameperiod.denominator << endl; 478 gLog << " - Lines: " << it->framelines << endl; 479 } 480 } 333 481 334 482 // ------------------------------------------------------------- … … 338 486 Bool_t MVideo::Open(Int_t ch) 339 487 { 340 Bool_t rc = Init(ch);488 const Bool_t rc = Init(ch); 341 489 if (!rc) 342 490 Close(); … … 361 509 do 362 510 { 363 fFileDesc = open(fPath, O_RDWR );511 fFileDesc = open(fPath, O_RDWR|O_NONBLOCK, 0); 364 512 usleep(1); 365 513 } … … 381 529 } 382 530 383 gLog << warn << "Setting video standard to PAL-N." << endl; 384 385 fVideoStandard = V4L2_STD_PAL_N; 386 if (Ioctl(VIDIOC_S_STD, &fVideoStandard)==-1) 387 { 388 gLog << err << "ERROR - Could not set video standard to PAL-N." << endl; 389 return kFALSE; 390 } 391 392 if (!EnumerateControls()) 393 { 394 gLog << err << "ERROR - Could not enumerate controls." << endl; 395 return kFALSE; 396 } 397 398 if (!ResetControls()) 399 { 400 gLog << err << "ERROR - Could not reset controls to default." << endl; 401 return kFALSE; 402 } 403 404 if (!GetCapabilities()) 405 { 406 gLog << err << "ERROR - Getting device capabilities failed." << endl; 407 return kFALSE; 408 } 409 410 if (!SetChannel(channel)) 411 return kFALSE; 412 413 if (!GetProperties()) 414 { 415 gLog << err << "ERROR - Couldn't get picture properties." << endl; 416 return kFALSE; 417 } 531 532 418 533 /* 419 if (HasTuner()) 420 { 421 if (!GetTunerAbilities()) 534 if (!Enumerate(fInputs, VIDIOC_ENUMINPUT)) 535 { 536 gLog << err << "ERROR - Could not enumerate inputs." << endl; 537 return kFALSE; 538 } 539 PrintInputs(); 540 541 if (!Enumerate(fStandards, VIDIOC_ENUMSTD)) 542 { 543 gLog << err << "ERROR - Could not enumerate inputs." << endl; 544 return kFALSE; 545 } 546 PrintStandards(); 547 */ 548 549 int index = 3; 550 if (Ioctl(VIDIOC_S_INPUT, &index)==-1) 551 { 552 gLog << err << "ERROR - Could not set input." << endl; 553 return kFALSE; 554 } 555 556 //check the input 557 if (Ioctl(VIDIOC_G_INPUT, &index)) 558 { 559 gLog << err << "ERROR - Could not get input." << endl; 560 return kFALSE; 561 } 562 563 v4l2_input input; 564 memset(&input, 0, sizeof (input)); 565 input.index = index; 566 if (Ioctl(VIDIOC_ENUMINPUT, &input)) 567 { 568 gLog << err << "ERROR - Could enum input." << endl; 569 return kFALSE; 570 } 571 gLog << "*** Input: " << input.name << " (" << input.index << ")" << endl; 572 573 v4l2_std_id st = 4;//standard.id; 574 if (Ioctl (VIDIOC_S_STD, &st)) 575 { 576 gLog << err << "ERROR - Could not set standard." << endl; 577 return kFALSE; 578 } 579 580 v4l2_capability cap; 581 if (Ioctl(VIDIOC_QUERYCAP, &cap)) 582 { 583 gLog << err << "ERROR - Could not get capabilities." << endl; 584 return kFALSE; 585 } 586 587 if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) 588 { 589 gLog << err << "ERROR - No capture capabaility." << endl; 590 return kFALSE; 591 } 592 593 v4l2_cropcap cropcap; 594 cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 595 596 if (Ioctl(VIDIOC_CROPCAP, &cropcap)==-1) 597 { 598 } 599 600 v4l2_crop crop; 601 crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 602 crop.c = cropcap.defrect; /* reset to default */ 603 604 if (Ioctl(VIDIOC_S_CROP, &crop)) 605 { 606 gLog << err << "Could not reset cropping." << endl; 607 return kFALSE; 608 } 609 610 v4l2_format fmt; 611 fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 612 fmt.fmt.pix.width = 768; 613 fmt.fmt.pix.height = 576; 614 fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB32; 615 616 if (Ioctl(VIDIOC_S_FMT, &fmt)==-1) 617 { 618 gLog << err << "ERROR - Could not set format." << endl; 619 return kFALSE; 620 } 621 // The image format must be selected before buffers are allocated, 622 // with the VIDIOC_S_FMT ioctl. When no format is selected the driver 623 // may use the last, possibly by another application requested format. 624 625 v4l2_requestbuffers reqbuf; 626 memset (&reqbuf, 0, sizeof (reqbuf)); 627 628 reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 629 reqbuf.memory = V4L2_MEMORY_MMAP; 630 reqbuf.count = 4;//125; 631 632 if (Ioctl(VIDIOC_REQBUFS, &reqbuf)==-1) 633 { 634 gLog << err << "ERROR - Couldn't setup frame buffers." << endl; 635 return kFALSE; 636 } 637 638 gLog << all << "Allocated " << reqbuf.count << " frame buffers." << endl; 639 640 for (unsigned int i=0; i<reqbuf.count; i++) 641 { 642 v4l2_buffer buffer; 643 memset (&buffer, 0, sizeof (buffer)); 644 645 buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 646 buffer.memory = V4L2_MEMORY_MMAP; 647 buffer.index = i; 648 649 if (Ioctl(VIDIOC_QUERYBUF, &buffer)) 422 650 { 423 gLog << err << "ERROR - Couldn't get tuner abilities." << endl;651 gLog << err << "ERROR - Request of frame buffer " << i << " failed." << endl; 424 652 return kFALSE; 425 653 } 426 } 427 */ 428 // get mmap grab buffer info 429 if (Ioctl(VIDIOCGMBUF, &fBuffer)==-1) 430 { 431 gLog << err << "ERROR - Couldn't get info about memory map buffer." << endl; 432 return kFALSE; 433 } 434 435 // map file (device) into memory 436 fMapBuffer = (unsigned char*)mmap(0, fBuffer.size, PROT_READ|PROT_WRITE, MAP_SHARED, fFileDesc, 0); 437 if (fMapBuffer == (void*)-1) 438 { 439 gLog << err << "ERROR - Couldn't map device buffer into memory." << endl; 440 fMapBuffer = 0; 441 return kFALSE; 442 } 443 444 Print(); 654 655 void *ptr = mmap(NULL, buffer.length, 656 PROT_READ | PROT_WRITE, 657 MAP_SHARED, 658 fFileDesc, buffer.m.offset); 659 660 if (MAP_FAILED == ptr) 661 { 662 663 gLog << err << "ERROR - Could not allocate shared memory." << endl; 664 return kFALSE; 665 // If you do not exit here you should unmap() and free() 666 // the buffers mapped so far. 667 //perror ("mmap"); 668 //exit (EXIT_FAILURE); 669 } 670 671 fBuffers.push_back(make_pair(buffer, ptr)); 672 } 673 674 return kTRUE; 675 } 676 677 Bool_t MVideo::Start() 678 { 679 v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 680 if (Ioctl(VIDIOC_STREAMON, &type)==-1) 681 { 682 gLog << err << "ERROR - Couldn't start capturing." << endl; 683 return kFALSE; 684 } 685 686 cout << "*** Stream on" << endl; 445 687 446 688 return kTRUE; … … 455 697 // if (!IsOpen()) 456 698 // return kTRUE; 457 699 /* 700 if (Ioctl(VIDIOC_STREAMON, &fBuffers[0])==-1) 701 { 702 gLog << err << "ERROR - Couldn't start capturing." << endl; 703 return kFALSE; 704 } 705 */ 458 706 Bool_t rc = kTRUE; 459 707 … … 471 719 472 720 // unmap device memory 473 if (fMapBuffer) 474 munmap(fMapBuffer, fBuffer.size); 721 for (vector<pair<v4l2_buffer,void*> >::iterator it=fBuffers.begin(); it!=fBuffers.end(); it++) 722 { 723 munmap(it->second, it->first.length); 724 fBuffers.erase(it); 725 } 475 726 476 727 Reset(); … … 485 736 Bool_t MVideo::CaptureStart(unsigned int frame) const 486 737 { 487 frame %= fBuffer.frames; 488 738 frame %= fBuffers.size(); 739 740 // cout << "*** CaptureStart " << frame << endl; 741 742 if (Ioctl(VIDIOC_QBUF, const_cast<v4l2_buffer*>(&fBuffers[frame].first))==-1) 743 { 744 gLog << err << "ERROR - Couldn't buffer " << frame << "." << endl; 745 return kFALSE; 746 } 747 748 // cout << "*** " << errno << endl; 749 750 return kTRUE; 751 752 /* 489 753 struct video_mmap gb = 490 754 { … … 508 772 gLog << "ERROR - Couldn't start capturing frame " << frame << "." << endl; 509 773 gLog << " Maybe your card doesn't support VIDEO_PALETTE_RGB24." << endl; 510 511 774 return kFALSE; 775 */ 512 776 } 513 777 … … 518 782 Int_t MVideo::CaptureWait(unsigned int frame, unsigned char **ptr) const 519 783 { 520 frame %= fBuffer .frames;784 frame %= fBuffers.size(); 521 785 522 786 if (ptr) 523 787 *ptr = NULL; 524 788 525 const int SYNC_TIMEOUT = 1;526 527 #ifdef DEBUG528 gLog << dbg << "CaptureWait(" << frame << ")"<< endl;529 #endif530 531 alarm(SYNC_TIMEOUT);532 const Int_t rc = Ioctl(VIDIOC SYNC, &frame, false);789 // const int SYNC_TIMEOUT = 1; 790 791 //#ifdef DEBUG 792 // cout << "*** CaptureWait " << frame << endl; 793 //#endif 794 795 //alarm(SYNC_TIMEOUT); 796 const Int_t rc = Ioctl(VIDIOC_DQBUF, const_cast<v4l2_buffer*>(&fBuffers[frame].first), false); 533 797 if (rc==-4) 534 798 { … … 536 800 return kSKIP; 537 801 } 538 alarm(0);802 //alarm(0); 539 803 540 804 if (rc==-1) … … 545 809 546 810 if (ptr) 547 *ptr = fMapBuffer+fBuffer.offsets[frame];811 *ptr = static_cast<unsigned char*>(fBuffers[frame].second); 548 812 549 813 return kTRUE; … … 556 820 Int_t MVideo::SetChannel(Int_t chan) 557 821 { 822 return kSKIP; 823 558 824 if (fChannel.channel==chan) 559 825 return kSKIP; … … 612 878 Int_t MVideo::GetNumBuffers() const 613 879 { 614 return fBuffer .frames;880 return fBuffers.size(); 615 881 } 616 882 … … 621 887 Int_t MVideo::GetWidth() const 622 888 { 623 return fCaps.maxwidth;889 return 768;//fCaps.maxwidth; 624 890 } 625 891 … … 630 896 Int_t MVideo::GetHeight() const 631 897 { 632 return fCaps.maxheight;898 return 576;//fCaps.maxheight; 633 899 } 634 900 … … 775 1041 gLog << all << dec; 776 1042 777 gLog << "Device " << fPath << " " << ( IsOpen()?"open":"closed") << "." << endl;778 779 if ( !IsOpen())1043 gLog << "Device " << fPath << " " << (fFileDesc>0?"open":"closed") << "." << endl; 1044 1045 if (fFileDesc<=0) 780 1046 return; 781 1047 … … 801 1067 gLog << " - Tuner: " << fAbil.tuner << endl; 802 1068 gLog << " - Name: " << fAbil.name << endl; 803 gLog << " - Tuner Range: " << fAbil.rangelow << " - " << fAbil.rangehigh << endl;1069 // gLog << " - Tuner Range: " << fAbil.rangelow << " - " << fAbil.rangehigh << endl; 804 1070 gLog << " - Tuner flags: " << GetTunerFlags(fAbil.flags) << " (" << fAbil.flags << ")" << endl; 805 1071 gLog << " - Tuner mode: " << GetTunerMode(fAbil.mode) << " (" << fAbil.mode << ")" <<endl; … … 816 1082 gLog << endl; 817 1083 818 gLog << " - BufferSize: 0x" << hex << fBuffer.size << " (" << dec << fBuffer.frames << " frames)" << endl;819 gLog << " - Offsets: " << hex;820 for (int i=0; i<fBuffer.frames; i++)821 gLog << " 0x" << fBuffer.offsets[i];822 gLog << dec << endl;1084 // gLog << " - BufferSize: 0x" << hex << fBuffer.size << " (" << dec << fBuffer.frames << " frames)" << endl; 1085 // gLog << " - Offsets: " << hex; 1086 // for (int i=0; i<fBuffer.frames; i++) 1087 // gLog << " 0x" << fBuffer.offsets[i]; 1088 // gLog << dec << endl; 823 1089 824 1090 gLog << inf2 << "Controls:" << endl; -
trunk/Cosy/videodev/MVideo.h
r8862 r16766 8 8 #ifndef __CINT__ 9 9 #ifndef __LINUX_VIDEODEV_H 10 #include <linux/videodev.h>// video4linux10 #include "videodev.h" // video4linux 11 11 #endif 12 12 #ifndef __LINUX_VIDEODEV2_H … … 15 15 #endif 16 16 17 #include <vector> 18 17 19 struct v4l2_queryctrl; 20 struct v4l2_input; 21 struct v4l2_standard; 22 struct v4l2_buffer; 23 18 24 class TEnv; 19 25 … … 53 59 struct video_capability fCaps; // Device capabilities 54 60 struct video_channel fChannel; // Channel information 55 struct video_mbuf fBuffer; // Buffer information61 //struct video_mbuf fBuffer; // Buffer information 56 62 struct video_picture fProp; // Picture properties 57 63 struct video_tuner fAbil; // Tuner abilities 58 64 59 65 ULong64_t fVideoStandard; 66 67 std::vector<v4l2_input> fInputs; 68 std::vector<v4l2_standard> fStandards; 69 std::vector<std::pair<v4l2_buffer, void*> > fBuffers; 60 70 61 71 TList fControls; … … 74 84 Bool_t Init(Int_t channel); 75 85 86 template<class S> 87 Bool_t Enumerate(std::vector<S> &s, int request); 88 89 void PrintInputs() const; 90 void PrintStandards() const; 91 76 92 // Conversion functions 77 93 TString GetDevType(int type) const; … … 83 99 84 100 public: 85 MVideo(const char *path="/dev/video ");101 MVideo(const char *path="/dev/video0"); 86 102 virtual ~MVideo() { Close(); } 87 103 88 104 // Getter 89 Bool_t IsOpen() const { return fFileDesc>0 && f MapBuffer; }105 Bool_t IsOpen() const { return fFileDesc>0 && fBuffers.size()>0; } 90 106 Bool_t CanCapture() const; 91 107 Bool_t HasTuner() const; … … 109 125 Bool_t CaptureStart(unsigned int frame) const; 110 126 Int_t CaptureWait(unsigned int frame, unsigned char **ptr=0) const; 127 Bool_t Start(); 111 128 112 129 // Support
Note:
See TracChangeset
for help on using the changeset viewer.