88using System . Text ;
99using System . Threading . Tasks ;
1010using Windows . Media ;
11+ using Windows . Media . Capture ;
1112using Windows . Media . Core ;
13+ using Windows . Media . Playback ;
14+ using Windows . UI . Composition ;
1215
1316namespace StyleTransfer
1417{
@@ -17,8 +20,10 @@ class AppModel : INotifyPropertyChanged
1720 public AppModel ( )
1821 {
1922 this . _useGPU = true ;
23+ this . _modelSource = "candy" ;
2024 }
2125
26+ // Name of the style transfer model to apply to input media
2227 private string _modelSource ;
2328 public string ModelSource
2429 {
@@ -30,14 +35,16 @@ public string ModelSource
3035 }
3136 }
3237
33- private string _inputMediaSource ;
34- public string InputMediaSource
38+ // Type of input media to use
39+ private string _inputMedia ;
40+ public string InputMedia
3541 {
36- get { return _inputMediaSource ; }
42+ get { return _inputMedia ; }
3743 set
3844 {
39- _inputMediaSource = value ;
45+ _inputMedia = value ;
4046 OnPropertyChanged ( ) ;
47+ OnPropertyChanged ( "StreamingControlsVisible" ) ;
4148 }
4249 }
4350
@@ -52,18 +59,51 @@ public bool UseGPU
5259 }
5360 }
5461
55- // In AppModel or in AppViewModel?
56- private VideoFrame _outputFrame ;
57- public VideoFrame OutputFrame
62+ // MediaSource for transformed media
63+ private MediaSource _outputMediaSource ;
64+ public MediaSource OutputMediaSource
5865 {
59- get { return _outputFrame ; }
66+ get { return _outputMediaSource ; }
67+ set { _outputMediaSource = value ; OnPropertyChanged ( ) ; }
68+ }
69+
70+ // MediaSource for the input media
71+ private MediaSource _inputMediaSource ;
72+ public MediaSource InputMediaSource
73+ {
74+ get { return _inputMediaSource ; }
75+ set { _inputMediaSource = value ; OnPropertyChanged ( ) ; }
76+ }
77+
78+ // List of cameras available to use as input
79+ private IEnumerable < string > _cameraNamesList ;
80+ public IEnumerable < string > CameraNamesList
81+ {
82+ get { return _cameraNamesList ; }
83+ set { _cameraNamesList = value ; OnPropertyChanged ( ) ; }
84+ }
85+
86+ // Index in CameraNamesList of the selected input camera
87+ private int _selectedCameraIndex ;
88+ public int SelectedCameraIndex
89+ {
90+ get { return _selectedCameraIndex ; }
6091 set
6192 {
62- _outputFrame = value ;
93+ _selectedCameraIndex = value ;
6394 OnPropertyChanged ( ) ;
6495 }
6596 }
6697
98+ public bool StreamingControlsVisible
99+ {
100+ get
101+ {
102+ return _inputMedia == "LiveStream" ;
103+ }
104+ }
105+
106+
67107 public event PropertyChangedEventHandler PropertyChanged ;
68108 private void OnPropertyChanged ( [ CallerMemberName ] string propertyName = null )
69109 {
0 commit comments