[chronojump] Encoder play and record video on main GUI
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder play and record video on main GUI
- Date: Mon, 9 Feb 2015 00:23:29 +0000 (UTC)
commit c241c083d033244bdfdaf126e88a0c0bc967c6ca
Author: Xavier de Blas <xaviblas gmail com>
Date: Sun Feb 8 18:33:29 2015 +0000
Encoder play and record video on main GUI
glade/chronojump.glade | 438 +++++++++++++++++++++++++++++-------------------
src/gui/chronojump.cs | 75 ++++-----
src/gui/encoder.cs | 69 +++++---
3 files changed, 344 insertions(+), 238 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 7a41cc2..e9b60c8 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -6419,6 +6419,15 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -7212,6 +7221,15 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -8257,6 +8275,15 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -8943,6 +8970,15 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -13041,7 +13077,6 @@ on current Chronojump version.</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">2</property>
- <property name="n_columns">2</property>
<property name="column_spacing">10</property>
<child>
<widget class="GtkHBox" id="hbox75">
@@ -13088,16 +13123,6 @@ on current Chronojump version.</property>
<property name="position">2</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox95">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">4</property>
<child>
<widget class="GtkCheckButton"
id="checkbutton_volume_encoder">
<property name="visible">True</property>
@@ -13105,128 +13130,13 @@ on current Chronojump version.</property>
<property name="receives_default">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Play
sound (on / off)</property>
- <property name="relief">none</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="draw_indicator">False</property>
<signal name="clicked"
handler="on_checkbutton_volume_encoder_clicked" swapped="no"/>
<child>
- <widget class="GtkAlignment" id="alignment21">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <widget class="GtkHBox" id="hbox87">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">2</property>
- <child>
- <widget class="GtkImage"
id="image_volume_encoder">
- <property name="width_request">16</property>
- <property name="height_request">16</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property
name="yalign">0.49000000953674316</property>
- <property name="icon-size">1</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel"
id="label_video_feedback_encoder">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkCheckButton"
id="checkbutton_video_encoder">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip" translatable="yes">Record
video (on / off)</property>
- <property name="relief">none</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <signal name="clicked"
handler="on_checkbutton_video_encoder_clicked" swapped="no"/>
- <child>
- <widget class="GtkHBox" id="hbox94">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">2</property>
- <child>
- <widget class="GtkImage"
id="image_video_yes_encoder">
- <property name="width_request">16</property>
- <property name="height_request">16</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property
name="stock">gtk-media-record</property>
- <property name="icon-size">1</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkImage"
id="image_video_no_encoder">
- <property name="width_request">16</property>
- <property name="height_request">16</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-no</property>
- <property name="icon-size">1</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton"
id="button_video_play_this_test_encoder">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip" translatable="yes">Play
Video (v)</property>
- <signal name="clicked"
handler="on_video_play_this_test_encoder_clicked" swapped="no"/>
- <accelerator key="v" signal="clicked"/>
- <child>
- <widget class="GtkImage" id="image2">
+ <widget class="GtkImage" id="image_volume_encoder">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-media-play</property>
+ <property
name="stock">gtk-missing-image</property>
<property name="icon-size">2</property>
</widget>
</child>
@@ -13234,35 +13144,16 @@ on current Chronojump version.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options"/>
<property name="y_options"/>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_video_capture_encoder">
- <property name="width_request">120</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"/>
- </packing>
- </child>
- <child>
<widget class="GtkHBox" id="hbox96">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -13395,8 +13286,8 @@ on current Chronojump version.</property>
</child>
</widget>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
@@ -13591,8 +13482,8 @@ on current Chronojump version.</property>
</child>
</widget>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -13920,7 +13811,7 @@ on current Chronojump version.</property>
</widget>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -13928,6 +13819,7 @@ on current Chronojump version.</property>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
+ <property name="y_options"/>
</packing>
</child>
</widget>
@@ -14056,49 +13948,118 @@ on current Chronojump version.</property>
</child>
</widget>
<packing>
- <property name="resize">False</property>
- <property name="shrink">True</property>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
</packing>
</child>
<child>
- <widget class="GtkFrame" id="frame2">
+ <widget class="GtkNotebook"
id="notebook_video_encoder">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property
name="label_yalign">0.69999998807907104</property>
- <property name="shadow_type">none</property>
+ <property name="can_focus">True</property>
<child>
- <widget class="GtkAlignment" id="alignment25">
+ <widget class="GtkVBox" id="vbox59">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="left_padding">6</property>
- <property name="right_padding">6</property>
+ <property name="border_width">2</property>
<child>
- <widget class="GtkViewport"
id="viewport_capture_encoder">
+ <widget class="GtkCheckButton"
id="checkbutton_video_encoder">
+ <property name="label" translatable="yes">Record
video on capture</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="tooltip"
translatable="yes">Record video (on / off)</property>
+ <property name="draw_indicator">True</property>
+ <signal name="clicked"
handler="on_checkbutton_video_encoder_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment21">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkViewport"
id="viewport_video_capture_encoder">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="border_width">4</property>
<child>
<placeholder/>
</child>
</widget>
</child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_video_feedback_encoder">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Preview</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
</child>
<child>
- <widget class="GtkLabel" id="label123">
+ <widget class="GtkLabel" id="label125">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label"
translatable="yes">Video</property>
- <property name="use_markup">True</property>
+ <property name="label" translatable="yes">Video
capture</property>
</widget>
<packing>
- <property name="type">label_item</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkViewport"
id="viewport_video_play_encoder">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">2</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label126">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Play</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="resize">True</property>
- <property name="shrink">True</property>
+ <property name="shrink">False</property>
</packing>
</child>
</widget>
@@ -16133,7 +16094,7 @@ Evaluator can use real name or nickname.</property>
</widget>
<packing>
<property name="resize">True</property>
- <property name="shrink">True</property>
+ <property name="shrink">False</property>
</packing>
</child>
</widget>
@@ -19212,6 +19173,15 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -19806,6 +19776,15 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -20892,6 +20871,15 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -21035,6 +21023,15 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -30496,6 +30493,60 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -32470,6 +32521,15 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -33102,6 +33162,15 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -35700,6 +35769,15 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -35958,6 +36036,15 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -36231,6 +36318,15 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index afcdef9..5399d58 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -214,8 +214,9 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Label label_chronopic_encoder;
[Widget] Gtk.HBox hbox_video_capture;
- [Widget] Gtk.HBox hbox_video_capture_encoder;
- [Widget] Gtk.Viewport viewport_capture_encoder;
+ [Widget] Gtk.Notebook notebook_video_encoder;
+ [Widget] Gtk.Viewport viewport_video_capture_encoder;
+ [Widget] Gtk.Viewport viewport_video_play_encoder;
[Widget] Gtk.Label label_video_feedback;
[Widget] Gtk.Label label_video_feedback_encoder;
[Widget] Gtk.CheckButton checkbutton_video;
@@ -223,8 +224,6 @@ public partial class ChronoJumpWindow
//[Widget] Gtk.Label label_video;
[Widget] Gtk.Image image_video_yes;
[Widget] Gtk.Image image_video_no;
- [Widget] Gtk.Image image_video_yes_encoder;
- [Widget] Gtk.Image image_video_no_encoder;
[Widget] Gtk.CheckButton checkbutton_volume;
[Widget] Gtk.Image image_volume;
[Widget] Gtk.CheckButton checkbutton_volume_encoder;
@@ -3044,14 +3043,14 @@ public partial class ChronoJumpWindow
if(notebook_sup.CurrentPage == 0) {
//remove video capture from encoder tab
- hbox_video_capture_encoder.Remove(capturer);
+ viewport_video_capture_encoder.Remove(capturer);
//add in contacts tab
hbox_video_capture.PackStart(capturer, true, true, 0);
} else {
//remove video capture from contacts tab
hbox_video_capture.Remove(capturer);
//add in encoder tab
- hbox_video_capture_encoder.PackStart(capturer, true, true, 0);
+ viewport_video_capture_encoder.Add(capturer);
}
if(wasActive)
@@ -3120,8 +3119,6 @@ public partial class ChronoJumpWindow
private void changeVideoButtons(bool myVideo) {
image_video_yes.Visible = myVideo;
image_video_no.Visible = ! myVideo;
- image_video_yes_encoder.Visible = myVideo;
- image_video_no_encoder.Visible = ! myVideo;
}
private void on_checkbutton_video_clicked(object o, EventArgs args) {
@@ -3155,8 +3152,9 @@ public partial class ChronoJumpWindow
checkbutton_video.Active = preferences.videoOn;
checkbutton_video.Clicked += new EventHandler(on_checkbutton_video_clicked);
- changeVideoButtons(preferences.videoOn);
-
+ //changeVideoButtons(preferences.videoOn);
+
+ //will start on record
videoCapturePrepare(true); //if error, show message
}
@@ -3200,6 +3198,15 @@ public partial class ChronoJumpWindow
if(checkbutton_volume_encoder.Active) {
preferences.volumeOn = true;
SqlitePreferences.Update("volumeOn", "True", false);
+
+ //on Linux put volumeOn on false on start because there's a bug on Mono and audio
+ //https://github.com/mono/mono/pull/1376
+ if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX)
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ "There's an audio problem with Mono on Linux.\n" +
+ "We recommend to have sound disabled. More info:\n" +
+ "https://github.com/mono/mono/pull/1376"
+ );
} else {
preferences.volumeOn = false;
SqlitePreferences.Update("volumeOn", "False", false);
@@ -5004,33 +5011,22 @@ LogB.Debug("X");
* --------------------------------------------------------
*/
-
- private bool playVideo(string fileName, bool encoder, bool play)
+ //Not used on encoder
+ private bool playVideo(string fileName, bool play)
{
if(File.Exists(fileName)) {
LogB.Information("Play video starting...");
PlayerBin player = new PlayerBin();
player.Open(fileName);
- //plays at main encoder GUI
- if(encoder) {
- //don't add to an hbox, it will show halfsized
- //hbox_video_capture_encoder_big.Add(player);
- //hbox_video_capture_encoder_big.WidthRequest=500;
- //hbox_video_capture_encoder_big.HeightRequest=400;
-
- viewport_capture_encoder.Add(player);
- player.SeeControlsBox(true);
- } else { //plays in a separate window
- //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();};
- }
-
+ //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();
@@ -5040,6 +5036,7 @@ LogB.Debug("X");
return false;
}
+
private void on_video_play_this_test_clicked (object o, EventArgs args) {
Constants.TestTypes type = Constants.TestTypes.JUMP;
int id = 0;
@@ -5076,56 +5073,56 @@ LogB.Debug("X");
break;
}
- playVideo(Util.GetVideoFileName(currentSession.UniqueID, type, id), false, true);
+ playVideo(Util.GetVideoFileName(currentSession.UniqueID, type, id), true);
}
private void on_video_play_selected_jump_clicked (object o, EventArgs args) {
if (myTreeViewJumps.EventSelectedID > 0)
playVideo(Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.JUMP,
- myTreeViewJumps.EventSelectedID), false, true);
+ myTreeViewJumps.EventSelectedID), true);
}
private void on_video_play_selected_jump_rj_clicked (object o, EventArgs args) {
if (myTreeViewJumpsRj.EventSelectedID > 0)
playVideo(Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.JUMP_RJ,
- myTreeViewJumpsRj.EventSelectedID), false, true);
+ myTreeViewJumpsRj.EventSelectedID), true);
}
private void on_video_play_selected_run_clicked (object o, EventArgs args) {
if (myTreeViewRuns.EventSelectedID > 0)
playVideo(Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.RUN,
- myTreeViewRuns.EventSelectedID), false, true);
+ myTreeViewRuns.EventSelectedID), true);
}
private void on_video_play_selected_run_interval_clicked (object o, EventArgs args) {
if (myTreeViewRunsInterval.EventSelectedID > 0)
playVideo(Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.RUN_I,
- myTreeViewRunsInterval.EventSelectedID), false, true);
+ myTreeViewRunsInterval.EventSelectedID), true);
}
private void on_video_play_selected_reaction_time_clicked (object o, EventArgs args) {
if (myTreeViewReactionTimes.EventSelectedID > 0)
playVideo(Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.RT,
- myTreeViewReactionTimes.EventSelectedID), false, true);
+ myTreeViewReactionTimes.EventSelectedID), true);
}
private void on_video_play_selected_pulse_clicked (object o, EventArgs args) {
if (myTreeViewPulses.EventSelectedID > 0)
playVideo(Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.PULSE,
- myTreeViewPulses.EventSelectedID), false, true);
+ myTreeViewPulses.EventSelectedID), true);
}
private void on_video_play_selected_multi_chronopic_clicked (object o, EventArgs args) {
if (myTreeViewMultiChronopic.EventSelectedID > 0)
playVideo(Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.MULTICHRONOPIC,
- myTreeViewMultiChronopic.EventSelectedID), false, true);
+ myTreeViewMultiChronopic.EventSelectedID), true);
}
/* ---------------------------------------------------------
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 4700608..0264c04 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -30,6 +30,7 @@ using Mono.Unix;
using System.Linq;
using RDotNet;
using System.Diagnostics; //for detect OS and for Process
+using LongoMatch.Gui;
public partial class ChronoJumpWindow
@@ -54,7 +55,6 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Button button_encoder_capture_finish;
[Widget] Gtk.Button button_encoder_recalculate;
[Widget] Gtk.Button button_encoder_load_signal;
- //[Widget] Gtk.Button button_video_play_this_test_encoder;
[Widget] Gtk.Viewport viewport_image_encoder_capture;
[Widget] Gtk.Image image_encoder_capture;
[Widget] Gtk.Image image_encoder_capture_open;
@@ -302,6 +302,8 @@ public partial class ChronoJumpWindow
captureCurvesBarsData = new ArrayList(0);
RInitialized = Constants.Status.UNSTARTED;
+
+ playVideoEncoderInitialSetup();
}
void on_menuitem_test_rdotnet_activate (object o, EventArgs args) {
@@ -1286,12 +1288,10 @@ public partial class ChronoJumpWindow
//entry_encoder_signal_comment.Text = eSQL.description;
encoderTimeStamp = eSQL.GetDate(false);
encoderSignalUniqueID = eSQL.uniqueID;
-
- //button_video_play_this_test_encoder.Sensitive = (eSQL.videoURL != "");
- viewport_capture_encoder.Sensitive = (eSQL.videoURL != "");
- if(eSQL.videoURL != "")
- playEncoderVideo(false);
-
+
+ //has to be done here, because if done in encoderThreadStart or in
finishPulsebar it crashes
+ notebook_video_encoder.CurrentPage = 1;
+
encoderConfigurationCurrent = eSQL.encoderConfiguration;
label_encoder_selected.Text = encoderConfigurationCurrent.code;
@@ -1825,8 +1825,7 @@ public partial class ChronoJumpWindow
encoderSignalUniqueID = myID;
feedback = Catalog.GetString("Set saved");
- //button_video_play_this_test_encoder.Sensitive = false;
- viewport_capture_encoder.Sensitive = false;
+ viewport_video_play_encoder.Sensitive = false;
//copy video
if(preferences.videoOn) {
if(Util.CopyTempVideo(currentSession.UniqueID,
@@ -1838,9 +1837,10 @@ public partial class ChronoJumpWindow
//need assign uniqueID to update and add the URL of video
eSQL.uniqueID = encoderSignalUniqueID;
SqliteEncoder.Update(false, eSQL);
- //button_video_play_this_test_encoder.Sensitive = true;
- viewport_capture_encoder.Sensitive = true;
- playEncoderVideo(false);
+
+ notebook_video_encoder.CurrentPage = 1;
+ viewport_video_play_encoder.Sensitive = true;
+ playVideoEncoderPrepare(false); //do not play
} else {
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, video cannot be
stored."));
@@ -5145,7 +5145,12 @@ LogB.Debug("D");
encoder_pulsebar_capture.Text = Catalog.GetString("Finished");
}
else if(action == encoderActions.CURVES || action == encoderActions.LOAD) {
- //tis notebook has capture (signal plotting), and curves (shows R graph)
+
+ if(action == encoderActions.LOAD) {
+ playVideoEncoderPrepare(false); //do not play
+ }
+
+ //this notebook has capture (signal plotting), and curves (shows R graph)
if(notebook_encoder_capture.CurrentPage == 0)
notebook_encoder_capture.NextPage();
@@ -5370,8 +5375,7 @@ LogB.Debug("D");
capturer.ClickRec();
label_video_feedback_encoder.Text = "Rec.";
}
- //button_video_play_this_test_encoder.Sensitive = false;
- viewport_capture_encoder.Sensitive = false;
+ //viewport_video_capture_encoder.Sensitive = false;
}
private void encoderStopVideoRecord() {
@@ -5384,26 +5388,35 @@ LogB.Debug("D");
}
}
-
- void on_video_play_this_test_encoder_clicked (object o, EventArgs args) {
- playEncoderVideo(true);
+ static PlayerBin playerEncoder;
+ private void playVideoEncoderInitialSetup()
+ {
+ LogB.Information("Prepare video encoder");
+ playerEncoder = new PlayerBin();
+ viewport_video_play_encoder.Add(playerEncoder);
+ playerEncoder.SeeControlsBox(true);
}
-
- void playEncoderVideo(bool play) {
+ void playVideoEncoderPrepare(bool play)
+ {
+ LogB.Information("playVideoEncoderDo", play.ToString());
string file = Util.GetVideoFileName(currentSession.UniqueID,
Constants.TestTypes.ENCODER, Convert.ToInt32(encoderSignalUniqueID));
- bool errors = false;
if(file == null || file == "")
- errors = true;
- else
- if(! playVideo(file, true, play)) //encoder, start playing?
- errors = true;
-
- if(errors)
+ return;
+
+ try {
+ playerEncoder.Open(file);
+ if(play)
+ playerEncoder.Play();
+ else
+ playerEncoder.Show();
+ } catch {
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, file not found"));
- }
+ }
+ }
+
/* end of video stuff */
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]