@@ -293,8 +293,8 @@ private static void PutSourcePropertyValue(ITable table, VideoEvent evnt, bool i
293
293
string infoName ;
294
294
if ( evnt . Name . StartsWith ( "raw_" ) )
295
295
{
296
- name = $ "RawProperty/{ evnt . Name . Substring ( 4 ) } ";
297
- infoName = $ "RawPropertyInfo/{ evnt . Name . Substring ( 4 ) } ";
296
+ name = $ "RawProperty/{ evnt . Name } ";
297
+ infoName = $ "RawPropertyInfo/{ evnt . Name } ";
298
298
}
299
299
else
300
300
{
@@ -371,9 +371,16 @@ private CameraServer()
371
371
NativeMethods . GetSourceDescription ( vidEvent . SourceHandle ) ) ;
372
372
table . PutBoolean ( "connected" , NativeMethods . IsSourceConnected ( vidEvent . SourceHandle ) ) ;
373
373
table . PutStringArray ( "streams" , GetSourceStreamValues ( vidEvent . SourceHandle ) ) ;
374
- VideoMode mode = NativeMethods . GetSourceVideoMode ( vidEvent . SourceHandle ) ;
375
- table . SetDefaultString ( "mode" , VideoModeToString ( mode ) ) ;
376
- table . PutStringArray ( "modes" , GetSourceModeValues ( vidEvent . SourceHandle ) ) ;
374
+ try
375
+ {
376
+ VideoMode mode = NativeMethods . GetSourceVideoMode ( vidEvent . SourceHandle ) ;
377
+ table . SetDefaultString ( "mode" , VideoModeToString ( mode ) ) ;
378
+ table . PutStringArray ( "modes" , GetSourceModeValues ( vidEvent . SourceHandle ) ) ;
379
+ }
380
+ catch ( VideoException )
381
+ {
382
+ // Do nothing
383
+ }
377
384
break ;
378
385
}
379
386
case EventKind . SourceDestroyed :
@@ -416,6 +423,7 @@ private CameraServer()
416
423
}
417
424
case EventKind . SourceVideoModeChanged :
418
425
{
426
+
419
427
ITable table = GetSourceTable ( vidEvent . SourceHandle ) ;
420
428
if ( table != null )
421
429
{
@@ -486,11 +494,8 @@ private CameraServer()
486
494
string propName ;
487
495
if ( relativeKey == "mode" )
488
496
{
489
- VideoMode mode = VideoModeFromString ( value . GetString ( ) ) ;
490
- if ( mode . PixelFormat == PixelFormat . Unknown || ! source . SetVideoMode ( mode ) )
491
- {
492
- NtCore . SetEntryString ( key , VideoModeToString ( source . GetVideoMode ( ) ) ) ;
493
- }
497
+ // reset to current mode
498
+ NtCore . SetEntryString ( key , VideoModeToString ( source . GetVideoMode ( ) ) ) ;
494
499
return ;
495
500
}
496
501
else if ( relativeKey . StartsWith ( "Property/" ) )
@@ -512,17 +517,17 @@ private CameraServer()
512
517
case PropertyKind . None :
513
518
return ;
514
519
case PropertyKind . Boolean :
515
- prop . Set ( value . GetBoolean ( ) ? 1 : 0 ) ;
520
+ NtCore . SetEntryBoolean ( key , prop . Get ( ) != 0 ) ;
516
521
break ;
517
522
case PropertyKind . Integer :
518
523
case PropertyKind . Enum :
519
- prop . Set ( ( int ) value . GetDouble ( ) ) ;
524
+ NtCore . SetEntryDouble ( key , prop . Get ( ) ) ;
520
525
break ;
521
526
case PropertyKind . String :
522
- prop . SetString ( value . GetString ( ) ) ;
527
+ NtCore . SetEntryString ( key , prop . GetString ( ) ) ;
523
528
break ;
524
529
default :
525
- throw new ArgumentOutOfRangeException ( ) ;
530
+ return ;
526
531
}
527
532
528
533
} , NotifyFlags . NotifyImmediate | NotifyFlags . NotifyUpdate ) ;
0 commit comments