diff options
| author | Adonais Romero González <[email protected]> | 2018-07-19 16:02:30 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-07-19 16:02:30 -0700 |
| commit | 501519dfa481140a77dd49217d98c868b807e591 (patch) | |
| tree | dc7f5e99b796ea9fd918907411595501bf086a63 | |
| parent | 84a856eda909e1084fa6b5978f9701398b67ec45 (diff) | |
| parent | 021af44b09f91a9d0ced14d26654cc238802f307 (diff) | |
Merge pull request #254 from JoelCorley/rs4-update
Update AVStream / Camera samples for RS4.
| -rw-r--r-- | avstream/avscamera/sys/Device.cpp | 189 | ||||
| -rw-r--r-- | avstream/avscamera/sys/Sensor.cpp | 6 | ||||
| -rw-r--r-- | avstream/avscamera/sys/Sensor.h | 2 | ||||
| -rw-r--r-- | avstream/avscamera/sys/SensorSimulation.cpp | 2 | ||||
| -rw-r--r-- | avstream/avscamera/sys/Synthesizer.h | 1 | ||||
| -rw-r--r-- | avstream/avscamera/sys/hwsim.cpp | 12 | ||||
| -rw-r--r-- | avstream/sampledevicemft/multipinmft.cpp | 8 | ||||
| -rw-r--r-- | avstream/samplemft0/Package/package.vcxproj | 8 | ||||
| -rw-r--r-- | avstream/samplemft0/SampleMft0.vcxproj | 8 |
9 files changed, 24 insertions, 212 deletions
diff --git a/avstream/avscamera/sys/Device.cpp b/avstream/avscamera/sys/Device.cpp index ed46bdc8..943b2f2b 100644 --- a/avstream/avscamera/sys/Device.cpp +++ b/avstream/avscamera/sys/Device.cpp @@ -29,160 +29,6 @@ **************************************************************************/ -///// -/// Structures... -//// Profile 0 -static KSCAMERA_PROFILE_MEDIAINFO s_Profile0_PreviewMediaInfo[] = -{ - //{ resolution }, { fps }, Flags, Data0, Data1, Data2, Data 3 - { { 1920, 1080 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1280, 720 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 640, 360 }, { 30, 1 }, 0, 0, 0, 0, 0 }, -}; - -static KSCAMERA_PROFILE_MEDIAINFO s_Profile0_RecordMediaInfo[] = -{ - //{ resolution }, { fps }, Flags, Data0, Data1, Data2, Data 3 - { { 3840, 2160 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1920, 1080 }, { 120, 1 }, 0, 0, 0, 0, 0 }, - { { 1920, 1080 }, { 90, 1 }, 0, 0, 0, 0, 0 }, - { { 1920, 1080 }, { 60, 1 }, 0, 0, 0, 0, 0 }, - { { 1920, 1080 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1280, 720 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 640, 360 }, { 30, 1 }, 0, 0, 0, 0, 0 }, -}; - -static KSCAMERA_PROFILE_MEDIAINFO s_Profile0_PhotoMediaInfo[] = -{ - //{ resolution }, { fps }, Flags, Data0, Data1, Data2, Data 3 - { { 1920, 1080 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1280, 720 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 640, 360 }, { 30, 1 }, 0, 0, 0, 0, 0 } -}; - - -//// Profile 1 -static KSCAMERA_PROFILE_MEDIAINFO s_Profile1_PreviewMediaInfo[] = -{ - //{ resolution }, { fps }, Flags, Data0, Data1, Data2, Data 3 - { { 1920, 1080 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1280, 720 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 640, 360 }, { 30, 1 }, 0, 0, 0, 0, 0 } -}; - -static KSCAMERA_PROFILE_MEDIAINFO s_Profile1_PhotoMediaInfo[] = -{ - //{ resolution }, { fps }, Flags, Data0, Data1, Data2, Data 3 - { { 7680, 4320 }, { 0, 1 }, 0, 0, 0, 0, 0 }, - { { 3840, 2160 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1920, 1080 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1280, 720 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 640, 360 }, { 30, 1 }, 0, 0, 0, 0, 0 } -}; - -//// Profile 2 -static KSCAMERA_PROFILE_MEDIAINFO s_Profile2_PreviewMediaInfo[] = -{ - //{ resolution }, { fps }, Flags, Data0, Data1, Data2, Data 3 - { { 1920, 1080 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1280, 720 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 640, 360 }, { 30, 1 }, 0, 0, 0, 0, 0 } -}; - -static KSCAMERA_PROFILE_MEDIAINFO s_Profile2_RecordMediaInfo[] = -{ - //{ resolution }, { fps }, Flags, Data0, Data1, Data2, Data 3 - { { 1920, 1080 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 1280, 720 }, { 30, 1 }, 0, 0, 0, 0, 0 }, - { { 640, 360 }, { 30, 1 }, 0, 0, 0, 0, 0 } -}; - -static KSCAMERA_PROFILE_PININFO s_Profile0_PinInfo[] = -{ - { {STATIC_PINNAME_VIDEO_PREVIEW}, 0,0, ARRAYSIZE(s_Profile0_PreviewMediaInfo), s_Profile0_PreviewMediaInfo }, - { {STATIC_PINNAME_VIDEO_CAPTURE}, 0,0, ARRAYSIZE(s_Profile0_RecordMediaInfo), s_Profile0_RecordMediaInfo }, - { {STATIC_PINNAME_IMAGE}, 0,0, ARRAYSIZE(s_Profile0_PhotoMediaInfo), s_Profile0_PhotoMediaInfo } -}; - -static KSCAMERA_PROFILE_PININFO s_Profile1_PinInfo[] = -{ - { {STATIC_PINNAME_VIDEO_PREVIEW}, 0,0, ARRAYSIZE(s_Profile1_PreviewMediaInfo), s_Profile1_PreviewMediaInfo }, - { {STATIC_PINNAME_IMAGE}, 0,0, ARRAYSIZE(s_Profile1_PhotoMediaInfo), s_Profile1_PhotoMediaInfo } -}; - -static KSCAMERA_PROFILE_PININFO s_Profile2_PinInfo[] = -{ - { {STATIC_PINNAME_VIDEO_PREVIEW}, 0,0, ARRAYSIZE(s_Profile2_PreviewMediaInfo), s_Profile2_PreviewMediaInfo }, - { {STATIC_PINNAME_VIDEO_CAPTURE}, 0,0, ARRAYSIZE(s_Profile2_RecordMediaInfo), s_Profile2_RecordMediaInfo } -}; - -static KSCAMERA_PROFILE_INFO s_Profiles[] = -{ - { {STATIC_KSCAMERAPROFILE_BalancedVideoAndPhoto}, 0, ARRAYSIZE(s_Profile0_PinInfo), s_Profile0_PinInfo }, - { {STATIC_KSCAMERAPROFILE_HighQualityPhoto}, 0, ARRAYSIZE(s_Profile1_PinInfo), s_Profile1_PinInfo }, - { {STATIC_KSCAMERAPROFILE_VideoRecording}, 0, ARRAYSIZE(s_Profile2_PinInfo), s_Profile2_PinInfo } -}; - -// The front camera is concurrent with the rear camera, so the front camera concurrency -// has the back camera's reference GUID and vice versa. -static KSCAMERA_PROFILE_CONCURRENCYINFO s_Profile2_ConcurrencyInfoFront[] = -{ - { {STATIC_RearCamera_Filter}, 0, 1, &s_Profiles[2] } -}; - -static KSCAMERA_PROFILE_CONCURRENCYINFO s_Profile2_ConcurrencyInfoBack[] = -{ - { {STATIC_FrontCamera_Filter}, 0, 1, &s_Profiles[2] } -}; - -const UINT32 s_ProfileCount = 3; - -UINT32 -InitializeDeviceProfiles( - _In_ BOOL fFrontCamera, - _Outptr_result_maybenull_ - PKSDEVICE_PROFILE_INFO *ppDeviceProfiles -) -{ - UINT32 uiProfileCount = 0; - PKSDEVICE_PROFILE_INFO pDeviceProfiles = NULL; - - pDeviceProfiles = (PKSDEVICE_PROFILE_INFO)ExAllocatePoolWithTag( PagedPool, sizeof(KSDEVICE_PROFILE_INFO) * ARRAYSIZE(s_Profiles) , 'fpSC'); - if( !pDeviceProfiles ) - { - // Can't publish, we're out of memory, silently fail here. - *ppDeviceProfiles = nullptr; - goto Exit; - } - - for (UINT32 i = 0; i < ARRAYSIZE(s_Profiles); i++) - { - pDeviceProfiles[i].Type = KSDEVICE_PROFILE_TYPE_CAMERA; - pDeviceProfiles[i].Size = sizeof(KSDEVICE_PROFILE_INFO); - pDeviceProfiles[i].Camera.Info = s_Profiles[i]; - pDeviceProfiles[i].Camera.Reserved = 0; - pDeviceProfiles[i].Camera.ConcurrencyCount = 0; - pDeviceProfiles[i].Camera.Concurrency = NULL; - } - - pDeviceProfiles[2].Camera.ConcurrencyCount = 1; - if (fFrontCamera) - { - pDeviceProfiles[2].Camera.Concurrency = (PKSCAMERA_PROFILE_CONCURRENCYINFO)&s_Profile2_ConcurrencyInfoFront; - } - else - { - pDeviceProfiles[2].Camera.Concurrency = (PKSCAMERA_PROFILE_CONCURRENCYINFO)&s_Profile2_ConcurrencyInfoBack; - } - - uiProfileCount = ARRAYSIZE(s_Profiles); - *ppDeviceProfiles = pDeviceProfiles; - pDeviceProfiles = NULL; - -Exit: - return uiProfileCount; -} - #ifdef ALLOC_PRAGMA #pragma code_seg("PAGE") #endif // ALLOC_PRAGMA @@ -673,7 +519,6 @@ Return Value: PKSDEVICE_PROFILE_INFO pDeviceProfiles = nullptr; UINT32 uiProfileCount = 0; PUNICODE_STRING SymbolicLinkName = KsFilterFactoryGetSymbolicLink(FilterFactory); - BOOL fFrontCamera = FALSE; ACPI_PLD_V2_BUFFER pld = {0}; pld.Revision = 2; pld.Panel = m_Context[i].AcpiPosition; @@ -691,40 +536,6 @@ Return Value: sizeof(pld), (PVOID)&pld) ); - - if( m_Context[i].Descriptor->ReferenceGuid && - IsEqualGUID(*(m_Context[i].Descriptor->ReferenceGuid), FFC_Filter)) - { - fFrontCamera = TRUE; - } - - // Publish our profile here. - uiProfileCount = InitializeDeviceProfiles(fFrontCamera, &pDeviceProfiles); - if( uiProfileCount > 0 && pDeviceProfiles != nullptr) - { - if( NT_SUCCESS(KsInitializeDeviceProfile(FilterFactory)) ) - { - for( UINT32 j=0; j<uiProfileCount; j++ ) - { - if( !NT_SUCCESS(KsPublishDeviceProfile(FilterFactory, &pDeviceProfiles[j])) ) - { - // Bail... - break; - } - } - if( !NT_SUCCESS(KsPersistDeviceProfile(FilterFactory)) ) - { - // Trace here? - } - } - - ExFreePool(pDeviceProfiles); - pDeviceProfiles = NULL; - } - else - { - IFFAILED_EXIT(STATUS_INSUFFICIENT_RESOURCES); - } } // On a real device this object would be constructed whenever the sensor hardware is ready... diff --git a/avstream/avscamera/sys/Sensor.cpp b/avstream/avscamera/sys/Sensor.cpp index 97615250..9215f6b6 100644 --- a/avstream/avscamera/sys/Sensor.cpp +++ b/avstream/avscamera/sys/Sensor.cpp @@ -1090,14 +1090,16 @@ void CSensor:: SetSynthesizerAttribute( CSynthesizer::Attribute Attrib, - LONGLONG Info + LONGLONG Info, + LONG PinId ) { PAGED_CODE(); for( ULONG Pin=0; IsValidIndex(Pin); Pin++ ) { - if( m_Synthesizer[Pin] ) + if( (Pin==(ULONG)PinId || IsStillIndex(Pin)) && + m_Synthesizer[Pin] ) { m_Synthesizer[Pin]->Set( Attrib, Info ); } diff --git a/avstream/avscamera/sys/Sensor.h b/avstream/avscamera/sys/Sensor.h index dac97630..34997908 100644 --- a/avstream/avscamera/sys/Sensor.h +++ b/avstream/avscamera/sys/Sensor.h @@ -517,7 +517,7 @@ public: } void - SetSynthesizerAttribute( CSynthesizer::Attribute Attrib, LONGLONG Info ); + SetSynthesizerAttribute( CSynthesizer::Attribute Attrib, LONGLONG Info, LONG PinId ); protected: LONG diff --git a/avstream/avscamera/sys/SensorSimulation.cpp b/avstream/avscamera/sys/SensorSimulation.cpp index ce6a2c17..95824ca5 100644 --- a/avstream/avscamera/sys/SensorSimulation.cpp +++ b/avstream/avscamera/sys/SensorSimulation.cpp @@ -702,7 +702,7 @@ GetFaceDetection( KSCAMERA_EXTENDEDPROP_FACEDETECTION_SMILE ; pProperty->Max() = m_FaceDetectionMax; - pProperty->Min() = 1; + pProperty->Min() = 0; pProperty->Step() = 1; *pProperty = m_FaceDetectionCurrentMax; pProperty->Result = m_FaceDetectionResult; diff --git a/avstream/avscamera/sys/Synthesizer.h b/avstream/avscamera/sys/Synthesizer.h index 6612a3f6..7281ff80 100644 --- a/avstream/avscamera/sys/Synthesizer.h +++ b/avstream/avscamera/sys/Synthesizer.h @@ -132,7 +132,6 @@ protected: LONGLONG m_Attrib[MAX_Attribute]; // This value is used to fudge a rotated image. - enum AcpiPldRotation m_Rotation; diff --git a/avstream/avscamera/sys/hwsim.cpp b/avstream/avscamera/sys/hwsim.cpp index 4309befb..2db48d30 100644 --- a/avstream/avscamera/sys/hwsim.cpp +++ b/avstream/avscamera/sys/hwsim.cpp @@ -1195,16 +1195,16 @@ Return Value: // Generate a "time stamp" just to overlay it onto the capture image. // It makes it more exciting than bars that do nothing. // - // Only set these values if it's a preview simulation. - // Note: This was simpler than overloading CHardwareSimulation... - if( m_Sensor->IsPreviewIndex(m_PinID) ) + // Note: Streaming pins have their own indexes; but still pins track + // the most recent streaming pin's index. + if (!m_Sensor->IsStillIndex(m_PinID)) { DBG_TRACE("QPC=0x%016llX", Qpc); // Broadcast the preview pin's info to all pin simulations. - m_Sensor->SetSynthesizerAttribute(CSynthesizer::FrameNumber, m_InterruptTime); - m_Sensor->SetSynthesizerAttribute(CSynthesizer::RelativePts, (m_InterruptTime + 1) * m_TimePerFrame ); - m_Sensor->SetSynthesizerAttribute(CSynthesizer::QpcTime, Qpc ); + m_Sensor->SetSynthesizerAttribute(CSynthesizer::FrameNumber, m_InterruptTime, m_PinID); + m_Sensor->SetSynthesizerAttribute(CSynthesizer::RelativePts, (m_InterruptTime + 1) * m_TimePerFrame, m_PinID); + m_Sensor->SetSynthesizerAttribute(CSynthesizer::QpcTime, Qpc, m_PinID); } m_Synthesizer->DoSynthesize(); diff --git a/avstream/sampledevicemft/multipinmft.cpp b/avstream/sampledevicemft/multipinmft.cpp index 0403abdf..3467870b 100644 --- a/avstream/sampledevicemft/multipinmft.cpp +++ b/avstream/sampledevicemft/multipinmft.cpp @@ -162,7 +162,7 @@ done: --*/ -// This Sample will create a grayscale for known media types. Please remove MF_DEVICEMFT_ADD_GRAYSCALER_ to remove the grayscaler +// This sample will create a grayscale for known media types. Please remove MF_DEVICEMFT_ADD_GRAYSCALER_ to remove the grayscaler // This sample also has photo confirmation enabled remove DMF_DEVICEMFT_PHTOTOCONFIRMATION to remove photo confirmation // Please search for the @@@@ README tag for critical sections in code and it's documentation // @@ -778,15 +778,15 @@ output pins and populate the corresponding MFT_OUTPUT_DATA_BUFFER with the sampl pdwStatus ) ) ) { gotOne = true; - // Do photo confirmation if enabled off the preview stream only + // Do photo confirmation if enabled from the preview stream only #if defined (MF_DEVICEMFT_PHTOTOCONFIRMATION) BOOL pIsPreviewPin = FALSE; if (pOutputSamples[i].pSample && IsPhotoConfirmationEnabled() && ((SUCCEEDED(CheckPreviewPin(static_cast<IMFAttributes*>(spOpin.Get()), &pIsPreviewPin)) && pIsPreviewPin) && - InterlockedCompareExchange(reinterpret_cast<PLONG>(&m_firePhotoConfirmation),FALSE,TRUE))) + InterlockedCompareExchange(reinterpret_cast<PLONG>(&m_firePhotoConfirmation), FALSE, TRUE))) { - // Please note photo confirmation should always be fired off the preview stream. + // Please note photo confirmation should always be fired from the preview stream. ComPtr<IMFMediaType> spMediaType; if (SUCCEEDED(spOpin->getMediaType(spMediaType.GetAddressOf()))) { diff --git a/avstream/samplemft0/Package/package.vcxproj b/avstream/samplemft0/Package/package.vcxproj index b1b4d0a1..c898c343 100644 --- a/avstream/samplemft0/Package/package.vcxproj +++ b/avstream/samplemft0/Package/package.vcxproj @@ -33,19 +33,19 @@ <RootNamespace>$(MSBuildProjectName)</RootNamespace> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <TargetVersion>Windows8</TargetVersion> + <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>true</UseDebugLibraries> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <TargetVersion>Windows8</TargetVersion> + <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>false</UseDebugLibraries> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <TargetVersion>Windows8</TargetVersion> + <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>true</UseDebugLibraries> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <TargetVersion>Windows8</TargetVersion> + <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>false</UseDebugLibraries> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> diff --git a/avstream/samplemft0/SampleMft0.vcxproj b/avstream/samplemft0/SampleMft0.vcxproj index 90c623ba..c7a28b8e 100644 --- a/avstream/samplemft0/SampleMft0.vcxproj +++ b/avstream/samplemft0/SampleMft0.vcxproj @@ -36,19 +36,19 @@ <RootNamespace>$(MSBuildProjectName)</RootNamespace> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Win8</TargetVersion> + <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>True</UseDebugLibraries> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Win8</TargetVersion> + <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>False</UseDebugLibraries> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Win8</TargetVersion> + <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>True</UseDebugLibraries> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Win8</TargetVersion> + <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>False</UseDebugLibraries> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
