Skip to content

Commit 8fd55a4

Browse files
trying to call from c++ component instead, problems with passing properties
1 parent b9f25c6 commit 8fd55a4

File tree

6 files changed

+36
-23
lines changed

6 files changed

+36
-23
lines changed

Samples/StyleTransfer/AppViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public async Task ChangeLiveStream()
307307
await _mediaCapture.InitializeAsync(settings);
308308

309309
// Initialize VideoEffect
310-
VideoEffectDefinition videoEffectDefinition = new VideoEffectDefinition("StyleTransferEffectComponent.StyleTransferVideoEffect");
310+
VideoEffectDefinition videoEffectDefinition = new VideoEffectDefinition("RuntimeComponent2.Class");
311311
videoEffect = await _mediaCapture.AddVideoEffectAsync(videoEffectDefinition, MediaStreamType.VideoPreview);
312312
videoEffect.SetProperties(new PropertySet() {
313313
{ "Session", m_session},

Samples/StyleTransfer/RuntimeComponent2/Class.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55

66
namespace winrt::RuntimeComponent2::implementation
77
{
8-
int32_t Class::MyProperty()
9-
{
10-
throw hresult_not_implemented();
11-
}
12-
13-
void Class::MyProperty(int32_t /* value */)
14-
{
15-
throw hresult_not_implemented();
16-
}
178

189
IVectorView<VideoEncodingProperties> Class::SupportedEncodingProperties() {
1910
VideoEncodingProperties encodingProperties = VideoEncodingProperties();
@@ -22,7 +13,7 @@ namespace winrt::RuntimeComponent2::implementation
2213
}
2314

2415
LearningModelSession Class::Session() {
25-
if (!configuration) {
16+
if (this->configuration) {
2617
IInspectable val = configuration.TryLookup(L"Session");
2718
if (val) {
2819
return val.try_as<LearningModelSession>();
@@ -31,28 +22,28 @@ namespace winrt::RuntimeComponent2::implementation
3122
return NULL;
3223
}
3324
LearningModelBinding Class::Binding() {
34-
if (!configuration) {
25+
if (configuration) {
3526
IInspectable val = configuration.TryLookup(L"Binding");
36-
if (!configuration && val) {
27+
if (val) {
3728
return val.try_as<LearningModelBinding>();
3829
}
3930
}
4031
return NULL;
4132
}
4233

4334
hstring Class::InputImageDescription() {
44-
if (!configuration) {
35+
if (configuration) {
4536
IInspectable val = configuration.TryLookup(L"InputImageDescription");
46-
if (!configuration && val) {
37+
if (val) {
4738
return unbox_value<hstring>(val);
4839
}
4940
}
5041
return L"";
5142
}
5243
hstring Class::OutputImageDescription() {
53-
if (!configuration) {
44+
if (configuration) {
5445
IInspectable val = configuration.TryLookup(L"OutputImageDescription");
55-
if (!configuration && val) {
46+
if (val) {
5647
return unbox_value<hstring>(val);
5748
}
5849
}
@@ -81,11 +72,11 @@ namespace winrt::RuntimeComponent2::implementation
8172
auto results = _session.Evaluate(_binding, L"test");
8273
}
8374

84-
void Class::SetEncodingProperties(VideoEncodingProperties, IDirect3DDevice) {
85-
throw hresult_not_implemented();
75+
void Class::SetEncodingProperties(VideoEncodingProperties props, IDirect3DDevice device) {
76+
encodingProperties = props;
8677
}
8778

8879
void Class::SetProperties(IPropertySet config) {
89-
configuration = config;
80+
this->configuration = config;
9081
}
9182
}

Samples/StyleTransfer/RuntimeComponent2/Class.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ namespace winrt::RuntimeComponent2::implementation
1616
{
1717
Class() = default;
1818

19-
int32_t MyProperty();
2019
IVectorView<VideoEncodingProperties> SupportedEncodingProperties();
2120
bool TimeIndependent();
2221
MediaMemoryTypes SupportedMemoryTypes();
@@ -35,7 +34,7 @@ namespace winrt::RuntimeComponent2::implementation
3534
LearningModelBinding Binding();
3635
hstring InputImageDescription();
3736
hstring OutputImageDescription();
38-
37+
VideoEncodingProperties encodingProperties;
3938
};
4039
}
4140

Samples/StyleTransfer/RuntimeComponent2/Class.idl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace RuntimeComponent2
55
runtimeclass Class : Windows.Media.Effects.IBasicVideoEffect
66
{
77
Class();
8-
Int32 MyProperty;
98
void SetProperties(Windows.Foundation.Collections.IPropertySet config);
109
}
1110
}

Samples/StyleTransfer/StyleTransfer.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@
247247
<Folder Include="Helpers\" />
248248
</ItemGroup>
249249
<ItemGroup>
250+
<ProjectReference Include="RuntimeComponent2\RuntimeComponent2.vcxproj">
251+
<Project>{e9c60c87-553f-406b-892e-1f827a31930d}</Project>
252+
<Name>RuntimeComponent2</Name>
253+
</ProjectReference>
250254
<ProjectReference Include="StyleTransferEffectComponent\StyleTransferEffectComponent.csproj">
251255
<Project>{62925583-4d02-451e-9a72-27b12b66712c}</Project>
252256
<Name>StyleTransferEffectComponent</Name>

Samples/StyleTransfer/StyleTransfer.sln

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StyleTransfer", "StyleTrans
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StyleTransferEffectComponent", "StyleTransferEffectComponent\StyleTransferEffectComponent.csproj", "{62925583-4D02-451E-9A72-27B12B66712C}"
99
EndProject
10+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RuntimeComponent2", "RuntimeComponent2\RuntimeComponent2.vcxproj", "{E9C60C87-553F-406B-892E-1F827A31930D}"
11+
EndProject
1012
Global
1113
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1214
Debug|Any CPU = Debug|Any CPU
@@ -67,6 +69,24 @@ Global
6769
{62925583-4D02-451E-9A72-27B12B66712C}.Release|x64.Build.0 = Release|x64
6870
{62925583-4D02-451E-9A72-27B12B66712C}.Release|x86.ActiveCfg = Release|x86
6971
{62925583-4D02-451E-9A72-27B12B66712C}.Release|x86.Build.0 = Release|x86
72+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|Any CPU.ActiveCfg = Debug|Win32
73+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|ARM.ActiveCfg = Debug|ARM
74+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|ARM.Build.0 = Debug|ARM
75+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|ARM64.ActiveCfg = Debug|ARM64
76+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|ARM64.Build.0 = Debug|ARM64
77+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|x64.ActiveCfg = Debug|x64
78+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|x64.Build.0 = Debug|x64
79+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|x86.ActiveCfg = Debug|Win32
80+
{E9C60C87-553F-406B-892E-1F827A31930D}.Debug|x86.Build.0 = Debug|Win32
81+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|Any CPU.ActiveCfg = Release|Win32
82+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|ARM.ActiveCfg = Release|ARM
83+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|ARM.Build.0 = Release|ARM
84+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|ARM64.ActiveCfg = Release|ARM64
85+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|ARM64.Build.0 = Release|ARM64
86+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|x64.ActiveCfg = Release|x64
87+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|x64.Build.0 = Release|x64
88+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|x86.ActiveCfg = Release|Win32
89+
{E9C60C87-553F-406B-892E-1F827A31930D}.Release|x86.Build.0 = Release|Win32
7090
EndGlobalSection
7191
GlobalSection(SolutionProperties) = preSolution
7292
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)