[chronojump] ffplay can play sounds (all systems). removed gstreamer on macOS.
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] ffplay can play sounds (all systems). removed gstreamer on macOS.
- Date: Sat, 4 Jul 2020 01:19:42 +0000 (UTC)
commit 16e136aa346556dd57245b134b8a01aac8f196bd
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Jul 4 03:17:44 2020 +0200
ffplay can play sounds (all systems). removed gstreamer on macOS.
glade/preferences_win.glade | 167 ++++++++++++++++++--------------------------
src/chronojump.cs | 4 +-
src/gui/preferences.cs | 56 ++++++++++-----
src/preferences.cs | 4 +-
src/sqlite/main.cs | 9 ++-
src/sqlite/preferences.cs | 20 +++++-
src/util.cs | 18 ++++-
7 files changed, 153 insertions(+), 125 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index ece0880c..575181e1 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -4443,19 +4443,13 @@ It starts before and arrives there with some speed.</property>
<property name="can_focus">False</property>
<property name="spacing">20</property>
<child>
- <widget class="GtkTable" id="table_gstreamer">
+ <widget class="GtkVBox" id="vbox21">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">10</property>
- <child>
- <placeholder/>
- </child>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkRadioButton" id="radio_gstreamer_0_1">
- <property name="label">Gstreamer 0.1</property>
+ <widget class="GtkRadioButton" id="radio_ffplay">
+ <property name="label">ffplay</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -4463,8 +4457,9 @@ It starts before and arrives there with some speed.</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -4473,90 +4468,46 @@ It starts before and arrives there with some speed.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">radio_gstreamer_0_1</property>
+ <property name="group">radio_ffplay</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox40">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <widget class="GtkLabel" id="label68">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">(</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label66">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Recommended</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label112">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">)</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="radio_sound_systemsounds">
- <property name="label">System sounds</property>
+ <widget class="GtkRadioButton" id="radio_gstreamer_0_1">
+ <property name="label">Gstreamer 0.1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">radio_gstreamer_0_1</property>
+ <property name="group">radio_ffplay</property>
</widget>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_not_recommended_when_not_on_windows">
+ <widget class="GtkHBox" id="hbox40">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">10</property>
<child>
- <widget class="GtkLabel" id="label74">
+ <widget class="GtkRadioButton" id="radio_sound_systemsounds">
+ <property name="label">System sounds</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">(</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_ffplay</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -4565,11 +4516,46 @@ It starts before and arrives there with some speed.</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label75">
+ <widget class="GtkHBox"
id="hbox_not_recommended_when_not_on_windows">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Not
recommended</property>
+ <child>
+ <widget class="GtkLabel" id="label74">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">(</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label75">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Not
recommended</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label77">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">)</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -4577,26 +4563,11 @@ It starts before and arrives there with some speed.</property>
<property name="position">1</property>
</packing>
</child>
- <child>
- <widget class="GtkLabel" id="label77">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">)</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
diff --git a/src/chronojump.cs b/src/chronojump.cs
index 5c18ae9f..3992606c 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -130,11 +130,13 @@ public class ChronoJump
LogB.Information(Environment.GetEnvironmentVariable("R_HOME"));
LogB.Information(Environment.GetEnvironmentVariable("PATH"));
- //Gstreamer stuff
+ /*
+ //Gstreamer stuff (right now not used, we used ffplay)
string prefix="/Applications/Chronojump.app/Contents/Home/";
Environment.SetEnvironmentVariable ("GST_PLUGIN_PATH", prefix +
"lib/gstreamer-0.10");
Environment.SetEnvironmentVariable ("GST_PLUGIN_SYSTEM_PATH", prefix
+ "lib/gstreamer-0.10");
Environment.SetEnvironmentVariable ("GST_PLUGIN_SCANNER_PATH", prefix
+ "lib/gstreamer-0.10/gst-plugin-scanner");
+ */
break;
case UtilAll.OperatingSystems.LINUX:
rBinPath = @"/usr/lib/R/lib";
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 9a154152..a993425b 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -164,9 +164,9 @@ public class PreferencesWindow
//multimedia tab
[Widget] Gtk.CheckButton checkbutton_volume;
- [Widget] Gtk.Table table_gstreamer;
[Widget] Gtk.RadioButton radio_gstreamer_0_1;
[Widget] Gtk.RadioButton radio_gstreamer_1_0;
+ [Widget] Gtk.RadioButton radio_ffplay;
[Widget] Gtk.RadioButton radio_sound_systemsounds;
[Widget] Gtk.HBox hbox_not_recommended_when_not_on_windows;
[Widget] Gtk.Label label_test_sound_result;
@@ -394,24 +394,35 @@ public class PreferencesWindow
PreferencesWindowBox.label_camera_error.Visible = false;
- if(UtilAll.IsWindows())
- PreferencesWindowBox.label_webcam_windows.Visible = true;
+ PreferencesWindowBox.label_webcam_windows.Visible =
+ (PreferencesWindowBox.operatingSystem == UtilAll.OperatingSystems.WINDOWS);
- if(UtilAll.IsWindows())
+ PreferencesWindowBox.hbox_not_recommended_when_not_on_windows.Visible =
+ ! (PreferencesWindowBox.operatingSystem == UtilAll.OperatingSystems.WINDOWS);
+
+ if(PreferencesWindowBox.operatingSystem == UtilAll.OperatingSystems.WINDOWS ||
+ PreferencesWindowBox.operatingSystem == UtilAll.OperatingSystems.MACOSX)
{
- PreferencesWindowBox.table_gstreamer.Visible = false;
- PreferencesWindowBox.hbox_not_recommended_when_not_on_windows.Visible = false;
- } else {
- PreferencesWindowBox.table_gstreamer.Visible = true;
- PreferencesWindowBox.hbox_not_recommended_when_not_on_windows.Visible = true;
+ if(preferences.gstreamer == Preferences.GstreamerTypes.FFPLAY)
+ PreferencesWindowBox.radio_ffplay.Active = true;
+ else //(preferences.gstreamer == Preferences.GstreamerTypes.SYSTEMSOUNDS)
+ PreferencesWindowBox.radio_sound_systemsounds.Active = true;
+
+ PreferencesWindowBox.radio_gstreamer_0_1.Visible = false;
+ PreferencesWindowBox.radio_gstreamer_1_0.Visible = false;
+ }
+ else //LINUX
+ {
+ if(preferences.gstreamer == Preferences.GstreamerTypes.GST_0_1)
+ PreferencesWindowBox.radio_gstreamer_0_1.Active = true;
+ else if(preferences.gstreamer == Preferences.GstreamerTypes.GST_1_0)
+ PreferencesWindowBox.radio_gstreamer_1_0.Active = true;
+ else if(preferences.gstreamer == Preferences.GstreamerTypes.FFPLAY)
+ PreferencesWindowBox.radio_ffplay.Active = true;
+ else //(preferences.gstreamer == Preferences.GstreamerTypes.SYSTEMSOUNDS)
+ PreferencesWindowBox.radio_sound_systemsounds.Active = true;
}
- if(preferences.gstreamer == Preferences.GstreamerTypes.GST_0_1)
- PreferencesWindowBox.radio_gstreamer_0_1.Active = true;
- else if(preferences.gstreamer == Preferences.GstreamerTypes.GST_1_0)
- PreferencesWindowBox.radio_gstreamer_1_0.Active = true;
- else //(preferences.gstreamer == Preferences.GstreamerTypes.SYSTEMSOUNDS)
- PreferencesWindowBox.radio_sound_systemsounds.Active = true;
PreferencesWindowBox.label_test_sound_result.Text = "";
wd_list = UtilMultimedia.GetVideoDevices();
@@ -1103,6 +1114,8 @@ public class PreferencesWindow
sc = Util.PlaySound(Constants.SoundTypes.GOOD, true,
Preferences.GstreamerTypes.GST_0_1);
else if(radio_gstreamer_1_0.Active)
sc = Util.PlaySound(Constants.SoundTypes.GOOD, true,
Preferences.GstreamerTypes.GST_1_0);
+ else if(radio_ffplay.Active)
+ sc = Util.PlaySound(Constants.SoundTypes.GOOD, true,
Preferences.GstreamerTypes.FFPLAY);
else
sc = Util.PlaySound(Constants.SoundTypes.GOOD, true,
Preferences.GstreamerTypes.SYSTEMSOUNDS);
@@ -1244,19 +1257,19 @@ public class PreferencesWindow
button_video_ffplay_kill.Visible = false;
label_camera_check_running.Text = "";
- bool runningFfmpeg = false;
- bool runningFfplay = false;
+ //bool runningFfmpeg = false;
+ //bool runningFfplay = false;
if(ExecuteProcess.IsRunning3 (-1, WebcamFfmpeg.GetExecutableCapture(operatingSystem)))
{
- runningFfmpeg = true;
+ //runningFfmpeg = true;
label_video_check_ffmpeg_running.Text = "Running";
button_video_ffmpeg_kill.Visible = true;
}
if(ExecuteProcess.IsRunning3 (-1, WebcamFfmpeg.GetExecutablePlay(operatingSystem)))
{
- runningFfplay = true;
+ //runningFfplay = true;
label_video_check_ffplay_running.Text = "Running";
button_video_ffplay_kill.Visible = true;
}
@@ -1946,6 +1959,11 @@ public class PreferencesWindow
SqlitePreferences.Update(Preferences.GstreamerStr,
Preferences.GstreamerTypes.GST_0_1.ToString(), true);
preferences.gstreamer = Preferences.GstreamerTypes.GST_0_1;
}
+ else if( preferences.gstreamer != Preferences.GstreamerTypes.FFPLAY && radio_ffplay.Active)
+ {
+ SqlitePreferences.Update(Preferences.GstreamerStr,
Preferences.GstreamerTypes.FFPLAY.ToString(), true);
+ preferences.gstreamer = Preferences.GstreamerTypes.FFPLAY;
+ }
else if( preferences.gstreamer != Preferences.GstreamerTypes.SYSTEMSOUNDS &&
radio_sound_systemsounds.Active)
{
SqlitePreferences.Update(Preferences.GstreamerStr,
Preferences.GstreamerTypes.SYSTEMSOUNDS.ToString(), true);
diff --git a/src/preferences.cs b/src/preferences.cs
index bded10c0..1a6cd043 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -217,7 +217,9 @@ public class Preferences
public int encoderCaptureTimeIM = 180; //hardcoded 3 minutes.
- public enum GstreamerTypes { GST_0_1, GST_1_0, SYSTEMSOUNDS }; //SYSTEMSOUNDS is the default sounds
played on Windows
+ public enum GstreamerTypes { GST_0_1, GST_1_0, FFPLAY, SYSTEMSOUNDS };
+ //SYSTEMSOUNDS is the default sounds played on Windows, FFPLAY on mac (to avoid installing gstreamer)
+
public GstreamerTypes gstreamer;
public static string GstreamerStr = "gstreamer"; //in order to ensure write correctly on SQL
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index d4b45021..659ab1bb 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -2250,7 +2250,13 @@ class Sqlite
{
LogB.SQL("Updated preferences: added gstreamer");
- SqlitePreferences.Insert (Preferences.GstreamerStr,
Preferences.GstreamerTypes.GST_0_1.ToString());
+ UtilAll.OperatingSystems os = UtilAll.GetOSEnum();
+ if(os == UtilAll.OperatingSystems.WINDOWS)
+ SqlitePreferences.Insert (Preferences.GstreamerStr,
Preferences.GstreamerTypes.SYSTEMSOUNDS.ToString());
+ else if(os == UtilAll.OperatingSystems.MACOSX)
+ SqlitePreferences.Insert (Preferences.GstreamerStr,
Preferences.GstreamerTypes.FFPLAY.ToString());
+ else
+ SqlitePreferences.Insert (Preferences.GstreamerStr,
Preferences.GstreamerTypes.GST_1_0.ToString());
currentVersion = updateVersion("1.48");
}
@@ -2722,7 +2728,6 @@ class Sqlite
currentVersion = updateVersion("1.95");
}
-
/*
if(currentVersion == "1.79")
{
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index ae040e38..a6454c63 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -144,8 +144,16 @@ class SqlitePreferences : Sqlite
Insert ("language", "", dbcmdTr);
Insert ("crashLogLanguage", "", dbcmdTr);
Insert ("allowFinishRjAfterTime", "True", dbcmdTr);
- Insert ("volumeOn", "True", dbcmdTr);
- Insert (Preferences.GstreamerStr,
Preferences.GstreamerTypes.GST_0_1.ToString(), dbcmdTr);
+ Insert ("volumeOn", "True", dbcmdTr);
+
+ UtilAll.OperatingSystems os = UtilAll.GetOSEnum();
+ if(os == UtilAll.OperatingSystems.WINDOWS)
+ Insert (Preferences.GstreamerStr,
Preferences.GstreamerTypes.SYSTEMSOUNDS.ToString());
+ else if(os == UtilAll.OperatingSystems.MACOSX)
+ Insert (Preferences.GstreamerStr,
Preferences.GstreamerTypes.FFPLAY.ToString(), dbcmdTr);
+ else
+ Insert (Preferences.GstreamerStr,
Preferences.GstreamerTypes.GST_1_0.ToString(), dbcmdTr);
+
Insert ("videoOn", "True", dbcmdTr);
Insert ("evaluatorServerID", "-1", dbcmdTr);
Insert ("versionAvailable", "", dbcmdTr);
@@ -529,8 +537,16 @@ class SqlitePreferences : Sqlite
else if(reader[0].ToString() == "volumeOn")
preferences.volumeOn = reader[1].ToString() == "True";
else if(reader[0].ToString() == Preferences.GstreamerStr)
+ {
preferences.gstreamer = (Preferences.GstreamerTypes)
Enum.Parse(typeof(Preferences.GstreamerTypes), reader[1].ToString());
+
+ //on 2.0 gstreamer is disabled on mac
+ if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX && (
+ preferences.gstreamer == Preferences.GstreamerTypes.GST_0_1 ||
+ preferences.gstreamer == Preferences.GstreamerTypes.GST_1_0 )
)
+ preferences.gstreamer = Preferences.GstreamerTypes.FFPLAY;
+ }
else if(reader[0].ToString() == "videoOn")
preferences.videoOn = reader[1].ToString() == "True";
else if(reader[0].ToString() == "evaluatorServerID")
diff --git a/src/util.cs b/src/util.cs
index 35e08adb..13779dff 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1512,7 +1512,6 @@ public class Util
return playSoundGstreamer(mySound, gstreamer);
}
-// private enum gstreamerVersions { GST_0_1, GST_1_0, SYSTEMSOUNDS }
private static SoundCodes playSoundGstreamer (Constants.SoundTypes mySound,
Preferences.GstreamerTypes gstreamer)
{
string fileName = "";
@@ -1535,10 +1534,25 @@ public class Util
pBin="gst-launch-0.10";
pinfo.Arguments = "playbin2 " + @"uri=file://" + fileName;
}
- else { //gstreamer == Preferences.GstreamerTypes.GST_1_0
+ else if (gstreamer == Preferences.GstreamerTypes.GST_1_0) {
pBin="gst-launch-1.0";
pinfo.Arguments = "playbin " + @"uri=file://" + fileName;
}
+ else if (gstreamer == Preferences.GstreamerTypes.FFPLAY)
+ {
+ pBin="ffplay";
+ if(operatingSystem == UtilAll.OperatingSystems.WINDOWS)
+ {
+ if(System.Environment.Is64BitProcess)
+ pBin = System.IO.Path.Combine(Util.GetPrefixDir(),
"bin/ffplay.exe");
+ else
+ pBin = System.IO.Path.Combine(Util.GetPrefixDir(),
"bin/i386/ffplay.exe");
+ }
+ else if(operatingSystem == UtilAll.OperatingSystems.MACOSX)
+ pBin = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffplay");
+
+ pinfo.Arguments = fileName + " -nodisp -nostats -hide_banner -autoexit";
+ }
pinfo.FileName=pBin;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]