//Not used on encoder private void playVideo(string fileName) { //constructor for playpreview webcamPlay = new WebcamFfmpeg(Webcam.Action.PLAYFILE, UtilAll.GetOSEnum(), "", "", ""); Webcam.Result result = webcamPlay.PlayFile(fileName); /* * TODO: reimplement this with ffmpeg * * if(File.Exists(fileName)) { * LogB.Information("Play video starting..."); * PlayerBin player = new PlayerBin(); * player.Open(fileName); * * //without these lines works also but has less functionalities (speed, go to ms) * Gtk.Window d = new Gtk.Window(Catalog.GetString("Playing video")); * d.Add(player); * d.Modal = true; * d.SetDefaultSize(500,400); * d.ShowAll(); * d.DeleteEvent += delegate(object sender, DeleteEventArgs e) {player.Close(); player.Dispose();}; * * if(play) { * LogB.Information("Play video playing..."); * player.Play(); * } * return true; * } */ }
//do this to start them at the "same moment" //can pass a -1 uniqueID if test is cancelled private void webcamEndTwoCams(Constants.TestTypes testType, int uniqueID) { WebcamManage.GuiContactsEncoder guiContactsEncoder = WebcamManage.GuiContactsEncoder.CONTACTS; if (testType == Constants.TestTypes.ENCODER) { guiContactsEncoder = WebcamManage.GuiContactsEncoder.ENCODER; label_video_encoder_feedback.Text = ""; } //button_video_play_this_test.Sensitive = false; //button_video_play_this_test_sensitive (guiContactsEncoder, false); if (!preferences.videoOn || webcamManage == null) { return; } Webcam.Result result1 = webcamManage.RecordEnd(1); Webcam.Result result2 = webcamManage.RecordEnd(2); string errorMessage = ""; if (result1.success) { Webcam.Result result1Exit = webcamManage.ExitAndFinish(1, currentSession.UniqueID, testType, uniqueID, guiContactsEncoder); if (uniqueID != -1 && !result1Exit.success) { errorMessage += result1Exit.error + "\n"; } } else { errorMessage += result1.error + "\n"; } if (result2.success) { Webcam.Result result2Exit = webcamManage.ExitAndFinish(2, currentSession.UniqueID, testType, -1 * uniqueID, guiContactsEncoder); if (uniqueID != -1 && !result2Exit.success) { errorMessage += result2Exit.error + "\n"; } } else { errorMessage += result2.error + "\n"; } if (errorMessage != "") { new DialogMessage(Constants.MessageTypes.WARNING, errorMessage); } //button_video_play_this_test.Sensitive = (uniqueID != -1 && errorMessage == ""); button_video_play_this_test_sensitive(guiContactsEncoder, (uniqueID != -1 && errorMessage == "")); button_video_play_selected_test(current_menuitem_mode); }
//can pass a -1 uniqueID if test is cancelled private void webcamEnd(Constants.TestTypes testType, int uniqueID) { //on contacts tests, we have WebcamStarted. No need to stop camera because it is not recording if (testType != Constants.TestTypes.ENCODER && !webcamManage.ReallyStarted) { return; } WebcamManage.GuiContactsEncoder guiContactsEncoder = WebcamManage.GuiContactsEncoder.CONTACTS; if (testType == Constants.TestTypes.ENCODER) { guiContactsEncoder = WebcamManage.GuiContactsEncoder.ENCODER; label_video_encoder_feedback.Text = ""; hbox_video_encoder.Sensitive = true; hbox_video_encoder_no_capturing.Visible = true; hbox_video_encoder_capturing.Visible = false; } if (!preferences.videoOn || webcamManage == null) { return; } Webcam.Result result = webcamManage.RecordEnd(1); if (!result.success) { new DialogMessage(Constants.MessageTypes.WARNING, result.error); return; } webcamEndParams = new WebcamEndParams(1, currentSession.UniqueID, testType, uniqueID, guiContactsEncoder); //on encoder do not have a delayed call to not have problems with CopyTempVideo on src/gui/encoder.cs //also on encoder exercise ends when movement has really finished if (testType == Constants.TestTypes.ENCODER) { LogB.Information("Encoder, immediate call to webcamEndDo()"); webcamEndDo(); } else { if (preferences.videoStopAfter == 0) { webcamEndDo(); } else { //call it later to be able to have some video on a short test like a jump. LogB.Information(string.Format("Preparing to call webcamEndDo() in {0} s", preferences.videoStopAfter)); GLib.Timeout.Add(Convert.ToUInt32(preferences.videoStopAfter * 1000), new GLib.TimeoutHandler(webcamEndDo)); } } }
// 2 cameras public Webcam.Result RecordPrepare(string videoDevice, string videoDevice2, string videoDeviceResolution, string videoDeviceFramerate) { Webcam.Result result1 = recordPrepareDo(ref webcam, videoDevice, videoDeviceResolution, videoDeviceFramerate); Webcam.Result result2 = recordPrepareDo(ref webcam2, videoDevice2, videoDeviceResolution, videoDeviceFramerate); return(new Webcam.Result( result1.success && result2.success, result1.output + result2.output, result1.error + result2.error )); }
private Webcam.Result recordEndDo(ref Webcam webcam) { LogB.Information("webcamRecordEnd call 0"); Webcam.Result result = webcam.VideoCaptureEnd(); LogB.Information("webcamRecordEnd call 1"); if (!result.success) { return(result); } LogB.Information("webcamRecordEnd call 2"); return(result); }
private bool webcamEndDo() { LogB.Information("Called webcamEndDo()"); Webcam.Result resultExit = webcamManage.ExitAndFinish(webcamEndParams.camera, webcamEndParams.sessionID, webcamEndParams.testType, webcamEndParams.uniqueID, webcamEndParams.guiContactsEncoder); if (webcamEndParams.uniqueID != -1 && !resultExit.success) { new DialogMessage(Constants.MessageTypes.WARNING, resultExit.error); } LogB.Information(string.Format("calling button_video_play_this_test_sensitive {0}-{1}-{2}", webcamEndParams.guiContactsEncoder, webcamManage.ReallyStarted, resultExit.success)); button_video_play_this_test_sensitive(webcamEndParams.guiContactsEncoder, webcamManage.ReallyStarted && resultExit.success); button_video_play_selected_test(current_menuitem_mode); return(false); //do not call this Timeout routine again }
private void on_button_video_watch_clicked(object o, EventArgs args) { if (File.Exists(videoFileName)) { LogB.Information("Exists and clicked " + videoFileName); /* * using mplayer * * Webcam webcam = new WebcamMplayer (); * Webcam.Result result = webcam.PlayFile(videoFileName); */ //using ffmpeg Webcam webcam = new WebcamFfmpeg(Webcam.Action.PLAYFILE, UtilAll.GetOSEnum(), "", "", ""); Webcam.Result result = webcam.PlayFile(videoFileName); } }
private Webcam.Result recordPrepareDo(ref Webcam w, string videoDevice, string videoDeviceResolution, string videoDeviceFramerate) { if (videoDevice == "") { new DialogMessage(Constants.MessageTypes.WARNING, "Video device is not configured. Check Preferences / Multimedia."); return(new Webcam.Result(false, "")); } //w = new Webcam(preferences.videoDevice); LogB.Information("wRS at gui chronojump.cs 0, videoDevice: " + videoDevice); //w = new WebcamMplayer (videoDevice); w = new WebcamFfmpeg(Webcam.Action.CAPTURE, os, videoDevice, videoDeviceResolution, videoDeviceFramerate); Webcam.Result result = w.CapturePrepare(Webcam.CaptureTypes.VIDEO); LogB.Information("wRS at gui chronojump.cs 1, videoDevice: " + videoDevice); return(result); }
private void playPreview() { //constructor for playpreview webcamPlay = new WebcamFfmpeg(Webcam.Action.PLAYPREVIEW, UtilAll.GetOSEnum(), preferences.videoDevice, preferences.videoDeviceResolution, preferences.videoDeviceFramerate); Webcam.Result result = webcamPlay.PlayPreviewNoBackground(); }