Results 1 to 8 of 8

Thread: grabber.openDev() problem

  1. #1
    Join Date
    Jul 2017
    Posts
    7

    grabber.openDev() problem

    Hello! I'm using MSVS 2015. When I try to open device I got Exception thrown:

    ///////////////////////////////////////////////////////////
    Exception thrown at 0x00007FFD59FC8633 (TIS_UDSHL11d_x64.dll) in IC_WriteSampleVideo.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

    If there is a handler for this exception, the program may be safely continued.
    //////////////////////////////////////////////////////////

    Code of function:
    bool select_openCam(std::vector<DShowLib::Grabber>& grabber)
    {
    // Function for choosing which cameras to open and use for writing videos
    //

    grabber.resize(1); // for getting availabeVideoCaptureDevices;

    DShowLib::Grabber::tVidCapDevListPtr pVidCapDevList = grabber[0].getAvailableVideoCaptureDevices();
    if (pVidCapDevList->size() == 0)
    {
    std::cout << "No available Devices";
    return false;
    }
    else
    {
    std::cout << "Available Devices:\n";
    unsigned int i = 0;
    for (DShowLib::Grabber::tVidCapDevList::const_iterator it=pVidCapDevList->begin(); it!=pVidCapDevList->end(); ++it)
    std::cout << i++ <<". " << it->getBaseName() << std::endl;

    // Choose number of cameras
    unsigned int ncam = 0;
    std::cout << "\nHow many cameras do you want to use for recording?";
    std::cout << "\nNcam = ";
    while (!(std::cin >> ncam) || ncam<0 || ncam > pVidCapDevList->size()) {
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsiz e>::max(), '\n');
    std::cout << "Invalid input. Try again: Ncam = ";
    }
    grabber.resize(ncam);

    if (ncam == 0)
    return false;

    // Open all cameras
    else if (ncam == pVidCapDevList->size())
    {
    /*for (unsigned int i = 0; i < ncam; ++i)
    if (!grabber[i].openDev(pVidCapDevList->at(i)))
    {
    std::cerr << "\nError to open " << pVidCapDevList->at(i).getBaseName();
    std::cerr << "\nError:" << grabber[i].getLastError().toString();
    return false;
    }*/

    for (auto i = std::make_pair(grabber.begin(), pVidCapDevList->begin()); //std::pair<std::vector<DShowLib::Grabber>::iterator , DShowLib::Grabber::tVidCapDevList::const_iterator> i(grabber.begin(), pVidCapDevList->begin())
    i.first!=grabber.end();
    ++i.first, ++i.second)
    if ( !i.first->openDev(i.second->getBaseName()) )
    {

    std::cerr << "\nError to open " << i.second->getBaseName();
    std::cerr << "\nError:" << i.first->getLastError().toString();
    return false;
    }
    }

    // Open only selected cameras
    else
    {
    std::vector<int> icam(ncam);
    bool bRepeat;
    int i = 0;
    std::cout << "\nChoose cameras (Write index of camera and press enter):\n";
    while (i != ncam)
    {
    bRepeat = false;
    while (!(std::cin >> icam[i]) || icam[i]<0 || icam[i] >= pVidCapDevList->size()) {
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsiz e>::max(), '\n');
    std::cout << "Invalid input. Try again: ";
    }

    //Check for repeted index of camera
    for (int j = 0; j<i; ++j)
    if (icam[j] == icam[i])
    {
    std::cout << "You have already chose that camera. Try again:\n";
    bRepeat = true;
    }
    if (!bRepeat)
    ++i;
    }

    // Open grabbers
    for (unsigned int i = 0; i<ncam; ++i)
    if (!grabber[i].openDev(pVidCapDevList->at(icam[i])))
    {
    std::cerr << "\nError to open " << pVidCapDevList->at(i).getBaseName();
    std::cerr << "\nError:" << grabber[i].getLastError().toString();
    return false;
    }

    }
    }

    return true;
    }

  2. #2
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,854

    Re: grabber.openDev() problem

    The error can happen, if there are cameras in the system with bad drivers. Are there other cameras in your system?
    Which output do you receive, if you change the open code at

    Code:
    // Open grabbers
    for (unsigned int i = 0; i<ncam; ++i)
    {
    	std::cerr << "\try to open " << pVidCapDevList->at(i).getBaseName();
    	if (!grabber[i].openDev(pVidCapDevList->at(icam[i])))
    	{
    		std::cerr << "\nError to open " << pVidCapDevList->at(i).getBaseName();
    		std::cerr << "\nError:" << grabber[i].getLastError().toString();
    		return false;
    	}
    }
    Best regards
    Stefan
    IC Imaging Control Support

  3. #3
    Join Date
    Jul 2017
    Posts
    7

    Re: grabber.openDev() problem

    The main notice, that that exception occurs periodically and in different adresses. Sometime it runs normal, sometimes not. Even with your code situation the same.

    But today I found the special feature. If I substitute std::vector<DShowLib::Grabber>& for DShowLib::Grabber* (and allocate memory of it), I don't have any exceptions.

    I know that it sounds strange. Is it possible that problem with a placing grabbers to container?

  4. #4
    Join Date
    Jul 2017
    Posts
    7

    Re: grabber.openDev() problem

    I found a problem. The first time I resize grabber to for getting availabe Video Capture Devices
    Code:
    grabber.resize(1); // for getting availabeVideoCaptureDevices;
    After that I resize it to number of cameras
    Code:
    grabber.resize(ncam);
    And when I try to open device I receive exception, but If you substitute
    Code:
    grabber.resize(1); // for getting availabeVideoCaptureDevices;
    
    DShowLib::Grabber::tVidCapDevListPtr pVidCapDevList = grabber[0].getAvailableVideoCaptureDevices();
    for
    Code:
    DShowLib::Grabber::tVidCapDevListPtr pVidCapDevList;
    {
    	DShowLib::Grabber grabber_temp;
    	pVidCapDevList = grabber_temp.getAvailableVideoCaptureDevices();
    }
    you don't receive any exceptions.

  5. #5
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,854

    Re: grabber.openDev() problem

    Hi

    It is nice to see, what you are doing. However, I made a suggestion and wanted to know its output. Unfortunately you did not see that part, I got not output.
    Best regards
    Stefan
    IC Imaging Control Support

  6. #6
    Join Date
    Jul 2017
    Posts
    7

    Re: grabber.openDev() problem

    Sorry Stefan,

    I should have written output to you.
    I changed code as you said:
    Code:
    for (unsigned int i = 0; i<ncam; ++i)
    {
    	std::cerr << "\try to open " << pVidCapDevList->at(i).getBaseName();
    	if (!grabber[i].openDev(pVidCapDevList->at(icam[i])))
    	{
    		std::cerr << "\nError to open " << pVidCapDevList->at(i).getBaseName();
    		std::cerr << "\nError:" << grabber[i].getLastError().toString();
    		return false;
    	}
    }
    And I tried to run program 10 times.
    There are outputs:

    1. Exception thrown at 0x00007FF9402D8633 (TIS_UDSHL11d_x64.dll) in IC_CreateVideo.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

    2. No exceptions. Everything opened successfully.

    3. Exception thrown at 0x00007FF9402D8633 (TIS_UDSHL11d_x64.dll) in IC_CreateVideo.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

    4. Exception thrown at 0x00007FF9403D8633 (TIS_UDSHL11d_x64.dll) in IC_CreateVideo.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

    5. Exception thrown at 0x00007FF9402D8633 (TIS_UDSHL11d_x64.dll) in IC_CreateVideo.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

    6. No exceptions. Everything opened successfully.

    7. No exceptions. Everything opened successfully.

    8. No exceptions. Everything opened successfully.

    9. No exceptions. Everything opened successfully.

    10. Exception thrown at 0x00007FF9403D8633 (TIS_UDSHL11d_x64.dll) in IC_CreateVideo.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

  7. #7
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,854

    Re: grabber.openDev() problem

    Which cameras do you use?
    Best regards
    Stefan
    IC Imaging Control Support

  8. #8
    Join Date
    Jul 2017
    Posts
    7

    Re: grabber.openDev() problem

    DMK 33GP2000e

Similar Threads

  1. Problem of opening 2 grabber at the same time
    By ray@frontier in forum IC Imaging Control C++ Class Library
    Replies: 1
    Last Post: December 13, 2006, 15:07:13
  2. PCI frame grabber
    By Datman in forum IC Imaging Control ActiveX
    Replies: 1
    Last Post: September 18, 2006, 10:12:47
  3. problem with frame grabber card DFG/SV1
    By Stefan Ey in forum IC Imaging Control ActiveX
    Replies: 1
    Last Post: December 13, 2005, 12:52:10
  4. Grabber::newMemBufferCollection
    By rowkajjh in forum IC Imaging Control C++ Class Library
    Replies: 4
    Last Post: April 13, 2005, 16:05:17
  5. Invalid Address specified to RtlValidateHeap in openDev
    By qwda in forum IC Imaging Control C++ Class Library
    Replies: 6
    Last Post: February 1, 2005, 14:43:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •