From 1d2865d33a2815c31a93bf9b352b94b096f72f57 Mon Sep 17 00:00:00 2001 From: Joel Corley Date: Tue, 21 Jan 2020 15:47:24 -0800 Subject: Update all the AvStream samples for Vibranium. --- avstream/avscamera/sys/Sensor.cpp | 49 +++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 20 deletions(-) (limited to 'avstream/avscamera/sys/Sensor.cpp') diff --git a/avstream/avscamera/sys/Sensor.cpp b/avstream/avscamera/sys/Sensor.cpp index 9215f6b6..1f062497 100644 --- a/avstream/avscamera/sys/Sensor.cpp +++ b/avstream/avscamera/sys/Sensor.cpp @@ -188,7 +188,7 @@ Initialize() m_InterruptTime[i] = 0; m_LastMappingsCompleted[i] = 0; } - return STATUS_SUCCESS; + return m_Device ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER; } void @@ -356,7 +356,7 @@ CreateSynthesizer( if( NT_SUCCESS( Status ) ) { - DBG_TRACE( "Setting Mounting Orientation to %d°", DbgRotation2Degrees(m_MountingOrientation) ) + DBG_TRACE( "Setting Mounting Orientation to %d°", DbgRotation2Degrees(m_MountingOrientation) ) m_Synthesizer[ Pin->Id ]->SetRotation( m_MountingOrientation ); } @@ -412,15 +412,17 @@ Return Value: NTSTATUS Status = STATUS_SUCCESS; LONG lPindex = Pin->Id; + + // Hold off all image generation while we muck with the capture pin and synthensizer arrays. + KScopedMutex Lock(m_SensorMutex); + // // If we're the first pin to go into acquire (remember we can have // a filter in another graph going simultaneously), grab the resources for Preview // - if( InterlockedCompareExchangePointer( - (PVOID *) &m_CapturePin[lPindex], - CapturePin, - nullptr) == nullptr) + if (m_CapturePin[lPindex] == nullptr) { + m_CapturePin[lPindex] = CapturePin; m_VideoInfoHeader[lPindex] = VideoInfoHeader; // @@ -449,7 +451,6 @@ Return Value: // // If everything has succeeded thus far, set the capture pin. // - m_CapturePin[lPindex] = CapturePin; *pSim = m_HardwareSimulation[lPindex]; } @@ -460,6 +461,8 @@ Return Value: // acquired. // ReleaseHardwareResources(Pin); + *pSim = nullptr; + m_CapturePin[lPindex] = nullptr; } } else @@ -1088,20 +1091,23 @@ Return Value: void CSensor:: -SetSynthesizerAttribute( - CSynthesizer::Attribute Attrib, - LONGLONG Info, - LONG PinId +SetSynthesizerAttributeList( + _In_ size_t Count, + _In_ SynthesizerAttributeEntry AttributeList[] ) { PAGED_CODE(); - - for( ULONG Pin=0; IsValidIndex(Pin); Pin++ ) + // Syncrhonize access to sensor. + KScopedMutex Lock(m_SensorMutex); + for (size_t item = 0; item < Count; item++) { - if( (Pin==(ULONG)PinId || IsStillIndex(Pin)) && - m_Synthesizer[Pin] ) + for (ULONG Pin = 0; IsValidIndex(Pin); Pin++) { - m_Synthesizer[Pin]->Set( Attrib, Info ); + if ((Pin == (ULONG)AttributeList[item].PinId || IsStillIndex(Pin)) && + m_Synthesizer[Pin]) + { + m_Synthesizer[Pin]->Set(AttributeList[item].Attrib, AttributeList[item].Info); + } } } } @@ -1140,11 +1146,15 @@ Return Value: DBG_ENTER( "( Pin=%d )\n", Pin->Id ) ; LONG lPindex = Pin->Id; + // // Blow away the image synth. // m_HardwareSimulation[lPindex]->Reset(); + // Hold off all image generation while we free the capture pin and synthensizer arrays. + KScopedMutex Lock(m_SensorMutex); + SAFE_DELETE( m_Synthesizer[lPindex] ); m_VideoInfoHeader[lPindex] = NULL; @@ -1152,10 +1162,7 @@ Return Value: // Release our "lock" on hardware resources. This will allow another // pin (perhaps in another graph) to acquire them. // - InterlockedExchangePointer( - (PVOID *) &(m_CapturePin[lPindex]), - nullptr - ); + m_CapturePin[lPindex] = nullptr; DBG_LEAVE( "( Pin=%d )\n", Pin->Id ) ; } @@ -1322,6 +1329,7 @@ DEFINE_NULL_PROPERTY_GET(CSensor, KSPROPERTY_CAMERACONTROL_IMAGE_PIN_CAPABILITY_ DEFINE_NULL_PROPERTY(CSensor, CExtendedProperty, TriggerTime) DEFINE_NULL_PROPERTY(CSensor, CExtendedProperty, TorchMode) +DEFINE_NULL_PROPERTY(CSensor, CExtendedVidProcSetting, IRTorch) DEFINE_NULL_PROPERTY(CSensor, CExtendedProperty, ExtendedFlash) DEFINE_NULL_PROPERTY_GET(CSensor, CExtendedProperty, PhotoFrameRate) @@ -1352,6 +1360,7 @@ DEFINE_NULL_PROPERTY(CSensor, CExtendedProperty, OptimizationHint) DEFINE_NULL_PROPERTY(CSensor, CExtendedProperty, AdvancedPhoto) DEFINE_NULL_PROPERTY(CSensor, CExtendedVidProcSetting, FaceDetection) DEFINE_NULL_PROPERTY(CSensor, CExtendedProperty, VideoTemporalDenoising) +DEFINE_NULL_PROPERTY(CSensor, CExtendedProperty, RelativePanel) DEFINE_NULL_PROPERTY(CSensor, KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_S, VideoStabMode) -- cgit v1.3.1 From 6568238719a3fe6d317e1d4a13131f5d2ca0234b Mon Sep 17 00:00:00 2001 From: Joel Corley Date: Tue, 7 Apr 2020 00:42:28 -0700 Subject: Fix typos, etc. to address review comments. --- avstream/avscamera/sys/Common.h | 1 - avstream/avscamera/sys/Device.cpp | 4 +--- avstream/avscamera/sys/Sensor.cpp | 2 +- avstream/avscamera/sys/Sensor.h | 1 - avstream/avscamera/sys/filter.h | 2 +- avstream/avssamp/audio.cpp | 2 +- avstream/avssamp/video.cpp | 6 +++--- avstream/sampledevicemft/basepin.cpp | 2 +- 8 files changed, 8 insertions(+), 12 deletions(-) (limited to 'avstream/avscamera/sys/Sensor.cpp') diff --git a/avstream/avscamera/sys/Common.h b/avstream/avscamera/sys/Common.h index d29a0438..7cde102f 100644 --- a/avstream/avscamera/sys/Common.h +++ b/avstream/avscamera/sys/Common.h @@ -33,7 +33,6 @@ #include #include -//#include #include #include #include diff --git a/avstream/avscamera/sys/Device.cpp b/avstream/avscamera/sys/Device.cpp index 9fab69d9..2741da08 100644 --- a/avstream/avscamera/sys/Device.cpp +++ b/avstream/avscamera/sys/Device.cpp @@ -637,9 +637,7 @@ Return Value: (PVOID)&pld) ); - //Also set Panel ID manually, because PnP does not do this for the interface currently - // TODO: This is a bug in PnP that they will fix, so don't check the return code - // It will be read only when fixed. + // Also set Panel ID manually, because PnP does not do this for the interface currently IoSetDeviceInterfacePropertyData(SymbolicLinkName, &DEVPKEY_Device_PanelId, LOCALE_NEUTRAL, diff --git a/avstream/avscamera/sys/Sensor.cpp b/avstream/avscamera/sys/Sensor.cpp index 1f062497..654ea666 100644 --- a/avstream/avscamera/sys/Sensor.cpp +++ b/avstream/avscamera/sys/Sensor.cpp @@ -413,7 +413,7 @@ Return Value: NTSTATUS Status = STATUS_SUCCESS; LONG lPindex = Pin->Id; - // Hold off all image generation while we muck with the capture pin and synthensizer arrays. + // Hold off all image generation while we manipulate the capture pin and synthensizer arrays. KScopedMutex Lock(m_SensorMutex); // diff --git a/avstream/avscamera/sys/Sensor.h b/avstream/avscamera/sys/Sensor.h index c68f1b3a..31b0f3a2 100644 --- a/avstream/avscamera/sys/Sensor.h +++ b/avstream/avscamera/sys/Sensor.h @@ -522,7 +522,6 @@ public: CSynthesizer::Attribute Attrib; LONGLONG Info; LONG PinId; - }; void diff --git a/avstream/avscamera/sys/filter.h b/avstream/avscamera/sys/filter.h index 07f1c0d4..5b272a9d 100644 --- a/avstream/avscamera/sys/filter.h +++ b/avstream/avscamera/sys/filter.h @@ -58,7 +58,7 @@ private: // The AVStream filter object associated with this CCaptureFilter. // CCapturePin **m_pinArray; - ULONG* m_pMinimumRequestedFrames; + ULONG *m_pMinimumRequestedFrames; protected: // diff --git a/avstream/avssamp/audio.cpp b/avstream/avssamp/audio.cpp index cc35f869..579fa002 100644 --- a/avstream/avssamp/audio.cpp +++ b/avstream/avssamp/audio.cpp @@ -358,7 +358,7 @@ Routine Description: selected in order to change the format for the pin. In this case, OldFormat will not be NULL. - Validate that the format is acceptible and perform the actions necessary + Validate that the format is acceptable and perform the actions necessary to change format if appropriate. Arguments: diff --git a/avstream/avssamp/video.cpp b/avstream/avssamp/video.cpp index d2291a24..d18dc95d 100644 --- a/avstream/avssamp/video.cpp +++ b/avstream/avssamp/video.cpp @@ -1,4 +1,4 @@ -/************************************************************************** +/************************************************************************** AVStream Filter-Centric Sample @@ -23,7 +23,7 @@ /************************************************************************** PAGEABLE CODE - + **************************************************************************/ #ifdef ALLOC_PRAGMA @@ -557,7 +557,7 @@ Routine Description: selected in order to change the format for the pin. In this case, OldFormat will not be NULL. - Validate that the format is acceptible and perform the actions necessary + Validate that the format is acceptable and perform the actions necessary to change format if appropriate. Arguments: diff --git a/avstream/sampledevicemft/basepin.cpp b/avstream/sampledevicemft/basepin.cpp index 9c989000..563ff610 100644 --- a/avstream/sampledevicemft/basepin.cpp +++ b/avstream/sampledevicemft/basepin.cpp @@ -742,7 +742,7 @@ done: STDMETHODIMP CAsyncInPin::Init() { - m_asyncCallback = new (std::nothrow) CDMFTAsyncCallback(this,m_dwWorkQueueId); + m_asyncCallback = new (std::nothrow) CDMFTAsyncCallback(this, m_dwWorkQueueId); if (!m_asyncCallback) throw bad_alloc(); return S_OK; -- cgit v1.3.1