Skip to content

Commit ebc52a2

Browse files
clean up code for web streaming pipeline
1 parent 19714ab commit ebc52a2

File tree

9 files changed

+196
-159
lines changed

9 files changed

+196
-159
lines changed

Samples/StyleTransfer/AppModel.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Windows.Media.Capture;
1212
using Windows.Media.Core;
1313
using Windows.Media.Playback;
14+
using Windows.UI.Composition;
1415

1516
namespace StyleTransfer
1617
{
@@ -19,10 +20,10 @@ class AppModel : INotifyPropertyChanged
1920
public AppModel()
2021
{
2122
this._useGPU = true;
22-
//this._selectedCameraIndex = 0;
2323
this._modelSource = "candy";
2424
}
2525

26+
// Name of the style transfer model to apply to input media
2627
private string _modelSource;
2728
public string ModelSource
2829
{
@@ -34,6 +35,7 @@ public string ModelSource
3435
}
3536
}
3637

38+
// Type of input media to use
3739
private string _inputMedia;
3840
public string InputMedia
3941
{
@@ -42,6 +44,7 @@ public string InputMedia
4244
{
4345
_inputMedia = value;
4446
OnPropertyChanged();
47+
OnPropertyChanged("StreamingControlsVisible");
4548
}
4649
}
4750

@@ -56,30 +59,31 @@ public bool UseGPU
5659
}
5760
}
5861

62+
// MediaSource for transformed media
5963
private MediaSource _outputMediaSource;
6064
public MediaSource OutputMediaSource
6165
{
62-
get
63-
{
64-
// TODO: Configure mediasource based on profile? or in VM
65-
return _outputMediaSource;
66-
}
66+
get { return _outputMediaSource; }
6767
set { _outputMediaSource = value; OnPropertyChanged(); }
6868
}
69+
70+
// MediaSource for the input media
6971
private MediaSource _inputMediaSource;
7072
public MediaSource InputMediaSource
7173
{
7274
get { return _inputMediaSource; }
7375
set { _inputMediaSource = value; OnPropertyChanged(); }
7476
}
7577

78+
// List of cameras available to use as input
7679
private IEnumerable<string> _cameraNamesList;
7780
public IEnumerable<string> CameraNamesList
7881
{
7982
get { return _cameraNamesList; }
8083
set { _cameraNamesList = value; OnPropertyChanged(); }
8184
}
8285

86+
// Index in CameraNamesList of the selected input camera
8387
private int _selectedCameraIndex;
8488
public int SelectedCameraIndex
8589
{
@@ -91,6 +95,14 @@ public int SelectedCameraIndex
9195
}
9296
}
9397

98+
public bool StreamingControlsVisible
99+
{
100+
get
101+
{
102+
return _inputMedia == "LiveStream";
103+
}
104+
}
105+
94106

95107
public event PropertyChangedEventHandler PropertyChanged;
96108
private void OnPropertyChanged([CallerMemberName] string propertyName = null)

0 commit comments

Comments
 (0)