diff --git a/Samples/360VideoPlayback/cpp/Package.appxmanifest b/Samples/360VideoPlayback/cpp/Package.appxmanifest index 0ec7a420c0..ce5060bdee 100644 --- a/Samples/360VideoPlayback/cpp/Package.appxmanifest +++ b/Samples/360VideoPlayback/cpp/Package.appxmanifest @@ -11,7 +11,7 @@ 360 Video Playback C++ Sample Microsoft Corporation - Assets\StoreLogo.png + Assets\StoreLogo-sdk.png diff --git a/Samples/360VideoPlayback/cs/Common/DeviceResources.cs b/Samples/360VideoPlayback/cs/Common/DeviceResources.cs index 6edbd91011..cf5fb773c9 100644 --- a/Samples/360VideoPlayback/cs/Common/DeviceResources.cs +++ b/Samples/360VideoPlayback/cs/Common/DeviceResources.cs @@ -66,12 +66,12 @@ private void CreateDeviceIndependentResources() // Initialize Direct2D resources. var debugLevel = SharpDX.Direct2D1.DebugLevel.None; - //#if DEBUG + #if DEBUG if (DirectXHelper.SdkLayersAvailable()) { debugLevel = SharpDX.Direct2D1.DebugLevel.Information; } - //#endif + #endif // Initialize the Direct2D Factory. d2dFactory = this.ToDispose( diff --git a/Samples/360VideoPlayback/cs/Package.appxmanifest b/Samples/360VideoPlayback/cs/Package.appxmanifest index b99094015d..18cc20eb87 100644 --- a/Samples/360VideoPlayback/cs/Package.appxmanifest +++ b/Samples/360VideoPlayback/cs/Package.appxmanifest @@ -11,7 +11,7 @@ 360 Video Playback C# Sample Microsoft Corporation - Assets\StoreLogo.png + Assets\StoreLogo-sdk.png diff --git a/Samples/BarcodeScanner/cs/BarcodeScanner.sln b/Samples/BarcodeScanner/cs/BarcodeScanner.sln index a6bca0678e..cf015a0a4b 100644 --- a/Samples/BarcodeScanner/cs/BarcodeScanner.sln +++ b/Samples/BarcodeScanner/cs/BarcodeScanner.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/BluetoothAdvertisement/js/BluetoothAdvertisement.sln b/Samples/BluetoothAdvertisement/js/BluetoothAdvertisement.sln index 8cd83acb36..83a455d581 100644 --- a/Samples/BluetoothAdvertisement/js/BluetoothAdvertisement.sln +++ b/Samples/BluetoothAdvertisement/js/BluetoothAdvertisement.sln @@ -46,4 +46,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - diff --git a/Samples/CameraGetPreviewFrame/cs/MainPage.xaml.cs b/Samples/CameraGetPreviewFrame/cs/MainPage.xaml.cs index 07dcd053dc..6efc5f69c8 100644 --- a/Samples/CameraGetPreviewFrame/cs/MainPage.xaml.cs +++ b/Samples/CameraGetPreviewFrame/cs/MainPage.xaml.cs @@ -13,6 +13,7 @@ using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; +using System.Threading; using System.Threading.Tasks; using Windows.ApplicationModel; using Windows.Devices.Enumeration; @@ -63,6 +64,7 @@ public sealed partial class MainPage : Page private MediaCapture _mediaCapture; private bool _isInitialized = false; private bool _isPreviewing = false; + private static readonly SemaphoreSlim _mediaCaptureLifeLock = new SemaphoreSlim(1); // Information about the camera device private bool _mirroringPreview = false; @@ -93,7 +95,7 @@ private async void Application_Suspending(object sender, SuspendingEventArgs e) await CleanupCameraAsync(); _displayInformation.OrientationChanged -= DisplayInformation_OrientationChanged; - + deferral.Complete(); } } @@ -213,6 +215,8 @@ private async Task InitializeCameraAsync() { Debug.WriteLine("InitializeCameraAsync"); + await _mediaCaptureLifeLock.WaitAsync(); + if (_mediaCapture == null) { // Attempt to get the back camera if one is available, but use any camera device if not @@ -221,6 +225,7 @@ private async Task InitializeCameraAsync() if (cameraDevice == null) { Debug.WriteLine("No camera device found!"); + _mediaCaptureLifeLock.Release(); return; } @@ -242,6 +247,10 @@ private async Task InitializeCameraAsync() { Debug.WriteLine("The app was denied access to the camera"); } + finally + { + _mediaCaptureLifeLock.Release(); + } // If initialization succeeded, start the preview if (_isInitialized) @@ -260,7 +269,7 @@ private async Task InitializeCameraAsync() // Only mirror the preview if the camera is on the front panel _mirroringPreview = (cameraDevice.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Front); } - + await StartPreviewAsync(); var picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures); @@ -268,6 +277,10 @@ private async Task InitializeCameraAsync() _captureFolder = picturesLibrary.SaveFolder ?? ApplicationData.Current.LocalFolder; } } + else + { + _mediaCaptureLifeLock.Release(); + } } /// @@ -436,24 +449,33 @@ private async Task GetPreviewFrameAsD3DSurfaceAsync() /// private async Task CleanupCameraAsync() { - if (_isInitialized) + await _mediaCaptureLifeLock.WaitAsync(); + + try { - if (_isPreviewing) + if (_isInitialized) { - // The call to stop the preview is included here for completeness, but can be - // safely removed if a call to MediaCapture.Dispose() is being made later, - // as the preview will be automatically stopped at that point - await StopPreviewAsync(); + if (_isPreviewing) + { + // The call to stop the preview is included here for completeness, but can be + // safely removed if a call to MediaCapture.Dispose() is being made later, + // as the preview will be automatically stopped at that point + await StopPreviewAsync(); + } + + _isInitialized = false; } - _isInitialized = false; + if (_mediaCapture != null) + { + _mediaCapture.Failed -= MediaCapture_Failed; + _mediaCapture.Dispose(); + _mediaCapture = null; + } } - - if (_mediaCapture != null) + finally { - _mediaCapture.Failed -= MediaCapture_Failed; - _mediaCapture.Dispose(); - _mediaCapture = null; + _mediaCaptureLifeLock.Release(); } } diff --git a/Samples/CameraResolution/cpp/SampleConfiguration.cpp b/Samples/CameraResolution/cpp/SampleConfiguration.cpp index 7c4aedcd73..1d1ee2ffad 100644 --- a/Samples/CameraResolution/cpp/SampleConfiguration.cpp +++ b/Samples/CameraResolution/cpp/SampleConfiguration.cpp @@ -13,7 +13,13 @@ #include "MainPage.xaml.h" #include "SampleConfiguration.h" +using namespace Concurrency; using namespace SDKTemplate; +using namespace Windows::Devices; +using namespace Windows::Devices::Enumeration; +using namespace Windows::Media::Capture; +using namespace Windows::Media::MediaProperties; +using namespace Windows::UI::Xaml::Controls; Platform::Array^ MainPage::scenariosInner = ref new Platform::Array { @@ -21,3 +27,23 @@ Platform::Array^ MainPage::scenariosInner = ref new Platform::Array +/// Sets encoding properties on a camera stream. Ensures CaptureElement and preview stream are stopped before setting properties. +/// +task MainPage::SetMediaStreamPropertiesAsync(MediaCapture^ mediaCapture, CaptureElement^ previewControl, MediaStreamType streamType, IMediaEncodingProperties^ encodingProperties) +{ + // Stop preview and unlink the CaptureElement from the MediaCapture object + return create_task(mediaCapture->StopPreviewAsync()) + .then([this, mediaCapture, previewControl, streamType, encodingProperties]() + { + previewControl->Source = nullptr; + // Apply desired stream properties + return create_task(mediaCapture->VideoDeviceController->SetMediaStreamPropertiesAsync(streamType, encodingProperties)); + }).then([this, mediaCapture, previewControl]() { + // Recreate the CaptureElement pipeline and restart the preview + previewControl->Source = mediaCapture; + return create_task(mediaCapture->StartPreviewAsync()); + }); +} + diff --git a/Samples/CameraResolution/cpp/SampleConfiguration.h b/Samples/CameraResolution/cpp/SampleConfiguration.h index 3bccf1ae61..dbc3cce247 100644 --- a/Samples/CameraResolution/cpp/SampleConfiguration.h +++ b/Samples/CameraResolution/cpp/SampleConfiguration.h @@ -35,6 +35,8 @@ namespace SDKTemplate } } + Concurrency::task SetMediaStreamPropertiesAsync(Windows::Media::Capture::MediaCapture^ mediaCapture, Windows::UI::Xaml::Controls::CaptureElement^ previewControl, Windows::Media::Capture::MediaStreamType streamType, Windows::Media::MediaProperties::IMediaEncodingProperties ^ encodingProperties); + private: static Platform::Array^ scenariosInner; }; diff --git a/Samples/CameraResolution/cpp/Scenario1_PreviewSettings.xaml.cpp b/Samples/CameraResolution/cpp/Scenario1_PreviewSettings.xaml.cpp index d03e6636ee..b4e75e5812 100644 --- a/Samples/CameraResolution/cpp/Scenario1_PreviewSettings.xaml.cpp +++ b/Samples/CameraResolution/cpp/Scenario1_PreviewSettings.xaml.cpp @@ -142,7 +142,7 @@ void Scenario1_PreviewSettings::ComboBoxSettings_Changed(Platform::Object^ sende { auto selectedItem = static_cast(static_cast(sender)->SelectedItem); auto encodingProperties = static_cast(selectedItem->Tag); - create_task(_mediaCapture->VideoDeviceController->SetMediaStreamPropertiesAsync(MediaStreamType::VideoPreview, encodingProperties)); + create_task(_rootPage->SetMediaStreamPropertiesAsync(_mediaCapture.Get(), PreviewControl, MediaStreamType::VideoPreview, encodingProperties)); } } diff --git a/Samples/CameraResolution/cpp/Scenario2_PhotoSettings.xaml.cpp b/Samples/CameraResolution/cpp/Scenario2_PhotoSettings.xaml.cpp index a3d6d98e24..dcd025124a 100644 --- a/Samples/CameraResolution/cpp/Scenario2_PhotoSettings.xaml.cpp +++ b/Samples/CameraResolution/cpp/Scenario2_PhotoSettings.xaml.cpp @@ -192,7 +192,7 @@ void Scenario2_PhotoSettings::PreviewSettings_Changed(Platform::Object^ sender, { auto selectedItem = static_cast(static_cast(sender)->SelectedItem); auto encodingProperties = static_cast(selectedItem->Tag); - create_task(_mediaCapture->VideoDeviceController->SetMediaStreamPropertiesAsync(MediaStreamType::VideoPreview, encodingProperties)); + create_task(_rootPage->SetMediaStreamPropertiesAsync(_mediaCapture.Get(), PreviewControl, MediaStreamType::VideoPreview, encodingProperties)); } } @@ -206,7 +206,7 @@ void Scenario2_PhotoSettings::PhotoSettings_Changed(Platform::Object^ sender, Wi { auto selectedItem = static_cast(static_cast(sender)->SelectedItem); auto encodingProperties = static_cast(selectedItem->Tag); - create_task(_mediaCapture->VideoDeviceController->SetMediaStreamPropertiesAsync(MediaStreamType::Photo, encodingProperties)); + create_task(_rootPage->SetMediaStreamPropertiesAsync(_mediaCapture.Get(), PreviewControl, MediaStreamType::Photo, encodingProperties)); } } diff --git a/Samples/CameraResolution/cpp/Scenario3_AspectRatio.xaml.cpp b/Samples/CameraResolution/cpp/Scenario3_AspectRatio.xaml.cpp index b0475ec2cb..146c7f41d7 100644 --- a/Samples/CameraResolution/cpp/Scenario3_AspectRatio.xaml.cpp +++ b/Samples/CameraResolution/cpp/Scenario3_AspectRatio.xaml.cpp @@ -210,7 +210,7 @@ void Scenario3_AspectRatio::PreviewSettings_Changed(Platform::Object^ sender, Wi { auto selectedItem = static_cast(static_cast(sender)->SelectedItem); auto encodingProperties = static_cast(selectedItem->Tag); - create_task(_mediaCapture->VideoDeviceController->SetMediaStreamPropertiesAsync(MediaStreamType::VideoPreview, encodingProperties)); + create_task(_rootPage->SetMediaStreamPropertiesAsync(_mediaCapture.Get(), PreviewControl, MediaStreamType::VideoPreview, encodingProperties)); // The preview just changed, update the video combo box MatchPreviewAspectRatio(); @@ -227,7 +227,7 @@ void Scenario3_AspectRatio::VideoSettings_Changed(Platform::Object^ sender, Wind { auto selectedItem = static_cast(static_cast(sender)->SelectedItem); auto encodingProperties = static_cast(selectedItem->Tag); - create_task(_mediaCapture->VideoDeviceController->SetMediaStreamPropertiesAsync(MediaStreamType::VideoRecord, encodingProperties)); + create_task(_rootPage->SetMediaStreamPropertiesAsync(_mediaCapture.Get(), PreviewControl, MediaStreamType::VideoRecord, encodingProperties)); } } diff --git a/Samples/CameraResolution/cs/SampleConfiguration.cs b/Samples/CameraResolution/cs/SampleConfiguration.cs index 4ab7078982..373fc60a02 100644 --- a/Samples/CameraResolution/cs/SampleConfiguration.cs +++ b/Samples/CameraResolution/cs/SampleConfiguration.cs @@ -14,6 +14,7 @@ using Windows.UI.Xaml.Controls; using Windows.Media.Capture; using Windows.UI.Core; +using Windows.Media.MediaProperties; namespace SDKTemplate { @@ -50,6 +51,22 @@ public MediaCapturePreviewer(CaptureElement previewControl, CoreDispatcher dispa public bool IsRecording { get; set; } public MediaCapture MediaCapture { get; private set; } + /// + /// Sets encoding properties on a camera stream. Ensures CaptureElement and preview stream are stopped before setting properties. + /// + public async Task SetMediaStreamPropertiesAsync(MediaStreamType streamType, IMediaEncodingProperties encodingProperties) + { + // Stop preview and unlink the CaptureElement from the MediaCapture object + await MediaCapture.StopPreviewAsync(); + _previewControl.Source = null; + + // Apply desired stream properties + await MediaCapture.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, encodingProperties); + + // Recreate the CaptureElement pipeline and restart the preview + _previewControl.Source = MediaCapture; + await MediaCapture.StartPreviewAsync(); + } /// /// Initializes the MediaCapture, starts preview. diff --git a/Samples/CameraResolution/cs/Scenario1_PreviewSettings.xaml.cs b/Samples/CameraResolution/cs/Scenario1_PreviewSettings.xaml.cs index e14dd9acd9..b67b1f694f 100644 --- a/Samples/CameraResolution/cs/Scenario1_PreviewSettings.xaml.cs +++ b/Samples/CameraResolution/cs/Scenario1_PreviewSettings.xaml.cs @@ -79,7 +79,7 @@ private async void ComboBoxSettings_Changed(object sender, RoutedEventArgs e) { var selectedItem = (sender as ComboBox).SelectedItem as ComboBoxItem; var encodingProperties = (selectedItem.Tag as StreamResolution).EncodingProperties; - await _previewer.MediaCapture.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, encodingProperties); + await _previewer.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, encodingProperties); } } diff --git a/Samples/CameraResolution/cs/Scenario2_PhotoSettings.xaml.cs b/Samples/CameraResolution/cs/Scenario2_PhotoSettings.xaml.cs index aae8c0203a..e3b97237f4 100644 --- a/Samples/CameraResolution/cs/Scenario2_PhotoSettings.xaml.cs +++ b/Samples/CameraResolution/cs/Scenario2_PhotoSettings.xaml.cs @@ -107,7 +107,7 @@ private async void PreviewSettings_Changed(object sender, RoutedEventArgs e) { var selectedItem = (sender as ComboBox).SelectedItem as ComboBoxItem; var encodingProperties = (selectedItem.Tag as StreamResolution).EncodingProperties; - await _previewer.MediaCapture.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, encodingProperties); + await _previewer.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, encodingProperties); } } diff --git a/Samples/CameraResolution/cs/Scenario3_AspectRatio.xaml.cs b/Samples/CameraResolution/cs/Scenario3_AspectRatio.xaml.cs index 4ac9eec0d0..33b48f08d4 100644 --- a/Samples/CameraResolution/cs/Scenario3_AspectRatio.xaml.cs +++ b/Samples/CameraResolution/cs/Scenario3_AspectRatio.xaml.cs @@ -111,7 +111,7 @@ private async void PreviewSettings_Changed(object sender, RoutedEventArgs e) { var selectedItem = (sender as ComboBox).SelectedItem as ComboBoxItem; var encodingProperties = (selectedItem.Tag as StreamResolution).EncodingProperties; - await _previewer.MediaCapture.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, encodingProperties); + await _previewer.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, encodingProperties); // The preview just changed, update the video combo box MatchPreviewAspectRatio(); diff --git a/Samples/CameraResolution/js/js/Scenario1_PreviewSettings.js b/Samples/CameraResolution/js/js/Scenario1_PreviewSettings.js index e7da563799..0524974dc3 100644 --- a/Samples/CameraResolution/js/js/Scenario1_PreviewSettings.js +++ b/Samples/CameraResolution/js/js/Scenario1_PreviewSettings.js @@ -84,7 +84,7 @@ if (cameraSettings.value == "") return; - mediaCapture.videoDeviceController.setMediaStreamPropertiesAsync(Capture.MediaStreamType.videoPreview, allProperties[cameraSettings.value]); + setMediaStreamPropertiesAsync(mediaCapture, Capture.MediaStreamType.videoPreview, allProperties[cameraSettings.value]); } } diff --git a/Samples/CameraResolution/js/js/Scenario2_PhotoSettings.js b/Samples/CameraResolution/js/js/Scenario2_PhotoSettings.js index 4052d1b0dd..3d66fea938 100644 --- a/Samples/CameraResolution/js/js/Scenario2_PhotoSettings.js +++ b/Samples/CameraResolution/js/js/Scenario2_PhotoSettings.js @@ -101,7 +101,7 @@ if (previewSettings.value == "") return; - mediaCapture.videoDeviceController.setMediaStreamPropertiesAsync(Capture.MediaStreamType.videoPreview, previewProperties[previewSettings.value]); + setMediaStreamPropertiesAsync(mediaCapture, Capture.MediaStreamType.videoPreview, previewProperties[previewSettings.value]); } } @@ -114,7 +114,7 @@ if (photoSettings.value == "") return; - mediaCapture.videoDeviceController.setMediaStreamPropertiesAsync(Capture.MediaStreamType.videoPreview, photoProperties[photoSettings.value]); + setMediaStreamPropertiesAsync(mediaCapture, Capture.MediaStreamType.videoPreview, photoProperties[photoSettings.value]); } } diff --git a/Samples/CameraResolution/js/js/Scenario3_AspectRatio.js b/Samples/CameraResolution/js/js/Scenario3_AspectRatio.js index 6ea318bf3f..7a6e6d67eb 100644 --- a/Samples/CameraResolution/js/js/Scenario3_AspectRatio.js +++ b/Samples/CameraResolution/js/js/Scenario3_AspectRatio.js @@ -113,7 +113,7 @@ if (previewSettings.value == "") return; console.log(previewSettings.value) - mediaCapture.videoDeviceController.setMediaStreamPropertiesAsync(Capture.MediaStreamType.videoPreview, previewProperties[previewSettings.value]); + setMediaStreamPropertiesAsync(mediaCapture, Capture.MediaStreamType.videoPreview, previewProperties[previewSettings.value]); // The preview just changed, update the video combo box MatchPreviewAspectRatio(); @@ -128,7 +128,7 @@ // The first element is just text if (videoSettings.value == "") return; - mediaCapture.videoDeviceController.setMediaStreamPropertiesAsync(Capture.MediaStreamType.videoRecord, videoProperties[videoSettings.value]); + setMediaStreamPropertiesAsync(mediaCapture, Capture.MediaStreamType.videoRecord, videoProperties[videoSettings.value]); } } diff --git a/Samples/CameraResolution/js/js/StreamResolutionHelper.js b/Samples/CameraResolution/js/js/StreamResolutionHelper.js index 10f5b9366e..2fc432e0e2 100644 --- a/Samples/CameraResolution/js/js/StreamResolutionHelper.js +++ b/Samples/CameraResolution/js/js/StreamResolutionHelper.js @@ -61,3 +61,23 @@ streamResolutionHelper.prototype.frameRate = function () { streamResolutionHelper.prototype.aspectRatio = function () { return (this.width() / this.height()).toFixed(2); } + +/// +/// Sets encoding properties on a camera stream. Ensures VideoElement and preview stream are stopped before setting properties. +/// +function setMediaStreamPropertiesAsync(mediaCapture, streamType, encodingProperties) { + // Stop preview and unlink the VideoElement from the MediaCapture object + var previewVidTag = document.getElementById("cameraPreview"); + previewVidTag.pause; + previewVidTag.src = null; + + // Apply desired stream properties + return mediaCapture.videoDeviceController.setMediaStreamPropertiesAsync(streamType, encodingProperties) + .then(function () { + // Recreate pipeline and restart the preview + var previewVidTag = document.getElementById("cameraPreview"); + var previewUrl = URL.createObjectURL(mediaCapture); + previewVidTag.src = previewUrl; + previewVidTag.play(); + }); +} \ No newline at end of file diff --git a/Samples/CashDrawer/cs/CashDrawer.sln b/Samples/CashDrawer/cs/CashDrawer.sln index 695d31bba6..70e53d6046 100644 --- a/Samples/CashDrawer/cs/CashDrawer.sln +++ b/Samples/CashDrawer/cs/CashDrawer.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/ContactPanel/cs/ContactPanel.csproj b/Samples/ContactPanel/cs/ContactPanel.csproj index a942957f18..b1524b2198 100644 --- a/Samples/ContactPanel/cs/ContactPanel.csproj +++ b/Samples/ContactPanel/cs/ContactPanel.csproj @@ -12,7 +12,7 @@ en-US UAP 10.0.16299.0 - 10.0.15063.0 + 10.0.16299.0 15 true 512 diff --git a/Samples/ContactPanel/cs/Package.appxmanifest b/Samples/ContactPanel/cs/Package.appxmanifest index f3b832191e..8a2ee5a5fe 100644 --- a/Samples/ContactPanel/cs/Package.appxmanifest +++ b/Samples/ContactPanel/cs/Package.appxmanifest @@ -21,7 +21,7 @@ - + diff --git a/Samples/ContentIndexer/cs/ContentIndexer.sln b/Samples/ContentIndexer/cs/ContentIndexer.sln index adeb845857..cf8c608a66 100644 --- a/Samples/ContentIndexer/cs/ContentIndexer.sln +++ b/Samples/ContentIndexer/cs/ContentIndexer.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/ContextMenu/cs/ContextMenu.sln b/Samples/ContextMenu/cs/ContextMenu.sln index a570fcc3f8..a8e4f53e88 100644 --- a/Samples/ContextMenu/cs/ContextMenu.sln +++ b/Samples/ContextMenu/cs/ContextMenu.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/CustomHidDeviceAccess/cs/CustomHidDeviceAccess.sln b/Samples/CustomHidDeviceAccess/cs/CustomHidDeviceAccess.sln index ce970bbf5e..8ee44fda33 100644 --- a/Samples/CustomHidDeviceAccess/cs/CustomHidDeviceAccess.sln +++ b/Samples/CustomHidDeviceAccess/cs/CustomHidDeviceAccess.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/CustomSerialDeviceAccess/cs/CustomSerialDeviceAccess.sln b/Samples/CustomSerialDeviceAccess/cs/CustomSerialDeviceAccess.sln index bb43b004ed..cdb327e71b 100644 --- a/Samples/CustomSerialDeviceAccess/cs/CustomSerialDeviceAccess.sln +++ b/Samples/CustomSerialDeviceAccess/cs/CustomSerialDeviceAccess.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/CustomUsbDeviceAccess/cs/CustomUsbDeviceAccess.sln b/Samples/CustomUsbDeviceAccess/cs/CustomUsbDeviceAccess.sln index 20fa05e94d..3bf77902ba 100644 --- a/Samples/CustomUsbDeviceAccess/cs/CustomUsbDeviceAccess.sln +++ b/Samples/CustomUsbDeviceAccess/cs/CustomUsbDeviceAccess.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -53,5 +52,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/Geolocation/cs/Geolocation.sln b/Samples/Geolocation/cs/Geolocation.sln index 0c2839e281..916dc51a14 100644 --- a/Samples/Geolocation/cs/Geolocation.sln +++ b/Samples/Geolocation/cs/Geolocation.sln @@ -52,5 +52,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/HolographicMixedRealityCapture/cpp/Common/DeviceResources.cpp b/Samples/HolographicMixedRealityCapture/cpp/Common/DeviceResources.cpp index 182e71b91c..a6d5925c0b 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/Common/DeviceResources.cpp +++ b/Samples/HolographicMixedRealityCapture/cpp/Common/DeviceResources.cpp @@ -15,8 +15,12 @@ using namespace Windows::Graphics::Holographic; static const std::wstring s_VertexShaderFiles[DX::VertexShader_Max] = { L"ms-appx:///VertexShader.cso", - L"ms-appx:///VprtVertexShader.cso", L"ms-appx:///VertexShaderTexture.cso", +}; + +static const std::wstring s_VprtVertexShaderFiles[DX::VertexShader_Max] = +{ + L"ms-appx:///VprtVertexShader.cso", L"ms-appx:///VprtVertexShaderTexture.cso" }; @@ -393,7 +397,7 @@ Concurrency::task DX::DeviceResources::LoadShaders() // Load vertex shaders and input layouts for (int i = 0; i < VertexShader_Max; i++) { - Concurrency::task> loadVSTask = DX::ReadDataAsync(s_VertexShaderFiles[i]); + Concurrency::task> loadVSTask = DX::ReadDataAsync(m_supportsVprt ? s_VprtVertexShaderFiles[i] : s_VertexShaderFiles[i]); Concurrency::task createVSTask = loadVSTask.then([this, i](const std::vector& fileData) { @@ -407,7 +411,6 @@ Concurrency::task DX::DeviceResources::LoadShaders() switch (i) { case VertexShader_Simple: - case VertexShader_VPRT: { const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = { @@ -425,7 +428,6 @@ Concurrency::task DX::DeviceResources::LoadShaders() } break; case VertexShader_Texture: - case VertexShader_TextureVPRT: { const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = { diff --git a/Samples/HolographicMixedRealityCapture/cpp/Common/DeviceResources.h b/Samples/HolographicMixedRealityCapture/cpp/Common/DeviceResources.h index 8b01e53aa6..f17423b948 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/Common/DeviceResources.h +++ b/Samples/HolographicMixedRealityCapture/cpp/Common/DeviceResources.h @@ -9,9 +9,7 @@ namespace DX typedef enum { VertexShader_Simple = 0, - VertexShader_VPRT, VertexShader_Texture, - VertexShader_TextureVPRT, VertexShader_Max } VertexShaderIndex; diff --git a/Samples/HolographicMixedRealityCapture/cpp/Content/Button.cpp b/Samples/HolographicMixedRealityCapture/cpp/Content/Button.cpp index ec9a9a61b9..d091d99afe 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/Content/Button.cpp +++ b/Samples/HolographicMixedRealityCapture/cpp/Content/Button.cpp @@ -220,8 +220,8 @@ void Button::DoCreateDeviceDependentResources() // target array index, thus avoiding any overhead that would be // incurred by setting the geometry shader stage. - m_vertexShader = m_deviceResources->GetVertexShader(m_usingVprtShaders ? DX::VertexShader_TextureVPRT : DX::VertexShader_Texture); - m_inputLayout = m_deviceResources->GetInputLayout(m_usingVprtShaders ? DX::VertexShader_TextureVPRT : DX::VertexShader_Texture); + m_vertexShader = m_deviceResources->GetVertexShader(DX::VertexShader_Texture); + m_inputLayout = m_deviceResources->GetInputLayout(DX::VertexShader_Texture); m_pixelShader = m_deviceResources->GetPixelShader(DX::PixelShader_Texture); D3D11_TEXTURE2D_DESC texDesc; diff --git a/Samples/HolographicMixedRealityCapture/cpp/Content/Cursor.cpp b/Samples/HolographicMixedRealityCapture/cpp/Content/Cursor.cpp index 3a97e85094..d1a950ce3b 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/Content/Cursor.cpp +++ b/Samples/HolographicMixedRealityCapture/cpp/Content/Cursor.cpp @@ -154,8 +154,8 @@ void Cursor::CreateDeviceDependentResources() // target array index, thus avoiding any overhead that would be // incurred by setting the geometry shader stage. - m_vertexShader = m_deviceResources->GetVertexShader(m_usingVprtShaders ? DX::VertexShader_TextureVPRT : DX::VertexShader_Texture); - m_inputLayout = m_deviceResources->GetInputLayout(m_usingVprtShaders ? DX::VertexShader_TextureVPRT : DX::VertexShader_Texture); + m_vertexShader = m_deviceResources->GetVertexShader(DX::VertexShader_Texture); + m_inputLayout = m_deviceResources->GetInputLayout(DX::VertexShader_Texture); m_pixelShader = m_deviceResources->GetPixelShader(DX::PixelShader_Cursor); D3D11_TEXTURE2D_DESC texDesc; diff --git a/Samples/HolographicMixedRealityCapture/cpp/Content/Panel.cpp b/Samples/HolographicMixedRealityCapture/cpp/Content/Panel.cpp index b62f86a1a3..65b0e430ae 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/Content/Panel.cpp +++ b/Samples/HolographicMixedRealityCapture/cpp/Content/Panel.cpp @@ -145,8 +145,8 @@ void Panel::DoCreateDeviceDependentResources() // target array index, thus avoiding any overhead that would be // incurred by setting the geometry shader stage. - m_vertexShader = m_deviceResources->GetVertexShader(m_usingVprtShaders ? DX::VertexShader_VPRT : DX::VertexShader_Simple); - m_inputLayout = m_deviceResources->GetInputLayout(m_usingVprtShaders ? DX::VertexShader_VPRT : DX::VertexShader_Simple); + m_vertexShader = m_deviceResources->GetVertexShader(DX::VertexShader_Simple); + m_inputLayout = m_deviceResources->GetInputLayout(DX::VertexShader_Simple); m_pixelShader = m_deviceResources->GetPixelShader(DX::PixelShader_Simple); if (!m_usingVprtShaders) diff --git a/Samples/HolographicMixedRealityCapture/cpp/Content/SpinningCubeRenderer.cpp b/Samples/HolographicMixedRealityCapture/cpp/Content/SpinningCubeRenderer.cpp index 24f36ac49f..c1db313210 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/Content/SpinningCubeRenderer.cpp +++ b/Samples/HolographicMixedRealityCapture/cpp/Content/SpinningCubeRenderer.cpp @@ -166,8 +166,8 @@ void SpinningCubeRenderer::CreateDeviceDependentResources() // target array index, thus avoiding any overhead that would be // incurred by setting the geometry shader stage. - m_vertexShader = m_deviceResources->GetVertexShader(m_usingVprtShaders ? DX::VertexShader_VPRT : DX::VertexShader_Simple); - m_inputLayout = m_deviceResources->GetInputLayout(m_usingVprtShaders ? DX::VertexShader_VPRT : DX::VertexShader_Simple); + m_vertexShader = m_deviceResources->GetVertexShader(DX::VertexShader_Simple); + m_inputLayout = m_deviceResources->GetInputLayout(DX::VertexShader_Simple); m_pixelShader = m_deviceResources->GetPixelShader(DX::PixelShader_Simple); if (!m_usingVprtShaders) diff --git a/Samples/HolographicMixedRealityCapture/cpp/HolographicMRCSampleMain.cpp b/Samples/HolographicMixedRealityCapture/cpp/HolographicMRCSampleMain.cpp index bf256e8f6c..1041550c70 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/HolographicMRCSampleMain.cpp +++ b/Samples/HolographicMixedRealityCapture/cpp/HolographicMRCSampleMain.cpp @@ -517,8 +517,8 @@ void HolographicMRCSampleMain::OnButtonInitTapped() { Concurrency::create_task(m_mediaCapture->InitializeAsync()).then([this]() { - m_photoButton->SetEnabled(true); - m_videoButton->SetEnabled(true); + m_photoButton->SetEnabled(m_mediaCapture->CanTakePhoto()); + m_videoButton->SetEnabled(m_mediaCapture->CanToggleVideo()); m_hologramButton->SetEnabled(true); m_sysAudioButton->SetEnabled(true); }); @@ -544,7 +544,7 @@ void HolographicMRCSampleMain::OnButtonVideoTapped() m_initButton->SetEnabled(false); m_photoButton->SetEnabled(m_mediaCapture->CanTakePhoto()); - m_videoButton->SetEnabled(true); + m_videoButton->SetEnabled(m_mediaCapture->CanToggleVideo()); m_hologramButton->SetEnabled(true); m_sysAudioButton->SetEnabled(true); }); @@ -565,7 +565,7 @@ void HolographicMRCSampleMain::OnButtonVideoTapped() m_initButton->SetEnabled(false); m_photoButton->SetEnabled(m_mediaCapture->CanTakePhoto()); - m_videoButton->SetEnabled(true); + m_videoButton->SetEnabled(m_mediaCapture->CanToggleVideo()); m_hologramButton->SetEnabled(false); m_sysAudioButton->SetEnabled(false); }); @@ -587,7 +587,7 @@ void HolographicMRCSampleMain::OnButtonPhotoTapped() { m_initButton->SetEnabled(false); m_photoButton->SetEnabled(m_mediaCapture->CanTakePhoto()); - m_videoButton->SetEnabled(true); + m_videoButton->SetEnabled(m_mediaCapture->CanToggleVideo()); m_hologramButton->SetEnabled(true); m_sysAudioButton->SetEnabled(true); }); diff --git a/Samples/HolographicMixedRealityCapture/cpp/MediaCaptureManager.cpp b/Samples/HolographicMixedRealityCapture/cpp/MediaCaptureManager.cpp index 3928efa8d2..7ffe4aca38 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/MediaCaptureManager.cpp +++ b/Samples/HolographicMixedRealityCapture/cpp/MediaCaptureManager.cpp @@ -49,7 +49,16 @@ Concurrency::task MediaCaptureManager::InitializeAsync(IMFDXGIDeviceManage return Concurrency::create_task(m_mediaCapture->InitializeAsync(initSetting)).then([this]() { auto lock = m_lock.LockExclusive(); - m_currentState = Initialized; + + if (m_mediaCapture->MediaCaptureSettings->AudioDeviceId && m_mediaCapture->MediaCaptureSettings->VideoDeviceId) + { + // MediaCapture is initialized with valid audio and video device. + m_currentState = Initialized; + } + else + { + OutputDebugString(L"MediaCapture is initialized without valid sources.\n"); + } }); } @@ -295,13 +304,20 @@ bool MediaCaptureManager::CanTakePhoto() if (m_currentState == Initialized) { - OutputDebugString(L"Can Take Photo\n"); ret = true; } - else + + return ret; +} + +bool MediaCaptureManager::CanToggleVideo() +{ + auto lock = m_lock.LockShared(); + bool ret = false; + + if (m_currentState == Initialized || m_currentState == Recording) { - OutputDebugString(L"Can NOT Take Photo\n"); - ret = false; + ret = true; } return ret; diff --git a/Samples/HolographicMixedRealityCapture/cpp/MediaCaptureManager.h b/Samples/HolographicMixedRealityCapture/cpp/MediaCaptureManager.h index 4b0b9db5b2..d56ca0e58d 100644 --- a/Samples/HolographicMixedRealityCapture/cpp/MediaCaptureManager.h +++ b/Samples/HolographicMixedRealityCapture/cpp/MediaCaptureManager.h @@ -35,6 +35,7 @@ namespace HolographicMRCSample bool IsHologramEnabled() { auto lock = m_lock.LockShared(); return m_hologramEnabled; } bool IsSystemAudioEnabled() { auto lock = m_lock.LockShared(); return m_sysAudioEnabled; } bool CanTakePhoto(); + bool CanToggleVideo(); private: Microsoft::WRL::Wrappers::SRWLock m_lock; diff --git a/Samples/HomeGroup/cs/HomeGroup.sln b/Samples/HomeGroup/cs/HomeGroup.sln index 65de5a6ec7..a0879f342f 100644 --- a/Samples/HomeGroup/cs/HomeGroup.sln +++ b/Samples/HomeGroup/cs/HomeGroup.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/MagneticStripeReader/cs/MagneticStripeReader.sln b/Samples/MagneticStripeReader/cs/MagneticStripeReader.sln index 520dd3b91a..b87762b24d 100644 --- a/Samples/MagneticStripeReader/cs/MagneticStripeReader.sln +++ b/Samples/MagneticStripeReader/cs/MagneticStripeReader.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/MapControl/cpp/Scenario2.xaml.cpp b/Samples/MapControl/cpp/Scenario2.xaml.cpp index 03e942b6db..33b33b3769 100644 --- a/Samples/MapControl/cpp/Scenario2.xaml.cpp +++ b/Samples/MapControl/cpp/Scenario2.xaml.cpp @@ -29,7 +29,7 @@ Scenario2::Scenario2() mapIconStreamReference = RandomAccessStreamReference::CreateFromUri(ref new Uri("ms-appx:///Assets/MapPin.png")); mapBillboardStreamReference = RandomAccessStreamReference::CreateFromUri(ref new Uri("ms-appx:///Assets/billboard.jpg")); - mapModelStreamReference = RandomAccessStreamReference::CreateFromUri(ref new Uri("ms-appx:///Assets/ConkerAfro.3mf")); + mapModelStreamReference = RandomAccessStreamReference::CreateFromUri(ref new Uri("ms-appx:///Assets/box.3mf")); } void Scenario2::MyMap_Loaded(Object^ sender, RoutedEventArgs^ e) diff --git a/Samples/MapControl/cs/MapControl.csproj b/Samples/MapControl/cs/MapControl.csproj index 1beb7c76ce..3404a8ccd9 100644 --- a/Samples/MapControl/cs/MapControl.csproj +++ b/Samples/MapControl/cs/MapControl.csproj @@ -281,7 +281,7 @@ Always - Assets\ConkerAfro.3mf + Assets\box.3mf Always diff --git a/Samples/MessageDialog/cs/MessageDialogSample.sln b/Samples/MessageDialog/cs/MessageDialogSample.sln index 57f652c391..e35179d202 100644 --- a/Samples/MessageDialog/cs/MessageDialogSample.sln +++ b/Samples/MessageDialog/cs/MessageDialogSample.sln @@ -1,5 +1,4 @@  - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26228.4 @@ -39,5 +38,3 @@ Global HideSolutionNode = FALSE EndGlobalSection EndGlobal - - diff --git a/Samples/PdfDocument/shared/Scenario1_Render.xaml b/Samples/PdfDocument/shared/Scenario1_Render.xaml index 170aeab35a..815142e58f 100644 --- a/Samples/PdfDocument/shared/Scenario1_Render.xaml +++ b/Samples/PdfDocument/shared/Scenario1_Render.xaml @@ -32,12 +32,18 @@ - View page - + View page + + of . - + + Actual size Half size on beige background Crop to center of page @@ -45,7 +51,9 @@