Changeset 3797

Show
Ignore:
Timestamp:
08/23/06 15:03:10 (8 years ago)
Author:
piers
Message:

Added more graceful error handling so vic will bring up a warning dialogue instead of crashing;)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vic/trunk/video/grabber-win32DS.cpp

    r3702 r3797  
    222222   if (FAILED(hr)) { 
    223223                Grabber::status_=-1; 
    224                 //showErrorMessage(hr); 
    225224                return; 
    226225   } 
     
    230229   hr = pGraph_->QueryInterface(IID_IMediaControl, (void **)&pMediaControl_); 
    231230   //showErrorMessage(hr); 
     231   if (FAILED(hr)) { 
     232                Grabber::status_=-1; 
     233                return; 
     234   } 
    232235   debug_msg("DirectShowGrabber::DirectShowGrabber():  graph media control interface acquired\n"); 
    233236    
     
    236239                         IID_ICaptureGraphBuilder2, (void **)&pBuild_); 
    237240   //showErrorMessage(hr); 
     241   if (FAILED(hr)) { 
     242                Grabber::status_=-1; 
     243                return; 
     244   } 
    238245   debug_msg("DirectShowGrabber::DirectShowGrabber():  graph builder interface acquired\n"); 
    239246 
     
    241248   hr = pBuild_->SetFiltergraph(pGraph_); 
    242249   //showErrorMessage(hr); 
     250   if (FAILED(hr)) { 
     251                Grabber::status_=-1; 
     252                return; 
     253   } 
    243254   debug_msg("DirectShowGrabber::DirectShowGrabber():  graph associated with builder\n"); 
    244255 
     
    267278                         IID_IBaseFilter, (LPVOID *)&pNullBaseFilter_); 
    268279   //showErrorMessage(hr); 
     280    if (FAILED(hr)) { 
     281                Grabber::status_=-1; 
     282                return; 
     283   } 
    269284   debug_msg("DirectShowGrabber::DirectShowGrabber():  Null Renderer interface acquired\n"); 
    270285 
    271286   // Finally, add the Null Renderer "sink" to the graph 
    272287   hr = pGraph_->AddFilter(pNullBaseFilter_,L"VicNullRenderer"); 
    273    //showErrorMessage(hr); 
     288    if (FAILED(hr)) { 
     289                Grabber::status_=-1; 
     290                return; 
     291   } 
    274292   debug_msg("DirectShowGrabber::DirectShowGrabber():  Null Renderer added to graph\n"); 
    275293 
     
    539557   hr        = pBuild_->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, 
    540558                                     pCaptureFilter_, IID_IAMStreamConfig, (void**)&pConfig); 
    541    //showErrorMessage(hr); 
     559   if (FAILED(hr)) { 
     560                Grabber::status_=-1; 
     561                return; 
     562   } 
     563 
    542564   debug_msg("DirectShowGrabber::setCaptureOutputFormat(): IAMStreamConfig interface acquired\n"); 
    543565 
    544566   iCount = iSize = 0; 
    545567   hr     = pConfig->GetNumberOfCapabilities(&iCount, &iSize); 
    546    //showErrorMessage(hr); 
    547  
    548568   // Check the size to make sure we pass in the correct structure. 
    549569   // The alternative output of iSize is AUDIO_STREAM_CONFIG_CAPS, btw.