Skip to content

Commit 7ad24e8

Browse files
authored
Merge pull request #1377 from msebolt/walkthrough-review-pr3
walkthrough fix
2 parents f2bcd6d + c24cf6e commit 7ad24e8

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

docs/windows/codesnippet/CSharp/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation_8.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using Windows.Devices.Enumeration;
33
using Windows.Media.Capture;
4+
using Windows.Media.Effects;
45
using Windows.Media.MediaProperties;
56
using Windows.Storage.Streams;
67
using Windows.UI;
@@ -110,7 +111,8 @@ private async void AddRemoveEffect_Checked(object sender, RoutedEventArgs e)
110111
try
111112
{
112113
AddRemoveEffect.IsEnabled = false;
113-
await mediaCapture.AddEffectAsync(MediaStreamType.Photo, "GrayscaleTransform.GrayscaleEffect", null);
114+
VideoEffectDefinition def = new VideoEffectDefinition("GrayscaleTransform.GrayscaleEffect");
115+
await mediaCapture.AddVideoEffectAsync(def, MediaStreamType.Photo);
114116
ShowStatusMessage("Add effect to video preview successful");
115117
AddRemoveEffect.IsEnabled = true;
116118
}

docs/windows/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This example creates a custom Media Foundation transform that applies a grayscal
1919
> [!NOTE]
2020
> Instead of C#, you can also use JavaScript, Visual Basic, or C++ to consume the custom transform component.
2121
22-
In most cases, you can use C++/CX to create Windows Runtime). However, sometimes you have to use the WRL. For example, when you create a media extension for Microsoft Media Foundation, you must create a component that implements both COM and Windows Runtime interfaces. Because C++/CX can only create Windows Runtime objects, to create a media extension you must use the WRL because it enables the implementation of both COM and Windows Runtime interfaces.
22+
In most cases, you can use C++/CX to create Windows Runtime. However, sometimes you have to use the WRL. For example, when you create a media extension for Microsoft Media Foundation, you must create a component that implements both COM and Windows Runtime interfaces. Because C++/CX can only create Windows Runtime objects, to create a media extension you must use the WRL because it enables the implementation of both COM and Windows Runtime interfaces.
2323

2424
> [!NOTE]
2525
> Although this code example is long, it demonstrates the minimum that's required to create a useful Media Foundation transform. You can use it as a starting point for your own custom transform. This example is adapted from the [Media extensions sample](http://code.msdn.microsoft.com/windowsapps/Media-extensions-sample-7b466096), which uses media extensions to apply effects to video, decode video, and create scheme handlers that produce media streams.
@@ -42,7 +42,7 @@ In most cases, you can use C++/CX to create Windows Runtime). However, sometimes
4242

4343
- The [InspectableClass](../windows/inspectableclass-macro.md) macro implements basic COM functionality such as reference counting and the `QueryInterface` method, and sets the runtime class name and trust level.
4444

45-
- Use the Microsoft::WRL::[Module class](https://www.microsoftonedoc.com/#/organizations/e6f6a65cf14f462597b64ac058dbe1d0/projects/3fedad16-eaf1-41a6-8f96-0c1949c68f32/containers/a3daf831-1c5f-4bbe-964d-503870caf874/tocpaths/b4acf5de-2f4c-4c8b-b5ff-9140d023ecbe/locales/en-US) to implement DLL entry-point functions such as [DllGetActivationFactory](https://msdn.microsoft.com/library/br205771.aspx), [DllCanUnloadNow](/windows/desktop/api/combaseapi/nf-combaseapi-dllcanunloadnow), and [DllGetClassObject](/windows/desktop/api/combaseapi/nf-combaseapi-dllgetclassobject).
45+
- Use the Microsoft::WRL::[Module class](https://www.microsoftonedoc.com/#/organizations/e6f6a65cf14f462597b64ac058dbe1d0/projects/3fedad16-eaf1-41a6-8f96-0c1949c68f32/containers/a3daf831-1c5f-4bbe-964d-503870caf874/tocpaths/b4acf5de-2f4c-4c8b-b5ff-9140d023ecbe) to implement DLL entry-point functions such as [DllGetActivationFactory](https://msdn.microsoft.com/library/br205771.aspx), [DllCanUnloadNow](/windows/desktop/api/combaseapi/nf-combaseapi-dllcanunloadnow), and [DllGetClassObject](/windows/desktop/api/combaseapi/nf-combaseapi-dllgetclassobject).
4646

4747
- Link your component DLL to runtimeobject.lib. Also specify [/WINMD](../cppcx/compiler-and-linker-options-c-cx.md) on the linker line to generate Windows metadata.
4848

@@ -52,29 +52,29 @@ In most cases, you can use C++/CX to create Windows Runtime). However, sometimes
5252

5353
1. In Visual Studio, create a **Blank Solution** project. Name the project, for example, *MediaCapture*.
5454

55-
2. Add a **DLL (Universal Windows)** project to the solution. Name the project, for example, *GrayscaleTransform*.
55+
1. Add a **DLL (Universal Windows)** project to the solution. Name the project, for example, *GrayscaleTransform*.
5656

57-
3. Add a **Midl File (.idl)** file to the project. Name the file, for example, *GrayscaleTransform.idl*.
57+
1. Add a **Midl File (.idl)** file to the project. Name the file, for example, *GrayscaleTransform.idl*.
5858

59-
4. Add this code to GrayscaleTransform.idl.
59+
1. Add this code to GrayscaleTransform.idl:
6060

6161
[!code-cpp[wrl-media-capture#1](../windows/codesnippet/CPP/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation_1.idl)]
6262

63-
5. Use the following code to replace the contents of `pch.h`.
63+
1. Use the following code to replace the contents of `pch.h`:
6464

6565
[!code-cpp[wrl-media-capture#2](../windows/codesnippet/CPP/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation_2.h)]
6666

67-
6. Add a new header file to the project, name it `BufferLock.h`, and then add this code:
67+
1. Add a new header file to the project, name it `BufferLock.h`, and then replace the contents with this code:
6868

6969
[!code-cpp[wrl-media-capture#3](../windows/codesnippet/CPP/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation_3.h)]
7070

71-
7. `GrayscaleTransform.h` is not used in this example. You can remove it from the project if you want to.
71+
1. `GrayscaleTransform.h` is not used in this example. You can remove it from the project if you want to.
7272

73-
8. Use the following code to replace the contents of `GrayscaleTransform.cpp`.
73+
1. Use the following code to replace the contents of `GrayscaleTransform.cpp`:
7474

7575
[!code-cpp[wrl-media-capture#4](../windows/codesnippet/CPP/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation_4.cpp)]
7676

77-
9. Add a new module-definition file to the project, name it `GrayscaleTransform.def`, and then add this code:
77+
1. Add a new module-definition file to the project, name it `GrayscaleTransform.def`, and then add this code:
7878

7979
```
8080
EXPORTS
@@ -83,31 +83,31 @@ In most cases, you can use C++/CX to create Windows Runtime). However, sometimes
8383
DllGetClassObject PRIVATE
8484
```
8585

86-
10. Use the following code to replace the contents of `dllmain.cpp`.
86+
1. Use the following code to replace the contents of `dllmain.cpp`:
8787

8888
[!code-cpp[wrl-media-capture#6](../windows/codesnippet/CPP/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation_6.cpp)]
8989

90-
11. In the project’s **Property Pages** dialog box, set the following **Linker** properties.
90+
1. In the project’s **Property Pages** dialog box, set the following **Linker** properties.
9191

9292
1. Under **Input**, for the **Module Definition File**, specify `GrayScaleTransform.def`.
9393

94-
2. Also under **Input**, add `runtimeobject.lib`, `mfuuid.lib`, and `mfplat.lib` to the **Additional Dependencies** property.
94+
1. Also under **Input**, add `runtimeobject.lib`, `mfuuid.lib`, and `mfplat.lib` to the **Additional Dependencies** property.
9595

96-
3. Under **Windows Metadata**, set **Generate Windows Metadata** to **Yes (/WINMD)**.
96+
1. Under **Windows Metadata**, set **Generate Windows Metadata** to **Yes (/WINMD)**.
9797

9898
### To use the WRL the custom Media Foundation component from a C# app
9999

100-
1. Add a new **C# Blank App (XAML)** project to the `MediaCapture` solution. Name the project, for example, *MediaCapture*.
100+
1. Add a new **C# Blank App (Universal Windows)** project to the `MediaCapture` solution. Name the project, for example, *MediaCapture*.
101101

102-
2. In the **MediaCapture** project, add a reference to the `GrayscaleTransform` project. To learn how, see [How to: Add or Remove References By Using the Reference Manager](/visualstudio/ide/how-to-add-or-remove-references-by-using-the-reference-manager).
102+
1. In the **MediaCapture** project, add a reference to the `GrayscaleTransform` project. To learn how, see [How to: Add or Remove References By Using the Reference Manager](/visualstudio/ide/how-to-add-or-remove-references-by-using-the-reference-manager).
103103

104-
3. In `Package.appxmanifest`, on the **Capabilities** tab, select **Microphone** and **Webcam**. Both capabilities are required to capture photos from the webcam.
104+
1. In `Package.appxmanifest`, on the **Capabilities** tab, select **Microphone** and **Webcam**. Both capabilities are required to capture photos from the webcam.
105105

106-
4. In `MainPage.xaml`, add this code to the root [Grid](https://msdn.microsoft.com/library/windows/apps/xaml/windows.ui.xaml.controls.grid.aspx) element:
106+
1. In `MainPage.xaml`, add this code to the root [Grid](https://msdn.microsoft.com/library/windows/apps/xaml/windows.ui.xaml.controls.grid.aspx) element:
107107

108108
[!code-xml[wrl-media-capture#7](../windows/codesnippet/Xaml/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation_7.xaml)]
109109

110-
5. Use the following code to replace the contents of `MainPage.xaml.cs`.
110+
1. Use the following code to replace the contents of `MainPage.xaml.cs`:
111111

112112
[!code-cs[wrl-media-capture#8](../windows/codesnippet/CSharp/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation_8.cs)]
113113

0 commit comments

Comments
 (0)