| 318 | } |
| 319 | |
| 320 | bool CaptureBasicApp::setupCaptureWithMode( Capture::DeviceRef device, const Capture::Mode& mode ) |
| 321 | { |
| 322 | CI_LOG_I( "\n=== Setting up capture with specific mode ===" ); |
| 323 | CI_LOG_I( "Device: " << device->getName() ); |
| 324 | CI_LOG_I( "Mode: " << toString( mode ) ); |
| 325 | |
| 326 | try { |
| 327 | // Stop and fully release old capture |
| 328 | if( mCapture ) { |
| 329 | CI_LOG_I( "Stopping previous capture" ); |
| 330 | mCapture->stop(); |
| 331 | } |
| 332 | |
| 333 | // Reset everything to ensure clean state |
| 334 | mCapture = nullptr; |
| 335 | mTexture = nullptr; |
| 336 | |
| 337 | // Create capture with specific mode |
| 338 | CI_LOG_I( "Creating capture with mode..." ); |
| 339 | mCapture = Capture::create( device, mode ); |
| 340 | CI_LOG_I( "Starting capture..." ); |
| 341 | mCapture->start(); |
| 342 | |
| 343 | CI_LOG_I( "Capture started successfully!" ); |
| 344 | CI_LOG_I( "Actual size: " << mCapture->getWidth() << "x" << mCapture->getHeight() ); |
| 345 | CI_LOG_I( "Created capture with mode: " << toString( mode ) ); |
| 346 | return true; |
| 347 | } |
| 348 | catch( ci::Exception& exc ) { |
| 349 | CI_LOG_EXCEPTION( "Failed to setup capture with mode: " << toString( mode ) << " on device: " << device->getName(), exc ); |
| 350 | CI_LOG_E( "ERROR: Failed to setup capture with mode! Falling back to auto mode." ); |
| 351 | // Fall back to regular capture |
| 352 | setupCapture( device ); |
| 353 | return false; |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | |
| 358 | void CaptureBasicApp::updateModes() |