AdvancedCapture.xaml.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //*********************************************************
  2. //
  3. // Copyright (c) Microsoft. All rights reserved.
  4. // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
  5. // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
  6. // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
  7. // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
  8. //
  9. //*********************************************************
  10. //
  11. // AdvancedCapture.xaml.h
  12. // Declaration of the AdvancedCapture class
  13. //
  14. #pragma once
  15. #include "pch.h"
  16. #include "AdvancedCapture.g.h"
  17. #include "MainPage.xaml.h"
  18. #include <ppl.h>
  19. #define VIDEO_FILE_NAME "video.mp4"
  20. #define PHOTO_FILE_NAME "photo.jpg"
  21. #define TEMP_PHOTO_FILE_NAME "photoTmp.jpg"
  22. using namespace concurrency;
  23. using namespace Windows::Devices::Enumeration;
  24. namespace SDKSample
  25. {
  26. namespace MediaCapture
  27. {
  28. /// <summary>
  29. /// An empty page that can be used on its own or navigated to within a Frame.
  30. /// </summary>
  31. [Windows::Foundation::Metadata::WebHostHidden]
  32. public ref class AdvancedCapture sealed
  33. {
  34. public:
  35. AdvancedCapture();
  36. protected:
  37. virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
  38. virtual void OnNavigatedFrom(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
  39. private:
  40. MainPage^ rootPage;
  41. void ScenarioInit();
  42. void ScenarioReset();
  43. void Failed(Windows::Media::Capture::MediaCapture ^ mediaCapture, Windows::Media::Capture::MediaCaptureFailedEventArgs ^ args);
  44. void btnStartDevice_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  45. void btnStartPreview_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  46. void lstEnumedDevices_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
  47. void EnumerateWebcamsAsync();
  48. void AddEffectToImageStream();
  49. void ShowStatusMessage(Platform::String^ text);
  50. void ShowExceptionMessage(Platform::Exception^ ex);
  51. void EnableButton(bool enabled, Platform::String ^name);
  52. task<Windows::Storage::StorageFile^> ReencodePhotoAsync(
  53. Windows::Storage::StorageFile ^tempStorageFile,
  54. Windows::Storage::FileProperties::PhotoOrientation photoRotation);
  55. Windows::Storage::FileProperties::PhotoOrientation GetCurrentPhotoRotation();
  56. void PrepareForVideoRecording();
  57. void DisplayProperties_OrientationChanged(Platform::Object^ sender);
  58. Windows::Storage::FileProperties::PhotoOrientation PhotoRotationLookup(
  59. Windows::Graphics::Display::DisplayOrientations displayOrientation, bool counterclockwise);
  60. Windows::Media::Capture::VideoRotation VideoRotationLookup(
  61. Windows::Graphics::Display::DisplayOrientations displayOrientation, bool counterclockwise);
  62. Platform::Agile<Windows::Media::Capture::MediaCapture> m_mediaCaptureMgr;
  63. Windows::Storage::StorageFile^ m_recordStorageFile;
  64. bool m_bRecording;
  65. bool m_bEffectAdded;
  66. bool m_bEffectAddedToRecord;
  67. bool m_bEffectAddedToPhoto;
  68. bool m_bSuspended;
  69. bool m_bPreviewing;
  70. DeviceInformationCollection^ m_devInfoCollection;
  71. Windows::Foundation::EventRegistrationToken m_eventRegistrationToken;
  72. bool m_bRotateVideoOnOrientationChange;
  73. bool m_bReversePreviewRotation;
  74. Windows::Foundation::EventRegistrationToken m_orientationChangedEventToken;
  75. void Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  76. };
  77. }
  78. }