[chronojump/video-capture: 5/7] Add CesarPlayer
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/video-capture: 5/7] Add CesarPlayer
- Date: Thu, 16 Dec 2010 00:30:33 +0000 (UTC)
commit 4f93d39655057327ce2585e5678b62d18b01c00c
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Dec 15 23:53:47 2010 +0100
Add CesarPlayer
CesarPlayer/AssemblyInfo.cs.in | 50 +
CesarPlayer/Capturer/CaptureProperties.cs | 39 +
CesarPlayer/Capturer/FakeCapturer.cs | 120 ++
CesarPlayer/Capturer/GstCameraCapturer.cs | 489 +++++++
CesarPlayer/Capturer/ICapturer.cs | 93 ++
CesarPlayer/Capturer/LiveSourceTimer.cs | 87 ++
CesarPlayer/Capturer/ObjectManager.cs | 39 +
CesarPlayer/CesarPlayer.dll.config.in | 3 +
CesarPlayer/Common/Constants.cs | 28 +
CesarPlayer/Common/Enum.cs | 168 +++
CesarPlayer/Common/Handlers.cs | 106 ++
CesarPlayer/Editor/EditorState.cs | 32 +
CesarPlayer/Editor/GstVideoSplitter.cs | 433 ++++++
CesarPlayer/Editor/IVideoEditor.cs | 83 ++
CesarPlayer/Editor/IVideoSplitter.cs | 84 ++
CesarPlayer/Editor/VideoSegment.cs | 70 +
CesarPlayer/Gui/CapturerBin.cs | 362 +++++
CesarPlayer/Gui/PlayerBin.cs | 619 +++++++++
CesarPlayer/Gui/VolumeWindow.cs | 70 +
CesarPlayer/Makefile.am | 113 ++
CesarPlayer/MultimediaFactory.cs | 108 ++
CesarPlayer/Player/GstDVDEvent.cs | 46 +
CesarPlayer/Player/GstPlayer.cs | 1415 ++++++++++++++++++++
CesarPlayer/Player/IPlayer.cs | 146 ++
CesarPlayer/Player/ObjectManager.cs | 38 +
CesarPlayer/Utils/Device.cs | 90 ++
CesarPlayer/Utils/FramesCapturer.cs | 111 ++
CesarPlayer/Utils/IFramesCapturer.cs | 38 +
CesarPlayer/Utils/IMetadataReader.cs | 37 +
CesarPlayer/Utils/MediaFile.cs | 170 +++
CesarPlayer/Utils/PreviewMediaFile.cs | 120 ++
CesarPlayer/Utils/TimeString.cs | 83 ++
CesarPlayer/cesarplayer.key | Bin 0 -> 596 bytes
CesarPlayer/cesarplayer.pc.in | 6 +
CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs | 169 +++
CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs | 337 +++++
CesarPlayer/gtk-gui/LongoMatch.Gui.VolumeWindow.cs | 85 ++
CesarPlayer/gtk-gui/generated.cs | 115 ++
CesarPlayer/gtk-gui/gui.stetic | 451 +++++++
CesarPlayer/gtk-gui/objects.xml | 31 +
40 files changed, 6684 insertions(+), 0 deletions(-)
---
diff --git a/CesarPlayer/AssemblyInfo.cs.in b/CesarPlayer/AssemblyInfo.cs.in
new file mode 100644
index 0000000..08721f2
--- /dev/null
+++ b/CesarPlayer/AssemblyInfo.cs.in
@@ -0,0 +1,50 @@
+// Copyright(C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("CesarPlayer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Andoni Morales Alastruey")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("@PACKAGE_VERSION@")]
+
+// The following attributes specify the key for the sign of your assembly. See the
+// .NET Framework documentation for more information about signing.
+// This is not required, if you don't want signing let these attributes like they're.
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("cesarplayer.key")]
diff --git a/CesarPlayer/Capturer/CaptureProperties.cs b/CesarPlayer/Capturer/CaptureProperties.cs
new file mode 100644
index 0000000..d99bab4
--- /dev/null
+++ b/CesarPlayer/Capturer/CaptureProperties.cs
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2010 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Video.Capturer
+{
+
+
+ public struct CapturePropertiesStruct
+ {
+ public CaptureSourceType CaptureSourceType;
+ public string OutputFile;
+ public string DeviceID;
+ public uint VideoBitrate;
+ public uint AudioBitrate;
+ public VideoEncoderType VideoEncoder;
+ public AudioEncoderType AudioEncoder;
+ public VideoMuxerType Muxer;
+ public uint Height;
+ public uint Width;
+ }
+}
\ No newline at end of file
diff --git a/CesarPlayer/Capturer/FakeCapturer.cs b/CesarPlayer/Capturer/FakeCapturer.cs
new file mode 100644
index 0000000..5e3cf88
--- /dev/null
+++ b/CesarPlayer/Capturer/FakeCapturer.cs
@@ -0,0 +1,120 @@
+//
+// Copyright (C) 2010 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using Mono.Unix;
+using GLib;
+using LongoMatch.Video.Common;
+using Gdk;
+
+namespace LongoMatch.Video.Capturer
+{
+
+
+ public class FakeCapturer : Gtk.Bin, ICapturer
+ {
+ public event EllpasedTimeHandler EllapsedTime;
+ public event ErrorHandler Error;
+ public event DeviceChangeHandler DeviceChange;
+
+ private LiveSourceTimer timer;
+
+ public FakeCapturer(): base ()
+ {
+ timer = new LiveSourceTimer();
+ timer.EllapsedTime += delegate(int ellapsedTime) {
+ if (EllapsedTime!= null)
+ EllapsedTime(ellapsedTime);
+ };
+ }
+
+ public int CurrentTime{
+ get{
+ return timer.CurrentTime;
+ }
+ }
+
+ public void Run(){
+ }
+
+ public void Close(){
+ }
+
+ public void Start(){
+ timer.Start();
+ }
+
+ public void Stop(){
+ timer.Stop();
+ }
+
+ public void TogglePause(){
+ timer.TogglePause();
+ }
+
+ public uint OutputWidth {
+ get{return 0;}
+ set{}
+ }
+
+ public uint OutputHeight {
+ get{return 0;}
+ set{}
+ }
+
+ public string OutputFile {
+ get {return Catalog.GetString("Fake live source");}
+ set {}
+ }
+
+ public uint VideoBitrate {
+ get {return 0;}
+ set {}
+ }
+
+ public uint AudioBitrate {
+ get {return 0;}
+ set {}
+ }
+
+ public Pixbuf CurrentFrame {
+ get {return null;}
+ }
+
+ public string DeviceID {
+ get {return "";}
+ set{}
+ }
+
+ public bool SetVideoEncoder(VideoEncoderType type){
+ return true;
+ }
+
+ public bool SetAudioEncoder(AudioEncoderType type){
+ return true;
+ }
+
+ public bool SetVideoMuxer(VideoMuxerType type){
+ return true;
+ }
+
+ public bool SetSource(CaptureSourceType type){
+ return true;
+ }
+ }
+}
diff --git a/CesarPlayer/Capturer/GstCameraCapturer.cs b/CesarPlayer/Capturer/GstCameraCapturer.cs
new file mode 100644
index 0000000..7f6b0d5
--- /dev/null
+++ b/CesarPlayer/Capturer/GstCameraCapturer.cs
@@ -0,0 +1,489 @@
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+namespace LongoMatch.Video.Capturer {
+
+ using System;
+ using System.Collections;
+ using System.Runtime.InteropServices;
+ using LongoMatch.Video.Common;
+
+#region Autogenerated code
+ public class GstCameraCapturer : Gtk.HBox, LongoMatch.Video.Capturer.ICapturer {
+
+ public event EllpasedTimeHandler EllapsedTime;
+
+ private LiveSourceTimer timer;
+
+ [Obsolete]
+ protected GstCameraCapturer(GLib.GType gtype) : base(gtype) {}
+ public GstCameraCapturer(IntPtr raw) : base(raw) {}
+
+ [DllImport("libcesarplayer.dll")]
+ static extern unsafe IntPtr gst_camera_capturer_new(IntPtr filename, out IntPtr err);
+
+ public unsafe GstCameraCapturer (string filename) : base (IntPtr.Zero)
+ {
+ if (GetType () != typeof (GstCameraCapturer)) {
+ throw new InvalidOperationException ("Can't override this constructor.");
+ }
+ IntPtr error = IntPtr.Zero;
+ Raw = gst_camera_capturer_new(GLib.Marshaller.StringToPtrGStrdup(filename), out error);
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+
+ timer = new LiveSourceTimer();
+ timer.EllapsedTime += delegate(int ellapsedTime) {
+ if (EllapsedTime!= null)
+ EllapsedTime(ellapsedTime);
+ };
+ }
+
+ [GLib.Property ("output_height")]
+ public uint OutputHeight {
+ get {
+ GLib.Value val = GetProperty ("output_height");
+ uint ret = (uint) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("output_height", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("output_width")]
+ public uint OutputWidth {
+ get {
+ GLib.Value val = GetProperty ("output_width");
+ uint ret = (uint) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("output_width", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("video_bitrate")]
+ public uint VideoBitrate {
+ get {
+ GLib.Value val = GetProperty ("video_bitrate");
+ uint ret = (uint) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("video_bitrate", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("output_file")]
+ public string OutputFile {
+ get {
+ GLib.Value val = GetProperty ("output_file");
+ string ret = (string) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("output_file", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("audio_bitrate")]
+ public uint AudioBitrate {
+ get {
+ GLib.Value val = GetProperty ("audio_bitrate");
+ uint ret = (uint) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("audio_bitrate", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("device_id")]
+ public string DeviceID {
+ get {
+ GLib.Value val = GetProperty ("device_id");
+ string ret = (string) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("device_id", val);
+ val.Dispose ();
+ }
+ }
+
+#pragma warning disable 0169
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void ErrorSignalDelegate (IntPtr arg0, IntPtr arg1, IntPtr gch);
+
+ static void ErrorSignalCallback (IntPtr arg0, IntPtr arg1, IntPtr gch)
+ {
+ ErrorArgs args = new ErrorArgs ();
+ try {
+ GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
+ if (sig == null)
+ throw new Exception("Unknown signal GC handle received " + gch);
+
+ args.Args = new object[1];
+ args.Args[0] = GLib.Marshaller.Utf8PtrToString (arg1);
+ ErrorHandler handler = (ErrorHandler) sig.Handler;
+ handler (GLib.Object.GetObject (arg0), args);
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void ErrorVMDelegate (IntPtr gcc, IntPtr message);
+
+ static ErrorVMDelegate ErrorVMCallback;
+
+ static void error_cb (IntPtr gcc, IntPtr message)
+ {
+ try {
+ GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
+ gcc_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideError (GLib.GType gtype)
+ {
+ if (ErrorVMCallback == null)
+ ErrorVMCallback = new ErrorVMDelegate (error_cb);
+ OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideError")]
+ protected virtual void OnError (string message)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (message);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("error")]
+ public event ErrorHandler Error {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void DeviceChangeSignalDelegate (IntPtr arg0, int arg1, IntPtr gch);
+
+ static void DeviceChangeSignalCallback (IntPtr arg0, int arg1, IntPtr gch)
+ {
+ DeviceChangeArgs args = new DeviceChangeArgs ();
+ try {
+ GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
+ if (sig == null)
+ throw new Exception("Unknown signal GC handle received " + gch);
+
+ args.Args = new object[1];
+ args.Args[0] = arg1;
+ DeviceChangeHandler handler = (DeviceChangeHandler) sig.Handler;
+ handler (GLib.Object.GetObject (arg0), args);
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void DeviceChangeVMDelegate (IntPtr gcc, int deviceChange);
+
+ static DeviceChangeVMDelegate DeviceChangeVMCallback;
+
+ static void device_change_cb (IntPtr gcc, int deviceChange)
+ {
+ try {
+ GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
+ gcc_managed.OnDeviceChange (deviceChange);
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideDeviceChange (GLib.GType gtype)
+ {
+ if (DeviceChangeVMCallback == null)
+ DeviceChangeVMCallback = new DeviceChangeVMDelegate (device_change_cb);
+ OverrideVirtualMethod (gtype, "device_change", DeviceChangeVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideDeviceChange")]
+ protected virtual void OnDeviceChange (int deviceChange)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (deviceChange);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("device_change")]
+ public event DeviceChangeHandler DeviceChange {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void EosVMDelegate (IntPtr gcc);
+
+ static EosVMDelegate EosVMCallback;
+
+ static void eos_cb (IntPtr gcc)
+ {
+ try {
+ GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
+ gcc_managed.OnEos ();
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideEos (GLib.GType gtype)
+ {
+ if (EosVMCallback == null)
+ EosVMCallback = new EosVMDelegate (eos_cb);
+ OverrideVirtualMethod (gtype, "eos", EosVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideEos")]
+ protected virtual void OnEos ()
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.Value[] vals = new GLib.Value [1];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("eos")]
+ public event System.EventHandler Eos {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
+ sig.RemoveDelegate (value);
+ }
+ }
+#pragma warning restore 0169
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_camera_capturer_init_backend(out int argc, IntPtr argv);
+
+ public static int InitBackend(string argv) {
+ int argc;
+ gst_camera_capturer_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
+ return argc;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_camera_capturer_stop(IntPtr raw);
+
+ public void Stop() {
+ timer.Stop();
+ gst_camera_capturer_stop(Handle);
+ }
+
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_camera_capturer_toggle_pause(IntPtr raw);
+
+ public void TogglePause() {
+ timer.TogglePause();
+ gst_camera_capturer_toggle_pause(Handle);
+ }
+
+ public int CurrentTime{
+ get{
+ return timer.CurrentTime;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_camera_capturer_start(IntPtr raw);
+
+ public void Start() {
+ timer.Start();
+ gst_camera_capturer_start(Handle);
+ }
+
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_camera_capturer_run(IntPtr raw);
+
+ public void Run() {
+ gst_camera_capturer_run(Handle);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_camera_capturer_close(IntPtr raw);
+
+ public void Close() {
+ gst_camera_capturer_close(Handle);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool gst_camera_capturer_set_video_muxer(IntPtr raw, int type, out IntPtr error);
+
+ public bool SetVideoMuxer(VideoMuxerType type) {
+ IntPtr error = IntPtr.Zero;
+ bool raw_ret = gst_camera_capturer_set_video_muxer(Handle, (int) type, out error);
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool gst_camera_capturer_set_video_encoder(IntPtr raw, int type, out IntPtr error);
+
+ public bool SetVideoEncoder(VideoEncoderType type) {
+ IntPtr error = IntPtr.Zero;
+ bool raw_ret = gst_camera_capturer_set_video_encoder(Handle, (int) type, out error);
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool gst_camera_capturer_set_audio_encoder(IntPtr raw, int type, out IntPtr error);
+
+ public bool SetAudioEncoder(AudioEncoderType type) {
+ IntPtr error = IntPtr.Zero;
+ bool raw_ret = gst_camera_capturer_set_audio_encoder(Handle, (int) type, out error);
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool gst_camera_capturer_set_source(IntPtr raw, int type, out IntPtr error);
+
+ public bool SetSource(CaptureSourceType type) {
+ IntPtr error = IntPtr.Zero;
+ bool raw_ret = gst_camera_capturer_set_source(Handle, (int) type, out error);
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr gst_camera_capturer_get_type();
+
+ public static new GLib.GType GType {
+ get {
+ IntPtr raw_ret = gst_camera_capturer_get_type();
+ GLib.GType ret = new GLib.GType(raw_ret);
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr gst_camera_capturer_enum_audio_devices();
+
+ public static string[] AudioDevices {
+ get {
+ IntPtr raw_ret = gst_camera_capturer_enum_audio_devices();
+ return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), true, false, typeof(String));
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr gst_camera_capturer_enum_video_devices();
+
+ public static string[] VideoDevices {
+ get {
+ IntPtr raw_ret = gst_camera_capturer_enum_video_devices();
+ return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), true, false, typeof(String));
+ }
+ }
+
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr gst_camera_capturer_get_current_frame(IntPtr raw);
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr gst_camera_capturer_unref_pixbuf(IntPtr raw);
+
+ public Gdk.Pixbuf CurrentFrame {
+ get {
+ IntPtr raw_ret = gst_camera_capturer_get_current_frame (Handle);
+ Gdk.Pixbuf p = GLib.Object.GetObject (raw_ret) as Gdk.Pixbuf;
+ /* The refcount for p is now 2. We need to decrease the counter to 1
+ * so that p.Dipose() sets it to 0 and triggers the pixbuf destroy function
+ * that frees the associated data*/
+ gst_camera_capturer_unref_pixbuf (raw_ret);
+ return p;
+ }
+ }
+
+ static GstCameraCapturer ()
+ {
+ LongoMatch.GtkSharp.Capturer.ObjectManager.Initialize ();
+ }
+#endregion
+
+ }
+}
diff --git a/CesarPlayer/Capturer/ICapturer.cs b/CesarPlayer/Capturer/ICapturer.cs
new file mode 100644
index 0000000..4960bdb
--- /dev/null
+++ b/CesarPlayer/Capturer/ICapturer.cs
@@ -0,0 +1,93 @@
+// ICapturer.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using LongoMatch.Video.Common;
+using Gdk;
+
+namespace LongoMatch.Video.Capturer
+{
+
+
+ public interface ICapturer
+ {
+ event EllpasedTimeHandler EllapsedTime;
+ event ErrorHandler Error;
+ event DeviceChangeHandler DeviceChange;
+
+ uint OutputWidth {
+ get ;
+ set ;
+ }
+
+ uint OutputHeight {
+ get;
+ set ;
+ }
+
+ string OutputFile {
+ get ;
+ set ;
+ }
+
+ uint VideoBitrate {
+ get;
+ set ;
+ }
+
+ uint AudioBitrate {
+ get ;
+ set ;
+ }
+
+ int CurrentTime {
+ get ;
+ }
+
+ Pixbuf CurrentFrame {
+ get;
+ }
+
+ string DeviceID {
+ set;
+ get;
+ }
+
+ bool SetVideoEncoder(VideoEncoderType type);
+
+ bool SetAudioEncoder(AudioEncoderType type);
+
+ bool SetVideoMuxer(VideoMuxerType type);
+
+ bool SetSource(CaptureSourceType type);
+
+ void TogglePause();
+
+ void Start();
+
+ void Stop();
+
+ void Run();
+
+ void Close();
+
+ void Dispose();
+ }
+}
diff --git a/CesarPlayer/Capturer/LiveSourceTimer.cs b/CesarPlayer/Capturer/LiveSourceTimer.cs
new file mode 100644
index 0000000..47fd043
--- /dev/null
+++ b/CesarPlayer/Capturer/LiveSourceTimer.cs
@@ -0,0 +1,87 @@
+//
+// Copyright (C) 2010 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using LongoMatch.Video.Common;
+
+
+namespace LongoMatch.Video.Capturer
+{
+
+
+ public class LiveSourceTimer
+ {
+ public event EllpasedTimeHandler EllapsedTime;
+
+ private DateTime lastStart;
+ private TimeSpan ellapsed;
+ private bool playing;
+ private bool started;
+ private uint timerID;
+
+ public LiveSourceTimer()
+ {
+ lastStart = DateTime.Now;
+ ellapsed = new TimeSpan(0,0,0);
+ playing = false;
+ started = false;
+ }
+
+ public int CurrentTime{
+ get{
+ if (!started)
+ return 0;
+ else if (playing)
+ return (int)(ellapsed + (DateTime.Now - lastStart)).TotalMilliseconds;
+ else
+ return (int)ellapsed.TotalMilliseconds;
+ }
+ }
+
+ public void TogglePause(){
+ if (!started)
+ return;
+
+ if (playing){
+ playing = false;
+ ellapsed += DateTime.Now - lastStart;
+ }
+ else{
+ playing = true;
+ lastStart = DateTime.Now;
+ }
+ }
+
+ public void Start(){
+ timerID = GLib.Timeout.Add(100, OnTick);
+ lastStart = DateTime.Now;
+ playing = true;
+ started = true;
+ }
+
+ public void Stop(){
+ GLib.Source.Remove(timerID);
+ }
+
+ protected virtual bool OnTick(){
+ if (EllapsedTime != null)
+ EllapsedTime(CurrentTime);
+ return true;
+ }
+ }
+}
diff --git a/CesarPlayer/Capturer/ObjectManager.cs b/CesarPlayer/Capturer/ObjectManager.cs
new file mode 100644
index 0000000..ed2be4c
--- /dev/null
+++ b/CesarPlayer/Capturer/ObjectManager.cs
@@ -0,0 +1,39 @@
+// ObjectManager.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+// This file was generated by the Gtk# code generator.
+// Any changes made will be lost if regenerated.
+
+namespace LongoMatch.GtkSharp.Capturer {
+
+ public class ObjectManager {
+
+ static bool initialized = false;
+ // Call this method from the appropriate module init function.
+ public static void Initialize ()
+ {
+ if (initialized)
+ return;
+
+ initialized = true;
+
+ GLib.GType.Register (LongoMatch.Video.Capturer.GstCameraCapturer.GType, typeof (LongoMatch.Video.Capturer.GstCameraCapturer));
+ }
+ }
+}
diff --git a/CesarPlayer/CesarPlayer.dll.config.in b/CesarPlayer/CesarPlayer.dll.config.in
new file mode 100644
index 0000000..adc67da
--- /dev/null
+++ b/CesarPlayer/CesarPlayer.dll.config.in
@@ -0,0 +1,3 @@
+<configuration>
+ <dllmap dll="libcesarplayer.dll" target="@expanded_libdir@/@PACKAGE@/libcesarplayer.so.0"/>
+</configuration>
diff --git a/CesarPlayer/Common/Constants.cs b/CesarPlayer/Common/Constants.cs
new file mode 100644
index 0000000..0053eec
--- /dev/null
+++ b/CesarPlayer/Common/Constants.cs
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2010 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+
+namespace LongoMatch.Video.Common
+{
+
+ class Constants{
+ public const string DV1394SRC_PROP = "guid";
+ public const string DSHOWVIDEOSINK_PROP = "device-name";
+ }
+}
diff --git a/CesarPlayer/Common/Enum.cs b/CesarPlayer/Common/Enum.cs
new file mode 100644
index 0000000..6331834
--- /dev/null
+++ b/CesarPlayer/Common/Enum.cs
@@ -0,0 +1,168 @@
+//
+// Copyright (C) 2010 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+
+namespace LongoMatch.Video.Common
+{
+
+
+ public enum Error {
+ AudioPlugin,
+ NoPluginForFile,
+ VideoPlugin,
+ AudioBusy,
+ BrokenFile,
+ FileGeneric,
+ FilePermission,
+ FileEncrypted,
+ FileNotFound,
+ DvdEncrypted,
+ InvalidDevice,
+ UnknownHost,
+ NetworkUnreachable,
+ ConnectionRefused,
+ UnvalidLocation,
+ Generic,
+ CodecNotHandled,
+ AudioOnly,
+ CannotCapture,
+ ReadError,
+ PluginLoad,
+ EmptyFile,
+ }
+
+ public enum VideoEncoderType {
+ Mpeg4,
+ Xvid,
+ Theora,
+ H264,
+ Mpeg2,
+ VP8,
+ }
+
+ public enum AudioEncoderType {
+ Mp3,
+ Aac,
+ Vorbis,
+ }
+
+ public enum VideoMuxerType {
+ Avi,
+ Mp4,
+ Matroska,
+ Ogg,
+ MpegPS,
+ WebM,
+ }
+
+ public enum CapturerType{
+ Fake,
+ Live,
+ }
+
+ public enum VideoFormat {
+ PORTABLE=0,
+ VGA=1,
+ TV=2,
+ HD720p=3,
+ HD1080p=4
+ }
+
+ public enum VideoQuality {
+ Low = 1000,
+ Normal = 3000,
+ Good = 5000,
+ Extra = 7000,
+ }
+
+ public enum AudioQuality
+ {
+ Low = 32000,
+ Normal = 64000,
+ Good = 128000,
+ Extra = 256000,
+ copy,
+ }
+
+ public enum PlayerUseType {
+ Video,
+ Audio,
+ Capture,
+ Metadata,
+ }
+
+ public enum VideoProperty {
+ Brightness,
+ Contrast,
+ Saturation,
+ Hue,
+ }
+
+ public enum AspectRatio {
+ Auto,
+ Square,
+ Fourbythree,
+ Anamorphic,
+ Dvb,
+ }
+
+ public enum AudioOutType {
+ Stereo,
+ Channel4,
+ Channel41,
+ Channel5,
+ Channel51,
+ Ac3passthru,
+ }
+
+ public enum MetadataType {
+ Title,
+ Artist,
+ Year,
+ Comment,
+ Album,
+ Duration,
+ TrackNumber,
+ Cover,
+ HasVideo,
+ DimensionX,
+ DimensionY,
+ VideoBitrate,
+ VideoEncoderType,
+ Fps,
+ HasAudio,
+ AudioBitrate,
+ AudioEncoderType,
+ AudioSampleRate,
+ AudioChannels,
+ }
+
+ public enum DeviceType {
+ Video,
+ Audio,
+ DV
+ }
+
+ public enum CaptureSourceType {
+ None,
+ DV,
+ Raw,
+ DShow
+ }
+}
diff --git a/CesarPlayer/Common/Handlers.cs b/CesarPlayer/Common/Handlers.cs
new file mode 100644
index 0000000..ae02ad6
--- /dev/null
+++ b/CesarPlayer/Common/Handlers.cs
@@ -0,0 +1,106 @@
+//
+// Copyright (C) 2010 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using Gdk;
+
+namespace LongoMatch.Video.Common
+{
+
+ public delegate void PlayListSegmentDoneHandler ();
+ public delegate void SegmentClosedHandler();
+ public delegate void SegmentDoneHandler();
+ public delegate void SeekEventHandler(long pos);
+ public delegate void VolumeChangedHandler (double level);
+ public delegate void NextButtonClickedHandler ();
+ public delegate void PrevButtonClickedHandler ();
+ public delegate void ProgressHandler (float progress);
+ public delegate void FramesProgressHandler (int actual, int total,Pixbuf frame);
+ public delegate void DrawFrameHandler (int time);
+ public delegate void EllpasedTimeHandler (int ellapsedTime);
+
+
+ public delegate void ErrorHandler(object o, ErrorArgs args);
+ public delegate void PercentCompletedHandler(object o, PercentCompletedArgs args);
+ public delegate void StateChangeHandler(object o, StateChangeArgs args);
+ public delegate void TickHandler(object o, TickArgs args);
+ public delegate void DeviceChangeHandler(object o, DeviceChangeArgs args);
+
+
+
+ public class ErrorArgs : GLib.SignalArgs {
+ public string Message{
+ get {
+ return (string) Args[0];
+ }
+ }
+
+ }
+
+ public class PercentCompletedArgs : GLib.SignalArgs {
+ public float Percent{
+ get {
+ return (float) Args[0];
+ }
+ }
+
+ }
+
+ public class StateChangeArgs : GLib.SignalArgs {
+ public bool Playing{
+ get {
+ return (bool) Args[0];
+ }
+ }
+ }
+
+ public class TickArgs : GLib.SignalArgs {
+ public long CurrentTime{
+ get {
+ return (long) Args[0];
+ }
+ }
+
+ public long StreamLength{
+ get {
+ return (long) Args[1];
+ }
+ }
+
+ public float CurrentPosition{
+ get {
+ return (float) Args[2];
+ }
+ }
+
+ public bool Seekable{
+ get {
+ return (bool) Args[3];
+ }
+ }
+ }
+
+ public class DeviceChangeArgs : GLib.SignalArgs {
+ public int DeviceChange{
+ get {
+ return (int) Args[0];
+ }
+ }
+
+ }
+}
diff --git a/CesarPlayer/Editor/EditorState.cs b/CesarPlayer/Editor/EditorState.cs
new file mode 100644
index 0000000..31b4438
--- /dev/null
+++ b/CesarPlayer/Editor/EditorState.cs
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+
+namespace LongoMatch.Video.Editor
+{
+
+
+ public enum EditorState
+ {
+ START = 0,
+ FINISHED = 1,
+ CANCELED = -1,
+ ERROR = -2
+ }
+}
diff --git a/CesarPlayer/Editor/GstVideoSplitter.cs b/CesarPlayer/Editor/GstVideoSplitter.cs
new file mode 100644
index 0000000..c97c1cb
--- /dev/null
+++ b/CesarPlayer/Editor/GstVideoSplitter.cs
@@ -0,0 +1,433 @@
+// GstVideoSplitter.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+namespace LongoMatch.Video.Editor {
+
+ using System;
+ using System.Collections;
+ using System.Runtime.InteropServices;
+ using LongoMatch.Video.Common;
+
+
+ public class GstVideoSplitter : GLib.Object, IVideoEditor, IVideoSplitter {
+
+ [DllImport("libcesarplayer.dll")]
+ static extern unsafe IntPtr gst_video_editor_new(out IntPtr err);
+
+ public event ProgressHandler Progress;
+
+ public unsafe GstVideoSplitter () : base (IntPtr.Zero)
+ {
+ if (GetType () != typeof (GstVideoSplitter)) {
+ throw new InvalidOperationException ("Can't override this constructor.");
+ }
+ IntPtr error = IntPtr.Zero;
+ Raw = gst_video_editor_new(out error);
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+ PercentCompleted += delegate(object o, PercentCompletedArgs args) {
+ if (Progress!= null)
+ Progress (args.Percent);
+ };
+ }
+
+ #region Properties
+
+ [GLib.Property ("enable-audio")]
+ public bool EnableAudio {
+ get {
+ GLib.Value val = GetProperty ("enable-audio");
+ bool ret = (bool) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("enable-audio", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("enable-title")]
+ public bool EnableTitle {
+ get {
+ GLib.Value val = GetProperty ("enable-title");
+ bool ret = (bool) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("enable-title", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("video_bitrate")]
+ public int VideoBitrate {
+ get {
+ GLib.Value val = GetProperty ("video_bitrate");
+ int ret = (int) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("video_bitrate", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("audio_bitrate")]
+ public int AudioBitrate {
+ get {
+ GLib.Value val = GetProperty ("audio_bitrate");
+ int ret = (int) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("audio_bitrate", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("width")]
+ public int Width {
+ get {
+ GLib.Value val = GetProperty ("width");
+ int ret = (int) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("width", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("height")]
+ public int Height {
+ get {
+ GLib.Value val = GetProperty ("height");
+ int ret = (int) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("height", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("output_file")]
+ public string OutputFile {
+ get {
+ GLib.Value val = GetProperty ("output_file");
+ string ret = (string) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("output_file", val);
+ val.Dispose ();
+ }
+ }
+
+ #endregion
+
+
+
+ #region GSignals
+#pragma warning disable 0169
+ [GLib.CDeclCallback]
+ delegate void ErrorVMDelegate (IntPtr gvc, IntPtr message);
+
+ static ErrorVMDelegate ErrorVMCallback;
+
+ static void error_cb (IntPtr gvc, IntPtr message)
+ {
+ try {
+ GstVideoSplitter gvc_managed = GLib.Object.GetObject (gvc, false) as GstVideoSplitter;
+ gvc_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideError (GLib.GType gtype)
+ {
+ if (ErrorVMCallback == null)
+ ErrorVMCallback = new ErrorVMDelegate (error_cb);
+ OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Editor.GstVideoSplitter), ConnectionMethod="OverrideError")]
+ protected virtual void OnError (string message)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (message);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("error")]
+ public event ErrorHandler Error {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
+ sig.RemoveDelegate (value);
+ }
+ }
+
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void PercentCompletedVMDelegate (IntPtr gvc, float percent);
+
+ static PercentCompletedVMDelegate PercentCompletedVMCallback;
+
+ static void percentcompleted_cb (IntPtr gvc, float percent)
+ {
+ try {
+ GstVideoSplitter gvc_managed = GLib.Object.GetObject (gvc, false) as GstVideoSplitter;
+ gvc_managed.OnPercentCompleted (percent);
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverridePercentCompleted (GLib.GType gtype)
+ {
+ if (PercentCompletedVMCallback == null)
+ PercentCompletedVMCallback = new PercentCompletedVMDelegate (percentcompleted_cb);
+ OverrideVirtualMethod (gtype, "percent_completed", PercentCompletedVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Editor.GstVideoSplitter), ConnectionMethod="OverridePercentCompleted")]
+ protected virtual void OnPercentCompleted (float percent)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (percent);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("percent_completed")]
+ public event PercentCompletedHandler PercentCompleted {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "percent_completed", typeof (PercentCompletedArgs));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "percent_completed", typeof (PercentCompletedArgs));
+ sig.RemoveDelegate (value);
+ }
+ }
+#pragma warning restore 0169
+ #endregion
+
+ #region Public Methods
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr gst_video_editor_get_type();
+
+ public static new GLib.GType GType {
+ get {
+ IntPtr raw_ret = gst_video_editor_get_type();
+ GLib.GType ret = new GLib.GType(raw_ret);
+ return ret;
+ }
+ }
+
+
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_video_editor_clear_segments_list(IntPtr raw);
+
+ public void ClearList() {
+ gst_video_editor_clear_segments_list(Handle);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_video_editor_add_segment(IntPtr raw, string file_path, long start, long duration, double rate, IntPtr title, bool hasAudio);
+
+ public void AddSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio) {
+ if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+ filePath="file:///"+filePath;
+ gst_video_editor_add_segment(Handle, filePath, start, duration, rate, GLib.Marshaller.StringToPtrGStrdup(title), hasAudio);
+ }
+
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_video_editor_start(IntPtr raw);
+
+ public void Start() {
+ gst_video_editor_start(Handle);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_video_editor_cancel(IntPtr raw);
+
+ public void Cancel() {
+ // The handle might have already been dealocated
+ try{
+ gst_video_editor_cancel(Handle);
+ }catch{
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_video_editor_set_video_encoder(IntPtr raw, out IntPtr error_ptr, int type);
+
+ public void SetVideoEncoder(out string error, VideoEncoderType codec) {
+ IntPtr error_ptr = IntPtr.Zero;
+ gst_video_editor_set_video_encoder(Handle,out error_ptr,(int)codec);
+ if (error_ptr != IntPtr.Zero)
+ error = GLib.Marshaller.Utf8PtrToString(error_ptr);
+ else
+ error = null;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_video_editor_set_audio_encoder(IntPtr raw, out IntPtr error_ptr, int type);
+
+ public void SetAudioEncoder(out string error, AudioEncoderType codec) {
+ IntPtr error_ptr = IntPtr.Zero;
+ gst_video_editor_set_audio_encoder(Handle,out error_ptr,(int)codec);
+ if (error_ptr != IntPtr.Zero)
+ error = GLib.Marshaller.Utf8PtrToString(error_ptr);
+ else
+ error = null;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_video_editor_set_video_muxer(IntPtr raw, out IntPtr error_ptr, int type);
+
+ public void SetVideoMuxer(out string error, VideoMuxerType muxer) {
+ IntPtr error_ptr = IntPtr.Zero;
+ gst_video_editor_set_video_muxer(Handle,out error_ptr,(int)muxer);
+ if (error_ptr != IntPtr.Zero)
+ error = GLib.Marshaller.Utf8PtrToString(error_ptr);
+ else
+ error = null;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void gst_video_editor_init_backend(out int argc, IntPtr argv);
+
+ public static int InitBackend(string argv) {
+ int argc;
+ gst_video_editor_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
+ return argc;
+ }
+
+
+ public void SetSegment (string filePath, long start, long duration, double rate, string title, bool hasAudio){
+ ClearList();
+ AddSegment(filePath, start, duration, rate, title,hasAudio);
+ }
+
+ public VideoQuality VideoQuality{
+ set{VideoBitrate=(int)value;}
+ }
+
+ public AudioQuality AudioQuality{
+ set{AudioBitrate = (int)value;}
+ }
+
+ public VideoFormat VideoFormat{
+ set{
+ if (value == VideoFormat.PORTABLE){
+ Height = 240;
+ Width = 320;
+ }
+ else if (value == VideoFormat.VGA){
+ Height = 480 ;
+ Width = 640;
+ }
+ else if (value == VideoFormat.TV){
+ Height = 576;
+ Width = 720;
+ }
+ else if (value == VideoFormat.HD720p){
+ Height = 720;
+ Width = 1280;
+ }
+ else if (value == VideoFormat.HD1080p){
+ Height = 1080;
+ Width = 1920;
+ }
+ }
+ }
+
+ public AudioEncoderType AudioEncoder{
+ set{
+ string error;
+ SetAudioEncoder(out error,value);
+ if (error != null)
+ throw new Exception(error);
+ }
+ }
+
+ public VideoEncoderType VideoEncoder{
+ set{
+ string error;
+ SetVideoEncoder(out error, value);
+ if (error != null)
+ throw new Exception(error);
+ }
+ }
+
+ public VideoMuxerType VideoMuxer{
+ set{
+ string error;
+ SetVideoMuxer(out error,value);
+ if (error != null)
+ throw new Exception(error);
+ }
+ }
+
+ public string TempDir{
+ set{;}
+ }
+
+ #endregion
+
+
+ }
+}
diff --git a/CesarPlayer/Editor/IVideoEditor.cs b/CesarPlayer/Editor/IVideoEditor.cs
new file mode 100644
index 0000000..68cc46c
--- /dev/null
+++ b/CesarPlayer/Editor/IVideoEditor.cs
@@ -0,0 +1,83 @@
+// IVideoEditor.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Video.Editor
+{
+
+
+ public interface IVideoEditor
+ {
+ event ProgressHandler Progress;
+
+ VideoQuality VideoQuality{
+ set;
+ }
+
+ AudioQuality AudioQuality{
+ set;
+ }
+
+ VideoFormat VideoFormat{
+ set;
+ }
+
+ AudioEncoderType AudioEncoder{
+ set;
+ }
+
+ VideoEncoderType VideoEncoder{
+ set;
+ }
+
+ VideoMuxerType VideoMuxer{
+ set;
+ }
+
+ string OutputFile{
+ set;
+ }
+
+ string TempDir{
+ set;
+ }
+
+ bool EnableTitle{
+ set;
+ }
+
+ bool EnableAudio{
+ set;
+ }
+
+
+ void AddSegment (string filePath, long start, long duration, double rate, string title, bool hasAudio) ;
+
+ void ClearList();
+
+ void Start();
+
+ void Cancel();
+
+ }
+}
diff --git a/CesarPlayer/Editor/IVideoSplitter.cs b/CesarPlayer/Editor/IVideoSplitter.cs
new file mode 100644
index 0000000..9f5a76c
--- /dev/null
+++ b/CesarPlayer/Editor/IVideoSplitter.cs
@@ -0,0 +1,84 @@
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Video.Editor
+{
+
+
+ public interface IVideoSplitter
+ {
+ event PercentCompletedHandler PercentCompleted;
+ event ErrorHandler Error;
+
+ bool EnableAudio{
+ set;
+ get;
+ }
+
+ bool EnableTitle{
+ set;
+ get;
+ }
+
+ int VideoBitrate {
+ set;
+ get;
+ }
+
+ int AudioBitrate {
+ set;
+ get;
+ }
+
+ int Width {
+ get ;
+ set;
+ }
+
+ int Height {
+ get ;
+ set ;
+ }
+
+ string OutputFile {
+ get ;
+ set;
+ }
+
+ void SetSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio);
+
+ AudioEncoderType AudioEncoder{
+ set;
+ }
+
+ VideoEncoderType VideoEncoder{
+ set;
+ }
+
+ VideoMuxerType VideoMuxer{
+ set;
+ }
+
+ void Start();
+
+ void Cancel();
+ }
+}
diff --git a/CesarPlayer/Editor/VideoSegment.cs b/CesarPlayer/Editor/VideoSegment.cs
new file mode 100644
index 0000000..542bead
--- /dev/null
+++ b/CesarPlayer/Editor/VideoSegment.cs
@@ -0,0 +1,70 @@
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+
+namespace LongoMatch.Video.Editor
+{
+
+
+ public class VideoSegment
+ {
+ private string filePath;
+ private long start;
+ private long duration;
+ private double rate;
+ private string title;
+ private bool hasAudio;
+
+ public VideoSegment(string filePath, long start, long duration, double rate, string title,bool hasAudio)
+ {
+ this.filePath = filePath;
+ this.start = start;
+ this.duration = duration;
+ this.rate = rate;
+ this.title = title;
+ this.hasAudio= hasAudio;
+ }
+
+ public string FilePath{
+ get{ return filePath;}
+ }
+
+ public string Title{
+ get{ return title;}
+ }
+
+ public long Start{
+ get{ return start;}
+ }
+
+ public long Duration{
+ get { return duration;}
+ }
+
+ public double Rate{
+ get{ return rate;}
+ }
+
+ public bool HasAudio{
+ get{return hasAudio;}
+ }
+
+
+ }
+}
diff --git a/CesarPlayer/Gui/CapturerBin.cs b/CesarPlayer/Gui/CapturerBin.cs
new file mode 100644
index 0000000..30d5466
--- /dev/null
+++ b/CesarPlayer/Gui/CapturerBin.cs
@@ -0,0 +1,362 @@
+// CapturerBin.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gtk;
+using Gdk;
+using GLib;
+using LongoMatch.Video;
+using LongoMatch.Video.Common;
+using LongoMatch.Video.Capturer;
+using LongoMatch.Video.Utils;
+using Mono.Unix;
+
+namespace LongoMatch.Gui
+{
+
+
+ [System.ComponentModel.Category("CesarPlayer")]
+ [System.ComponentModel.ToolboxItem(true)]
+ public partial class CapturerBin : Gtk.Bin
+ {
+ public event EventHandler CaptureFinished;
+ public event ErrorHandler Error;
+
+ private Pixbuf logopix;
+ private CapturePropertiesStruct captureProps;
+ private CapturerType capturerType;
+ private bool captureStarted;
+ private bool capturing;
+ private const int THUMBNAIL_MAX_WIDTH = 100;
+
+ ICapturer capturer;
+
+ public CapturerBin()
+ {
+ this.Build();
+ captureProps = new CapturePropertiesStruct();
+ captureProps.Width = 320;
+ captureProps.Height = 240;
+ captureProps.VideoBitrate = 1000;
+ captureProps.AudioBitrate = 128;
+ captureProps.VideoEncoder = VideoEncoderType.H264;
+ captureProps.AudioEncoder = AudioEncoderType.Aac;
+ captureProps.Muxer = VideoMuxerType.Mp4;
+ captureProps.OutputFile = "";
+ captureProps.CaptureSourceType = CaptureSourceType.Raw;
+ Type = CapturerType.Fake;
+ }
+
+ public CapturerType Type {
+ set {
+ /* Close any previous instance of the capturer */
+ Close();
+
+ MultimediaFactory factory = new MultimediaFactory();
+ capturer = factory.getCapturer(value);
+ capturer.EllapsedTime += OnTick;
+ if (value != CapturerType.Fake){
+ capturer.Error += OnError;
+ capturer.DeviceChange += OnDeviceChange;
+ capturerhbox.Add((Widget)capturer);
+ (capturer as Widget).Visible = true;
+ capturerhbox.Visible = true;
+ logodrawingarea.Visible = false;
+ }
+ else{
+ logodrawingarea.Visible = true;
+ capturerhbox.Visible = false;
+ }
+ SetProperties();
+ capturerType = value;
+ }
+
+ }
+
+ public string Logo{
+ set{
+ try{
+ this.logopix = new Pixbuf(value);
+ }catch{
+ /* FIXME: Add log */
+ }
+ }
+ }
+
+ public int CurrentTime {
+ get {
+ if (capturer == null)
+ return -1;
+ return capturer.CurrentTime;
+ }
+ }
+
+ public bool Capturing{
+ get{
+ return capturing;
+ }
+ }
+
+ public CapturePropertiesStruct CaptureProperties{
+ set{
+ captureProps = value;
+ }
+ }
+
+ public void Start(){
+ if (capturer == null)
+ return;
+
+ capturing = true;
+ captureStarted = true;
+ recbutton.Visible = false;
+ pausebutton.Visible = true;
+ stopbutton.Visible = true;
+ capturer.Start();
+ }
+
+ public void TogglePause(){
+ if (capturer == null)
+ return;
+
+ capturing = !capturing;
+ recbutton.Visible = !capturing;
+ pausebutton.Visible = capturing;
+ capturer.TogglePause();
+ }
+
+ public void Stop() {
+ if (capturer != null){
+ capturing = false;
+ capturer.Stop();
+ }
+ }
+
+ public void Run(){
+ if (capturer != null)
+ capturer.Run();
+ }
+
+ public void Close(){
+ /* resetting common properties */
+ pausebutton.Visible = false;
+ stopbutton.Visible = false;
+ recbutton.Visible = true;
+ captureStarted = false;
+ capturing = false;
+ OnTick(0);
+
+ if (capturer == null)
+ return;
+
+ /* stopping and closing capturer */
+ try {
+ capturer.Stop();
+ capturer.Close();
+ if (capturerType == CapturerType.Live){
+ /* release and dispose live capturer */
+ capturer.Error -= OnError;
+ capturer.DeviceChange += OnDeviceChange;
+ capturerhbox.Remove(capturer as Gtk.Widget);
+ capturer.Dispose();
+ }
+ } catch (Exception e) {}
+ capturer = null;
+ }
+
+ public Pixbuf CurrentMiniatureFrame {
+ get {
+ int h, w;
+ double rate;
+ Pixbuf scaled_pix;
+ Pixbuf pix;
+
+ if (capturer == null)
+ return null;
+
+ pix = capturer.CurrentFrame;
+
+ if (pix == null)
+ return null;
+
+ w = pix.Width;
+ h = pix.Height;
+ rate = (double)w / (double)h;
+
+ if (h > w) {
+ w = (int)(THUMBNAIL_MAX_WIDTH * rate);
+ h = THUMBNAIL_MAX_WIDTH;
+ } else {
+ h = (int)(THUMBNAIL_MAX_WIDTH / rate);
+ w = THUMBNAIL_MAX_WIDTH;
+ }
+ scaled_pix = pix.ScaleSimple (w, h, Gdk.InterpType.Bilinear);
+ pix.Dispose();
+
+ return scaled_pix;
+ }
+ }
+
+ private void SetProperties(){
+ if (capturer == null)
+ return;
+
+ capturer.DeviceID = captureProps.DeviceID;
+ capturer.OutputFile = captureProps.OutputFile;
+ capturer.OutputHeight = captureProps.Height;
+ capturer.OutputWidth = captureProps.Width;
+ capturer.SetVideoEncoder(captureProps.VideoEncoder);
+ capturer.SetAudioEncoder(captureProps.AudioEncoder);
+ capturer.SetVideoMuxer(captureProps.Muxer);
+ capturer.SetSource(captureProps.CaptureSourceType);
+ capturer.VideoBitrate = captureProps.VideoBitrate;
+ capturer.AudioBitrate = captureProps.AudioBitrate;
+ }
+
+ protected virtual void OnRecbuttonClicked (object sender, System.EventArgs e)
+ {
+ if (capturer == null)
+ return;
+
+ if (captureStarted == true){
+ if (capturing)
+ return;
+ TogglePause();
+ }
+ else
+ Start();
+ }
+
+ protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
+ {
+ if (capturer != null && capturing)
+ TogglePause();
+ }
+
+ protected virtual void OnStopbuttonClicked (object sender, System.EventArgs e)
+ {
+ int res;
+
+ if (capturer == null)
+ return;
+
+ MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
+ Catalog.GetString("You are going to stop and finish the current capture."+"\n"+
+ "Do you want to proceed?"));
+ res = md.Run();
+ md.Destroy();
+ if (res == (int)ResponseType.Yes){
+ md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None,
+ Catalog.GetString("Finalizing file. This can take a while"));
+ md.Show();
+ Stop();
+ md.Destroy();
+ recbutton.Visible = true;
+ pausebutton.Visible = false;
+ stopbutton.Visible = false;
+ if (CaptureFinished != null)
+ CaptureFinished(this, new EventArgs());
+ }
+ }
+
+ protected virtual void OnTick (int ellapsedTime){
+ timelabel.Text = "Time: " + TimeString.MSecondsToSecondsString(CurrentTime);
+ }
+
+ protected virtual void OnError (object o, ErrorArgs args)
+ {
+ if (Error != null)
+ Error (o, args);
+
+ Close();
+ }
+
+ protected virtual void OnDeviceChange (object o, DeviceChangeArgs args)
+ {
+ /* device disconnected, pause capture */
+ if (args.DeviceChange == -1){
+ if (capturing)
+ TogglePause();
+
+ recbutton.Sensitive = false;
+
+ MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
+ MessageType.Question, ButtonsType.Ok,
+ Catalog.GetString("Device disconnected. " +
+ "The capture will be paused"));
+ md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog, 48);
+ md.Run();
+ md.Destroy();
+ } else {
+ recbutton.Sensitive = true;
+ MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
+ MessageType.Question, ButtonsType.YesNo,
+ Catalog.GetString("Device reconnected." +
+ "Do you want to restart the capture?"));
+ md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog, 48);
+ if (md.Run() == (int)ResponseType.Yes){
+ Console.WriteLine ("Accepted to toggle pause");
+ TogglePause();
+ }
+ md.Destroy();
+ }
+ }
+
+ protected virtual void OnLogodrawingareaExposeEvent (object o, Gtk.ExposeEventArgs args)
+ {
+ Gdk.Window win;
+ Pixbuf frame;
+ int width, height, allocWidth, allocHeight, logoX, logoY;
+ float ratio;
+
+ if (logopix == null)
+ return;
+
+ win = logodrawingarea.GdkWindow;
+ width = logopix.Width;
+ height = logopix.Height;
+ allocWidth = logodrawingarea.Allocation.Width;
+ allocHeight = logodrawingarea.Allocation.Height;
+
+ /* Checking if allocated space is smaller than our logo */
+ if ((float) allocWidth / width > (float) allocHeight / height) {
+ ratio = (float) allocHeight / height;
+ } else {
+ ratio = (float) allocWidth / width;
+ }
+ width = (int) (width * ratio);
+ height = (int) (height * ratio);
+
+ logoX = (allocWidth / 2) - (width / 2);
+ logoY = (allocHeight / 2) - (height / 2);
+
+ /* Drawing our frame */
+ frame = new Pixbuf(Colorspace.Rgb, false, 8, allocWidth, allocHeight);
+ logopix.Composite(frame, 0, 0, allocWidth, allocHeight, logoX, logoY,
+ ratio, ratio, InterpType.Bilinear, 255);
+
+ win.DrawPixbuf (this.Style.BlackGC, frame, 0, 0,
+ 0, 0, allocWidth, allocHeight,
+ RgbDither.Normal, 0, 0);
+ frame.Dispose();
+ return;
+ }
+ }
+}
diff --git a/CesarPlayer/Gui/PlayerBin.cs b/CesarPlayer/Gui/PlayerBin.cs
new file mode 100644
index 0000000..7a99fc7
--- /dev/null
+++ b/CesarPlayer/Gui/PlayerBin.cs
@@ -0,0 +1,619 @@
+// PlayerBin.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+//Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+using System;
+using Gtk;
+using Gdk;
+using Mono.Unix;
+using System.Runtime.InteropServices;
+using LongoMatch.Video;
+using LongoMatch.Video.Common;
+using LongoMatch.Video.Player;
+using LongoMatch.Video.Utils;
+
+namespace LongoMatch.Gui
+{
+ [System.ComponentModel.Category("LongoMatch")]
+ [System.ComponentModel.ToolboxItem(true)]
+
+ public partial class PlayerBin : Gtk.Bin
+ {
+
+ public event SegmentClosedHandler SegmentClosedEvent;
+ public event TickHandler Tick;
+ public event ErrorHandler Error;
+ public event StateChangeHandler PlayStateChanged;
+ public event NextButtonClickedHandler Next;
+ public event PrevButtonClickedHandler Prev;
+ public event DrawFrameHandler DrawFrame;
+ public event SeekEventHandler SeekEvent;
+
+ private const int THUMBNAIL_MAX_WIDTH = 100;
+ private TickHandler tickHandler;
+ private IPlayer player;
+ private long length=0;
+ private string slength;
+ private long segmentStartTime;
+ private long segmentStopTime;
+ private bool seeking=false;
+ private double[] seeksQueue;
+ private bool IsPlayingPrevState = false;
+ private float rate=1;
+ private double previousVLevel = 1;
+ private bool muted=false;
+ private object[] pendingSeek=null; //{start,stop,rate}
+ //the player.mrl is diferent from the filename as it's an uri eg:file:///foo.avi
+ private string filename = null;
+ protected VolumeWindow vwin;
+
+
+#region Constructors
+ public PlayerBin()
+ {
+ this.Build();
+ PlayerInit();
+ vwin = new VolumeWindow();
+ vwin.VolumeChanged += new VolumeChangedHandler(OnVolumeChanged);
+ controlsbox.Visible = false;
+ UnSensitive();
+ timescale.Adjustment.PageIncrement = 0.01;
+ timescale.Adjustment.StepIncrement = 0.0001;
+ playbutton.CanFocus = false;
+ prevbutton.CanFocus = false;
+ nextbutton.CanFocus = false;
+ volumebutton.CanFocus = false;
+ timescale.CanFocus = false;
+ vscale1.CanFocus = false;
+ drawbutton.CanFocus = false;
+ seeksQueue = new double[2];
+ seeksQueue [0] = -1;
+ seeksQueue [1] = -1;
+ }
+
+#endregion
+
+#region Properties
+
+ public IPlayer Player{
+ get{return player;}
+ }
+
+ public long AccurateCurrentTime{
+ get{return player.AccurateCurrentTime;}
+ }
+
+ public long CurrentTime{
+ get{return player.CurrentTime;}
+ }
+
+ public long StreamLength{
+ get{return player.StreamLength;}
+ }
+
+ public float Rate{
+ get{return rate;}
+ set{vscale1.Value = (int)(value*25);}
+ }
+
+ public bool FullScreen{
+ set{
+ if (value)
+ GdkWindow.Fullscreen();
+ else
+ GdkWindow.Unfullscreen();
+ }
+ }
+
+ public Pixbuf CurrentMiniatureFrame{
+ get{
+ Pixbuf pixbuf = player.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_WIDTH);
+ return pixbuf;
+ }
+ }
+
+ public Pixbuf CurrentFrame{
+ get{return player.GetCurrentFrame();}
+ }
+
+ public Pixbuf LogoPixbuf{
+ set{player.LogoPixbuf = value;}
+ }
+
+ public bool DrawingMode {
+ set{player.DrawingMode= value;}
+ }
+
+ public Pixbuf DrawingPixbuf {
+ set{player.DrawingPixbuf=value;}
+ }
+
+ public bool LogoMode{
+ set{player.LogoMode = value;}
+ }
+
+ public bool ExpandLogo {
+ get{return player.ExpandLogo;}
+ set{player.ExpandLogo = value;}
+ }
+
+ public bool Opened {
+ get{return filename != null;}
+ }
+
+ public Widget VideoWidget{
+ get{return ((Gtk.EventBox)player);}
+ }
+#endregion
+
+#region Public methods
+
+ public void Open (string mrl){
+ filename = mrl;
+ ResetGui();
+ CloseActualSegment();
+ try{
+ player.Open(mrl);
+ }
+ catch {
+ //We handle this error async
+ }
+ }
+
+ public void Play(){
+ player.Play();
+ float val = GetRateFromScale();
+ if (segmentStartTime == 0 && segmentStopTime==0)
+ player.SetRate(val);
+ else
+ player.SetRateInSegment(val,segmentStopTime);
+ }
+
+ public void Pause(){
+ player.Pause();
+ }
+
+ public void TogglePlay(){
+ if (player.Playing)
+ Pause();
+ else
+ Play();
+ }
+
+ public void SetLogo (string filename){
+ player.Logo=filename;
+ }
+
+ public void ResetGui(){
+ closebutton.Hide();
+ SetSensitive();
+ timescale.Value=0;
+ timelabel.Text="";
+ player.CancelProgramedStop();
+ }
+
+ public void SetPlayListElement(string fileName,long start, long stop, float rate, bool hasNext){
+ if (hasNext)
+ nextbutton.Sensitive = true;
+ else
+ nextbutton.Sensitive = false;
+
+ if (fileName != filename){
+ Open(fileName);
+ //Wait until the pipeline is prerolled and ready to seek
+ pendingSeek = new object[3] {start,stop,rate};
+ }
+ else player.SegmentSeek(start,stop,rate);
+
+ segmentStartTime = start;
+ segmentStopTime = stop;
+ player.LogoMode = false;
+ Rate = rate;
+ }
+
+ public void Close(){
+ player.Close();
+ filename = null;
+ timescale.Value = 0;
+ UnSensitive();
+ }
+
+ public void SeekTo(long time, bool accurate){
+ player.SeekTime(time,1,accurate);
+ if (SeekEvent != null)
+ SeekEvent(time);
+ }
+
+ public void SeekInSegment(long pos){
+ player.SeekInSegment(pos, GetRateFromScale());
+ if (SeekEvent != null)
+ SeekEvent(pos);
+ }
+
+ public void SeekToNextFrame(bool in_segment){
+ int currentTime = (int)player.CurrentTime;
+ if (segmentStopTime==0 | currentTime < segmentStopTime){
+ if (player.Playing)
+ player.Pause();
+ player.SeekToNextFrame( GetRateFromScale(), in_segment);
+ if (SeekEvent != null)
+ SeekEvent(currentTime );
+ }
+
+ }
+
+ public void SeekToPreviousFrame(bool in_segment){
+ long currentTime = player.CurrentTime;
+ if (currentTime> segmentStartTime){
+ if (player.Playing)
+ player.Pause();
+ player.SeekToPreviousFrame( GetRateFromScale(),in_segment);
+ if (SeekEvent != null)
+ SeekEvent(currentTime);
+ }
+ }
+
+ public void StepForward(){
+ SeekFromTimescale(timescale.Value + timescale.Adjustment.PageIncrement);
+ }
+
+ public void StepBackward(){
+ SeekFromTimescale(timescale.Value - timescale.Adjustment.PageIncrement);
+ }
+
+ public void FramerateUp(){
+ vscale1.Adjustment.Value += vscale1.Adjustment.StepIncrement;
+ }
+
+ public void FramerateDown(){
+ vscale1.Adjustment.Value -= vscale1.Adjustment.StepIncrement;
+ }
+
+ public void UpdateSegmentStartTime (long start){
+ segmentStartTime = start;
+ player.SegmentStartUpdate(start, GetRateFromScale());
+ if (SeekEvent != null)
+ SeekEvent(start);
+ }
+
+ public void UpdateSegmentStopTime (long stop){
+ segmentStopTime = stop;
+ player.SegmentStopUpdate(stop, GetRateFromScale());
+ if (SeekEvent != null)
+ SeekEvent(stop);
+ }
+
+ public void SetStartStop(long start, long stop){
+ segmentStartTime = start;
+ segmentStopTime = stop;
+ closebutton.Show();
+ vscale1.Value = 25;
+ player.SegmentSeek(start,stop, GetRateFromScale());
+ player.Play();
+ }
+
+ public void CloseActualSegment(){
+ closebutton.Hide();
+ segmentStartTime = 0;
+ segmentStopTime = 0;
+ vscale1.Value=25;
+ //timescale.Sensitive = true;
+ slength = TimeString.MSecondsToSecondsString(length);
+ SegmentClosedEvent();
+ player.CancelProgramedStop();
+ }
+
+ public void SetSensitive(){
+ controlsbox.Sensitive = true;
+ vscale1.Sensitive = true;
+ }
+
+ public void UnSensitive(){
+ controlsbox.Sensitive = false;
+ vscale1.Sensitive = false;
+ }
+
+#endregion
+
+#region Private methods
+
+ private float GetRateFromScale(){
+ VScale scale= vscale1;
+ double val = scale.Value;
+
+ if (val >25 ){
+ val = val-25 ;
+ }
+ else if (val <=25){
+ val = val/25;
+ }
+ return (float)val;
+ }
+
+ private bool InSegment(){
+ return !(segmentStopTime == 0 && segmentStartTime ==0) ;
+ }
+
+ private void PlayerInit(){
+ MultimediaFactory factory;
+ Widget playerWidget;
+
+ factory= new MultimediaFactory();
+ player = factory.getPlayer(320,280);
+
+ tickHandler = new TickHandler(OnTick);
+ player.Tick += tickHandler;
+ player.StateChange += new StateChangeHandler(OnStateChanged);
+ player.Eos += new EventHandler (OnEndOfStream);
+ player.Error += new ErrorHandler (OnError);
+ player.ReadyToSeek += new EventHandler(OnReadyToSeek);
+
+ playerWidget = (Widget)player;
+ playerWidget.ButtonPressEvent += OnVideoboxButtonPressEvent;
+ playerWidget.ScrollEvent += OnVideoboxScrollEvent;
+ playerWidget.Show();
+ videobox.Add(playerWidget);
+
+ }
+
+ private void SeekFromTimescale(double pos){
+ if (InSegment()){
+ long seekPos = segmentStartTime + (long)(pos*(segmentStopTime-segmentStartTime));
+ player.SeekInSegment(seekPos, GetRateFromScale());
+ timelabel.Text= TimeString.MSecondsToSecondsString(seekPos) + "/" +
+ TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
+ }
+ else {
+ player.Position = pos;
+ timelabel.Text= TimeString.MSecondsToSecondsString(player.CurrentTime) + "/" + slength;
+ Rate = 1;
+ }
+ }
+
+#endregion
+
+#region Callbacks
+ protected virtual void OnStateChanged(object o, StateChangeArgs args){
+ if (args.Playing){
+ playbutton.Hide();
+ pausebutton.Show();
+ }
+ else{
+ playbutton.Show();
+ pausebutton.Hide();
+ }
+ if (PlayStateChanged != null)
+ PlayStateChanged(this,args);
+ }
+
+ protected void OnReadyToSeek(object o, EventArgs args){
+ if (pendingSeek != null){
+ player.SegmentSeek((long)pendingSeek[0],
+ (long)pendingSeek[1],
+ (float)pendingSeek[2]);
+ player.Play();
+ pendingSeek = null;
+
+ }
+ }
+
+ protected virtual void OnTick(object o,TickArgs args){
+ long currentTime = args.CurrentTime;
+ float currentposition = args.CurrentPosition;
+ long streamLength = args.StreamLength;
+
+ //Console.WriteLine ("Current Time:{0}\n Length:{1}\n",currentTime, streamLength);
+ if (length != streamLength){
+ length = streamLength;
+ slength = TimeString.MSecondsToSecondsString(length);
+ }
+
+ if (InSegment()){
+ currentTime -= segmentStartTime;
+ currentposition = (float)currentTime/(float)(segmentStopTime-segmentStartTime);
+ slength = TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
+ }
+
+ timelabel.Text = TimeString.MSecondsToSecondsString(currentTime) + "/" + slength;
+ timescale.Value = currentposition;
+ if (Tick != null)
+ Tick(o,args);
+
+ }
+
+ protected virtual void OnTimescaleAdjustBounds(object o, Gtk.AdjustBoundsArgs args)
+ {
+ double pos;
+
+ if (!seeking){
+ seeking = true;
+ IsPlayingPrevState = player.Playing;
+ player.Tick -= tickHandler;
+ player.Pause();
+ seeksQueue [0] = -1;
+ seeksQueue [1] = -1;
+ }
+
+ pos = timescale.Value;
+ seeksQueue[0] = seeksQueue[1];
+ seeksQueue[1] = pos;
+
+ SeekFromTimescale(pos);
+ }
+
+ protected virtual void OnTimescaleValueChanged(object sender, System.EventArgs e)
+ {
+ if (seeking){
+ /* Releasing the timescale always report value different from the real one.
+ * We need to cache previous position and seek again to the this position */
+ SeekFromTimescale(seeksQueue[0] != -1 ? seeksQueue[0] : seeksQueue[1]);
+ seeking=false;
+ player.Tick += tickHandler;
+ if (IsPlayingPrevState)
+ player.Play();
+ }
+ }
+
+ protected virtual void OnPlaybuttonClicked(object sender, System.EventArgs e)
+ {
+ Play();
+ }
+
+ protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e)
+ {
+ player.SeekTime(segmentStartTime,1,true);
+ }
+
+ protected virtual void OnVolumebuttonClicked(object sender, System.EventArgs e)
+ {
+ vwin.SetLevel(player.Volume);
+ vwin.Show();
+ }
+
+ protected virtual void OnDestroyEvent(object o, Gtk.DestroyEventArgs args)
+ {
+ player.Dispose();
+ }
+
+ protected virtual void OnVolumeChanged(double level){
+ player.Volume = level;
+ if (level == 0)
+ muted = true;
+ else
+ muted = false;
+ }
+
+ protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
+ {
+ player.Pause();
+ }
+
+ protected virtual void OnEndOfStream (object o, EventArgs args){
+ player.SeekInSegment(0, GetRateFromScale());
+ player.Pause();
+ }
+
+
+ protected virtual void OnError (object o, ErrorArgs args){
+ if(Error != null)
+ Error(o,args);
+ }
+
+ protected virtual void OnClosebuttonClicked (object sender, System.EventArgs e)
+ {
+ CloseActualSegment();
+ }
+
+ protected virtual void OnPrevbuttonClicked (object sender, System.EventArgs e)
+ {
+ if (Prev != null)
+ Prev();
+ }
+
+ protected virtual void OnNextbuttonClicked (object sender, System.EventArgs e)
+ {
+ if (Next != null)
+ Next();
+ }
+
+ protected virtual void OnVscale1FormatValue (object o, Gtk.FormatValueArgs args)
+ {
+ double val = args.Value;
+ if (val >25 ){
+ val = val-25 ;
+ args.RetVal = val +"X";
+ }
+ else if (val ==25){
+ args.RetVal = "1X";
+ }
+ else if (val <25){
+ args.RetVal = "-"+val+"/25"+"X";
+ }
+ }
+
+ protected virtual void OnVscale1ValueChanged (object sender, System.EventArgs e)
+ {
+ float val = GetRateFromScale();
+
+ // Mute for rate != 1
+ if (val != 1 && player.Volume != 0){
+ previousVLevel = player.Volume;
+ player.Volume=0;
+ }
+ else if (val != 1 && muted)
+ previousVLevel = 0;
+ else if (val ==1)
+ player.Volume = previousVLevel;
+
+ if (InSegment()){
+ player.SetRateInSegment(val,segmentStopTime);
+ }
+ else
+ player.SetRate(val);
+ rate = val;
+ }
+
+ protected virtual void OnVideoboxButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
+ {
+ if(filename == null)
+ return;
+ /* FIXME: The pointer is grabbed when the event box is clicked.
+ * Make sure to ungrab it in order to avoid clicks outisde the window
+ * triggering this callback. This should be fixed properly.*/
+ Pointer.Ungrab(Gtk.Global.CurrentEventTime);
+ if (!player.Playing)
+ Play();
+ else
+ Pause();
+ }
+
+ protected virtual void OnVideoboxScrollEvent (object o, Gtk.ScrollEventArgs args)
+ {
+ switch (args.Event.Direction){
+ case ScrollDirection.Down:
+ SeekToPreviousFrame(InSegment());
+ break;
+ case ScrollDirection.Up:
+ SeekToNextFrame(InSegment());
+ break;
+ case ScrollDirection.Left:
+ StepBackward();
+ break;
+ case ScrollDirection.Right:
+ StepForward();
+ break;
+ }
+ }
+
+ protected virtual void OnDrawButtonClicked (object sender, System.EventArgs e)
+ {
+ int currentTime;
+
+ currentTime = (int)AccurateCurrentTime;
+ // If the player has reached the end of the segment the current time
+ // will be unseekable and it's not possible to get a frame at this
+ // instant. If we exceed the segment stop time, decrease in a
+ // milisecond the position.
+ if (InSegment() && currentTime >= segmentStopTime)
+ currentTime -= 1;
+ if (DrawFrame != null)
+ DrawFrame(currentTime);
+ }
+#endregion
+ }
+}
diff --git a/CesarPlayer/Gui/VolumeWindow.cs b/CesarPlayer/Gui/VolumeWindow.cs
new file mode 100644
index 0000000..6b4945e
--- /dev/null
+++ b/CesarPlayer/Gui/VolumeWindow.cs
@@ -0,0 +1,70 @@
+// VolumeWindow.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+using System;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Gui
+{
+
+
+ public partial class VolumeWindow : Gtk.Window
+ {
+
+
+
+ public event VolumeChangedHandler VolumeChanged;
+
+
+ public VolumeWindow() :
+ base(Gtk.WindowType.Toplevel)
+ {
+ this.Build();
+ volumescale.Adjustment.PageIncrement = 0.0001;
+ volumescale.Adjustment.StepIncrement = 0.0001;
+ }
+
+ public void SetLevel(double level){
+ volumescale.Value = level ;
+ }
+
+ protected virtual void OnLessbuttonClicked(object sender, System.EventArgs e)
+ {
+ volumescale.Value = volumescale.Value - 0.1;
+ }
+
+ protected virtual void OnMorebuttonClicked(object sender, System.EventArgs e)
+ {
+ volumescale.Value = volumescale.Value + 0.1;
+ }
+
+ protected virtual void OnVolumescaleValueChanged(object sender, System.EventArgs e)
+ {
+ VolumeChanged(volumescale.Value);
+ }
+
+ protected virtual void OnFocusOutEvent (object o, Gtk.FocusOutEventArgs args)
+ {
+ this.Hide();
+ }
+
+
+
+ }
+}
diff --git a/CesarPlayer/Makefile.am b/CesarPlayer/Makefile.am
new file mode 100644
index 0000000..b9d4db7
--- /dev/null
+++ b/CesarPlayer/Makefile.am
@@ -0,0 +1,113 @@
+
+EXTRA_DIST =
+
+if ENABLE_DEBUG
+ASSEMBLY_COMPILER_COMMAND = $(GMCS)
+ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -unsafe -warn:4 -optimize+ -debug -define:DEBUG
+ASSEMBLY = bin/Debug/CesarPlayer.dll
+ASSEMBLY_MDB = $(ASSEMBLY).mdb
+COMPILE_TARGET = library
+PROJECT_REFERENCES =
+BUILD_DIR = bin/Debug
+CESARPLAYER_DLL_MDB_SOURCE=bin/Debug/CesarPlayer.dll.mdb
+CESARPLAYER_DLL_MDB=$(BUILD_DIR)/CesarPlayer.dll.mdb
+CESARPLAYER_DLL_CONFIG_SOURCE = CesarPlayer.dll.config
+CESARPLAYER_DLL_CONFIG = $(BUILD_DIR)/CesarPlayer.dll.config
+
+endif
+
+if ENABLE_RELEASE
+ASSEMBLY_COMPILER_COMMAND = $(GMCS)
+ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -unsafe -warn:4 -optimize+
+ASSEMBLY = bin/Release/CesarPlayer.dll
+ASSEMBLY_MDB = $(ASSEMBLY).mdb
+COMPILE_TARGET = library
+PROJECT_REFERENCES =
+BUILD_DIR = bin/Release
+CESARPLAYER_DLL_MDB_SOURCE=
+CESARPLAYER_DLL_MDB=
+CESARPLAYER_DLL_CONFIG_SOURCE = CesarPlayer.dll.config
+CESARPLAYER_DLL_CONFIG = $(BUILD_DIR)/CesarPlayer.dll.config
+
+
+endif
+
+AL=al2
+SATELLITE_ASSEMBLY_NAME=$(notdir $(basename $(ASSEMBLY))).resources.dll
+
+PROGRAMFILES = \
+ $(CESARPLAYER_DLL_MDB)\
+ $(CESARPLAYER_DLL_CONFIG)
+
+RESGEN=resgen2
+
+all: $(ASSEMBLY) $(PROGRAMFILES)
+
+FILES = \
+ AssemblyInfo.cs \
+ gtk-gui/generated.cs \
+ Common/Constants.cs\
+ Common/Enum.cs\
+ Common/Handlers.cs\
+ Player/GstPlayer.cs \
+ Player/IPlayer.cs \
+ Player/ObjectManager.cs \
+ gtk-gui/LongoMatch.Gui.CapturerBin.cs \
+ gtk-gui/LongoMatch.Gui.PlayerBin.cs \
+ gtk-gui/LongoMatch.Gui.VolumeWindow.cs \
+ Gui/CapturerBin.cs \
+ Gui/PlayerBin.cs \
+ Gui/VolumeWindow.cs \
+ MultimediaFactory.cs \
+ Utils/IFramesCapturer.cs \
+ Utils/FramesCapturer.cs \
+ Utils/IMetadataReader.cs \
+ Utils/TimeString.cs \
+ Capturer/CaptureProperties.cs \
+ Capturer/GstCameraCapturer.cs \
+ Capturer/FakeCapturer.cs \
+ Capturer/ICapturer.cs \
+ Capturer/LiveSourceTimer.cs \
+ Capturer/ObjectManager.cs \
+ Editor/GstVideoSplitter.cs \
+ Editor/IVideoEditor.cs \
+ Editor/IVideoSplitter.cs \
+ Editor/VideoSegment.cs \
+ Editor/EditorState.cs \
+ Utils/Device.cs \
+ Utils/MediaFile.cs \
+ Utils/PreviewMediaFile.cs
+
+DATA_FILES =
+
+RESOURCES = \
+ gtk-gui/objects.xml \
+ gtk-gui/gui.stetic
+
+EXTRAS = \
+ cesarplayer.key\
+ CesarPlayer.dll.config\
+ AssemblyInfo.cs.in
+
+REFERENCES = \
+ System \
+ Mono.Posix \
+ System.Drawing \
+ $(GTK_SHARP_20_LIBS) \
+ $(GLIB_SHARP_20_LIBS)
+
+DLL_REFERENCES =
+
+CLEANFILES = $(PROGRAMFILES)
+
+include $(top_srcdir)/Makefile.include
+
+$(eval $(call emit-deploy-target,CESARPLAYER_DLL_CONFIG))
+
+$(eval $(call emit_resgen_targets))
+$(build_xamlg_list): %.xaml.g.cs: %.xaml
+ xamlg '$<'
+
+$(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) $(build_satellite_assembly_list)
+ mkdir -p $(shell dirname $(ASSEMBLY))
+ $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) $(build_resources_embed) $(build_references_ref)
diff --git a/CesarPlayer/MultimediaFactory.cs b/CesarPlayer/MultimediaFactory.cs
new file mode 100644
index 0000000..a9712c1
--- /dev/null
+++ b/CesarPlayer/MultimediaFactory.cs
@@ -0,0 +1,108 @@
+// PlayerMaker.cs
+//
+// Copyright(C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+//Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using LongoMatch.Video.Capturer;
+using LongoMatch.Video.Player;
+using LongoMatch.Video.Editor;
+using LongoMatch.Video.Utils;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Video
+{
+
+
+ public class MultimediaFactory
+ {
+
+ OperatingSystem oS;
+
+ public MultimediaFactory()
+ {
+ oS = Environment.OSVersion;
+ }
+
+ public IPlayer getPlayer(int width, int height){
+ switch (oS.Platform) {
+ case PlatformID.Unix:
+ return new GstPlayer(width,height,PlayerUseType.Video);
+
+ case PlatformID.Win32NT:
+ return new GstPlayer(width,height,PlayerUseType.Video);
+
+ default:
+ return new GstPlayer(width,height,PlayerUseType.Video);
+ }
+ }
+
+ public IMetadataReader getMetadataReader(){
+
+ switch (oS.Platform) {
+ case PlatformID.Unix:
+ return new GstPlayer(1,1,PlayerUseType.Metadata);
+
+ case PlatformID.Win32NT:
+ return new GstPlayer(1,1,PlayerUseType.Metadata);
+
+ default:
+ return new GstPlayer(1,1,PlayerUseType.Metadata);
+ }
+ }
+
+ public IFramesCapturer getFramesCapturer(){
+ switch (oS.Platform) {
+ case PlatformID.Unix:
+ return new GstPlayer(1,1,PlayerUseType.Capture);
+
+ case PlatformID.Win32NT:
+ return new GstPlayer(1,1,PlayerUseType.Capture);
+
+ default:
+ return new GstPlayer(1,1,PlayerUseType.Capture);
+ }
+ }
+
+ public IVideoEditor getVideoEditor(){
+ switch (oS.Platform) {
+ case PlatformID.Unix:
+ return new GstVideoSplitter();
+
+ case PlatformID.Win32NT:
+ return new GstVideoSplitter();
+
+ default:
+ return new GstVideoSplitter();
+ }
+ }
+
+ public ICapturer getCapturer(CapturerType type){
+ switch (type) {
+ case CapturerType.Fake:
+ return new FakeCapturer();
+
+ case CapturerType.Live:
+ return new GstCameraCapturer("test.avi");
+
+ default:
+ return new FakeCapturer();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CesarPlayer/Player/GstDVDEvent.cs b/CesarPlayer/Player/GstDVDEvent.cs
new file mode 100644
index 0000000..bd66d5f
--- /dev/null
+++ b/CesarPlayer/Player/GstDVDEvent.cs
@@ -0,0 +1,46 @@
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+namespace LongoMatch.Video.Player {
+
+ using System;
+ using System.Runtime.InteropServices;
+
+#region Autogenerated code
+ public enum GstDVDEvent {
+
+ RootMenu,
+ TitleMenu,
+ SubpictureMenu,
+ AudioMenu,
+ AngleMenu,
+ ChapterMenu,
+ NextChapter,
+ PrevChapter,
+ NextTitle,
+ PrevTitle,
+ NextAngle,
+ PrevAngle,
+ RootMenuUp,
+ RootMenuDown,
+ RootMenuLeft,
+ RootMenuRight,
+ RootMenuSelect,
+ }
+#endregion
+}
diff --git a/CesarPlayer/Player/GstPlayer.cs b/CesarPlayer/Player/GstPlayer.cs
new file mode 100644
index 0000000..6f51e51
--- /dev/null
+++ b/CesarPlayer/Player/GstPlayer.cs
@@ -0,0 +1,1415 @@
+// Copyright(C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+namespace LongoMatch.Video.Player {
+
+ using System;
+ using System.Collections;
+ using System.Runtime.InteropServices;
+ using LongoMatch.Video.Common;
+ using LongoMatch.Video.Utils;
+
+#region Autogenerated code
+ public class GstPlayer : Gtk.EventBox,IPlayer, IMetadataReader, IFramesCapturer{
+
+ [Obsolete]
+ protected GstPlayer(GLib.GType gtype) : base(gtype) {}
+ public GstPlayer(IntPtr raw) : base(raw) {}
+
+ [DllImport("libcesarplayer.dll")]
+ static extern unsafe IntPtr bacon_video_widget_new(int width, int height, int type, out IntPtr error);
+
+ public unsafe GstPlayer (int width, int height, PlayerUseType type) : base (IntPtr.Zero)
+ {
+ if (GetType () != typeof (GstPlayer)) {
+ throw new InvalidOperationException ("Can't override this constructor.");
+ }
+ IntPtr error = IntPtr.Zero;
+ Raw = bacon_video_widget_new(width, height, (int) type, out error);
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+ }
+
+ [GLib.Property ("seekable")]
+ public bool Seekable {
+ get {
+ GLib.Value val = GetProperty ("seekable");
+ bool ret = (bool) val;
+ val.Dispose ();
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_get_logo_mode(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_logo_mode(IntPtr raw, bool logo_mode);
+
+ [GLib.Property ("logo_mode")]
+ public bool LogoMode {
+ get {
+ bool raw_ret = bacon_video_widget_get_logo_mode(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_logo_mode(Handle, value);
+ }
+ }
+
+ [GLib.Property ("expand_logo")]
+ public bool ExpandLogo {
+ get {
+ GLib.Value val = GetProperty ("expand_logo");
+ bool ret = (bool) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("expand_logo", val);
+ val.Dispose ();
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern long bacon_video_widget_get_stream_length(IntPtr raw);
+
+ [GLib.Property ("stream_length")]
+ public long StreamLength {
+ get {
+ long raw_ret = bacon_video_widget_get_stream_length(Handle);
+ long ret = raw_ret;
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern double bacon_video_widget_get_volume(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_volume(IntPtr raw, double volume);
+
+ [GLib.Property ("volume")]
+ public double Volume {
+ get {
+ double raw_ret = bacon_video_widget_get_volume(Handle);
+ double ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_volume(Handle, value);
+ }
+ }
+
+ [GLib.Property ("showcursor")]
+ public bool Showcursor {
+ get {
+ GLib.Value val = GetProperty ("showcursor");
+ bool ret = (bool) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("showcursor", val);
+ val.Dispose ();
+ }
+ }
+
+ [GLib.Property ("playing")]
+ public bool Playing {
+ get {
+ GLib.Value val = GetProperty ("playing");
+ bool ret = (bool) val;
+ val.Dispose ();
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern double bacon_video_widget_get_position(IntPtr raw);
+
+ [GLib.Property ("position")]
+ public double Position {
+ get {
+ double raw_ret = bacon_video_widget_get_position(Handle);
+ double ret = raw_ret;
+ return ret;
+ }
+ set {
+ this.Seek(value,1);
+ }
+
+ }
+
+ [GLib.Property ("mediadev")]
+ public string Mediadev {
+ get {
+ GLib.Value val = GetProperty ("mediadev");
+ string ret = (string) val;
+ val.Dispose ();
+ return ret;
+ }
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("mediadev", val);
+ val.Dispose ();
+ }
+ }
+
+#pragma warning disable 0169
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void ReadyToSeekVMDelegate (IntPtr bvw);
+
+ static ReadyToSeekVMDelegate ReadyToSeekVMCallback;
+
+ static void readytoseek_cb (IntPtr bvw)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnReadyToSeek ();
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideReadyToSeek (GLib.GType gtype)
+ {
+ if (ReadyToSeekVMCallback == null)
+ ReadyToSeekVMCallback = new ReadyToSeekVMDelegate (readytoseek_cb);
+ OverrideVirtualMethod (gtype, "ready_to_seek", ReadyToSeekVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideReadyToSeek")]
+ protected virtual void OnReadyToSeek ()
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.Value[] vals = new GLib.Value [1];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("ready_to_seek")]
+ public event System.EventHandler ReadyToSeek {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "ready_to_seek");
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "ready_to_seek");
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void StateChangeVMDelegate (IntPtr bvw, bool playing);
+
+ static StateChangeVMDelegate StateChangeVMCallback;
+
+ static void statechange_cb (IntPtr bvw, bool playing)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnStateChange (playing);
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideStateChange (GLib.GType gtype)
+ {
+ if (StateChangeVMCallback == null)
+ StateChangeVMCallback = new StateChangeVMDelegate (statechange_cb);
+ OverrideVirtualMethod (gtype, "state_change", StateChangeVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideStateChange")]
+ protected virtual void OnStateChange (bool playing)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (playing);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("state_change")]
+ public event StateChangeHandler StateChange {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "state_change", typeof (StateChangeArgs));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "state_change", typeof (StateChangeArgs));
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ /*[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void GotRedirectVMDelegate (IntPtr bvw, IntPtr mrl);
+
+ static GotRedirectVMDelegate GotRedirectVMCallback;
+
+ static void gotredirect_cb (IntPtr bvw, IntPtr mrl)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnGotRedirect (GLib.Marshaller.Utf8PtrToString (mrl));
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideGotRedirect (GLib.GType gtype)
+ {
+ if (GotRedirectVMCallback == null)
+ GotRedirectVMCallback = new GotRedirectVMDelegate (gotredirect_cb);
+ OverrideVirtualMethod (gtype, "got-redirect", GotRedirectVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideGotRedirect")]
+ protected virtual void OnGotRedirect (string mrl)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (mrl);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("got-redirect")]
+ public event GotRedirectHandler GotRedirect {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "got-redirect", typeof (LongoMatch.GotRedirectArgs));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "got-redirect", typeof (LongoMatch.GotRedirectArgs));
+ sig.RemoveDelegate (value);
+ }
+ }*/
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void SegmentDoneVMDelegate (IntPtr bvw);
+
+ static SegmentDoneVMDelegate SegmentDoneVMCallback;
+
+ static void segmentdone_cb (IntPtr bvw)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnSegmentDone ();
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideSegmentDone (GLib.GType gtype)
+ {
+ if (SegmentDoneVMCallback == null)
+ SegmentDoneVMCallback = new SegmentDoneVMDelegate (segmentdone_cb);
+ OverrideVirtualMethod (gtype, "segment_done", SegmentDoneVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideSegmentDone")]
+ protected virtual void OnSegmentDone ()
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.Value[] vals = new GLib.Value [1];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("segment_done")]
+ public event System.EventHandler SegmentDone {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "segment_done");
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "segment_done");
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void EosVMDelegate (IntPtr bvw);
+
+ static EosVMDelegate EosVMCallback;
+
+ static void eos_cb (IntPtr bvw)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnEos ();
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideEos (GLib.GType gtype)
+ {
+ if (EosVMCallback == null)
+ EosVMCallback = new EosVMDelegate (eos_cb);
+ OverrideVirtualMethod (gtype, "eos", EosVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideEos")]
+ protected virtual void OnEos ()
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.Value[] vals = new GLib.Value [1];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("eos")]
+ public event System.EventHandler Eos {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void ErrorVMDelegate (IntPtr bvw, IntPtr message);
+
+ static ErrorVMDelegate ErrorVMCallback;
+
+ static void error_cb (IntPtr bvw, IntPtr message)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideError (GLib.GType gtype)
+ {
+ if (ErrorVMCallback == null)
+ ErrorVMCallback = new ErrorVMDelegate (error_cb);
+ OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideError")]
+ protected virtual void OnError (string message)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (message);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("error")]
+ public event ErrorHandler Error {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ /*[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void BufferingVMDelegate (IntPtr bvw, uint progress);
+
+ static BufferingVMDelegate BufferingVMCallback;
+
+ static void buffering_cb (IntPtr bvw, uint progress)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnBuffering (progress);
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideBuffering (GLib.GType gtype)
+ {
+ if (BufferingVMCallback == null)
+ BufferingVMCallback = new BufferingVMDelegate (buffering_cb);
+ OverrideVirtualMethod (gtype, "buffering", BufferingVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideBuffering")]
+ protected virtual void OnBuffering (uint progress)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (progress);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("buffering")]
+ public event LongoMatch.BufferingHandler Buffering {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "buffering", typeof (LongoMatch.BufferingArgs));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "buffering", typeof (LongoMatch.BufferingArgs));
+ sig.RemoveDelegate (value);
+ }
+ }*/
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void ChannelsChangeVMDelegate (IntPtr bvw);
+
+ static ChannelsChangeVMDelegate ChannelsChangeVMCallback;
+
+ static void channelschange_cb (IntPtr bvw)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnChannelsChange ();
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideChannelsChange (GLib.GType gtype)
+ {
+ if (ChannelsChangeVMCallback == null)
+ ChannelsChangeVMCallback = new ChannelsChangeVMDelegate (channelschange_cb);
+ OverrideVirtualMethod (gtype, "channels-change", ChannelsChangeVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideChannelsChange")]
+ protected virtual void OnChannelsChange ()
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.Value[] vals = new GLib.Value [1];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("channels-change")]
+ public event System.EventHandler ChannelsChange {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "channels-change");
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "channels-change");
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void GotMetadataVMDelegate (IntPtr bvw);
+
+ static GotMetadataVMDelegate GotMetadataVMCallback;
+
+ static void gotmetadata_cb (IntPtr bvw)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnGotMetadata ();
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideGotMetadata (GLib.GType gtype)
+ {
+ if (GotMetadataVMCallback == null)
+ GotMetadataVMCallback = new GotMetadataVMDelegate (gotmetadata_cb);
+ OverrideVirtualMethod (gtype, "got-metadata", GotMetadataVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideGotMetadata")]
+ protected virtual void OnGotMetadata ()
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.Value[] vals = new GLib.Value [1];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("got-metadata")]
+ public event System.EventHandler GotMetadata {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "got-metadata");
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "got-metadata");
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void TickVMDelegate (IntPtr bvw, long current_time, long stream_length, float current_position, bool seekable);
+
+ static TickVMDelegate TickVMCallback;
+
+ static void tick_cb (IntPtr bvw, long current_time, long stream_length, float current_position, bool seekable)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnTick (current_time, stream_length, current_position, seekable);
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideTick (GLib.GType gtype)
+ {
+ if (TickVMCallback == null)
+ TickVMCallback = new TickVMDelegate (tick_cb);
+ OverrideVirtualMethod (gtype, "tick", TickVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideTick")]
+ protected virtual void OnTick (long current_time, long stream_length, float current_position, bool seekable)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (5);
+ GLib.Value[] vals = new GLib.Value [5];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (current_time);
+ inst_and_params.Append (vals [1]);
+ vals [2] = new GLib.Value (stream_length);
+ inst_and_params.Append (vals [2]);
+ vals [3] = new GLib.Value (current_position);
+ inst_and_params.Append (vals [3]);
+ vals [4] = new GLib.Value (seekable);
+ inst_and_params.Append (vals [4]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("tick")]
+ public event TickHandler Tick {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "tick", typeof (TickArgs));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "tick", typeof (TickArgs));
+ sig.RemoveDelegate (value);
+ }
+ }
+
+ /*[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void TitleChangeVMDelegate (IntPtr bvw, IntPtr title);
+
+ static TitleChangeVMDelegate TitleChangeVMCallback;
+
+ static void titlechange_cb (IntPtr bvw, IntPtr title)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnTitleChange (GLib.Marshaller.Utf8PtrToString (title));
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideTitleChange (GLib.GType gtype)
+ {
+ if (TitleChangeVMCallback == null)
+ TitleChangeVMCallback = new TitleChangeVMDelegate (titlechange_cb);
+ OverrideVirtualMethod (gtype, "title-change", TitleChangeVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideTitleChange")]
+ protected virtual void OnTitleChange (string title)
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+ GLib.Value[] vals = new GLib.Value [2];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ vals [1] = new GLib.Value (title);
+ inst_and_params.Append (vals [1]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("title-change")]
+ public event TitleChangeHandler TitleChange {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "title-change", typeof (LongoMatch.TitleChangeArgs));
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "title-change", typeof (LongoMatch.TitleChangeArgs));
+ sig.RemoveDelegate (value);
+ }
+ }*/
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void GotDurationVMDelegate (IntPtr bvw);
+
+ static GotDurationVMDelegate GotDurationVMCallback;
+
+ static void gotduration_cb (IntPtr bvw)
+ {
+ try {
+ GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
+ bvw_managed.OnGotDuration ();
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ private static void OverrideGotDuration (GLib.GType gtype)
+ {
+ if (GotDurationVMCallback == null)
+ GotDurationVMCallback = new GotDurationVMDelegate (gotduration_cb);
+ OverrideVirtualMethod (gtype, "got_duration", GotDurationVMCallback);
+ }
+
+ [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), ConnectionMethod="OverrideGotDuration")]
+ protected virtual void OnGotDuration ()
+ {
+ GLib.Value ret = GLib.Value.Empty;
+ GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+ GLib.Value[] vals = new GLib.Value [1];
+ vals [0] = new GLib.Value (this);
+ inst_and_params.Append (vals [0]);
+ g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+ foreach (GLib.Value v in vals)
+ v.Dispose ();
+ }
+
+ [GLib.Signal("got_duration")]
+ public event System.EventHandler GotDuration {
+ add {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "got_duration");
+ sig.AddDelegate (value);
+ }
+ remove {
+ GLib.Signal sig = GLib.Signal.Lookup (this, "got_duration");
+ sig.RemoveDelegate (value);
+ }
+ }
+#pragma warning restore 0169
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr bacon_video_widget_get_backend_name(IntPtr raw);
+
+ public string BackendName {
+ get {
+ IntPtr raw_ret = bacon_video_widget_get_backend_name(Handle);
+ string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_set_rate(IntPtr raw, float rate);
+
+ public bool SetRate(float rate) {
+ bool raw_ret = bacon_video_widget_set_rate(Handle, rate);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_is_playing(IntPtr raw);
+
+ public bool IsPlaying {
+ get {
+ bool raw_ret = bacon_video_widget_is_playing(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_get_auto_resize(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_auto_resize(IntPtr raw, bool auto_resize);
+
+ public bool AutoResize {
+ get {
+ bool raw_ret = bacon_video_widget_get_auto_resize(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_auto_resize(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_seek(IntPtr raw, double position, float rate);
+
+ public bool Seek(double position, float rate) {
+ bool raw_ret = bacon_video_widget_seek(Handle, position, rate);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_get_show_cursor(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_show_cursor(IntPtr raw, bool show_cursor);
+
+ public bool ShowCursor {
+ get {
+ bool raw_ret = bacon_video_widget_get_show_cursor(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_show_cursor(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_init_backend(out int argc, IntPtr argv);
+
+ public static int InitBackend(string argv) {
+ int argc;
+ bacon_video_widget_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
+ return argc;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_pause(IntPtr raw);
+
+ public void Pause() {
+ bacon_video_widget_pause(Handle);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern double bacon_video_widget_get_zoom(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_zoom(IntPtr raw, double zoom);
+
+ public double Zoom {
+ get {
+ double raw_ret = bacon_video_widget_get_zoom(Handle);
+ double ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_zoom(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_seek_in_segment(IntPtr raw, long pos, float rate);
+
+ public bool SeekInSegment(long pos, float rate) {
+ bool raw_ret = bacon_video_widget_seek_in_segment(Handle, pos, rate);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_segment_seek(IntPtr raw, long start, long stop, float rate);
+
+ public bool SegmentSeek(long start, long stop, float rate) {
+ bool raw_ret = bacon_video_widget_segment_seek(Handle, start, stop, rate);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_stop(IntPtr raw);
+
+ public void Stop() {
+ bacon_video_widget_stop(Handle);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_has_next_track(IntPtr raw);
+
+ public bool HasNextTrack {
+ get {
+ bool raw_ret = bacon_video_widget_has_next_track(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_subtitle_font(IntPtr raw, IntPtr font);
+
+ public string SubtitleFont {
+ set {
+ IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
+ bacon_video_widget_set_subtitle_font(Handle, native_value);
+ GLib.Marshaller.Free (native_value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_set_visuals(IntPtr raw, IntPtr name);
+
+ public bool SetVisuals(string name) {
+ IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
+ bool raw_ret = bacon_video_widget_set_visuals(Handle, native_name);
+ bool ret = raw_ret;
+ GLib.Marshaller.Free (native_name);
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern long bacon_video_widget_get_accurate_current_time(IntPtr raw);
+
+ public long AccurateCurrentTime {
+ get {
+ long raw_ret = bacon_video_widget_get_accurate_current_time(Handle);
+ long ret = raw_ret;
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern int bacon_video_widget_get_video_property(IntPtr raw, int type);
+
+ public int GetVideoProperty(VideoProperty type) {
+ int raw_ret = bacon_video_widget_get_video_property(Handle, (int) type);
+ int ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern int bacon_video_widget_get_language(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_language(IntPtr raw, int language);
+
+ public int Language {
+ get {
+ int raw_ret = bacon_video_widget_get_language(Handle);
+ int ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_language(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_seek_time(IntPtr raw, long time, float rate, bool accurate);
+
+ public bool SeekTime(long time, float rate, bool accurate) {
+ bool raw_ret = bacon_video_widget_seek_time(Handle, time, rate, accurate);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_is_seekable(IntPtr raw);
+
+ public bool IsSeekable {
+ get {
+ bool raw_ret = bacon_video_widget_is_seekable(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern unsafe bool bacon_video_widget_can_get_frames(IntPtr raw, out IntPtr error);
+
+ public unsafe bool CanGetFrames() {
+ IntPtr error = IntPtr.Zero;
+ bool raw_ret = bacon_video_widget_can_get_frames(Handle, out error);
+ bool ret = raw_ret;
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern long bacon_video_widget_get_current_time(IntPtr raw);
+
+ public long CurrentTime {
+ get {
+ long raw_ret = bacon_video_widget_get_current_time(Handle);
+ long ret = raw_ret;
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_seek_to_previous_frame(IntPtr raw, float rate, bool in_segment);
+
+ public bool SeekToPreviousFrame(float rate, bool in_segment) {
+ bool raw_ret = bacon_video_widget_seek_to_previous_frame(Handle, rate, in_segment);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr bacon_video_widget_get_type();
+
+ public static new GLib.GType GType {
+ get {
+ IntPtr raw_ret = bacon_video_widget_get_type();
+ GLib.GType ret = new GLib.GType(raw_ret);
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr bacon_video_widget_get_languages(IntPtr raw);
+
+ public GLib.List Languages {
+ get {
+ IntPtr raw_ret = bacon_video_widget_get_languages(Handle);
+ GLib.List ret = new GLib.List(raw_ret);
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_fullscreen(IntPtr raw, bool fullscreen);
+
+ public bool Fullscreen {
+ set {
+ bacon_video_widget_set_fullscreen(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_set_audio_out_type(IntPtr raw, int type);
+
+ public bool SetAudioOutType(AudioOutType type) {
+ bool raw_ret = bacon_video_widget_set_audio_out_type(Handle, (int) type);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_has_previous_track(IntPtr raw);
+
+ public bool HasPreviousTrack {
+ get {
+ bool raw_ret = bacon_video_widget_has_previous_track(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_logo_pixbuf(IntPtr raw, IntPtr logo);
+
+ public Gdk.Pixbuf LogoPixbuf {
+ set {
+ bacon_video_widget_set_logo_pixbuf(Handle, value == null ? IntPtr.Zero : value.Handle);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_drawing_pixbuf(IntPtr raw, IntPtr drawing_mode);
+
+ public Gdk.Pixbuf DrawingPixbuf {
+ set {
+ bacon_video_widget_set_drawing_pixbuf(Handle, value == null ? IntPtr.Zero : value.Handle);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_drawing_mode(IntPtr raw, bool drawing_mode);
+
+ public bool DrawingMode {
+ set {
+ bacon_video_widget_set_drawing_mode(Handle, value);
+ }
+ }
+
+ /*[DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_visuals_quality(IntPtr raw, int quality);
+
+ public GstVisualsQuality VisualsQuality {
+ set {
+ bacon_video_widget_set_visuals_quality(Handle, (int) value);
+ }
+ }*/
+
+ [DllImport("libcesarplayer.dll")]
+ static extern int bacon_video_widget_get_connection_speed(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_connection_speed(IntPtr raw, int speed);
+
+ public int ConnectionSpeed {
+ get {
+ int raw_ret = bacon_video_widget_get_connection_speed(Handle);
+ int ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_connection_speed(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr bacon_video_widget_get_subtitles(IntPtr raw);
+
+ public GLib.List Subtitles {
+ get {
+ IntPtr raw_ret = bacon_video_widget_get_subtitles(Handle);
+ GLib.List ret = new GLib.List(raw_ret);
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr bacon_video_widget_get_current_frame(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr bacon_video_widget_unref_pixbuf(IntPtr raw);
+
+
+ public Gdk.Pixbuf GetCurrentFrame(int outwidth, int outheight) {
+ IntPtr raw_ret = bacon_video_widget_get_current_frame(Handle);
+ Gdk.Pixbuf unmanaged = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
+ if (unmanaged == null)
+ return null;
+ Gdk.Pixbuf managed;
+ int h = unmanaged.Height;
+ int w = unmanaged.Width;
+ double rate = (double)w/(double)h;
+ if (outwidth == -1 || outheight == -1){
+ outwidth = w;
+ outheight = h;
+ }else if (h>w){
+ outwidth = (int)(outheight*rate);
+ }else{
+ outheight = (int)(outwidth/rate);
+ }
+ managed = unmanaged.ScaleSimple(outwidth,outheight,Gdk.InterpType.Bilinear);
+ unmanaged.Dispose();
+ bacon_video_widget_unref_pixbuf(raw_ret);
+ return managed;
+ }
+
+ public Gdk.Pixbuf GetCurrentFrame() {
+ return GetCurrentFrame(-1,-1);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern IntPtr bacon_video_widget_get_visuals_list(IntPtr raw);
+
+ public GLib.List VisualsList {
+ get {
+ IntPtr raw_ret = bacon_video_widget_get_visuals_list(Handle);
+ GLib.List ret = new GLib.List(raw_ret);
+ return ret;
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_segment_stop_update(IntPtr raw, long stop, float rate);
+
+ public bool SegmentStopUpdate(long stop, float rate) {
+ bool raw_ret = bacon_video_widget_segment_stop_update(Handle, stop, rate);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_subtitle_encoding(IntPtr raw, IntPtr encoding);
+
+ public string SubtitleEncoding {
+ set {
+ IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
+ bacon_video_widget_set_subtitle_encoding(Handle, native_value);
+ GLib.Marshaller.Free (native_value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_aspect_ratio(IntPtr raw, int ratio);
+
+ public AspectRatio AspectRatio {
+ set {
+ bacon_video_widget_set_aspect_ratio(Handle, (int) value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_video_property(IntPtr raw, int type, int value);
+
+ public void SetVideoProperty(VideoProperty type, int value) {
+ bacon_video_widget_set_video_property(Handle, (int) type, value);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_get_deinterlacing(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_deinterlacing(IntPtr raw, bool deinterlace);
+
+ public bool Deinterlacing {
+ get {
+ bool raw_ret = bacon_video_widget_get_deinterlacing(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_deinterlacing(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_set_rate_in_segment(IntPtr raw, float rate, long stop);
+
+ public bool SetRateInSegment(float rate, long stop) {
+ bool raw_ret = bacon_video_widget_set_rate_in_segment(Handle, rate, stop);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_get_metadata(IntPtr raw, int type, IntPtr val);
+
+ public object GetMetadata(MetadataType type) {
+ GLib.Value val = new GLib.Value();
+ IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (val);
+ bacon_video_widget_get_metadata(Handle, (int) type, native_value);
+ val = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
+ Marshal.FreeHGlobal (native_value);
+ return val.Val;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_can_set_volume(IntPtr raw);
+
+ public bool CanSetVolume() {
+ bool raw_ret = bacon_video_widget_can_set_volume(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_can_direct_seek(IntPtr raw);
+
+ public bool CanDirectSeek() {
+ bool raw_ret = bacon_video_widget_can_direct_seek(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_close(IntPtr raw);
+
+ public void Close() {
+ bacon_video_widget_close(Handle);
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_play(IntPtr raw);
+
+ public bool Play() {
+ bool raw_ret = bacon_video_widget_play(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern int bacon_video_widget_get_subtitle(IntPtr raw);
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_subtitle(IntPtr raw, int subtitle);
+
+ public int Subtitle {
+ get {
+ int raw_ret = bacon_video_widget_get_subtitle(Handle);
+ int ret = raw_ret;
+ return ret;
+ }
+ set {
+ bacon_video_widget_set_subtitle(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern int bacon_video_widget_error_quark();
+
+ public static int ErrorQuark() {
+ int raw_ret = bacon_video_widget_error_quark();
+ int ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern unsafe bool bacon_video_widget_open(IntPtr raw, IntPtr mrl, IntPtr subtitle_uri, out IntPtr error);
+
+ public unsafe bool Open(string mrl, string subtitle_uri) {
+ IntPtr native_mrl = GLib.Marshaller.StringToPtrGStrdup (mrl);
+ IntPtr native_subtitle_uri = GLib.Marshaller.StringToPtrGStrdup (subtitle_uri);
+ IntPtr error = IntPtr.Zero;
+ bool raw_ret = bacon_video_widget_open(Handle, native_mrl, native_subtitle_uri, out error);
+ bool ret = raw_ret;
+ GLib.Marshaller.Free (native_mrl);
+ GLib.Marshaller.Free (native_subtitle_uri);
+ if (error != IntPtr.Zero) throw new GLib.GException (error);
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_new_file_seek(IntPtr raw, long start,long stop,float rate);
+
+ public bool NewFileSeek(long start, long stop,float rate) {
+ bool raw_ret = bacon_video_widget_new_file_seek(Handle,start,stop,rate);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_segment_start_update(IntPtr raw, long start, float rate);
+
+ public bool SegmentStartUpdate(long start, float rate) {
+ bool raw_ret = bacon_video_widget_segment_start_update(Handle, start, rate);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_can_deinterlace(IntPtr raw);
+
+ public bool CanDeinterlace() {
+ bool raw_ret = bacon_video_widget_can_deinterlace(Handle);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_show_visuals(IntPtr raw, bool show_visuals);
+
+ public bool ShowVisuals {
+ set {
+ bacon_video_widget_set_show_visuals(Handle, value);
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_logo(IntPtr raw, IntPtr filename);
+
+ public string Logo {
+ set {
+ bacon_video_widget_set_logo(Handle, GLib.Marshaller.StringToPtrGStrdup(value));
+ }
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern bool bacon_video_widget_seek_to_next_frame(IntPtr raw, float rate, bool in_segment);
+
+ public bool SeekToNextFrame(float rate, bool in_segment) {
+ bool raw_ret = bacon_video_widget_seek_to_next_frame(Handle, rate, in_segment);
+ bool ret = raw_ret;
+ return ret;
+ }
+
+ [DllImport("libcesarplayer.dll")]
+ static extern void bacon_video_widget_set_scale_ratio(IntPtr raw, float ratio);
+
+ public float ScaleRatio {
+ set {
+ bacon_video_widget_set_scale_ratio(Handle, value);
+ }
+ }
+
+ static GstPlayer ()
+ {
+ LongoMatch.GtkSharp.Video.ObjectManager.Initialize ();
+ }
+#endregion
+
+ public bool SeekTime(long time, bool accurate) {
+ return SeekTime(time,1,accurate);
+ }
+
+
+ public void TogglePlay(){
+ if(!this.Playing){
+ this.Play();
+ }
+ else{
+ this.Pause();
+ }
+ }
+
+ public bool Open(string mrl){
+ return Open(mrl, null);
+ }
+
+ public void CancelProgramedStop(){
+ this.SegmentSeek(this.CurrentTime,this.StreamLength,1);
+ }
+
+ }
+}
diff --git a/CesarPlayer/Player/IPlayer.cs b/CesarPlayer/Player/IPlayer.cs
new file mode 100644
index 0000000..0f18b51
--- /dev/null
+++ b/CesarPlayer/Player/IPlayer.cs
@@ -0,0 +1,146 @@
+// IPlayer.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gtk;
+using Gdk;
+using LongoMatch.Video.Common;
+
+
+namespace LongoMatch.Video.Player
+
+{
+ public interface IPlayer
+ {
+
+
+ // Events
+
+
+ event ErrorHandler Error;
+ event System.EventHandler Eos;
+ event StateChangeHandler StateChange;
+ event TickHandler Tick;
+ event System.EventHandler GotDuration;
+ event System.EventHandler SegmentDone;
+ event System.EventHandler ReadyToSeek;
+
+
+ long StreamLength{
+ get;
+ }
+
+
+
+ long CurrentTime{
+ get;
+
+ }
+
+ double Position{
+ get;
+ set;
+
+ }
+
+ bool LogoMode {
+ get;
+ set;
+ }
+
+ bool DrawingMode {
+ set;
+ }
+
+ Pixbuf DrawingPixbuf {
+ set;
+ }
+
+ bool ExpandLogo{
+ get;
+ set;
+ }
+
+ double Volume{
+ get;
+ set;
+ }
+
+ bool Playing {
+ get;
+ }
+
+ string Logo {
+ set;
+ }
+
+ Pixbuf LogoPixbuf{
+ set;
+ }
+
+ long AccurateCurrentTime{
+ get;
+ }
+
+ bool SeekTime(long time,float rate, bool accurate);
+
+ bool Play();
+
+ bool Open(string mrl);
+
+ bool SetRate(float rate);
+
+ bool SetRateInSegment(float rate, long stopTime);
+
+
+
+ void TogglePlay();
+
+ void Pause();
+
+ void Stop();
+
+ void Close();
+
+
+ void Dispose();
+
+ bool SegmentSeek(long start, long stop,float rate);
+
+ bool SeekInSegment(long pos,float rate);
+
+ bool NewFileSeek(long start, long stop,float rate);
+
+ bool SegmentStartUpdate(long start,float rate);
+
+ bool SegmentStopUpdate(long stop,float rate);
+
+ bool SeekToNextFrame(float rate,bool in_segment);
+
+ bool SeekToPreviousFrame(float rate,bool in_segment);
+
+ Pixbuf GetCurrentFrame(int outwidth, int outheight);
+
+ Pixbuf GetCurrentFrame();
+
+ void CancelProgramedStop();
+
+ }
+}
diff --git a/CesarPlayer/Player/ObjectManager.cs b/CesarPlayer/Player/ObjectManager.cs
new file mode 100644
index 0000000..6fdbdcc
--- /dev/null
+++ b/CesarPlayer/Player/ObjectManager.cs
@@ -0,0 +1,38 @@
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+
+namespace LongoMatch.GtkSharp.Video {
+
+ public class ObjectManager {
+
+ static bool initialized = false;
+ // Call this method from the appropriate module init function.
+ public static void Initialize ()
+ {
+ if (initialized)
+ return;
+
+ initialized = true;
+
+ GLib.GType.Register (LongoMatch.Video.Player.GstPlayer.GType, typeof (LongoMatch.Video.Player.GstPlayer));
+
+ }
+ }
+}
diff --git a/CesarPlayer/Utils/Device.cs b/CesarPlayer/Utils/Device.cs
new file mode 100644
index 0000000..c0fde57
--- /dev/null
+++ b/CesarPlayer/Utils/Device.cs
@@ -0,0 +1,90 @@
+//
+// Copyright (C) 2010 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using System.Collections.Generic;
+using LongoMatch.Video.Capturer;
+using LongoMatch.Video.Common;
+using Mono.Unix;
+
+namespace LongoMatch.Video.Utils
+{
+
+
+ public class Device
+ {
+ public Device () {
+
+ }
+
+ /// <summary>
+ /// Device Type among Video, Audio or DV (for dv cameras)
+ /// </summary>
+ public DeviceType DeviceType {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Device id, can be a human friendly name (for DirectShow devices),
+ /// the de device name (/dev/video0) or the GUID (dv1394src)
+ /// </summary>
+ public string ID {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// The name of the gstreamer element property used to set the device
+ /// </summary>
+
+ public string IDProperty {
+ get;
+ set;
+ }
+
+ static public List<Device> ListVideoDevices (){
+ List<Device> devicesList = new List<Device>();
+
+ /* Generate the list of devices and add the gconf one at the bottom
+ * so that DV sources are always selected before, at least on Linux,
+ * since on Windows both raw an dv sources are listed from the same
+ * source element (dshowvideosrc) */
+ foreach (string devName in GstCameraCapturer.VideoDevices){
+ string idProp;
+
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ idProp = Constants.DV1394SRC_PROP;
+ else
+ idProp = Constants.DSHOWVIDEOSINK_PROP;
+
+ devicesList.Add(new Device {
+ ID = devName,
+ IDProperty = idProp,
+ DeviceType = DeviceType.DV});
+ }
+ if (Environment.OSVersion.Platform == PlatformID.Unix){
+ devicesList.Add(new Device {
+ ID = Catalog.GetString("Default device"),
+ IDProperty = "",
+ DeviceType = DeviceType.Video});
+ }
+ return devicesList;
+ }
+ }
+}
diff --git a/CesarPlayer/Utils/FramesCapturer.cs b/CesarPlayer/Utils/FramesCapturer.cs
new file mode 100644
index 0000000..189bed3
--- /dev/null
+++ b/CesarPlayer/Utils/FramesCapturer.cs
@@ -0,0 +1,111 @@
+// FramesCapturer.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using LongoMatch.Video.Utils;
+using LongoMatch.Video;
+using Gdk;
+using Gtk;
+using System.Threading;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Video.Utils
+{
+
+
+ public class FramesSeriesCapturer
+ {
+ IFramesCapturer capturer;
+ long start;
+ long stop;
+ uint interval;
+ int totalFrames;
+ string seriesName;
+ string outputDir;
+ bool cancel;
+ private const int THUMBNAIL_MAX_HEIGHT=250;
+ private const int THUMBNAIL_MAX_WIDTH=300;
+
+ public event FramesProgressHandler Progress;
+
+ public FramesSeriesCapturer(string videoFile,long start, long stop, uint interval, string outputDir)
+ {
+ MultimediaFactory mf= new MultimediaFactory();
+ this.capturer=mf.getFramesCapturer();
+ this.capturer.Open(videoFile);
+ this.start= start;
+ this.stop = stop;
+ this.interval = interval;
+ this.outputDir = outputDir;
+ this.seriesName = System.IO.Path.GetFileName(outputDir);
+ this.totalFrames = (int)Math.Floor((double)((stop - start ) / interval))+1;
+ }
+
+ public void Cancel(){
+ cancel = true;
+ }
+
+ public void Start(){
+ Thread thread = new Thread(new ThreadStart(CaptureFrames));
+ thread.Start();
+ }
+
+ public void CaptureFrames(){
+ long pos;
+ Pixbuf frame;
+ Pixbuf scaledFrame=null;
+ int i = 0;
+
+ System.IO.Directory.CreateDirectory(outputDir);
+
+ pos = start;
+ if (Progress != null)
+ Application.Invoke(delegate {Progress(0,totalFrames,null);});
+ while (pos <= stop){
+ if (!cancel){
+ capturer.SeekTime(pos,true);
+ capturer.Pause();
+ frame = capturer.GetCurrentFrame();
+ if (frame != null) {
+ frame.Save(System.IO.Path.Combine(outputDir,seriesName+"_" + i +".png"),"png");
+ int h = frame.Height;
+ int w = frame.Width;
+ double rate = (double)w/(double)h;
+ if (h>w)
+ scaledFrame = frame.ScaleSimple((int)(THUMBNAIL_MAX_HEIGHT*rate),THUMBNAIL_MAX_HEIGHT,InterpType.Bilinear);
+ else
+ scaledFrame = frame.ScaleSimple(THUMBNAIL_MAX_WIDTH,(int)(THUMBNAIL_MAX_WIDTH/rate),InterpType.Bilinear);
+ frame.Dispose();
+ }
+
+ if (Progress != null)
+ Application.Invoke(delegate {Progress(i+1,totalFrames,scaledFrame);});
+ pos += interval;
+ i++;
+ }
+ else {
+ System.IO.Directory.Delete(outputDir,true);
+ cancel=false;
+ break;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CesarPlayer/Utils/IFramesCapturer.cs b/CesarPlayer/Utils/IFramesCapturer.cs
new file mode 100644
index 0000000..38ac0f3
--- /dev/null
+++ b/CesarPlayer/Utils/IFramesCapturer.cs
@@ -0,0 +1,38 @@
+// IFramesCapturer.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gdk;
+
+namespace LongoMatch.Video.Utils
+{
+
+
+ public interface IFramesCapturer
+ {
+ bool Open(string mrl);
+ bool SeekTime(long time, bool accurate);
+ void Pause();
+ void Dispose();
+ Pixbuf GetCurrentFrame(int outwidth, int outheight);
+ Pixbuf GetCurrentFrame();
+
+ }
+}
diff --git a/CesarPlayer/Utils/IMetadataReader.cs b/CesarPlayer/Utils/IMetadataReader.cs
new file mode 100644
index 0000000..c6126b2
--- /dev/null
+++ b/CesarPlayer/Utils/IMetadataReader.cs
@@ -0,0 +1,37 @@
+// IMetadataReader.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using LongoMatch.Video.Player;
+using LongoMatch.Video.Common;
+
+
+namespace LongoMatch.Video.Utils
+{
+
+
+ public interface IMetadataReader
+ {
+ bool Open(string mrl);
+ void Close();
+ void Dispose();
+ object GetMetadata(MetadataType type);
+ }
+}
diff --git a/CesarPlayer/Utils/MediaFile.cs b/CesarPlayer/Utils/MediaFile.cs
new file mode 100644
index 0000000..f5d03f2
--- /dev/null
+++ b/CesarPlayer/Utils/MediaFile.cs
@@ -0,0 +1,170 @@
+// MediaFile.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Mono.Unix;
+using Gdk;
+using LongoMatch.Video;
+using LongoMatch.Video.Player;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Video.Utils
+{
+
+ [Serializable]
+
+ public class MediaFile
+ {
+
+ string filePath;
+ long length; // In MSeconds
+ ushort fps;
+ bool hasAudio;
+ bool hasVideo;
+ string videoCodec;
+ string audioCodec;
+ uint videoHeight;
+ uint videoWidth;
+
+
+ public MediaFile(){}
+
+ public MediaFile(string filePath,
+ long length,
+ ushort fps,
+ bool hasAudio,
+ bool hasVideo,
+ string videoCodec,
+ string audioCodec,
+ uint videoWidth,
+ uint videoHeight)
+ {
+ this.filePath = filePath;
+ this.length = length;
+ this.hasAudio = hasAudio;
+ this.hasVideo = hasVideo;
+ this.videoCodec = videoCodec;
+ this.audioCodec = audioCodec;
+ this.videoHeight = videoHeight;
+ this.videoWidth = videoWidth;
+ if (fps == 0)
+ //For audio Files
+ this.fps=25;
+ else
+ this.fps = fps;
+
+ }
+
+ public string FilePath{
+ get {return this.filePath;}
+ set {this.filePath = value;}
+ }
+
+ public long Length{
+ get {return this.length;}
+ set {this.length = value;}
+ }
+
+ public bool HasVideo{
+ get { return this.hasVideo;}
+ set{this.hasVideo = value;}
+ }
+
+ public bool HasAudio{
+ get { return this.hasAudio;}
+ set{this.hasAudio = value;}
+ }
+
+ public string VideoCodec{
+ get {return this.videoCodec;}
+ set {this.videoCodec = value;}
+ }
+
+ public string AudioCodec{
+ get {return this.audioCodec;}
+ set {this.audioCodec = value;}
+ }
+
+ public uint VideoWidth{
+ get {return this.videoWidth;}
+ set {this.videoWidth= value;}
+ }
+
+ public uint VideoHeight{
+ get {return this.videoHeight;}
+ set {this.videoHeight= value;}
+ }
+
+ public ushort Fps{
+ get {return this.fps;}
+ set {
+ if (value == 0)
+ //For audio Files
+ this.fps=25;
+ else
+ this.fps = value;}
+ }
+
+ public uint GetFrames(){
+ return (uint) (Fps*Length/1000);
+ }
+
+
+
+ public static MediaFile GetMediaFile(string filePath){
+ int duration, fps=0, height=0, width=0;
+ bool hasVideo, hasAudio;
+ string audioCodec = "", videoCodec = "";
+ MultimediaFactory factory;
+ IMetadataReader reader = null;
+
+ try{
+ factory = new MultimediaFactory();
+ reader = factory.getMetadataReader();
+ reader.Open(filePath);
+ duration = (int)reader.GetMetadata(MetadataType.Duration);
+ hasVideo = (bool) reader.GetMetadata(MetadataType.HasVideo);
+ hasAudio = (bool) reader.GetMetadata(MetadataType.HasAudio);
+ if (hasAudio)
+ audioCodec = (string) reader.GetMetadata(MetadataType.AudioEncoderType);
+ if (hasVideo){
+ videoCodec = (string) reader.GetMetadata(MetadataType.VideoEncoderType);
+ fps = (int) reader.GetMetadata(MetadataType.Fps);
+ }
+ height = (int) reader.GetMetadata(MetadataType.DimensionX);
+ width = (int) reader.GetMetadata (MetadataType.DimensionY);
+
+ return new MediaFile(filePath,duration*1000,(ushort)fps,
+ hasAudio,hasVideo,videoCodec,audioCodec,
+ (uint)height,(uint)width);
+
+ }
+ catch (GLib.GException ex){
+ throw new Exception (Catalog.GetString("Invalid video file:")+"\n"+ex.Message);
+ }
+ finally {
+ reader.Close();
+ reader.Dispose();
+ }
+ }
+
+
+ }
+}
diff --git a/CesarPlayer/Utils/PreviewMediaFile.cs b/CesarPlayer/Utils/PreviewMediaFile.cs
new file mode 100644
index 0000000..0fd512d
--- /dev/null
+++ b/CesarPlayer/Utils/PreviewMediaFile.cs
@@ -0,0 +1,120 @@
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using LongoMatch.Video;
+using LongoMatch.Video.Common;
+using LongoMatch.Video.Player;
+using Mono.Unix;
+using Gdk;
+
+namespace LongoMatch.Video.Utils
+{
+
+ [Serializable]
+ public class PreviewMediaFile:MediaFile
+ {
+
+ private byte[] thumbnailBuf;
+
+ const int THUMBNAIL_MAX_HEIGHT=72;
+ const int THUMBNAIL_MAX_WIDTH=96;
+
+ public PreviewMediaFile(){}
+
+ public PreviewMediaFile(string filePath,
+ long length,
+ ushort fps,
+ bool hasAudio,
+ bool hasVideo,
+ string VideoEncoderType,
+ string AudioEncoderType,
+ uint videoWidth,
+ uint videoHeight,
+ Pixbuf preview):base (filePath,length,fps,hasAudio,hasVideo,VideoEncoderType,AudioEncoderType,videoWidth,videoHeight)
+ {
+ this.Preview=preview;
+ }
+
+ public Pixbuf Preview{
+ get{
+ if (thumbnailBuf != null)
+ return new Pixbuf(thumbnailBuf);
+ else return null;
+ }
+ set{
+ if (value != null){
+ thumbnailBuf = value.SaveToBuffer("png");
+ value.Dispose();
+ }
+ else thumbnailBuf = null;
+ }
+ }
+
+ public new static PreviewMediaFile GetMediaFile(string filePath){
+ int duration=0;
+ bool hasVideo;
+ bool hasAudio;
+ string AudioEncoderType = "";
+ string VideoEncoderType = "";
+ int fps=0;
+ int height=0;
+ int width=0;
+ Pixbuf preview=null;
+ MultimediaFactory factory;
+ IMetadataReader reader;
+ IFramesCapturer thumbnailer;
+
+ try{
+ factory = new MultimediaFactory();
+ reader = factory.getMetadataReader();
+ reader.Open(filePath);
+ hasVideo = (bool) reader.GetMetadata(MetadataType.HasVideo);
+ hasAudio = (bool) reader.GetMetadata(MetadataType.HasAudio);
+ if (hasAudio){
+ AudioEncoderType = (string) reader.GetMetadata(MetadataType.AudioEncoderType);
+ }
+ if (hasVideo){
+ VideoEncoderType = (string) reader.GetMetadata(MetadataType.VideoEncoderType);
+ fps = (int) reader.GetMetadata(MetadataType.Fps);
+ thumbnailer = factory.getFramesCapturer();
+ thumbnailer.Open(filePath);
+ thumbnailer.SeekTime(1000,false);
+ preview = thumbnailer.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
+ duration =(int) ((thumbnailer as GstPlayer).StreamLength/1000); /* On Windows some formats report a 0 duration, try a last time with the reader */
+ if (duration == 0)
+ duration = (int)reader.GetMetadata(MetadataType.Duration);
+ thumbnailer.Dispose();
+ }
+ height = (int) reader.GetMetadata(MetadataType.DimensionX);
+ width = (int) reader.GetMetadata (MetadataType.DimensionY);
+ reader.Close();
+ reader.Dispose();
+
+ return new PreviewMediaFile(filePath,duration*1000,
+ (ushort)fps,hasAudio,
+ hasVideo,VideoEncoderType,
+ AudioEncoderType,(uint)height,
+ (uint)width,preview);
+ }
+ catch (GLib.GException ex){
+ throw new Exception (Catalog.GetString("Invalid video file:")+"\n"+ex.Message);
+ }
+ }
+ }
+}
diff --git a/CesarPlayer/Utils/TimeString.cs b/CesarPlayer/Utils/TimeString.cs
new file mode 100644
index 0000000..e264a0f
--- /dev/null
+++ b/CesarPlayer/Utils/TimeString.cs
@@ -0,0 +1,83 @@
+// TimeString.cs
+//
+// Copyright (C) 2007-2009 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+
+namespace LongoMatch.Video.Utils
+{
+
+
+ public class TimeString
+ {
+
+ public TimeString()
+ {
+ }
+
+ public static string SecondsToString (long time)
+ {
+ long _h, _m, _s;
+
+ _h = (time / 3600);
+ _m = ((time % 3600) / 60);
+ _s = ((time % 3600) % 60);
+
+ if (_h > 0)
+ return String.Format ("{0}:{1}:{2}", _h, _m.ToString ("d2"),
+ _s.ToString ("d2"));
+
+ return String.Format ("{0}:{1}", _m, _s.ToString ("d2"));
+ }
+ public static string MSecondsToMSecondsString (long time)
+ {
+ long _h, _m, _s,_ms,_time;
+ _time = time / 1000;
+ _h = (_time / 3600);
+ _m = ((_time % 3600) / 60);
+ _s = ((_time % 3600) % 60);
+ _ms = ((time % 3600000)%60000)%1000;
+
+ if (_h > 0)
+ return String.Format ("{0}:{1}:{2},{3}", _h, _m.ToString ("d2"),
+ _s.ToString ("d2"),_ms.ToString("d3"));
+
+ return String.Format ("{0}:{1},{2}", _m, _s.ToString ("d2"),_ms.ToString("d3"));
+ }
+ public static string MSecondsToSecondsString (long time)
+ {
+ long _h, _m, _s,_time;
+ _time = time / 1000;
+ _h = (_time / 3600);
+ _m = ((_time % 3600) / 60);
+ _s = ((_time % 3600) % 60);
+
+ if (_h > 0)
+ return String.Format ("{0}:{1}:{2}", _h, _m.ToString ("d2"),
+ _s.ToString ("d2"));
+
+ return String.Format ("{0}:{1}", _m, _s.ToString ("d2"));
+ }
+ public static string FileName( string filename){
+ return System.IO.Path.GetFileName(filename);
+ }
+
+
+ }
+}
diff --git a/CesarPlayer/cesarplayer.key b/CesarPlayer/cesarplayer.key
new file mode 100644
index 0000000..6671438
Binary files /dev/null and b/CesarPlayer/cesarplayer.key differ
diff --git a/CesarPlayer/cesarplayer.pc.in b/CesarPlayer/cesarplayer.pc.in
new file mode 100644
index 0000000..918f35c
--- /dev/null
+++ b/CesarPlayer/cesarplayer.pc.in
@@ -0,0 +1,6 @@
+Name: CesarPlayer
+Description: CesarPlayer
+Version: 0.1
+
+Requires:
+Libs: -r:@expanded_libdir@/@PACKAGE@/CesarPlayer.dll
diff --git a/CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs b/CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs
new file mode 100644
index 0000000..9c4498a
--- /dev/null
+++ b/CesarPlayer/gtk-gui/LongoMatch.Gui.CapturerBin.cs
@@ -0,0 +1,169 @@
+// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+//
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace LongoMatch.Gui {
+
+
+ public partial class CapturerBin {
+
+ private Gtk.VBox vbox1;
+
+ private Gtk.HBox capturerhbox;
+
+ private Gtk.DrawingArea logodrawingarea;
+
+ private Gtk.HBox hbox2;
+
+ private Gtk.HBox buttonsbox;
+
+ private Gtk.Button recbutton;
+
+ private Gtk.Button pausebutton;
+
+ private Gtk.Button stopbutton;
+
+ private Gtk.Label timelabel;
+
+ protected virtual void Build() {
+ Stetic.Gui.Initialize(this);
+ // Widget LongoMatch.Gui.CapturerBin
+ Stetic.BinContainer.Attach(this);
+ this.Name = "LongoMatch.Gui.CapturerBin";
+ // Container child LongoMatch.Gui.CapturerBin.Gtk.Container+ContainerChild
+ this.vbox1 = new Gtk.VBox();
+ this.vbox1.Name = "vbox1";
+ this.vbox1.Spacing = 6;
+ // Container child vbox1.Gtk.Box+BoxChild
+ this.capturerhbox = new Gtk.HBox();
+ this.capturerhbox.Name = "capturerhbox";
+ this.capturerhbox.Spacing = 6;
+ this.vbox1.Add(this.capturerhbox);
+ Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox1[this.capturerhbox]));
+ w1.Position = 0;
+ // Container child vbox1.Gtk.Box+BoxChild
+ this.logodrawingarea = new Gtk.DrawingArea();
+ this.logodrawingarea.Name = "logodrawingarea";
+ this.vbox1.Add(this.logodrawingarea);
+ Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.vbox1[this.logodrawingarea]));
+ w2.Position = 1;
+ // Container child vbox1.Gtk.Box+BoxChild
+ this.hbox2 = new Gtk.HBox();
+ this.hbox2.Name = "hbox2";
+ this.hbox2.Spacing = 6;
+ // Container child hbox2.Gtk.Box+BoxChild
+ this.buttonsbox = new Gtk.HBox();
+ this.buttonsbox.Name = "buttonsbox";
+ this.buttonsbox.Spacing = 6;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.recbutton = new Gtk.Button();
+ this.recbutton.TooltipMarkup = "Start or continue capture";
+ this.recbutton.Name = "recbutton";
+ this.recbutton.UseUnderline = true;
+ // Container child recbutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w3 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w4 = new Gtk.HBox();
+ w4.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w5 = new Gtk.Image();
+ w5.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-record", Gtk.IconSize.Dialog, 48);
+ w4.Add(w5);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w7 = new Gtk.Label();
+ w4.Add(w7);
+ w3.Add(w4);
+ this.recbutton.Add(w3);
+ this.buttonsbox.Add(this.recbutton);
+ Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.recbutton]));
+ w11.Position = 0;
+ w11.Expand = false;
+ w11.Fill = false;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.pausebutton = new Gtk.Button();
+ this.pausebutton.TooltipMarkup = "Pause capture";
+ this.pausebutton.Name = "pausebutton";
+ this.pausebutton.UseUnderline = true;
+ // Container child pausebutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w12 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w13 = new Gtk.HBox();
+ w13.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w14 = new Gtk.Image();
+ w14.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-pause", Gtk.IconSize.Dialog, 48);
+ w13.Add(w14);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w16 = new Gtk.Label();
+ w13.Add(w16);
+ w12.Add(w13);
+ this.pausebutton.Add(w12);
+ this.buttonsbox.Add(this.pausebutton);
+ Gtk.Box.BoxChild w20 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.pausebutton]));
+ w20.Position = 1;
+ w20.Expand = false;
+ w20.Fill = false;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.stopbutton = new Gtk.Button();
+ this.stopbutton.TooltipMarkup = "Stop and close capture";
+ this.stopbutton.Name = "stopbutton";
+ this.stopbutton.UseUnderline = true;
+ // Container child stopbutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w21 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w22 = new Gtk.HBox();
+ w22.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w23 = new Gtk.Image();
+ w23.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-stop", Gtk.IconSize.Dialog, 48);
+ w22.Add(w23);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w25 = new Gtk.Label();
+ w22.Add(w25);
+ w21.Add(w22);
+ this.stopbutton.Add(w21);
+ this.buttonsbox.Add(this.stopbutton);
+ Gtk.Box.BoxChild w29 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.stopbutton]));
+ w29.Position = 2;
+ w29.Expand = false;
+ w29.Fill = false;
+ this.hbox2.Add(this.buttonsbox);
+ Gtk.Box.BoxChild w30 = ((Gtk.Box.BoxChild)(this.hbox2[this.buttonsbox]));
+ w30.Position = 0;
+ w30.Expand = false;
+ w30.Fill = false;
+ // Container child hbox2.Gtk.Box+BoxChild
+ this.timelabel = new Gtk.Label();
+ this.timelabel.Name = "timelabel";
+ this.timelabel.Xalign = 1F;
+ this.timelabel.LabelProp = "Time: 0:00:00";
+ this.hbox2.Add(this.timelabel);
+ Gtk.Box.BoxChild w31 = ((Gtk.Box.BoxChild)(this.hbox2[this.timelabel]));
+ w31.PackType = ((Gtk.PackType)(1));
+ w31.Position = 1;
+ w31.Expand = false;
+ this.vbox1.Add(this.hbox2);
+ Gtk.Box.BoxChild w32 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox2]));
+ w32.Position = 2;
+ w32.Expand = false;
+ w32.Fill = false;
+ this.Add(this.vbox1);
+ if ((this.Child != null)) {
+ this.Child.ShowAll();
+ }
+ this.pausebutton.Hide();
+ this.stopbutton.Hide();
+ this.Show();
+ this.logodrawingarea.ExposeEvent += new Gtk.ExposeEventHandler(this.OnLogodrawingareaExposeEvent);
+ this.recbutton.Clicked += new System.EventHandler(this.OnRecbuttonClicked);
+ this.pausebutton.Clicked += new System.EventHandler(this.OnPausebuttonClicked);
+ this.stopbutton.Clicked += new System.EventHandler(this.OnStopbuttonClicked);
+ }
+ }
+}
diff --git a/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs b/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
new file mode 100644
index 0000000..f44aeaf
--- /dev/null
+++ b/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
@@ -0,0 +1,337 @@
+// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+//
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace LongoMatch.Gui {
+
+
+ public partial class PlayerBin {
+
+ private Gtk.HBox mainbox;
+
+ private Gtk.VBox vbox2;
+
+ private Gtk.HBox videobox;
+
+ private Gtk.HBox controlsbox;
+
+ private Gtk.HBox buttonsbox;
+
+ private Gtk.Button closebutton;
+
+ private Gtk.Button drawbutton;
+
+ private Gtk.Button playbutton;
+
+ private Gtk.Button pausebutton;
+
+ private Gtk.Button prevbutton;
+
+ private Gtk.Button nextbutton;
+
+ private Gtk.Label tlabel;
+
+ private Gtk.HScale timescale;
+
+ private Gtk.Label timelabel;
+
+ private Gtk.Button volumebutton;
+
+ private Gtk.VBox vbox3;
+
+ private Gtk.VScale vscale1;
+
+ protected virtual void Build() {
+ Stetic.Gui.Initialize(this);
+ // Widget LongoMatch.Gui.PlayerBin
+ Stetic.BinContainer.Attach(this);
+ this.Name = "LongoMatch.Gui.PlayerBin";
+ // Container child LongoMatch.Gui.PlayerBin.Gtk.Container+ContainerChild
+ this.mainbox = new Gtk.HBox();
+ this.mainbox.Name = "mainbox";
+ this.mainbox.Spacing = 6;
+ // Container child mainbox.Gtk.Box+BoxChild
+ this.vbox2 = new Gtk.VBox();
+ this.vbox2.Name = "vbox2";
+ this.vbox2.Spacing = 6;
+ // Container child vbox2.Gtk.Box+BoxChild
+ this.videobox = new Gtk.HBox();
+ this.videobox.Name = "videobox";
+ this.videobox.Spacing = 6;
+ this.vbox2.Add(this.videobox);
+ Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox2[this.videobox]));
+ w1.Position = 0;
+ // Container child vbox2.Gtk.Box+BoxChild
+ this.controlsbox = new Gtk.HBox();
+ this.controlsbox.Name = "controlsbox";
+ this.controlsbox.Spacing = 6;
+ // Container child controlsbox.Gtk.Box+BoxChild
+ this.buttonsbox = new Gtk.HBox();
+ this.buttonsbox.Name = "buttonsbox";
+ this.buttonsbox.Homogeneous = true;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.closebutton = new Gtk.Button();
+ this.closebutton.Name = "closebutton";
+ this.closebutton.UseUnderline = true;
+ // Container child closebutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w2 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w3 = new Gtk.HBox();
+ w3.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w4 = new Gtk.Image();
+ w4.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-close", Gtk.IconSize.Dnd, 32);
+ w3.Add(w4);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w6 = new Gtk.Label();
+ w3.Add(w6);
+ w2.Add(w3);
+ this.closebutton.Add(w2);
+ this.buttonsbox.Add(this.closebutton);
+ Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.closebutton]));
+ w10.Position = 0;
+ w10.Expand = false;
+ w10.Fill = false;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.drawbutton = new Gtk.Button();
+ this.drawbutton.Name = "drawbutton";
+ this.drawbutton.UseUnderline = true;
+ // Container child drawbutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w11 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w12 = new Gtk.HBox();
+ w12.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w13 = new Gtk.Image();
+ w13.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-select-color", Gtk.IconSize.Menu, 16);
+ w12.Add(w13);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w15 = new Gtk.Label();
+ w12.Add(w15);
+ w11.Add(w12);
+ this.drawbutton.Add(w11);
+ this.buttonsbox.Add(this.drawbutton);
+ Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.drawbutton]));
+ w19.Position = 1;
+ w19.Expand = false;
+ w19.Fill = false;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.playbutton = new Gtk.Button();
+ this.playbutton.Name = "playbutton";
+ this.playbutton.UseUnderline = true;
+ this.playbutton.Relief = ((Gtk.ReliefStyle)(2));
+ // Container child playbutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w20 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w21 = new Gtk.HBox();
+ w21.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w22 = new Gtk.Image();
+ w22.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-play", Gtk.IconSize.Button, 16);
+ w21.Add(w22);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w24 = new Gtk.Label();
+ w21.Add(w24);
+ w20.Add(w21);
+ this.playbutton.Add(w20);
+ this.buttonsbox.Add(this.playbutton);
+ Gtk.Box.BoxChild w28 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.playbutton]));
+ w28.Position = 2;
+ w28.Expand = false;
+ w28.Fill = false;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.pausebutton = new Gtk.Button();
+ this.pausebutton.Name = "pausebutton";
+ this.pausebutton.UseUnderline = true;
+ this.pausebutton.Relief = ((Gtk.ReliefStyle)(2));
+ // Container child pausebutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w29 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w30 = new Gtk.HBox();
+ w30.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w31 = new Gtk.Image();
+ w31.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-pause", Gtk.IconSize.Button, 16);
+ w30.Add(w31);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w33 = new Gtk.Label();
+ w30.Add(w33);
+ w29.Add(w30);
+ this.pausebutton.Add(w29);
+ this.buttonsbox.Add(this.pausebutton);
+ Gtk.Box.BoxChild w37 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.pausebutton]));
+ w37.Position = 3;
+ w37.Expand = false;
+ w37.Fill = false;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.prevbutton = new Gtk.Button();
+ this.prevbutton.Name = "prevbutton";
+ this.prevbutton.UseUnderline = true;
+ this.prevbutton.Relief = ((Gtk.ReliefStyle)(2));
+ // Container child prevbutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w38 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w39 = new Gtk.HBox();
+ w39.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w40 = new Gtk.Image();
+ w40.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-previous", Gtk.IconSize.Button, 16);
+ w39.Add(w40);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w42 = new Gtk.Label();
+ w39.Add(w42);
+ w38.Add(w39);
+ this.prevbutton.Add(w38);
+ this.buttonsbox.Add(this.prevbutton);
+ Gtk.Box.BoxChild w46 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.prevbutton]));
+ w46.Position = 4;
+ w46.Expand = false;
+ w46.Fill = false;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.nextbutton = new Gtk.Button();
+ this.nextbutton.Sensitive = false;
+ this.nextbutton.Name = "nextbutton";
+ this.nextbutton.UseUnderline = true;
+ this.nextbutton.Relief = ((Gtk.ReliefStyle)(2));
+ // Container child nextbutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w47 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w48 = new Gtk.HBox();
+ w48.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w49 = new Gtk.Image();
+ w49.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-next", Gtk.IconSize.Button, 16);
+ w48.Add(w49);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w51 = new Gtk.Label();
+ w48.Add(w51);
+ w47.Add(w48);
+ this.nextbutton.Add(w47);
+ this.buttonsbox.Add(this.nextbutton);
+ Gtk.Box.BoxChild w55 = ((Gtk.Box.BoxChild)(this.buttonsbox[this.nextbutton]));
+ w55.Position = 5;
+ w55.Expand = false;
+ w55.Fill = false;
+ this.controlsbox.Add(this.buttonsbox);
+ Gtk.Box.BoxChild w56 = ((Gtk.Box.BoxChild)(this.controlsbox[this.buttonsbox]));
+ w56.Position = 0;
+ w56.Expand = false;
+ w56.Fill = false;
+ // Container child controlsbox.Gtk.Box+BoxChild
+ this.tlabel = new Gtk.Label();
+ this.tlabel.Name = "tlabel";
+ this.tlabel.LabelProp = Mono.Unix.Catalog.GetString("Time:");
+ this.controlsbox.Add(this.tlabel);
+ Gtk.Box.BoxChild w57 = ((Gtk.Box.BoxChild)(this.controlsbox[this.tlabel]));
+ w57.Position = 1;
+ w57.Expand = false;
+ w57.Fill = false;
+ // Container child controlsbox.Gtk.Box+BoxChild
+ this.timescale = new Gtk.HScale(null);
+ this.timescale.Name = "timescale";
+ this.timescale.UpdatePolicy = ((Gtk.UpdateType)(1));
+ this.timescale.Adjustment.Upper = 1;
+ this.timescale.Adjustment.PageIncrement = 1;
+ this.timescale.Adjustment.StepIncrement = 1;
+ this.timescale.Adjustment.Value = 1;
+ this.timescale.DrawValue = false;
+ this.timescale.Digits = 0;
+ this.timescale.ValuePos = ((Gtk.PositionType)(2));
+ this.controlsbox.Add(this.timescale);
+ Gtk.Box.BoxChild w58 = ((Gtk.Box.BoxChild)(this.controlsbox[this.timescale]));
+ w58.Position = 2;
+ // Container child controlsbox.Gtk.Box+BoxChild
+ this.timelabel = new Gtk.Label();
+ this.timelabel.Name = "timelabel";
+ this.controlsbox.Add(this.timelabel);
+ Gtk.Box.BoxChild w59 = ((Gtk.Box.BoxChild)(this.controlsbox[this.timelabel]));
+ w59.Position = 3;
+ w59.Expand = false;
+ // Container child controlsbox.Gtk.Box+BoxChild
+ this.volumebutton = new Gtk.Button();
+ this.volumebutton.Name = "volumebutton";
+ this.volumebutton.UseUnderline = true;
+ this.volumebutton.Relief = ((Gtk.ReliefStyle)(2));
+ // Container child volumebutton.Gtk.Container+ContainerChild
+ Gtk.Alignment w60 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ Gtk.HBox w61 = new Gtk.HBox();
+ w61.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Image w62 = new Gtk.Image();
+ w62.Pixbuf = Stetic.IconLoader.LoadIcon(this, "stock_volume", Gtk.IconSize.Button, 16);
+ w61.Add(w62);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ Gtk.Label w64 = new Gtk.Label();
+ w61.Add(w64);
+ w60.Add(w61);
+ this.volumebutton.Add(w60);
+ this.controlsbox.Add(this.volumebutton);
+ Gtk.Box.BoxChild w68 = ((Gtk.Box.BoxChild)(this.controlsbox[this.volumebutton]));
+ w68.Position = 4;
+ w68.Expand = false;
+ w68.Fill = false;
+ this.vbox2.Add(this.controlsbox);
+ Gtk.Box.BoxChild w69 = ((Gtk.Box.BoxChild)(this.vbox2[this.controlsbox]));
+ w69.Position = 1;
+ w69.Expand = false;
+ this.mainbox.Add(this.vbox2);
+ Gtk.Box.BoxChild w70 = ((Gtk.Box.BoxChild)(this.mainbox[this.vbox2]));
+ w70.Position = 0;
+ // Container child mainbox.Gtk.Box+BoxChild
+ this.vbox3 = new Gtk.VBox();
+ this.vbox3.Name = "vbox3";
+ this.vbox3.Spacing = 6;
+ // Container child vbox3.Gtk.Box+BoxChild
+ this.vscale1 = new Gtk.VScale(null);
+ this.vscale1.WidthRequest = 45;
+ this.vscale1.Sensitive = false;
+ this.vscale1.Name = "vscale1";
+ this.vscale1.UpdatePolicy = ((Gtk.UpdateType)(1));
+ this.vscale1.Inverted = true;
+ this.vscale1.Adjustment.Lower = 1;
+ this.vscale1.Adjustment.Upper = 28;
+ this.vscale1.Adjustment.PageIncrement = 3;
+ this.vscale1.Adjustment.PageSize = 1;
+ this.vscale1.Adjustment.StepIncrement = 1;
+ this.vscale1.Adjustment.Value = 25;
+ this.vscale1.DrawValue = true;
+ this.vscale1.Digits = 0;
+ this.vscale1.ValuePos = ((Gtk.PositionType)(3));
+ this.vbox3.Add(this.vscale1);
+ Gtk.Box.BoxChild w71 = ((Gtk.Box.BoxChild)(this.vbox3[this.vscale1]));
+ w71.Position = 0;
+ this.mainbox.Add(this.vbox3);
+ Gtk.Box.BoxChild w72 = ((Gtk.Box.BoxChild)(this.mainbox[this.vbox3]));
+ w72.Position = 1;
+ w72.Expand = false;
+ w72.Fill = false;
+ this.Add(this.mainbox);
+ if ((this.Child != null)) {
+ this.Child.ShowAll();
+ }
+ this.closebutton.Hide();
+ this.prevbutton.Hide();
+ this.nextbutton.Hide();
+ this.controlsbox.Hide();
+ this.Show();
+ this.closebutton.Clicked += new System.EventHandler(this.OnClosebuttonClicked);
+ this.drawbutton.Clicked += new System.EventHandler(this.OnDrawButtonClicked);
+ this.playbutton.Clicked += new System.EventHandler(this.OnPlaybuttonClicked);
+ this.pausebutton.Clicked += new System.EventHandler(this.OnPausebuttonClicked);
+ this.prevbutton.Clicked += new System.EventHandler(this.OnPrevbuttonClicked);
+ this.nextbutton.Clicked += new System.EventHandler(this.OnNextbuttonClicked);
+ this.timescale.ValueChanged += new System.EventHandler(this.OnTimescaleValueChanged);
+ this.timescale.AdjustBounds += new Gtk.AdjustBoundsHandler(this.OnTimescaleAdjustBounds);
+ this.volumebutton.Clicked += new System.EventHandler(this.OnVolumebuttonClicked);
+ this.vscale1.FormatValue += new Gtk.FormatValueHandler(this.OnVscale1FormatValue);
+ this.vscale1.ValueChanged += new System.EventHandler(this.OnVscale1ValueChanged);
+ }
+ }
+}
diff --git a/CesarPlayer/gtk-gui/LongoMatch.Gui.VolumeWindow.cs b/CesarPlayer/gtk-gui/LongoMatch.Gui.VolumeWindow.cs
new file mode 100644
index 0000000..ece41c9
--- /dev/null
+++ b/CesarPlayer/gtk-gui/LongoMatch.Gui.VolumeWindow.cs
@@ -0,0 +1,85 @@
+// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+//
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace LongoMatch.Gui {
+
+
+ public partial class VolumeWindow {
+
+ private Gtk.VBox vbox2;
+
+ private Gtk.Button morebutton;
+
+ private Gtk.VScale volumescale;
+
+ private Gtk.Button lessbutton;
+
+ protected virtual void Build() {
+ Stetic.Gui.Initialize(this);
+ // Widget LongoMatch.Gui.VolumeWindow
+ this.Name = "LongoMatch.Gui.VolumeWindow";
+ this.Title = "";
+ this.WindowPosition = ((Gtk.WindowPosition)(2));
+ this.Decorated = false;
+ this.DestroyWithParent = true;
+ this.SkipPagerHint = true;
+ this.SkipTaskbarHint = true;
+ // Container child LongoMatch.Gui.VolumeWindow.Gtk.Container+ContainerChild
+ this.vbox2 = new Gtk.VBox();
+ this.vbox2.Name = "vbox2";
+ // Container child vbox2.Gtk.Box+BoxChild
+ this.morebutton = new Gtk.Button();
+ this.morebutton.Name = "morebutton";
+ this.morebutton.Relief = ((Gtk.ReliefStyle)(2));
+ this.morebutton.Label = "+";
+ this.vbox2.Add(this.morebutton);
+ Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox2[this.morebutton]));
+ w1.Position = 0;
+ w1.Expand = false;
+ w1.Fill = false;
+ // Container child vbox2.Gtk.Box+BoxChild
+ this.volumescale = new Gtk.VScale(null);
+ this.volumescale.CanFocus = true;
+ this.volumescale.Name = "volumescale";
+ this.volumescale.Inverted = true;
+ this.volumescale.Adjustment.Upper = 1;
+ this.volumescale.Adjustment.PageIncrement = 1;
+ this.volumescale.Adjustment.StepIncrement = 1;
+ this.volumescale.Adjustment.Value = 1;
+ this.volumescale.DrawValue = false;
+ this.volumescale.Digits = 0;
+ this.volumescale.ValuePos = ((Gtk.PositionType)(2));
+ this.vbox2.Add(this.volumescale);
+ Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.vbox2[this.volumescale]));
+ w2.Position = 1;
+ // Container child vbox2.Gtk.Box+BoxChild
+ this.lessbutton = new Gtk.Button();
+ this.lessbutton.Name = "lessbutton";
+ this.lessbutton.Relief = ((Gtk.ReliefStyle)(2));
+ this.lessbutton.Label = "-";
+ this.vbox2.Add(this.lessbutton);
+ Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox2[this.lessbutton]));
+ w3.Position = 2;
+ w3.Expand = false;
+ w3.Fill = false;
+ this.Add(this.vbox2);
+ if ((this.Child != null)) {
+ this.Child.ShowAll();
+ }
+ this.DefaultWidth = 31;
+ this.DefaultHeight = 204;
+ this.Hide();
+ this.FocusOutEvent += new Gtk.FocusOutEventHandler(this.OnFocusOutEvent);
+ this.morebutton.Clicked += new System.EventHandler(this.OnMorebuttonClicked);
+ this.volumescale.ValueChanged += new System.EventHandler(this.OnVolumescaleValueChanged);
+ this.lessbutton.Clicked += new System.EventHandler(this.OnLessbuttonClicked);
+ }
+ }
+}
diff --git a/CesarPlayer/gtk-gui/generated.cs b/CesarPlayer/gtk-gui/generated.cs
new file mode 100644
index 0000000..35f420b
--- /dev/null
+++ b/CesarPlayer/gtk-gui/generated.cs
@@ -0,0 +1,115 @@
+// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+//
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace Stetic {
+
+
+ internal class Gui {
+
+ private static bool initialized;
+
+ internal static void Initialize(Gtk.Widget iconRenderer) {
+ if ((Stetic.Gui.initialized == false)) {
+ Stetic.Gui.initialized = true;
+ }
+ }
+ }
+
+ internal class BinContainer {
+
+ private Gtk.Widget child;
+
+ private Gtk.UIManager uimanager;
+
+ public static BinContainer Attach(Gtk.Bin bin) {
+ BinContainer bc = new BinContainer();
+ bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested);
+ bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated);
+ bin.Added += new Gtk.AddedHandler(bc.OnAdded);
+ return bc;
+ }
+
+ private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args) {
+ if ((this.child != null)) {
+ args.Requisition = this.child.SizeRequest();
+ }
+ }
+
+ private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args) {
+ if ((this.child != null)) {
+ this.child.Allocation = args.Allocation;
+ }
+ }
+
+ private void OnAdded(object sender, Gtk.AddedArgs args) {
+ this.child = args.Widget;
+ }
+
+ public void SetUiManager(Gtk.UIManager uim) {
+ this.uimanager = uim;
+ this.child.Realized += new System.EventHandler(this.OnRealized);
+ }
+
+ private void OnRealized(object sender, System.EventArgs args) {
+ if ((this.uimanager != null)) {
+ Gtk.Widget w;
+ w = this.child.Toplevel;
+ if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w))) {
+ ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup);
+ this.uimanager = null;
+ }
+ }
+ }
+ }
+
+ internal class IconLoader {
+
+ public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size, int sz) {
+ Gdk.Pixbuf res = widget.RenderIcon(name, size, null);
+ if ((res != null)) {
+ return res;
+ }
+ else {
+ try {
+ return Gtk.IconTheme.Default.LoadIcon(name, sz, 0);
+ }
+ catch (System.Exception ) {
+ if ((name != "gtk-missing-image")) {
+ return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size, sz);
+ }
+ else {
+ Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz);
+ Gdk.GC gc = new Gdk.GC(pmap);
+ gc.RgbFgColor = new Gdk.Color(255, 255, 255);
+ pmap.DrawRectangle(gc, true, 0, 0, sz, sz);
+ gc.RgbFgColor = new Gdk.Color(0, 0, 0);
+ pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1));
+ gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
+ gc.RgbFgColor = new Gdk.Color(255, 0, 0);
+ pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4)));
+ pmap.DrawLine(gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)));
+ return Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz);
+ }
+ }
+ }
+ }
+ }
+
+ internal class ActionGroups {
+
+ public static Gtk.ActionGroup GetActionGroup(System.Type type) {
+ return Stetic.ActionGroups.GetActionGroup(type.FullName);
+ }
+
+ public static Gtk.ActionGroup GetActionGroup(string name) {
+ return null;
+ }
+ }
+}
diff --git a/CesarPlayer/gtk-gui/gui.stetic b/CesarPlayer/gtk-gui/gui.stetic
new file mode 100644
index 0000000..1421d4b
--- /dev/null
+++ b/CesarPlayer/gtk-gui/gui.stetic
@@ -0,0 +1,451 @@
+<?xml version="1.0" encoding="utf-8"?>
+<stetic-interface>
+ <configuration>
+ <images-root-path>..</images-root-path>
+ <target-gtk-version>2.12</target-gtk-version>
+ </configuration>
+ <import>
+ <widget-library name="../bin/Release/CesarPlayer.dll" internal="true" />
+ </import>
+ <widget class="Gtk.Window" id="LongoMatch.Gui.VolumeWindow" design-size="31 204">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Title" />
+ <property name="WindowPosition">Mouse</property>
+ <property name="Decorated">False</property>
+ <property name="DestroyWithParent">True</property>
+ <property name="SkipPagerHint">True</property>
+ <property name="SkipTaskbarHint">True</property>
+ <signal name="FocusOutEvent" handler="OnFocusOutEvent" />
+ <child>
+ <widget class="Gtk.VBox" id="vbox2">
+ <property name="MemberName" />
+ <child>
+ <widget class="Gtk.Button" id="morebutton">
+ <property name="MemberName" />
+ <property name="Type">TextOnly</property>
+ <property name="Label">+</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnMorebuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.VScale" id="volumescale">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Inverted">True</property>
+ <property name="Upper">1</property>
+ <property name="PageIncrement">1</property>
+ <property name="StepIncrement">1</property>
+ <property name="Value">1</property>
+ <property name="DrawValue">False</property>
+ <property name="Digits">0</property>
+ <property name="ValuePos">Top</property>
+ <signal name="ValueChanged" handler="OnVolumescaleValueChanged" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="lessbutton">
+ <property name="MemberName" />
+ <property name="Type">TextOnly</property>
+ <property name="Label">-</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnLessbuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="Gtk.Bin" id="LongoMatch.Gui.PlayerBin" design-size="798 300">
+ <property name="MemberName" />
+ <child>
+ <widget class="Gtk.HBox" id="mainbox">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.VBox" id="vbox2">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.HBox" id="videobox">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.HBox" id="controlsbox">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.HBox" id="buttonsbox">
+ <property name="MemberName" />
+ <property name="Homogeneous">True</property>
+ <child>
+ <widget class="Gtk.Button" id="closebutton">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-close Dnd</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <signal name="Clicked" handler="OnClosebuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="drawbutton">
+ <property name="MemberName" />
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-select-color Menu</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <signal name="Clicked" handler="OnDrawButtonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="playbutton">
+ <property name="MemberName" />
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-play Button</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnPlaybuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="pausebutton">
+ <property name="MemberName" />
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-pause Button</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnPausebuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">3</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="prevbutton">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-previous Button</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnPrevbuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">4</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="nextbutton">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Sensitive">False</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-next Button</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnNextbuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">5</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="tlabel">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Time:</property>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.HScale" id="timescale">
+ <property name="MemberName" />
+ <property name="UpdatePolicy">Discontinuous</property>
+ <property name="Upper">1</property>
+ <property name="PageIncrement">1</property>
+ <property name="StepIncrement">1</property>
+ <property name="Value">1</property>
+ <property name="DrawValue">False</property>
+ <property name="Digits">0</property>
+ <property name="ValuePos">Top</property>
+ <signal name="ValueChanged" handler="OnTimescaleValueChanged" />
+ <signal name="AdjustBounds" handler="OnTimescaleAdjustBounds" />
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="timelabel">
+ <property name="MemberName" />
+ </widget>
+ <packing>
+ <property name="Position">3</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="volumebutton">
+ <property name="MemberName" />
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:stock_volume Button</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <property name="Relief">None</property>
+ <signal name="Clicked" handler="OnVolumebuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">4</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.VBox" id="vbox3">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.VScale" id="vscale1">
+ <property name="MemberName" />
+ <property name="WidthRequest">45</property>
+ <property name="Sensitive">False</property>
+ <property name="UpdatePolicy">Discontinuous</property>
+ <property name="Inverted">True</property>
+ <property name="Lower">1</property>
+ <property name="Upper">28</property>
+ <property name="PageIncrement">3</property>
+ <property name="PageSize">1</property>
+ <property name="StepIncrement">1</property>
+ <property name="Value">25</property>
+ <property name="DrawValue">True</property>
+ <property name="Digits">0</property>
+ <property name="ValuePos">Bottom</property>
+ <signal name="FormatValue" handler="OnVscale1FormatValue" />
+ <signal name="ValueChanged" handler="OnVscale1ValueChanged" />
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="Gtk.Bin" id="LongoMatch.Gui.CapturerBin" design-size="356 295">
+ <property name="MemberName" />
+ <child>
+ <widget class="Gtk.VBox" id="vbox1">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.HBox" id="capturerhbox">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.DrawingArea" id="logodrawingarea">
+ <property name="MemberName" />
+ <signal name="ExposeEvent" handler="OnLogodrawingareaExposeEvent" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.HBox" id="hbox2">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.HBox" id="buttonsbox">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Button" id="recbutton">
+ <property name="MemberName" />
+ <property name="Tooltip" translatable="yes">Start or continue capture</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-record Dialog</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <signal name="Clicked" handler="OnRecbuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="pausebutton">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Tooltip" translatable="yes">Pause capture</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-pause Dialog</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <signal name="Clicked" handler="OnPausebuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="stopbutton">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Tooltip" translatable="yes">Stop and close capture</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-stop Dialog</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ <signal name="Clicked" handler="OnStopbuttonClicked" />
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="timelabel">
+ <property name="MemberName" />
+ <property name="Xalign">1</property>
+ <property name="LabelProp">Time: 0:00:00</property>
+ </widget>
+ <packing>
+ <property name="PackType">End</property>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</stetic-interface>
\ No newline at end of file
diff --git a/CesarPlayer/gtk-gui/objects.xml b/CesarPlayer/gtk-gui/objects.xml
new file mode 100644
index 0000000..8946adc
--- /dev/null
+++ b/CesarPlayer/gtk-gui/objects.xml
@@ -0,0 +1,31 @@
+<objects attr-sync="on">
+ <object type="LongoMatch.Gui.CapturerBin" palette-category="CesarPlayer" allow-children="false" base-type="Gtk.Bin">
+ <itemgroups />
+ <signals>
+ <itemgroup label="CapturerBin Signals">
+ <signal name="CaptureFinished" />
+ <signal name="Error" />
+ </itemgroup>
+ </signals>
+ </object>
+ <object type="LongoMatch.Gui.PlayerBin" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
+ <itemgroups>
+ <itemgroup label="PlayerBin Properties">
+ <property name="Rate" />
+ <property name="ExpandLogo" />
+ </itemgroup>
+ </itemgroups>
+ <signals>
+ <itemgroup label="PlayerBin Signals">
+ <signal name="SegmentClosedEvent" />
+ <signal name="Tick" />
+ <signal name="Error" />
+ <signal name="Next" />
+ <signal name="Prev" />
+ <signal name="DrawFrame" />
+ <signal name="SeekEvent" />
+ <signal name="PlayStateChanged" />
+ </itemgroup>
+ </signals>
+ </object>
+</objects>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]