Commit 00bd2739 authored by Ghislain MARY's avatar Ghislain MARY

Add button to change camera in ms2-tester for Windows 10.

parent 3dd671eb
......@@ -60,7 +60,10 @@
</ComboBox>
<TextBlock x:Name="BitrateLabel" Grid.Row="4" Grid.Column="0" Text="Bitrate:" VerticalAlignment="Center" Margin="8"/>
<TextBox x:Name="BitrateTextBox" Grid.Row="4" Grid.Column="1" Margin="8" IsSpellCheckEnabled="False" IsTextPredictionEnabled="False" InputScope="Number" Text="1500"/>
<ToggleButton x:Name="VideoToggleButton" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Content="Toggle video" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Checked="VideoToggleButton_Checked" Unchecked="VideoToggleButton_Checked"/>
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal">
<ToggleButton x:Name="VideoToggleButton" Content="Toggle video" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Checked="VideoToggleButton_Checked" Unchecked="VideoToggleButton_Checked"/>
<Button x:Name="ChangeCameraButton" Content="Change camera" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Click="ChangeCameraButton_Click" IsEnabled="{Binding ElementName=VideoToggleButton, Path=IsChecked}"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1" MaxHeight="320">
<Grid.ColumnDefinitions>
......
......@@ -144,6 +144,12 @@ namespace ms2_tester
}
}
private void ChangeCameraButton_Click(object sender, RoutedEventArgs e)
{
String camera = (CameraComboBox.SelectedItem as ComboBoxItem).Content as String;
MS2Tester.Instance.changeCamera(camera);
}
private void SetVideoOrientation()
{
SimpleOrientation orientation = deviceOrientation;
......
......@@ -248,7 +248,7 @@ void MS2Tester::startVideoStream(Platform::Object^ CaptureElement, Platform::Obj
video_stream_set_sent_video_size(_videoStream, vsize);
video_stream_set_fps(_videoStream, frameRate);
video_stream_set_device_rotation(_videoStream, _deviceRotation);
video_stream_start(_videoStream, &av_profile, "127.0.0.1", 20000, NULL, 0, payload, 0, cam);
video_stream_start(_videoStream, &av_profile, "192.168.0.200", 20000, NULL, 0, payload, 0, cam);
}
void MS2Tester::stopVideoStream()
......@@ -258,6 +258,16 @@ void MS2Tester::stopVideoStream()
_videoStream = NULL;
}
void MS2Tester::changeCamera(Platform::String^ camera)
{
char cst[1024];
std::wstring wst;
MSWebCamManager *manager = ms_web_cam_manager_get();
PLATFORM_STRING_TO_C_STRING(camera);
MSWebCam *cam = ms_web_cam_manager_get_cam(manager, cst);
video_stream_change_camera(_videoStream, cam);
}
void MS2Tester::setOrientation(int degrees)
{
_deviceRotation = degrees;
......
......@@ -28,6 +28,7 @@ namespace ms2_tester_runtime_component
void stopVideoStream();
int getOrientation() { return _deviceRotation; }
void setOrientation(int degrees);
void changeCamera(Platform::String^ camera);
static property MS2Tester^ Instance
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment