+2006-05-20 Aaron Bockover <aaron@abock.org>
+
+ * autogen.sh: Fixed a left over configure.in to configure.ac
+
+ * confiugre.ac: Added check foo for NUnit
+
+ * gstreamer-sharp.mdp:
+ * gstreamer-sharp.mds: Added MonoDevelop solution
+
+ * source/Makefile.am: Cleaned and fixed
+
+ * tests/ConsoleUi.cs:
+ * tests/ApplicationTest.cs:
+ * tests/BinTest.cs:
+ * tests/Makefile.am: Added NUnit test framework and a few tests for
+ Gst.Application and Gst.Bin
+
+ * gstreamer-sharp/CommonTags.cs:
+ * gstreamer-sharp/*.custom:
+ * gstreamer-sharp/glue/*.c: Cleaned up
+
+ * gstreamer-sharp/Application.cs: New application bindings; fixed
+ to work properly with GStreamer 0.10
+
+ * gstreamer-sharp/Version.cs: New Gst.Version class
+
+ * gstreamer-sharp/Makefile.am: Added Version.cs
+
+ * gstreamer-sharp/plugins-base/PlayBin.cs: Fixed and extended PlayBin
+ element binding with new (but not all) properties
+
+ * Makefile.am: Added tests
+
2006-05-19 Aaron Bockover <aaron@abock.org>
* gstreamer-sharp: Initial import to Mono Subversion; all prior work
-SUBDIRS = source gstreamer-sharp doc sample
+SUBDIRS = source gstreamer-sharp doc tests sample
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gstreamer-sharp-0.10.pc
fi
fi
-(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
+(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed to compile Gst#."
AC_MSG_ERROR([You need to install gtk-sharp-gapi])
fi
+PKG_CHECK_MODULES(MONO_NUNIT, mono-nunit >= 1.0, do_tests="yes", do_tests="no")
+AC_SUBST(MONO_NUNIT_LIBS)
+AM_CONDITIONAL(ENABLE_TESTS, test "x$do_tests" = "xyes")
+if test "x$do_tests" = "xno"; then
+ AC_MSG_WARN([Could not find mono-nunit: tests will not be available])
+fi
+
AC_OUTPUT([
source/Makefile
gstreamer-sharp/Makefile
gstreamer-sharp/gstreamer-sharp.dll.config
gstreamer-sharp/glue/Makefile
doc/Makefile
+tests/Makefile
sample/Makefile
gstreamer-sharp-0.10.pc
Makefile
--- /dev/null
+<Project name="gstreamer-sharp" fileversion="2.0" language="C#" ctype="DotNetProject">
+ <Configurations active="Debug">
+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+ <Output directory="./bin/Debug" assembly="gstreamer-sharp" />
+ <Build debugmode="True" target="Exe" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
+ <Output directory="./bin/Release" assembly="gstreamer-sharp" />
+ <Build debugmode="False" target="Exe" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ </Configurations>
+ <DeploymentInformation strategy="File">
+ <excludeFiles />
+ </DeploymentInformation>
+ <Contents>
+ <File name="./gstreamer-sharp/Application.cs" subtype="Code" buildaction="Compile" />
+ <File name="./gstreamer-sharp/Bin.custom" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/Bus.custom" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/Clock.custom" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/CommonTags.cs" subtype="Code" buildaction="Compile" />
+ <File name="./gstreamer-sharp/Debug.custom" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/Element.custom" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/Gstreamer.metadata" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/Message.custom" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/Pad.custom" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/Version.cs" subtype="Code" buildaction="Compile" />
+ <File name="./tests/ConsoleUi.cs" subtype="Code" buildaction="Compile" />
+ <File name="./tests/ApplicationTest.cs" subtype="Code" buildaction="Compile" />
+ <File name="./tests/BinTest.cs" subtype="Code" buildaction="Compile" />
+ <File name="./gstreamer-sharp/plugins-base/PlayBin.cs" subtype="Code" buildaction="Compile" />
+ <File name="./gstreamer-sharp/glue/clock.c" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/glue/message.c" subtype="Code" buildaction="Nothing" />
+ <File name="./gstreamer-sharp/glue/miniobject.c" subtype="Code" buildaction="Nothing" />
+ </Contents>
+ <References />
+</Project>
\ No newline at end of file
--- /dev/null
+<Combine name="gstreamer-sharp" fileversion="2.0">
+ <Configurations active="Debug">
+ <Configuration name="Debug" ctype="CombineConfiguration">
+ <Entry configuration="Debug" build="True" name="gstreamer-sharp" />
+ </Configuration>
+ <Configuration name="Release" ctype="CombineConfiguration">
+ <Entry configuration="Debug" build="True" name="gstreamer-sharp" />
+ </Configuration>
+ </Configurations>
+ <StartMode startupentry="gstreamer-sharp" single="True">
+ <Execute type="None" entry="gstreamer-sharp" />
+ </StartMode>
+ <Entries>
+ <Entry filename="./gstreamer-sharp.mdp" />
+ </Entries>
+</Combine>
\ No newline at end of file
//
-// Application.cs - Gst initialization
+// Application.cs: Framework initialization for GStreamer
//
-// Author: Alp Toker <alp@atoker.com>
+// Authors:
+// Aaron Bockover (abockover@novell.com)
+// Alp Toker (alp@atoker.com)
//
-// 2002 (C) Copyright, Alp Toker
+// (C) 2006 Novell, Inc.
+// (C) 2002 Alp Toker
//
-
-namespace Gst {
-
- using System;
- using System.Runtime.InteropServices;
-
- public class Application {
-
- //
- // Disables creation of instances.
- //
- private Application ()
- {
+using System;
+using System.Runtime.InteropServices;
+
+namespace Gst
+{
+ public static class Application
+ {
+ public static void Init()
+ {
+ IntPtr argv = new IntPtr(0);
+ int argc = 0;
+
+ gst_init(ref argc, ref argv);
+ }
+
+ public static void Init(string progname, ref string [] args)
+ {
+ FullInit(progname, ref args, false);
+ }
+
+ public static void InitCheck(string progname, ref string [] args)
+ {
+ FullInit(progname, ref args, true);
+ }
+
+ public static void Deinit()
+ {
+ gst_deinit();
+ }
+
+ private static void FullInit(string progname, ref string [] args, bool check)
+ {
+ string [] progargs = new string[args.Length + 1];
+
+ progargs[0] = progname;
+ args.CopyTo(progargs, 1);
+
+ GLib.Argv argv = new GLib.Argv(progargs);
+ IntPtr argv_ptr = argv.Handle;
+ int argc = progargs.Length;
+
+ if(check) {
+ IntPtr error_ptr;
+ bool result = gst_init_check(ref argc, ref argv_ptr, out error_ptr);
+
+ if(error_ptr != IntPtr.Zero) {
+ throw new ApplicationException("gst_init_check set error");
+ } else if(!result) {
+ throw new ApplicationException("gst_init_check failed, error not set");
}
-
- [DllImport("gstreamer-0.10")]
- static extern void gst_init (ref int argc, ref IntPtr argv);
-
- [DllImport("gstreamer-0.10")]
- static extern bool gst_init_check (ref int argc, ref IntPtr argv);
-
- public static void Init ()
- {
- IntPtr argv = new IntPtr(0);
- int argc = 0;
-
- gst_init (ref argc, ref argv);
- }
-
- static bool do_init (string progname, ref string[] args, bool check)
- {
- bool res = false;
- string[] progargs = new string[args.Length + 1];
-
- progargs[0] = progname;
- args.CopyTo (progargs, 1);
-
- GLib.Argv argv = new GLib.Argv (progargs);
- IntPtr buf = argv.Handle;
- int argc = progargs.Length;
-
- if (check)
- res = gst_init_check (ref argc, ref buf);
- else
- gst_init (ref argc, ref buf);
-
- if (buf != argv.Handle)
- throw new Exception ("init returned new argv handle");
-
- // copy back the resulting argv, minus argv[0], which we're
- // not interested in.
-
- if (argc <= 1)
- args = new string[0];
- else {
- progargs = argv.GetArgs (argc);
- args = new string[argc - 1];
- Array.Copy (progargs, 1, args, 0, argc - 1);
- }
-
- return res;
+ } else {
+ gst_init(ref argc, ref argv_ptr);
+ }
+
+ if(argv_ptr != argv.Handle) {
+ string init_call = check ? "gst_init_check" : "gst_init";
+ throw new ApplicationException(init_call + " returned a new argv handle");
+ }
+
+ if(argc <= 1) {
+ args = new string[0];
+ } else {
+ progargs = argv.GetArgs(argc);
+ args = new string[argc - 1];
+ Array.Copy(progargs, 1, args, 0, argc - 1);
+ }
+ }
+
+ private static Version version = null;
+
+ public static Version Version {
+ get {
+ if(version == null) {
+ version = new Version();
}
-
- public static void Init (string progname, ref string[] args)
- {
- do_init (progname, ref args, false);
- }
-
- public static bool InitCheck (string progname, ref string[] args)
- {
- return do_init (progname, ref args, true);
- }
-
- [DllImport("gstreamer-0.10")]
- static extern void gst_version (out uint major, out uint minor, out uint micro);
-
- public static string Version {
- get {
- uint major, minor, micro;
- gst_version (out major, out minor, out micro);
- return major + "." + minor + "." + micro;
- }
- }
- }
+
+ return version;
+ }
+ }
+
+ [DllImport("gstreamer-0.10")]
+ private static extern void gst_init(ref int argc, ref IntPtr argv);
+
+ [DllImport("gstreamer-0.10")]
+ private static extern bool gst_init_check(ref int argc, ref IntPtr argv, out IntPtr error);
+
+ [DllImport("gstreamer-0.10")]
+ private static extern void gst_deinit();
+ }
}
-//
-// Bin.custom
-//
-// This code is inserted after the automatically generated code.
-//
- [DllImport("gstreamer-0.10")]
- static extern IntPtr gst_bin_get_list(IntPtr raw);
- public Element[] List {
- get {
- IntPtr list_ptr = gst_bin_get_list (Handle);
- if (list_ptr == IntPtr.Zero)
- return new Element [0];
-
- GLib.List list = new GLib.List (list_ptr);
- Element[] result = new Element [list.Count];
- for (int i = 0; i < list.Count; i++)
- result [i] = list [i] as Element;
- return result;
- }
- }
+ /*[DllImport ("gstreamersharpglue-0.10")]
+ private extern static uint gstsharp_gst_bin_get_children_offset();
- public bool AddMany (params Element[] elements)
- {
- if (elements == null)
- return false;
+ static uint children_offset = gstsharp_gst_bin_get_children_offset();*/
- bool ret = true;
- foreach (Element element in elements)
- {
- if (element == null || !Add (element)) {
- ret = false;
- continue;
- }
- }
+ /* TODO: This needs to be called 'Children' and the default version
+ needs to be hidden (see Gstreamer.metadata) */
- return ret;
- }
+ public Element [] List {
+ get {
+ GLib.List list;
+
+ unsafe {
+ IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + children_offset);
+ list = new GLib.List((*raw_ptr));
+ }
+
+ Element [] result = new Element[list.Count];
+
+ for(int i = 0; i < list.Count; i++) {
+ result[i] = list[i] as Element;
+ }
+
+ return result;
+ }
+ }
+
+ public bool AddMany(params Element[] elements)
+ {
+ if(elements == null) {
+ return false;
+ }
+
+ foreach(Element element in elements) {
+ if(element == null || !Add(element)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
-
- public uint AddWatch (BusFunc func)
- {
- return AddWatchFull (0, func);
- }
+
+ public uint AddWatch(BusFunc func)
+ {
+ return AddWatchFull(0, func);
+ }
-//
-// Clock.custom
-//
-//
-//
- [DllImport ("gstsharpglue-0.10")]
- extern static long gstsharp_gst_clock_get_gst_second ();
+ [DllImport("gstsharpglue-0.10")]
+ private extern static long gstsharp_gst_clock_get_gst_second();
- public static readonly long GstSecond = gstsharp_gst_clock_get_gst_second ();
+ public static readonly long GstSecond = gstsharp_gst_clock_get_gst_second();
- [DllImport ("gstsharpglue-0.10")]
- extern static long gstsharp_gst_clock_get_gst_msecond ();
+ [DllImport("gstsharpglue-0.10")]
+ private extern static long gstsharp_gst_clock_get_gst_msecond();
- public static readonly long GstMSecond = gstsharp_gst_clock_get_gst_second ();
+ public static readonly long GstMSecond = gstsharp_gst_clock_get_gst_second();
- [DllImport ("gstsharpglue-0.10")]
- extern static long gstsharp_gst_clock_get_gst_usecond ();
+ [DllImport("gstsharpglue-0.10")]
+ private extern static long gstsharp_gst_clock_get_gst_usecond();
- public static readonly long GstUSecond = gstsharp_gst_clock_get_gst_second ();
+ public static readonly long GstUSecond = gstsharp_gst_clock_get_gst_second();
- [DllImport ("gstsharpglue-0.10")]
- extern static long gstsharp_gst_clock_get_gst_nsecond ();
+ [DllImport("gstsharpglue-0.10")]
+ private extern static long gstsharp_gst_clock_get_gst_nsecond();
- public static readonly long GstNSecond = gstsharp_gst_clock_get_gst_second ();
+ public static readonly long GstNSecond = gstsharp_gst_clock_get_gst_second();
-namespace Gst {
- public sealed class CommonTags {
- public const string Title = "title";
- public const string Artist = "artist";
- public const string Album = "album";
- public const string Date = "date";
- public const string Genre = "genre";
- public const string Comment = "comment";
- public const string TrackNumber = "track-number";
- public const string TrackCount = "track-count";
- public const string AlbumVolumeNumber = "album-disc-number";
- public const string AlbumVolumeCount = "album-disc-count";
- public const string Location = "location";
- public const string Description = "description";
- public const string Version = "version";
- public const string Isrc = "isrc";
- public const string Organization = "organization";
- public const string Copyright = "copyright";
- public const string Contact = "contact";
- public const string License = "license";
- public const string Performer = "performer";
- public const string Duration = "duration";
- public const string Codec = "codec";
- public const string VideoCodec = "video-codec";
- public const string AudioCodec = "audio-codec";
- public const string Bitrate = "bitrate";
- public const string NominalBitrate = "nominal-bitrate";
- public const string MinimumBitrate = "minimum-bitrate";
- public const string MaximumBitrate = "maximum-bitrate";
- public const string Serial = "serial";
- public const string Encoder = "encoder";
- public const string EncoderVersion = "encoder-version";
- public const string TrackGain = "replaygain-track-gain";
- public const string TrackPeak = "replaygain-track-peak";
- public const string AlbumGain = "replaygain-album-gain";
- public const string AlbumPeak = "replaygain-album-peak";
- }
+//
+// Commontags.cs: Constant tag strings
+//
+// Authors:
+// Alp Toker (alp@atoker.com)
+//
+// (C) 2002 Alp Toker
+//
+
+namespace Gst
+{
+ public sealed class CommonTags
+ {
+ public const string Title = "title";
+ public const string Artist = "artist";
+ public const string Album = "album";
+ public const string Date = "date";
+ public const string Genre = "genre";
+ public const string Comment = "comment";
+ public const string TrackNumber = "track-number";
+ public const string TrackCount = "track-count";
+ public const string AlbumVolumeNumber = "album-disc-number";
+ public const string AlbumVolumeCount = "album-disc-count";
+ public const string Location = "location";
+ public const string Description = "description";
+ public const string Version = "version";
+ public const string Isrc = "isrc";
+ public const string Organization = "organization";
+ public const string Copyright = "copyright";
+ public const string Contact = "contact";
+ public const string License = "license";
+ public const string Performer = "performer";
+ public const string Duration = "duration";
+ public const string Codec = "codec";
+ public const string VideoCodec = "video-codec";
+ public const string AudioCodec = "audio-codec";
+ public const string Bitrate = "bitrate";
+ public const string NominalBitrate = "nominal-bitrate";
+ public const string MinimumBitrate = "minimum-bitrate";
+ public const string MaximumBitrate = "maximum-bitrate";
+ public const string Serial = "serial";
+ public const string Encoder = "encoder";
+ public const string EncoderVersion = "encoder-version";
+ public const string TrackGain = "replaygain-track-gain";
+ public const string TrackPeak = "replaygain-track-peak";
+ public const string AlbumGain = "replaygain-album-gain";
+ public const string AlbumPeak = "replaygain-album-peak";
+ }
}
- [DllImport("gstreamer-0.10.dll")]
- static extern void gst_debug_set_default_threshold(Gst.DebugLevel debug_level);
+ [DllImport("gstreamer-0.10.dll")]
+ static extern void gst_debug_set_default_threshold(Gst.DebugLevel debug_level);
- public static void SetDefaultThreshold (Gst.DebugLevel debug_level)
- {
- gst_debug_set_default_threshold(debug_level);
- }
+ public static void SetDefaultThreshold(Gst.DebugLevel debug_level)
+ {
+ gst_debug_set_default_threshold(debug_level);
+ }
-//
-// Element.custom
-//
-// This code is inserted after the automatically generated code.
-//
-
- public new GLib.Value GetProperty (string property_name) {
- return base.GetProperty (property_name);
- }
-
- public new void SetProperty (string property_name, GLib.Value value) {
- base.SetProperty (property_name, value);
- }
-
- public void SetProperty (string property_name, string value) {
- GLib.Value val = new GLib.Value (value);
- base.SetProperty (property_name, val);
- }
-
- public void SetProperty (string property_name, double value) {
- GLib.Value val = new GLib.Value (value);
- base.SetProperty (property_name, val);
- }
-
- public void SetProperty (string property_name, bool value) {
- GLib.Value val = new GLib.Value (value);
- base.SetProperty (property_name, val);
- }
-
- [DllImport("gstreamer-0.10.dll")]
- static extern bool gst_element_query_position(IntPtr raw, ref Format format, out long cur);
-
- public bool QueryPosition(Gst.Format format, out long cur) {
- return gst_element_query_position(Handle, ref format, out cur);
- }
-
- [DllImport("gstreamer-0.10.dll")]
- static extern bool gst_element_query_duration(IntPtr raw, ref Format format, out long duration);
-
- public bool QueryDuration(Gst.Format format, out long duration) {
- return gst_element_query_duration(Handle, ref format, out duration);
- }
+
+ public new GLib.Value GetProperty(string propertyName)
+ {
+ return base.GetProperty(propertyName);
+ }
+
+ public new void SetProperty(string propertyName, GLib.Value value)
+ {
+ base.SetProperty(propertyName, value);
+ }
+
+ public void SetProperty(string propertyName, string value)
+ {
+ GLib.Value val = new GLib.Value(value);
+ base.SetProperty(propertyName, val);
+ }
+
+ public void SetProperty(string propertyName, double value)
+ {
+ GLib.Value val = new GLib.Value(value);
+ base.SetProperty(propertyName, val);
+ }
+
+ public void SetProperty(string propertyName, bool value)
+ {
+ GLib.Value val = new GLib.Value(value);
+ base.SetProperty(propertyName, val);
+ }
+
+ [DllImport("gstreamer-0.10.dll")]
+ private static extern bool gst_element_query_position(IntPtr raw, ref Format format, out long cur);
+
+ public bool QueryPosition(Gst.Format format, out long current)
+ {
+ return gst_element_query_position(Handle, ref format, out current);
+ }
+
+ [DllImport("gstreamer-0.10.dll")]
+ private static extern bool gst_element_query_duration(IntPtr raw, ref Format format, out long duration);
+
+ public bool QueryDuration(Gst.Format format, out long duration)
+ {
+ return gst_element_query_duration(Handle, ref format, out duration);
+ }
<?xml version="1.0"?>
<metadata>
+ <attr path="/api/namespace/object[@name='Bin']" name="disable_gtype_ctor">1</attr>
+ <attr path="/api/namespace/object[@name='Pipeline']" name="disable_gtype_ctor">1</attr>
+
+ <!-- TODO: Why doesn't this work? -->
+ <attr path="/api/namespace/class[@name='Bin']/property[@name='Children']" name="hidden">1</attr>
+ <attr path="/api/namespace/object[@name='Bin']/property[@name='ChildrenCount']" name="name">ChildCount</attr>
+
<attr path="/api/namespace/object[@name='Element']/signal[@name='NoMorePads']" name="name">HasNoMorePads</attr>
<!-- Hidden as the parameter name conflicts with generated code -->
<attr path="/api/namespace/object[@name='Element']/method[@name='ContinueState']/parameters/*[@name='ret']" name="name">state_change_ret</attr>
APIS = $(API)
API = gstreamer-api.xml
RAW_API = gstreamer-api.raw
-SYMBOLS = gstreamer-symbols.xml
METADATA = Gstreamer.metadata
+SYMBOLS=gstreamer-symbols.xml
ASSEMBLY_NAME = gstreamer-sharp
references = $(GLIBSHARP_LIBS)
KEYFILE = gstreamer-sharp.snk
sources = \
Application.cs \
+ Version.cs \
AssemblyInfo.cs \
CommonTags.cs \
plugins-base/PlayBin.cs
-
- [DllImport("gstsharpglue-0.10")]
- extern static IntPtr gstsharp_message_parse_error (IntPtr raw);
-
- public void ParseError (out string error)
- {
- IntPtr err = gstsharp_message_parse_error (Handle);
- error = GLib.Marshaller.PtrToStringGFree (err);
- }
+
+ [DllImport("gstsharpglue-0.10")]
+ private extern static IntPtr gstsharp_message_parse_error(IntPtr raw);
+
+ public void ParseError(out string error)
+ {
+ IntPtr err = gstsharp_message_parse_error(Handle);
+ error = GLib.Marshaller.PtrToStringGFree(err);
+ }
- [DllImport("gstreamer-0.10.dll")]
- static extern bool gst_pad_query_position(IntPtr raw, ref Format format, out long cur);
+
+ [DllImport("gstreamer-0.10.dll")]
+ private static extern bool gst_pad_query_position(IntPtr raw, ref Format format, out long cur);
- public bool QueryPosition(Gst.Format format, out long cur) {
- return gst_pad_query_position(Handle, ref format, out cur);
- }
+ public bool QueryPosition(Gst.Format format, out long current)
+ {
+ return gst_pad_query_position(Handle, ref format, out current);
+ }
- [DllImport("gstreamer-0.10.dll")]
- static extern bool gst_pad_query_duration(IntPtr raw, ref Format format, out long duration);
+ [DllImport("gstreamer-0.10.dll")]
+ private static extern bool gst_pad_query_duration(IntPtr raw, ref Format format, out long duration);
- public bool QueryDuration(Gst.Format format, out long duration) {
- return gst_pad_query_duration(Handle, ref format, out duration);
- }
+ public bool QueryDuration(Gst.Format format, out long duration)
+ {
+ return gst_pad_query_duration(Handle, ref format, out duration);
+ }
--- /dev/null
+//
+// Version.cs: Lightweight Version Object for GStreamer
+//
+// Authors:
+// Aaron Bockover (abockover@novell.com)
+//
+// (C) 2006 Novell, Inc.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Gst
+{
+ public class Version
+ {
+ private uint major;
+ private uint minor;
+ private uint micro;
+ private uint nano;
+ private string version_string;
+
+ internal Version()
+ {
+ gst_version(out major, out minor, out micro, out nano);
+ }
+
+ public override string ToString()
+ {
+ return String.Format("{0}.{1}.{2}.{3}", major, minor, micro, nano);
+ }
+
+ public string Description {
+ get {
+ if(version_string == null) {
+ IntPtr version_string_ptr = gst_version_string();
+ version_string = GLib.Marshaller.Utf8PtrToString(version_string_ptr);
+ }
+
+ return version_string;
+ }
+ }
+
+ public uint Major {
+ get { return major; }
+ }
+
+ public uint Minor {
+ get { return minor; }
+ }
+
+ public uint Micro {
+ get { return micro; }
+ }
+
+ public uint Nano {
+ get { return nano; }
+ }
+
+ [DllImport("gstreamer-0.10")]
+ private static extern void gst_version(out uint major, out uint minor, out uint micro, out uint nano);
+
+ [DllImport("gstreamer-0.10")]
+ private static extern IntPtr gst_version_string();
+ }
+}
\ No newline at end of file
lib_LTLIBRARIES = libgstreamersharpglue-0.10.la
-libgstreamersharpglue_0_10_la_SOURCES = \
- clock.c \
- message.c \
- miniobject.c
+libgstreamersharpglue_0_10_la_SOURCES = \
+ clock.c \
+ message.c \
+ miniobject.c
nodist_libgstreamersharpglue_0_10_la_SOURCES = generated.c
libgstreamersharpglue_0_10_la_LIBADD = $(GST_LIBS)
-INCLUDES = $(GST_CFLAGS) -I$(top_srcdir)
+INCLUDES = -Wall -D_FORTIFY_SOURCE=2 $(GST_CFLAGS) -I$(top_srcdir)
CLEANFILES= lib*.a lib*.la
MAINTAINERCLEANFILES = Makefile.in
-
#include <glib.h>
#include <gst/gstclock.h>
-
-gint64 gstsharp_gst_clock_get_gst_second ()
+gint64 gstsharp_gst_clock_get_gst_second()
{
- return GST_SECOND;
+ return GST_SECOND;
}
-gint64 gstsharp_gst_clock_get_gst_msecond ()
+gint64 gstsharp_gst_clock_get_gst_msecond()
{
- return GST_MSECOND;
+ return GST_MSECOND;
}
-gint64 gstsharp_gst_clock_get_gst_usecond ()
+gint64 gstsharp_gst_clock_get_gst_usecond()
{
- return GST_USECOND;
+ return GST_USECOND;
}
-gint64 gstsharp_gst_clock_get_gst_nsecond ()
+gint64 gstsharp_gst_clock_get_gst_nsecond()
{
- return GST_NSECOND;
+ return GST_NSECOND;
}
-
#include <glib/gerror.h>
#include <gst/gstmessage.h>
-gchar* gstsharp_message_parse_error (GstMessage *message)
+gchar *
+gstsharp_message_parse_error(GstMessage *message)
{
- GError *gerror;
- gchar *error;
+ GError *gerror;
+ gchar *error;
- gst_message_parse_error (message, &gerror, NULL);
+ gst_message_parse_error(message, &gerror, NULL);
- error = g_strdup (gerror->message);
- g_error_free (gerror);
- return error;
+ error = g_strdup(gerror->message);
+ g_error_free(gerror);
+
+ return error;
}
#include <gst/gstminiobject.h>
GType
-gstsharp_get_type_id (GObject *obj)
+gstsharp_get_type_id(GObject *obj)
{
- return G_TYPE_FROM_INSTANCE (obj);
+ return G_TYPE_FROM_INSTANCE(obj);
}
GType
-gstsharp_register_type (gchar *name, GType parent)
+gstsharp_register_type(gchar *name, GType parent)
{
- GTypeQuery query;
- GTypeInfo info = {0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL };
+ GTypeQuery query;
+ GTypeInfo info = { 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL };
- g_type_query (parent, &query);
+ g_type_query (parent, &query);
- info.class_size = query.class_size;
- info.instance_size = query.instance_size;
+ info.class_size = query.class_size;
+ info.instance_size = query.instance_size;
- return g_type_register_static (parent, name, &info, 0);
+ return g_type_register_static(parent, name, &info, 0);
}
+//
+// PlayBin.cs: playbin element binding
+//
+// Authors:
+// Aaron Bockover (abockover@novell.com)
+//
+// (C) 2006 Novell, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
namespace Gst
{
- using System;
- using System.Collections;
- using System.Runtime.InteropServices;
-
- using Gst;
-
- public class PlayBin : Pipeline {
- [Obsolete]
- protected PlayBin(GLib.GType gtype) : base(gtype) {}
- public PlayBin(IntPtr raw) : base(raw) {}
-
- [GLib.Property ("uri")]
- public string Uri {
- get {
- GLib.Value val = GetProperty ("uri");
- string ret = val.Val as string;
- val.Dispose ();
- return ret;
- }
-
- set {
- GLib.Value val = new GLib.Value (value);
- SetProperty ("uri", val);
- val.Dispose ();
- }
-
- }
-
- [GLib.Property ("source")]
- public Element Source {
- get {
- GLib.Value val = GetProperty ("source");
- Element element = val.Val as Element;
- val.Dispose ();
- return element;
- }
- }
- }
+ public class PlayBin : Pipeline
+ {
+ public PlayBin(IntPtr raw) : base(raw)
+ {
+ }
+
+ [GLib.Property("uri")]
+ public string Uri {
+ get {
+ GLib.Value val = GetProperty("uri");
+ string ret = val.Val as string;
+ val.Dispose();
+ return ret;
+ }
+
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("uri", val);
+ val.Dispose();
+ }
+ }
+
+ [GLib.Property("suburi")]
+ public string SubUri {
+ get {
+ GLib.Value val = GetProperty("suburi");
+ string ret = val.Val as string;
+ val.Dispose();
+ return ret;
+ }
+
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("suburi", val);
+ val.Dispose();
+ }
+ }
+
+ [GLib.Property("source")]
+ public Element Source {
+ get {
+ GLib.Value val = GetProperty("source");
+ Element element = val.Val as Element;
+ val.Dispose();
+ return element;
+ }
+ }
+
+ [GLib.Property("audio-sink")]
+ public Element AudioSink {
+ get {
+ GLib.Value val = GetProperty("audio-sink");
+ Element ret = val.Val as Element;
+ val.Dispose();
+ return ret;
+ }
+
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("audio-sink", val);
+ val.Dispose();
+ }
+ }
+
+ [GLib.Property("video-sink")]
+ public Element VideoSink {
+ get {
+ GLib.Value val = GetProperty("video-sink");
+ Element ret = val.Val as Element;
+ val.Dispose();
+ return ret;
+ }
+
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("video-sink", val);
+ val.Dispose();
+ }
+ }
+
+ [GLib.Property("vis-plugin")]
+ public Element VisPlugin {
+ get {
+ GLib.Value val = GetProperty("vis-plugin");
+ Element ret = val.Val as Element;
+ val.Dispose();
+ return ret;
+ }
+
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("vis-plugin", val);
+ val.Dispose();
+ }
+ }
+
+ [GLib.Property("volume")]
+ public double Volume {
+ get {
+ GLib.Value val = GetProperty("volume");
+ double ret = (double)val.Val;
+ val.Dispose();
+ return ret;
+ }
+
+ set {
+ GLib.Value val = new GLib.Value(value);
+ SetProperty("volume", val);
+ val.Dispose();
+ }
+ }
+ }
}
-EXTRA_DIST = \
- gstreamer-parsable.diff
-
+EXTRA_DIST = gstreamer-parsable.diff
MAINTAINERCLEANFILES = Makefile.in
-get-source-code:
- wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-$(GSTREAMER_REQUIRED_VERSION).tar.gz --output-document=- | tar -xz
+BASE_PATH="http://gstreamer.freedesktop.org/src"
+
+update-source:
+ wget -O - $(BASE_PATH)/gstreamer/gstreamer-$(GSTREAMER_REQUIRED_VERSION).tar.gz | tar xz
+ wget -O - $(BASE_PATH)/gst-plugins-base/gst-plugins-base-$(GSTREAMER_REQUIRED_VERSION).tar.gz | tar xz
patch -p0 < gstreamer-parsable.diff
api:
--- /dev/null
+//
+// ApplicationTest.cs: NUnit Test Suite for gstreamer-sharp
+//
+// Authors:
+// Aaron Bockover (abockover@novell.com)
+//
+// (C) 2006 Novell, Inc.
+//
+
+using System;
+using NUnit.Framework;
+
+[TestFixture]
+public class ApplicationTest
+{
+ [Test]
+ public void Init()
+ {
+ Gst.Application.Init();
+ Gst.Application.Deinit();
+ }
+
+ [Test]
+ public void InitArgs()
+ {
+ string [] args = { "arg_a", "arg_b" };
+ Gst.Application.Init("gstreamer-sharp-test", ref args);
+ Gst.Application.Deinit();
+ }
+
+ [Test]
+ public void InitArgsCheck()
+ {
+ string [] args = { "arg_a", "arg_b" };
+ Gst.Application.InitCheck("gstreamer-sharp-test", ref args);
+ Gst.Application.Deinit();
+ }
+
+ [Test]
+ public void TestVersion()
+ {
+ Assert.AreEqual(Gst.Application.Version.Minor, 10);
+ }
+
+ [Test]
+ public void TestVersionString()
+ {
+ Assert.IsNotNull(Gst.Application.Version.ToString());
+ }
+
+ [Test]
+ public void TestVersionDescription()
+ {
+ Assert.IsNotNull(Gst.Application.Version.Description);
+ }
+}
+
--- /dev/null
+//
+// BinTest.cs: NUnit Test Suite for gstreamer-sharp
+//
+// Authors:
+// Aaron Bockover (abockover@novell.com)
+//
+// (C) 2006 Novell, Inc.
+//
+
+using System;
+using NUnit.Framework;
+
+using Gst;
+
+[TestFixture]
+public class BinTest
+{
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ Application.Init();
+ }
+
+ [TestFixtureTearDown]
+ public void Deinit()
+ {
+ Application.Deinit();
+ }
+
+ [Test]
+ public void TestAddMany()
+ {
+ Bin bin = new Bin("test-bin");
+ Element e1 = ElementFactory.Make("fakesrc", "fakesrc");
+ Element e2 = ElementFactory.Make("fakesink", "fakesink");
+ bin.AddMany(e1, e2);
+
+ Assert.AreEqual(bin.List.Length, 2);
+
+ e1.Dispose();
+ e2.Dispose();
+ bin.Dispose();
+ }
+
+ [Test]
+ public void TestGetByName()
+ {
+ Bin bin = new Bin("test-bin");
+ Element e1 = ElementFactory.Make("fakesrc", "element-name");
+ bin.Add(e1);
+
+ e1 = bin.GetByName("element-name");
+
+ Assert.IsNotNull(e1);
+ Assert.AreEqual(e1.Name, "element-name");
+
+ e1.Dispose();
+ bin.Dispose();
+ }
+}
+
--- /dev/null
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig\r
+/************************************************************************************\r
+'\r
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole\r
+' Copyright © 2000-2003 Philip A. Craig\r
+'\r
+' This software is provided 'as-is', without any express or implied warranty. In no \r
+' event will the authors be held liable for any damages arising from the use of this \r
+' software.\r
+' \r
+' Permission is granted to anyone to use this software for any purpose, including \r
+' commercial applications, and to alter it and redistribute it freely, subject to the \r
+' following restrictions:\r
+'\r
+' 1. The origin of this software must not be misrepresented; you must not claim that \r
+' you wrote the original software. If you use this software in a product, an \r
+' acknowledgment (see the following) in the product documentation is required.\r
+'\r
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole\r
+' or Copyright © 2000-2003 Philip A. Craig\r
+'\r
+' 2. Altered source versions must be plainly marked as such, and must not be \r
+' misrepresented as being the original software.\r
+'\r
+' 3. This notice may not be removed or altered from any source distribution.\r
+'\r
+'***********************************************************************************/\r
+#endregion\r
+\r
+namespace NUnit.Console\r
+{\r
+ using System;\r
+ using System.Collections;\r
+ using System.Collections.Specialized;\r
+ using System.IO;\r
+ using System.Reflection;\r
+ using System.Xml;\r
+ using System.Xml.Xsl;\r
+ using System.Xml.XPath;\r
+ using System.Resources;\r
+ using System.Text;\r
+ using System.Text.RegularExpressions;\r
+ using System.Diagnostics;\r
+ using NUnit.Core;\r
+ using NUnit.Util;\r
+ \r
+\r
+ /// <summary>\r
+ /// Summary description for ConsoleUi.\r
+ /// </summary>\r
+ public class ConsoleUi\r
+ {\r
+ [STAThread]\r
+ public static int Main(string[] args)\r
+ {\r
+ ConsoleOptions options = new ConsoleOptions(args);\r
+ if(!options.nologo)\r
+ WriteCopyright();\r
+\r
+ if(options.help)\r
+ {\r
+ options.Help();\r
+ return 0;\r
+ }\r
+ \r
+ if(options.NoArgs) \r
+ {\r
+ Console.Error.WriteLine("fatal error: no inputs specified");\r
+ options.Help();\r
+ return 0;\r
+ }\r
+ \r
+ if(!options.Validate())\r
+ {\r
+ Console.Error.WriteLine("fatal error: invalid arguments");\r
+ options.Help();\r
+ return 2;\r
+ }\r
+\r
+ try\r
+ {\r
+ ConsoleUi consoleUi = new ConsoleUi();\r
+ consoleUi.Execute( options );\r
+ return 0;\r
+ }\r
+ catch( FileNotFoundException ex )\r
+ {\r
+ Console.WriteLine( ex.Message );\r
+ return 2;\r
+ }\r
+ catch( BadImageFormatException ex )\r
+ {\r
+ Console.WriteLine( ex.Message );\r
+ return 2;\r
+ }\r
+ catch( Exception ex )\r
+ {\r
+ Console.WriteLine( "Unhandled Exception:\n{0}", ex.ToString() );\r
+ return 2;\r
+ }\r
+ finally\r
+ {\r
+ if(options.wait)\r
+ {\r
+ Console.Out.WriteLine("\nHit <enter> key to continue");\r
+ Console.ReadLine();\r
+ }\r
+ }\r
+ }\r
+\r
+ private static XmlTextReader GetTransformReader(ConsoleOptions parser)\r
+ {\r
+ XmlTextReader reader = null;\r
+ if(!parser.IsTransform)\r
+ {\r
+ Assembly assembly = Assembly.GetAssembly(typeof(XmlResultVisitor));\r
+ ResourceManager resourceManager = new ResourceManager("NUnit.Util.Transform",assembly);\r
+ string xmlData = (string)resourceManager.GetObject("Summary.xslt");\r
+\r
+ reader = new XmlTextReader(new StringReader(xmlData));\r
+ }\r
+ else\r
+ {\r
+ FileInfo xsltInfo = new FileInfo(parser.transform);\r
+ if(!xsltInfo.Exists)\r
+ {\r
+ Console.Error.WriteLine("Transform file: {0} does not exist", xsltInfo.FullName);\r
+ reader = null;\r
+ }\r
+ else\r
+ {\r
+ reader = new XmlTextReader(xsltInfo.FullName);\r
+ }\r
+ }\r
+\r
+ return reader;\r
+ }\r
+\r
+ private static void WriteCopyright()\r
+ {\r
+ Assembly executingAssembly = Assembly.GetExecutingAssembly();\r
+ System.Version version = executingAssembly.GetName().Version;\r
+\r
+ string clrPlatform = Type.GetType("Mono.Runtime", false) == null ? ".NET" : "Mono";\r
+ Console.WriteLine( string.Format("OS Version: {0} {1} Version: {2}",\r
+ Environment.OSVersion, clrPlatform, Environment.Version ) );\r
+ Console.WriteLine();\r
+ }\r
+\r
+ private static Test MakeTestFromCommandLine(TestDomain testDomain, ConsoleOptions parser)\r
+ {\r
+ NUnitProject project;\r
+\r
+ if ( parser.IsTestProject )\r
+ {\r
+ project = NUnitProject.LoadProject( (string)parser.Parameters[0] );\r
+ string configName = (string) parser.config;\r
+ if ( configName != null )\r
+ project.SetActiveConfig( configName );\r
+ }\r
+ else\r
+ project = NUnitProject.FromAssemblies( (string[])parser.Parameters.ToArray( typeof( string ) ) );\r
+\r
+ return testDomain.Load( project, parser.fixture );\r
+ }\r
+\r
+ public ConsoleUi()\r
+ {\r
+ }\r
+\r
+ public int Execute( ConsoleOptions options )\r
+ {\r
+ XmlTextReader transformReader = GetTransformReader(options);\r
+ if(transformReader == null) return 3;\r
+\r
+ ConsoleWriter outStream = options.isOut\r
+ ? new ConsoleWriter( new StreamWriter( options.output ) )\r
+ : new ConsoleWriter(Console.Out);\r
+\r
+ ConsoleWriter errorStream = options.isErr\r
+ ? new ConsoleWriter( new StreamWriter( options.err ) )\r
+ : new ConsoleWriter(Console.Error);\r
+\r
+ TestDomain testDomain = new TestDomain(outStream, errorStream);\r
+ if ( options.noshadow ) testDomain.ShadowCopyFiles = false;\r
+\r
+ Test test = MakeTestFromCommandLine(testDomain, options);\r
+\r
+ if(test == null)\r
+ {\r
+ Console.Error.WriteLine("Unable to locate fixture {0}", options.fixture);\r
+ return 2;\r
+ }\r
+\r
+ Directory.SetCurrentDirectory(new FileInfo((string)options.Parameters[0]).DirectoryName);\r
+ \r
+ EventListener collector = new EventCollector( options, outStream );\r
+\r
+ string savedDirectory = Environment.CurrentDirectory;\r
+\r
+ if (options.HasInclude)\r
+ {\r
+ Console.WriteLine( "Included categories: " + options.include );\r
+ testDomain.SetFilter( new CategoryFilter( options.IncludedCategories ) );\r
+ }\r
+ else if ( options.HasExclude )\r
+ {\r
+ Console.WriteLine( "Excluded categories: " + options.exclude );\r
+ testDomain.SetFilter( new CategoryFilter( options.ExcludedCategories, true ) );\r
+ }\r
+\r
+ TestResult result = null;\r
+ if ( options.thread )\r
+ {\r
+ testDomain.RunTest( collector );\r
+ testDomain.Wait();\r
+ result = testDomain.Result;\r
+ }\r
+ else\r
+ {\r
+ result = testDomain.Run( collector );\r
+ }\r
+\r
+ Directory.SetCurrentDirectory( savedDirectory );\r
+ \r
+ Console.WriteLine();\r
+\r
+ string xmlOutput = CreateXmlOutput( result );\r
+ \r
+ if (options.xmlConsole)\r
+ Console.WriteLine(xmlOutput);\r
+ else\r
+ CreateSummaryDocument(xmlOutput, transformReader);\r
+\r
+ // Write xml output here\r
+ string xmlResultFile = options.IsXml ? options.xml : "TestResult.xml";\r
+\r
+ using ( StreamWriter writer = new StreamWriter( xmlResultFile ) ) \r
+ {\r
+ writer.Write(xmlOutput);\r
+ }\r
+\r
+ if ( testDomain != null )\r
+ testDomain.Unload();\r
+\r
+ return result.IsFailure ? 1 : 0;\r
+ }\r
+\r
+ private string CreateXmlOutput( TestResult result )\r
+ {\r
+ StringBuilder builder = new StringBuilder();\r
+ XmlResultVisitor resultVisitor = new XmlResultVisitor(new StringWriter( builder ), result);\r
+ result.Accept(resultVisitor);\r
+ resultVisitor.Write();\r
+\r
+ return builder.ToString();\r
+ }\r
+\r
+ private void CreateSummaryDocument(string xmlOutput, XmlTextReader transformReader)\r
+ {\r
+ XPathDocument originalXPathDocument = new XPathDocument(new StringReader(xmlOutput));\r
+ XslTransform summaryXslTransform = new XslTransform();\r
+ \r
+ // Using obsolete form for now, remove warning suppression from project after changing\r
+ summaryXslTransform.Load(transformReader);\r
+ \r
+ // Using obsolete form for now, remove warning suppression from project after changing\r
+ summaryXslTransform.Transform(originalXPathDocument,null,Console.Out);\r
+ }\r
+\r
+ #region Nested Class to Handle Events\r
+\r
+ private class EventCollector : LongLivingMarshalByRefObject, EventListener\r
+ {\r
+ private int testRunCount;\r
+ private int testIgnoreCount;\r
+ private int failureCount;\r
+ private int level;\r
+\r
+ private ConsoleOptions options;\r
+ private ConsoleWriter writer;\r
+\r
+ StringCollection messages;\r
+ \r
+ private bool debugger = false;\r
+ private string currentTestName;\r
+\r
+ public EventCollector( ConsoleOptions options, ConsoleWriter writer )\r
+ {\r
+ debugger = Debugger.IsAttached;\r
+ level = 0;\r
+ this.options = options;\r
+ this.writer = writer;\r
+ this.currentTestName = string.Empty;\r
+ }\r
+\r
+ public void RunStarted(Test[] tests)\r
+ {\r
+ }\r
+\r
+ public void RunFinished(TestResult[] results)\r
+ {\r
+ }\r
+\r
+ public void RunFinished(Exception exception)\r
+ {\r
+ }\r
+\r
+ public void TestFinished(TestCaseResult testResult)\r
+ {\r
+ if ( !options.xmlConsole && !options.labels )\r
+ {\r
+ if(testResult.Executed)\r
+ {\r
+ testRunCount++;\r
+ \r
+ if(testResult.IsFailure)\r
+ { \r
+ failureCount++;\r
+ Console.Write("F");\r
+ if ( debugger )\r
+ {\r
+ messages.Add( string.Format( "{0}) {1} :", failureCount, testResult.Test.FullName ) );\r
+ messages.Add( testResult.Message.Trim( Environment.NewLine.ToCharArray() ) );\r
+\r
+ string stackTrace = StackTraceFilter.Filter( testResult.StackTrace );\r
+ string[] trace = stackTrace.Split( System.Environment.NewLine.ToCharArray() );\r
+ foreach( string s in trace )\r
+ {\r
+ if ( s != string.Empty )\r
+ {\r
+ string link = Regex.Replace( s.Trim(), @".* in (.*):line (.*)", "$1($2)");\r
+ messages.Add( string.Format( "at\n{0}", link ) );\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ testIgnoreCount++;\r
+ Console.Write("N");\r
+ }\r
+ }\r
+\r
+ currentTestName = string.Empty;\r
+ }\r
+\r
+ public void TestStarted(TestCase testCase)\r
+ {\r
+ currentTestName = testCase.FullName;\r
+\r
+ if ( options.labels )\r
+ writer.WriteLine("***** {0}", testCase.FullName );\r
+ else if ( !options.xmlConsole )\r
+ Console.Write(".");\r
+}\r
+\r
+ public void SuiteStarted(TestSuite suite) \r
+ {\r
+ if ( debugger && level++ == 0 )\r
+ {\r
+ messages = new StringCollection();\r
+ testRunCount = 0;\r
+ testIgnoreCount = 0;\r
+ failureCount = 0;\r
+ Trace.WriteLine( "################################ UNIT TESTS ################################" );\r
+ Trace.WriteLine( "Running tests in '" + suite.FullName + "'..." );\r
+ }\r
+ }\r
+\r
+ public void SuiteFinished(TestSuiteResult suiteResult) \r
+ {\r
+ if ( debugger && --level == 0) \r
+ {\r
+ Trace.WriteLine( "############################################################################" );\r
+\r
+ if (messages.Count == 0) \r
+ {\r
+ Trace.WriteLine( "############## S U C C E S S #################" );\r
+ }\r
+ else \r
+ {\r
+ Trace.WriteLine( "############## F A I L U R E S #################" );\r
+ \r
+ foreach ( string s in messages ) \r
+ {\r
+ Trace.WriteLine(s);\r
+ }\r
+ }\r
+\r
+ Trace.WriteLine( "############################################################################" );\r
+ Trace.WriteLine( "Executed tests : " + testRunCount );\r
+ Trace.WriteLine( "Ignored tests : " + testIgnoreCount );\r
+ Trace.WriteLine( "Failed tests : " + failureCount );\r
+ Trace.WriteLine( "Total time : " + suiteResult.Time + " seconds" );\r
+ Trace.WriteLine( "############################################################################");\r
+ }\r
+ }\r
+\r
+ public void UnhandledException( Exception exception )\r
+ {\r
+ string msg = string.Format( "##### Unhandled Exception while running {0}", currentTestName );\r
+\r
+ // If we do labels, we already have a newline\r
+ if ( !options.labels ) writer.WriteLine();\r
+ writer.WriteLine( msg );\r
+ writer.WriteLine( exception.ToString() );\r
+\r
+ if ( debugger )\r
+ {\r
+ Trace.WriteLine( msg );\r
+ Trace.WriteLine( exception.ToString() );\r
+ }\r
+ }\r
+ }\r
+\r
+ #endregion\r
+ }\r
+}\r
+\r
--- /dev/null
+MCS_FLAGS = -debug
+NUNIT_FLAGS = @MONO_NUNIT_LIBS@
+
+ASSEMBLY_NAME = gstreamer-tests
+ASSEMBLY = $(ASSEMBLY_NAME).dll
+ASSEMBLY_CSFILES = $(srcdir)/ApplicationTest.cs $(srcdir)/BinTest.cs
+
+NUNIT_TESTER_NAME = ConsoleUi
+NUNIT_TESTER = $(NUNIT_TESTER_NAME).exe
+NUNIT_TESTER_CSFILES = $(srcdir)/$(NUNIT_TESTER_NAME).cs
+
+$(ASSEMBLY): $(ASSEMBLY_CSFILES)
+ $(CSC) $(MCS_FLAGS) $(NUNIT_FLAGS) -out:$@ -target:library -r:$(top_builddir)/gstreamer-sharp/gstreamer-sharp.dll $(ASSEMBLY_CSFILES)
+
+$(NUNIT_TESTER): $(NUNIT_TESTER_CSFILES)
+ $(CSC) $(MCS_FLAGS) -out:$@ $(NUNIT_FLAGS) $(NUNIT_TESTER_CSFILES)
+
+run-test: $(NUNIT_TESTER) $(ASSEMBLY)
+ MONO_PATH="../gstreamer-sharp/" mono --debug $(NUNIT_TESTER) $(ASSEMBLY)
+
+CLEANFILES = $(ASSEMBLY) $(NUNIT_TESTER) TestResult.xml
+DISTCLEANFILES = *.mdb Makefile.in *.dll *.exe
+