[chronojump] RunEncoder capture video done!
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] RunEncoder capture video done!
- Date: Wed, 18 Sep 2019 17:30:31 +0000 (UTC)
commit 016032c66dcf5ffbf09273aeee6010cd5e2e69ca
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Sep 18 19:29:43 2019 +0200
RunEncoder capture video done!
src/gui/chronojump.cs | 30 ++++++++++++++++++++----------
src/gui/chronopic.cs | 2 +-
src/gui/forceSensor.cs | 9 +++++----
src/gui/runEncoder.cs | 32 ++++++++++++++++++++++++++++++++
src/gui/webcam.cs | 13 ++++++++++++-
src/runEncoder.cs | 5 +++++
6 files changed, 75 insertions(+), 16 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 77367e0c..f9d6e8ce 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3506,7 +3506,10 @@ public partial class ChronoJumpWindow
hbox_capture_phases_time.Visible = (m != Constants.Menuitem_modes.FORCESENSOR && m !=
Constants.Menuitem_modes.RUNSENCODER);
if(! configChronojump.Compujump)
- showWebcamCaptureContactsControls (m != Constants.Menuitem_modes.RUNSENCODER);
+ {
+ //showWebcamCaptureContactsControls (m != Constants.Menuitem_modes.RUNSENCODER);
+ showWebcamCaptureContactsControls(true);
+ }
force_sensor_menuitem.Visible = (m == Constants.Menuitem_modes.FORCESENSOR);
@@ -3965,24 +3968,29 @@ public partial class ChronoJumpWindow
return;
}
- on_button_execute_test_acceptedPre_start_camera(true);
+ on_button_execute_test_acceptedPre_start_camera(WebcamStartedTestStart.CHRONOPIC);
}
UtilGtk.DeviceColors(viewport_chronopics, true);
}
// camera stuff if needed
// true is chronopic
- // false is arduino like force sensor
- private void on_button_execute_test_acceptedPre_start_camera(bool chronopic)
+ // false is arduino like force sensor or run encoder
+ public enum WebcamStartedTestStart { CHRONOPIC, FORCESENSOR, RUNENCODER};
+
+ private void on_button_execute_test_acceptedPre_start_camera(WebcamStartedTestStart wsts)
{
button_video_play_this_test_sensitive (WebcamManage.GuiContactsEncoder.CONTACTS, false);
+
webcamManage = new WebcamManage();
if(! webcamStart (WebcamManage.GuiContactsEncoder.CONTACTS, 1))
{
- if(chronopic)
+ if(wsts == WebcamStartedTestStart.FORCESENSOR)
+ forceSensorCapturePre3_GTK_cameraCalled();
+ else if(wsts == WebcamStartedTestStart.RUNENCODER)
+ runEncoderCapturePre3_GTK_cameraCalled();
+ else // (wsts == WebcamStartedTestStart.CHRONOPIC)
on_button_execute_test_accepted();
- else
- forceSensorCapturePre3_GTK();
return;
}
@@ -3990,10 +3998,12 @@ public partial class ChronoJumpWindow
bool waitUntilRecording = true;
if(! waitUntilRecording)
{
- if(chronopic)
+ if(wsts == WebcamStartedTestStart.FORCESENSOR)
+ forceSensorCapturePre3_GTK_cameraCalled();
+ else if(wsts == WebcamStartedTestStart.RUNENCODER)
+ runEncoderCapturePre3_GTK_cameraCalled();
+ else // (wsts == WebcamStartedTestStart.CHRONOPIC)
on_button_execute_test_accepted();
- else
- forceSensorCapturePre3_GTK();
}
}
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index 45c91248..681769e8 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -88,7 +88,7 @@ public partial class ChronoJumpWindow
return;
} else {
button_activate_chronopics.Show();
- on_button_execute_test_acceptedPre_start_camera(true);
+
on_button_execute_test_acceptedPre_start_camera(ChronoJumpWindow.WebcamStartedTestStart.CHRONOPIC);
return;
}
}
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 9b7fe457..04911dcf 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -466,7 +466,7 @@ public partial class ChronoJumpWindow
else if(forceSensorOtherMode == forceSensorOtherModeEnum.CHECK_VERSION)
forceSensorButtonsSensitive(true);
else if(forceSensorOtherMode == forceSensorOtherModeEnum.TARE_AND_CAPTURE_PRE ||
forceSensorOtherMode == forceSensorOtherModeEnum.CAPTURE_PRE)
- forceSensorCapturePre2_GTK();
+ forceSensorCapturePre2_GTK_cameraCall();
return false;
}
@@ -642,12 +642,13 @@ public partial class ChronoJumpWindow
capturingForce = arduinoCaptureStatus.STARTING;
}
- private void forceSensorCapturePre2_GTK()
+ private void forceSensorCapturePre2_GTK_cameraCall()
{
- on_button_execute_test_acceptedPre_start_camera(false);
+ on_button_execute_test_acceptedPre_start_camera(
+ ChronoJumpWindow.WebcamStartedTestStart.FORCESENSOR);
}
- private void forceSensorCapturePre3_GTK()
+ private void forceSensorCapturePre3_GTK_cameraCalled()
{
button_execute_test.Sensitive = false;
event_execute_button_finish.Sensitive = true;
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index 238602d9..c9931dbc 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -198,6 +198,12 @@ public partial class ChronoJumpWindow
private void on_runs_encoder_capture_clicked ()
{
+ if(chronopicRegister.NumConnectedOfType(ChronopicRegisterPort.Types.ARDUINO_RUN_ENCODER) == 0)
+ {
+ event_execute_label_message.Text = runEncoderNotConnectedString;
+ return;
+ }
+
if(currentPersonSession.Weight == 0)
{
new DialogMessage(Constants.MessageTypes.WARNING,
@@ -212,6 +218,17 @@ public partial class ChronoJumpWindow
return;
}
+ runEncoderCapturePre2_GTK_cameraCall();
+ }
+
+ private void runEncoderCapturePre2_GTK_cameraCall()
+ {
+ on_button_execute_test_acceptedPre_start_camera(
+ ChronoJumpWindow.WebcamStartedTestStart.RUNENCODER);
+ }
+
+ private void runEncoderCapturePre3_GTK_cameraCalled()
+ {
textview_race_analyzer_comment.Buffer.Text = "";
assignCurrentRunEncoderExercise();
raceEncoderReadWidgets();
@@ -875,6 +892,18 @@ LogB.Information(" fc C finish");
currentRunEncoder.UniqueID = currentRunEncoder.InsertSQL(false);
+ //stop camera
+ if(webcamEnd (Constants.TestTypes.RACEANALYZER,
currentRunEncoder.UniqueID))
+ {
+ //add the videoURL to SQL
+ currentRunEncoder.VideoURL =
Util.GetVideoFileName(currentSession.UniqueID,
+ Constants.TestTypes.RACEANALYZER,
+ currentRunEncoder.UniqueID);
+ currentRunEncoder.UpdateSQL(false);
+ label_video_feedback.Text = "";
+ button_video_play_this_test.Sensitive = true;
+ }
+
Thread.Sleep (250); //Wait a bit to ensure is copied
runEncoderAnalyzeOpenImage();
@@ -897,6 +926,9 @@ LogB.Information(" fc C finish 2");
} else if(runEncoderProcessCancel || runEncoderProcessError)
{
LogB.Information(" fc C cancel ");
+ //stop the camera (and do not save)
+ webcamEnd (Constants.TestTypes.RACEANALYZER, -1);
+
if(runEncoderProcessCancel)
event_execute_label_message.Text = "Cancelled.";
else
diff --git a/src/gui/webcam.cs b/src/gui/webcam.cs
index 374085e4..b0c63983 100644
--- a/src/gui/webcam.cs
+++ b/src/gui/webcam.cs
@@ -202,7 +202,9 @@ public partial class ChronoJumpWindow
}
if(current_menuitem_mode == Constants.Menuitem_modes.FORCESENSOR)
- forceSensorCapturePre3_GTK();
+ forceSensorCapturePre3_GTK_cameraCalled();
+ else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSENCODER)
+ runEncoderCapturePre3_GTK_cameraCalled();
else
on_button_execute_test_accepted ();
@@ -751,6 +753,15 @@ public partial class ChronoJumpWindow
return;
}
+ else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSENCODER)
+ {
+ if(currentRunEncoder == null || currentRunEncoder.UniqueID == -1)
+ new DialogMessage(Constants.MessageTypes.WARNING, "Sorry, file not found");
+ else
+ playVideo(Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.RACEANALYZER, currentRunEncoder.UniqueID));
+
+ return;
+ }
Constants.TestTypes type = Constants.TestTypes.JUMP;
int id = 0;
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index 338d61bf..623c99c5 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -228,6 +228,11 @@ public class RunEncoder
get { return comments; }
set { comments = value; }
}
+ public string VideoURL
+ {
+ //get { return videoURL; }
+ set { videoURL = value; }
+ }
public string ExerciseName
{
get { return exerciseName; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]