Fix indention everywhere

This commit is contained in:
Sebastian Dröge 2009-09-20 10:19:49 +02:00
parent bd9052c00a
commit 80a5794fc1
61 changed files with 1682 additions and 1793 deletions

View File

@ -28,8 +28,7 @@ namespace Gst {
public string TypeName { public string TypeName {
get { get {
return type_name; return type_name;
} } set {
set {
type_name = value; type_name = value;
} }
} }

View File

@ -57,8 +57,7 @@ public byte this [uint index] {
byte **raw_ptr = (byte **) ( ( (byte*) Handle) + data_offset); byte **raw_ptr = (byte **) ( ( (byte*) Handle) + data_offset);
return * ( (*raw_ptr) + index); return * ( (*raw_ptr) + index);
} }
} } set {
set {
if (index >= Size) if (index >= Size)
throw new ArgumentOutOfRangeException (); throw new ArgumentOutOfRangeException ();
if (!IsWritable) if (!IsWritable)
@ -95,8 +94,7 @@ public Gst.Caps Caps {
IntPtr raw_ret = gst_buffer_get_caps (Handle); IntPtr raw_ret = gst_buffer_get_caps (Handle);
Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) Gst.GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Caps), true); Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) Gst.GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Caps), true);
return ret; return ret;
} } set {
set {
if (!IsMetadataWritable) if (!IsMetadataWritable)
throw new ApplicationException (); throw new ApplicationException ();
gst_buffer_set_caps (Handle, value == null ? IntPtr.Zero : value.Handle); gst_buffer_set_caps (Handle, value == null ? IntPtr.Zero : value.Handle);

View File

@ -101,8 +101,7 @@ public Gst.Clock Master {
IntPtr raw_ret = gst_clock_get_master (Handle); IntPtr raw_ret = gst_clock_get_master (Handle);
Gst.Clock ret = Gst.GLib.Object.GetObject (raw_ret, true) as Gst.Clock; Gst.Clock ret = Gst.GLib.Object.GetObject (raw_ret, true) as Gst.Clock;
return ret; return ret;
} } set {
set {
if (!gst_clock_set_master (Handle, value == null ? IntPtr.Zero : value.Handle)) if (!gst_clock_set_master (Handle, value == null ? IntPtr.Zero : value.Handle))
throw new Exception (); throw new Exception ();
} }

View File

@ -56,8 +56,7 @@ namespace Gst {
public IntPtr Closure { public IntPtr Closure {
get { get {
return closure; return closure;
} } set {
set {
closure = value; closure = value;
} }
} }
@ -65,8 +64,7 @@ namespace Gst {
public uint HandlerId { public uint HandlerId {
get { get {
return handlerId; return handlerId;
} } set {
set {
handlerId = value; handlerId = value;
} }
} }
@ -74,8 +72,7 @@ namespace Gst {
public Delegate RegisteredHandler { public Delegate RegisteredHandler {
get { get {
return registeredHandler; return registeredHandler;
} } set {
set {
registeredHandler = value; registeredHandler = value;
} }
} }
@ -83,8 +80,7 @@ namespace Gst {
public Type ArgsType { public Type ArgsType {
get { get {
return argsType; return argsType;
} } set {
set {
argsType = value; argsType = value;
} }
} }

View File

@ -10,8 +10,7 @@ public ulong Timestamp {
ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset); ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset);
return (*raw_ptr); return (*raw_ptr);
} }
} } set {
set {
if (!IsWritable) if (!IsWritable)
throw new ApplicationException (); throw new ApplicationException ();
@ -38,8 +37,7 @@ public Gst.Object Src {
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset); IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
return Gst.GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object; return Gst.GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object;
} }
} } set {
set {
if (!IsWritable) if (!IsWritable)
throw new ApplicationException (); throw new ApplicationException ();
@ -64,8 +62,7 @@ public uint Seqnum {
uint raw_ret = gst_event_get_seqnum (Handle); uint raw_ret = gst_event_get_seqnum (Handle);
uint ret = raw_ret; uint ret = raw_ret;
return ret; return ret;
} } set {
set {
if (!IsWritable) if (!IsWritable)
throw new ApplicationException (); throw new ApplicationException ();

View File

@ -18,8 +18,7 @@ namespace Gst {
public uint Domain { public uint Domain {
get { get {
return domain_quark; return domain_quark;
} } set {
set {
domain_quark = value; domain_quark = value;
} }
} }
@ -27,8 +26,7 @@ namespace Gst {
public int Code { public int Code {
get { get {
return code; return code;
} } set {
set {
code = value; code = value;
} }
} }
@ -38,8 +36,7 @@ namespace Gst {
if (message == IntPtr.Zero) if (message == IntPtr.Zero)
return null; return null;
return Gst.GLib.Marshaller.Utf8PtrToString (message); return Gst.GLib.Marshaller.Utf8PtrToString (message);
} } set {
set {
if (message != IntPtr.Zero) if (message != IntPtr.Zero)
Gst.GLib.Marshaller.Free (message); Gst.GLib.Marshaller.Free (message);
message = Gst.GLib.Marshaller.StringToPtrGStrdup (value); message = Gst.GLib.Marshaller.StringToPtrGStrdup (value);

0
gstreamer-sharp/Iterator.custom Executable file → Normal file
View File

View File

@ -6,8 +6,7 @@ using Gst.GLib;
namespace Gst { namespace Gst {
internal static class Marshaller { internal static class Marshaller {
public static IntPtr StringArrayToNullTermPointer (string[] strs) public static IntPtr StringArrayToNullTermPointer (string[] strs) {
{
if (strs == null) if (strs == null)
return IntPtr.Zero; return IntPtr.Zero;
@ -24,8 +23,7 @@ namespace Gst {
[DllImport ("libglib-2.0-0.dll") ] [DllImport ("libglib-2.0-0.dll") ]
static extern void g_strfreev (IntPtr mem); static extern void g_strfreev (IntPtr mem);
public static string[] NullTermPtrToStringArray (IntPtr null_term_array, bool owned) public static string[] NullTermPtrToStringArray (IntPtr null_term_array, bool owned) {
{
if (null_term_array == IntPtr.Zero) if (null_term_array == IntPtr.Zero)
return new string [0]; return new string [0];

View File

@ -10,8 +10,7 @@ public ulong Timestamp {
ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset); ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset);
return (*raw_ptr); return (*raw_ptr);
} }
} } set {
set {
if (!IsWritable) if (!IsWritable)
throw new ApplicationException (); throw new ApplicationException ();
@ -38,8 +37,7 @@ public Gst.Object Src {
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset); IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
return Gst.GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object; return Gst.GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object;
} }
} } set {
set {
if (!IsWritable) if (!IsWritable)
throw new ApplicationException (); throw new ApplicationException ();
@ -64,8 +62,7 @@ public uint Seqnum {
uint raw_ret = gst_message_get_seqnum (Handle); uint raw_ret = gst_message_get_seqnum (Handle);
uint ret = raw_ret; uint ret = raw_ret;
return ret; return ret;
} } set {
set {
if (!IsWritable) if (!IsWritable)
throw new ApplicationException (); throw new ApplicationException ();
@ -84,8 +81,7 @@ public GLib.Value StreamStatusObject {
IntPtr raw_ret = gst_message_get_stream_status_object (Handle); IntPtr raw_ret = gst_message_get_stream_status_object (Handle);
GLib.Value ret = (Gst.GLib.Value) Marshal.PtrToStructure (raw_ret, typeof (Gst.GLib.Value)); GLib.Value ret = (Gst.GLib.Value) Marshal.PtrToStructure (raw_ret, typeof (Gst.GLib.Value));
return ret; return ret;
} } set {
set {
if (!IsWritable) if (!IsWritable)
throw new ApplicationException (); throw new ApplicationException ();

View File

@ -341,8 +341,7 @@ namespace Gst {
protected virtual IntPtr Raw { protected virtual IntPtr Raw {
get { get {
return handle; return handle;
} } set {
set {
if (handle != IntPtr.Zero) if (handle != IntPtr.Zero)
Objects.Remove (handle); Objects.Remove (handle);
handle = value; handle = value;
@ -409,8 +408,7 @@ namespace Gst {
get { get {
GstMiniObject inst_struct = (GstMiniObject) Marshal.PtrToStructure (Handle, typeof (GstMiniObject)); GstMiniObject inst_struct = (GstMiniObject) Marshal.PtrToStructure (Handle, typeof (GstMiniObject));
return inst_struct.flags; return inst_struct.flags;
} } set {
set {
GstMiniObject inst_struct = (GstMiniObject) Marshal.PtrToStructure (Handle, typeof (GstMiniObject)); GstMiniObject inst_struct = (GstMiniObject) Marshal.PtrToStructure (Handle, typeof (GstMiniObject));
inst_struct.flags = value; inst_struct.flags = value;
} }

View File

@ -4,8 +4,7 @@ public object this[string property] {
object o = v.Val; object o = v.Val;
v.Dispose (); v.Dispose ();
return o; return o;
} } set {
set {
Gst.GLib.Value v = new Gst.GLib.Value (this, property); Gst.GLib.Value v = new Gst.GLib.Value (this, property);
v.Val = value; v.Val = value;
SetProperty (property, v); SetProperty (property, v);
@ -75,8 +74,7 @@ static extern IntPtr gst_object_ref_sink (IntPtr raw);
protected override IntPtr Raw { protected override IntPtr Raw {
get { get {
return base.Raw; return base.Raw;
} } set {
set {
if (value != IntPtr.Zero) { if (value != IntPtr.Zero) {
gst_object_ref_sink (value); gst_object_ref_sink (value);
} }

View File

@ -41,8 +41,7 @@ public string Name {
IntPtr raw_ret = gst_structure_get_name (Handle); IntPtr raw_ret = gst_structure_get_name (Handle);
string ret = Gst.GLib.Marshaller.Utf8PtrToString (raw_ret); string ret = Gst.GLib.Marshaller.Utf8PtrToString (raw_ret);
return ret; return ret;
} } set {
set {
if (!IsMutable) if (!IsMutable)
throw new ApplicationException (); throw new ApplicationException ();

View File

@ -52,8 +52,7 @@ public class StreamInfo : Gst.GLib.Object {
bool ret = (bool) val; bool ret = (bool) val;
val.Dispose (); val.Dispose ();
return ret; return ret;
} } set {
set {
Gst.GLib.Value val = new Gst.GLib.Value (this, "mute"); Gst.GLib.Value val = new Gst.GLib.Value (this, "mute");
val.Val = value; val.Val = value;
SetProperty ("mute", val); SetProperty ("mute", val);

View File

@ -2,7 +2,8 @@
#include <gst/base/gstadapter.h> #include <gst/base/gstadapter.h>
GstBuffer * GstBuffer *
gstsharp_gst_adapter_peek_buffer (GstAdapter *adapter, guint size) { gstsharp_gst_adapter_peek_buffer (GstAdapter * adapter, guint size)
{
GstBuffer *ret = gst_buffer_try_new_and_alloc (size); GstBuffer *ret = gst_buffer_try_new_and_alloc (size);
if (ret == NULL) if (ret == NULL)

View File

@ -1,22 +1,25 @@
#include <gst/gst.h> #include <gst/gst.h>
guint guint
gstsharp_gst_clock_get_entries_changed_offset (void) { gstsharp_gst_clock_get_entries_changed_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstClock, entries_changed); return (guint) G_STRUCT_OFFSET (GstClock, entries_changed);
} }
guint guint
gstsharp_gst_clock_get_slave_lock_offset (void) { gstsharp_gst_clock_get_slave_lock_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstClock, slave_lock); return (guint) G_STRUCT_OFFSET (GstClock, slave_lock);
} }
guint guint
gstsharp_gst_clock_get_entries_offset (void) { gstsharp_gst_clock_get_entries_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstClock, entries); return (guint) G_STRUCT_OFFSET (GstClock, entries);
} }
guint guint
gstsharp_gst_clock_get_times_offset (void) { gstsharp_gst_clock_get_times_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstClock, times); return (guint) G_STRUCT_OFFSET (GstClock, times);
} }

View File

@ -11,4 +11,3 @@ gst__controllersharp_gst__controller_controller_get_object_offset (void)
{ {
return (guint) G_STRUCT_OFFSET (GstController, object); return (guint) G_STRUCT_OFFSET (GstController, object);
} }

View File

@ -19,25 +19,28 @@ get_threshold_class (GObject *obj)
while (HAS_PREFIX (g_type_name (gtype))) while (HAS_PREFIX (g_type_name (gtype)))
gtype = g_type_parent (gtype); gtype = g_type_parent (gtype);
klass = g_type_class_peek (gtype); klass = g_type_class_peek (gtype);
if (klass == NULL) klass = g_type_class_ref (gtype); if (klass == NULL)
klass = g_type_class_ref (gtype);
return klass; return klass;
} }
gboolean gboolean
gst__controllersharp_gst__controller_controlsource_base_bind (GstControlSource *csource, GParamSpec *pspec) gst__controllersharp_gst__controller_controlsource_base_bind (GstControlSource *
csource, GParamSpec * pspec)
{ {
GstControlSourceClass *parent = (GstControlSourceClass *) get_threshold_class (G_OBJECT (csource)); GstControlSourceClass *parent =
(GstControlSourceClass *) get_threshold_class (G_OBJECT (csource));
if (parent->bind) if (parent->bind)
return parent->bind (csource, pspec); return parent->bind (csource, pspec);
return FALSE; return FALSE;
} }
void void
gst__controllersharp_gst__controller_controlsource_override_bind (GType gtype, gpointer cb) gst__controllersharp_gst__controller_controlsource_override_bind (GType gtype,
gpointer cb)
{ {
GstControlSourceClass *klass = g_type_class_peek (gtype); GstControlSourceClass *klass = g_type_class_peek (gtype);
if (!klass) if (!klass)
klass = g_type_class_ref (gtype); klass = g_type_class_ref (gtype);
((GstControlSourceClass *) klass)->bind = cb; ((GstControlSourceClass *) klass)->bind = cb;
} }

View File

@ -29,5 +29,3 @@ gstglibsharp_g_thread_supported ()
{ {
return g_thread_supported (); return g_thread_supported ();
} }

View File

@ -2,27 +2,31 @@
#include <gst/interfaces/mixertrack.h> #include <gst/interfaces/mixertrack.h>
guint guint
gst__interfacessharp_gst__interfaces_mixertrack_get_label_offset (void) { gst__interfacessharp_gst__interfaces_mixertrack_get_label_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, label); return (guint) G_STRUCT_OFFSET (GstMixerTrack, label);
} }
guint guint
gst__interfacessharp_gst__interfaces_mixertrack_get_flags_offset (void) { gst__interfacessharp_gst__interfaces_mixertrack_get_flags_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, flags); return (guint) G_STRUCT_OFFSET (GstMixerTrack, flags);
} }
guint guint
gst__interfacessharp_gst__interfaces_mixertrack_get_num_channels_offset (void) { gst__interfacessharp_gst__interfaces_mixertrack_get_num_channels_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, num_channels); return (guint) G_STRUCT_OFFSET (GstMixerTrack, num_channels);
} }
guint guint
gst__interfacessharp_gst__interfaces_mixertrack_get_min_volume_offset (void) { gst__interfacessharp_gst__interfaces_mixertrack_get_min_volume_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, min_volume); return (guint) G_STRUCT_OFFSET (GstMixerTrack, min_volume);
} }
guint guint
gst__interfacessharp_gst__interfaces_mixertrack_get_max_volume_offset (void) { gst__interfacessharp_gst__interfaces_mixertrack_get_max_volume_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, max_volume); return (guint) G_STRUCT_OFFSET (GstMixerTrack, max_volume);
} }

View File

@ -5,4 +5,3 @@ gstsharp_gst_task_get_cond_offset (void)
{ {
return (guint) G_STRUCT_OFFSET (GstTask, cond); return (guint) G_STRUCT_OFFSET (GstTask, cond);
} }

View File

@ -5,4 +5,3 @@ gst__interfacessharp_gst__interfaces_tunernorm_get_framerate_offset (void)
{ {
return (guint) G_STRUCT_OFFSET (GstTunerNorm, framerate); return (guint) G_STRUCT_OFFSET (GstTunerNorm, framerate);
} }

View File

@ -14,14 +14,12 @@ using GLib;
using Gst; using Gst;
using Cairo; using Cairo;
public class AppSrcDemo public class AppSrcDemo {
{
static MainLoop loop; static MainLoop loop;
static Gst.App.AppSrc appsrc; static Gst.App.AppSrc appsrc;
static Pipeline pipeline; static Pipeline pipeline;
public static void Main (string[] args) public static void Main (string[] args) {
{
Application.Init(); Application.Init();
loop = new MainLoop(); loop = new MainLoop();
@ -50,8 +48,7 @@ public class AppSrcDemo
pipeline.SetState (State.Null); pipeline.SetState (State.Null);
} }
static void PushAppData(object o, Gst.App.NeedDataArgs args) static void PushAppData (object o, Gst.App.NeedDataArgs args) {
{
ulong mseconds = 0; ulong mseconds = 0;
if (appsrc.Clock != null) if (appsrc.Clock != null)
mseconds = appsrc.Clock.Time / Clock.MSecond; mseconds = appsrc.Clock.Time / Clock.MSecond;
@ -62,11 +59,9 @@ public class AppSrcDemo
} }
// Returns a byte[] presentation of one 640x480 BGRA frame using Cairo // Returns a byte[] presentation of one 640x480 BGRA frame using Cairo
static byte[] DrawData(ulong seconds) static byte[] DrawData (ulong seconds) {
{
Cairo.ImageSurface img = new Cairo.ImageSurface (Cairo.Format.Argb32, 640, 480); Cairo.ImageSurface img = new Cairo.ImageSurface (Cairo.Format.Argb32, 640, 480);
using(Cairo.Context context = new Cairo.Context(img)) using (Cairo.Context context = new Cairo.Context (img)) {
{
double dx = (double) (seconds % 2180) / 5; double dx = (double) (seconds % 2180) / 5;
context.Color = new Color (1.0, 1.0, 0); context.Color = new Color (1.0, 1.0, 0);
context.Paint(); context.Paint();
@ -82,8 +77,7 @@ public class AppSrcDemo
return data; return data;
} }
static void MessageHandler(object sender, MessageArgs args) static void MessageHandler (object sender, MessageArgs args) {
{
Message message = args.Message; Message message = args.Message;
string text = String.Format ("Message from {0}: \t{1}", message.Src.Name, message.Type); string text = String.Format ("Message from {0}: \t{1}", message.Src.Name, message.Type);
switch (message.Type) { switch (message.Type) {

View File

@ -15,19 +15,16 @@ using Gst.BasePlugins;
public delegate void ErrorHandler (object o, ErrorArgs args); public delegate void ErrorHandler (object o, ErrorArgs args);
public delegate void ProgressHandler (object o, ProgressArgs args); public delegate void ProgressHandler (object o, ProgressArgs args);
public class ErrorArgs : EventArgs public class ErrorArgs : EventArgs {
{
public string Error; public string Error;
} }
public class ProgressArgs : EventArgs public class ProgressArgs : EventArgs {
{
public long Duration; public long Duration;
public long Position; public long Position;
} }
public class DecodeBinTranscoder : IDisposable public class DecodeBinTranscoder : IDisposable {
{
private Pipeline pipeline; private Pipeline pipeline;
private FileSrc filesrc; private FileSrc filesrc;
private FileSink filesink; private FileSink filesink;
@ -41,13 +38,11 @@ public class DecodeBinTranscoder : IDisposable
public event ErrorHandler Error; public event ErrorHandler Error;
public event ProgressHandler Progress; public event ProgressHandler Progress;
public DecodeBinTranscoder() public DecodeBinTranscoder() {
{
ConstructPipeline(); ConstructPipeline();
} }
public void Transcode(string inputFile, string outputFile) public void Transcode (string inputFile, string outputFile) {
{
filesrc.Location = inputFile; filesrc.Location = inputFile;
filesink.Location = outputFile; filesink.Location = outputFile;
@ -55,21 +50,18 @@ public class DecodeBinTranscoder : IDisposable
progress_timeout = GLib.Timeout.Add (250, OnProgressTimeout); progress_timeout = GLib.Timeout.Add (250, OnProgressTimeout);
} }
public void Dispose() public void Dispose() {
{
pipeline.Dispose(); pipeline.Dispose();
} }
protected virtual void OnFinished() protected virtual void OnFinished() {
{
EventHandler handler = Finished; EventHandler handler = Finished;
if (handler != null) { if (handler != null) {
handler (this, new EventArgs()); handler (this, new EventArgs());
} }
} }
protected virtual void OnError(string error) protected virtual void OnError (string error) {
{
ErrorHandler handler = Error; ErrorHandler handler = Error;
if (handler != null) { if (handler != null) {
ErrorArgs args = new ErrorArgs(); ErrorArgs args = new ErrorArgs();
@ -78,8 +70,7 @@ public class DecodeBinTranscoder : IDisposable
} }
} }
protected virtual void OnProgress(long position, long duration) protected virtual void OnProgress (long position, long duration) {
{
ProgressHandler handler = Progress; ProgressHandler handler = Progress;
if (handler != null) { if (handler != null) {
ProgressArgs args = new ProgressArgs(); ProgressArgs args = new ProgressArgs();
@ -89,8 +80,7 @@ public class DecodeBinTranscoder : IDisposable
} }
} }
private void ConstructPipeline() private void ConstructPipeline() {
{
pipeline = new Pipeline ("pipeline"); pipeline = new Pipeline ("pipeline");
filesrc = ElementFactory.Make ("filesrc", "filesrc") as FileSrc; filesrc = ElementFactory.Make ("filesrc", "filesrc") as FileSrc;
@ -109,8 +99,7 @@ public class DecodeBinTranscoder : IDisposable
pipeline.Bus.AddWatch (new BusFunc (OnBusMessage)); pipeline.Bus.AddWatch (new BusFunc (OnBusMessage));
} }
private void OnNewDecodedPad(object o, DecodeBin.NewDecodedPadArgs args) private void OnNewDecodedPad (object o, DecodeBin.NewDecodedPadArgs args) {
{
Pad sinkpad = audioconvert.GetStaticPad ("sink"); Pad sinkpad = audioconvert.GetStaticPad ("sink");
if (sinkpad.IsLinked) { if (sinkpad.IsLinked) {
@ -127,8 +116,7 @@ public class DecodeBinTranscoder : IDisposable
args.Pad.Link (sinkpad); args.Pad.Link (sinkpad);
} }
private bool OnBusMessage(Bus bus, Message message) private bool OnBusMessage (Bus bus, Message message) {
{
switch (message.Type) { switch (message.Type) {
case MessageType.Error: case MessageType.Error:
string msg; string msg;
@ -147,8 +135,7 @@ public class DecodeBinTranscoder : IDisposable
return true; return true;
} }
private bool OnProgressTimeout() private bool OnProgressTimeout() {
{
long duration, position; long duration, position;
Gst.Format fmt = Gst.Format.Time; Gst.Format fmt = Gst.Format.Time;
@ -161,8 +148,7 @@ public class DecodeBinTranscoder : IDisposable
private static GLib.MainLoop loop; private static GLib.MainLoop loop;
public static void Main(string [] args) public static void Main (string [] args) {
{
if (args.Length < 2) { if (args.Length < 2) {
Console.WriteLine ("Usage: mono decodebin-transcoder.exe <input-file> <output-file>"); Console.WriteLine ("Usage: mono decodebin-transcoder.exe <input-file> <output-file>");
return; return;

View File

@ -2,18 +2,15 @@ using System;
using Gst; using Gst;
using GLib; using GLib;
public class HelloWorld public class HelloWorld {
{
private MainLoop loop; private MainLoop loop;
private Element pipeline, source, parser, decoder, conv, identity, sink; private Element pipeline, source, parser, decoder, conv, identity, sink;
public static void Main(string [] args) public static void Main (string [] args) {
{
new HelloWorld (args); new HelloWorld (args);
} }
public HelloWorld(string [] args) public HelloWorld (string [] args) {
{
Application.Init(); Application.Init();
loop = new MainLoop(); loop = new MainLoop();
@ -65,8 +62,7 @@ public class HelloWorld
pipeline.Dispose(); pipeline.Dispose();
} }
private bool BusCall(Bus bus, Message message) private bool BusCall (Bus bus, Message message) {
{
switch (message.Type) { switch (message.Type) {
case MessageType.Error: case MessageType.Error:
string msg; string msg;
@ -87,14 +83,12 @@ public class HelloWorld
return true; return true;
} }
private void OnHandoff(object o, Gst.GLib.SignalArgs args) private void OnHandoff (object o, Gst.GLib.SignalArgs args) {
{
Gst.Buffer buffer = args.Args[0] as Gst.Buffer; Gst.Buffer buffer = args.Args[0] as Gst.Buffer;
Console.WriteLine (buffer.Duration + "\t" + buffer.Timestamp); Console.WriteLine (buffer.Duration + "\t" + buffer.Timestamp);
} }
void OnPadAdded(object o, PadAddedArgs args) void OnPadAdded (object o, PadAddedArgs args) {
{
Console.WriteLine ("Entered OnPadAdded"); Console.WriteLine ("Entered OnPadAdded");
Pad sinkpad = decoder.GetStaticPad ("sink"); Pad sinkpad = decoder.GetStaticPad ("sink");
args.Pad.Link (sinkpad); args.Pad.Link (sinkpad);

View File

@ -9,10 +9,8 @@ using System;
using Gst; using Gst;
public class MP3LaunchParse public class MP3LaunchParse {
{ static void EventLoop (Element pipe) {
static void EventLoop (Element pipe)
{
Bus bus = pipe.Bus; Bus bus = pipe.Bus;
Message message = null; Message message = null;
@ -24,8 +22,7 @@ public class MP3LaunchParse
System.Application.Exit(); System.Application.Exit();
} }
switch(message.Type) switch (message.Type) {
{
case MessageType.Eos: case MessageType.Eos:
message.Dispose(); message.Dispose();
return; return;
@ -40,8 +37,7 @@ public class MP3LaunchParse
} }
} }
public static void Main(string [] args) public static void Main (string [] args) {
{
Application.Init(); Application.Init();
if (args.Length != 1) { if (args.Length != 1) {

View File

@ -3,15 +3,13 @@ using GLib;
using Gst; using Gst;
using Gst.BasePlugins; using Gst.BasePlugins;
public class PlayBinPlayer public class PlayBinPlayer {
{
private static MainLoop loop; private static MainLoop loop;
private static string[] songs; private static string[] songs;
private static int song_idx = 0; private static int song_idx = 0;
private static PlayBin play; private static PlayBin play;
public static void Main (string[] args) public static void Main (string[] args) {
{
if (args.Length < 1) { if (args.Length < 1) {
Console.WriteLine ("usage: mono playbin-player.exe audio_file_uri"); Console.WriteLine ("usage: mono playbin-player.exe audio_file_uri");
return; return;
@ -36,8 +34,7 @@ public class PlayBinPlayer
loop.Run (); loop.Run ();
} }
private static bool BusCb (Bus bus, Message message) private static bool BusCb (Bus bus, Message message) {
{
switch (message.Type) { switch (message.Type) {
case MessageType.Error: case MessageType.Error:
Enum err; Enum err;

View File

@ -8,8 +8,7 @@ using Gst;
using System; using System;
public class QueueExample { public class QueueExample {
public static void Main(string [] args) public static void Main (string [] args) {
{
Application.Init(); Application.Init();
if (args.Length != 1) { if (args.Length != 1) {
@ -38,8 +37,7 @@ public class QueueExample {
pipeline.SetState (State.Null); pipeline.SetState (State.Null);
} }
static void EventLoop(Element pipe) static void EventLoop (Element pipe) {
{
Bus bus = pipe.Bus; Bus bus = pipe.Bus;
while (true) { while (true) {

View File

@ -2,12 +2,10 @@ using System;
using Gst; using Gst;
using Gst.CorePlugins; using Gst.CorePlugins;
public static class GstTypefindTest public static class GstTypefindTest {
{
private static TypeFindElement typefind; private static TypeFindElement typefind;
public static void Main(string [] args) public static void Main (string [] args) {
{
Application.Init(); Application.Init();
Pipeline pipeline = new Pipeline ("pipeline"); Pipeline pipeline = new Pipeline ("pipeline");
@ -29,8 +27,7 @@ public static class GstTypefindTest
pipeline.Dispose(); pipeline.Dispose();
} }
private static void OnHaveType(object o, TypeFindElement.HaveTypeArgs args) private static void OnHaveType (object o, TypeFindElement.HaveTypeArgs args) {
{
Console.WriteLine ("MimeType: {0}", args.Caps); Console.WriteLine ("MimeType: {0}", args.Caps);
} }
} }

View File

@ -11,24 +11,20 @@ using System;
using NUnit.Framework; using NUnit.Framework;
[TestFixture] [TestFixture]
public class ApplicationTest public class ApplicationTest {
{
[Test] [Test]
public void Init() public void Init() {
{
Gst.Application.Init(); Gst.Application.Init();
} }
[Test] [Test]
public void InitArgs() public void InitArgs() {
{
string [] args = { "arg_a", "arg_b" }; string [] args = { "arg_a", "arg_b" };
Gst.Application.Init ("gstreamer-sharp-test", ref args); Gst.Application.Init ("gstreamer-sharp-test", ref args);
} }
[Test] [Test]
public void InitArgsCheck() public void InitArgsCheck() {
{
string [] args = { "arg_a", "arg_b" }; string [] args = { "arg_a", "arg_b" };
Gst.Application.InitCheck ("gstreamer-sharp-test", ref args); Gst.Application.InitCheck ("gstreamer-sharp-test", ref args);
} }

View File

@ -14,17 +14,14 @@ using Gst;
using Gst.CorePlugins; using Gst.CorePlugins;
[TestFixture] [TestFixture]
public class BinTest public class BinTest {
{
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init() {
{
Application.Init(); Application.Init();
} }
[Test] [Test]
public void TestAdd() public void TestAdd() {
{
Bin bin = new Bin ("test-bin"); Bin bin = new Bin ("test-bin");
Element e1 = new FakeSrc ("fakesrc"); Element e1 = new FakeSrc ("fakesrc");
Element e2 = new FakeSink ("fakesink"); Element e2 = new FakeSink ("fakesink");
@ -39,8 +36,7 @@ public class BinTest
} }
[Test] [Test]
public void TestAddRemove() public void TestAddRemove() {
{
Bin bin = ElementFactory.Make ("bin") as Bin; Bin bin = ElementFactory.Make ("bin") as Bin;
Assert.IsNotNull (bin, "Could not create bin"); Assert.IsNotNull (bin, "Could not create bin");
@ -65,8 +61,7 @@ public class BinTest
} }
[Test] [Test]
public void TestGetByName() public void TestGetByName() {
{
Bin bin = new Bin ("test-bin"); Bin bin = new Bin ("test-bin");
Element e1 = ElementFactory.Make ("fakesrc", "element-name"); Element e1 = ElementFactory.Make ("fakesrc", "element-name");
bin.Add (e1); bin.Add (e1);
@ -78,8 +73,7 @@ public class BinTest
} }
[Test] [Test]
public void TestGetChildByIndex() public void TestGetChildByIndex() {
{
Bin bin = new Bin ("test-bin"); Bin bin = new Bin ("test-bin");
Element [] elements = new Element [] { Element [] elements = new Element [] {
@ -101,8 +95,7 @@ public class BinTest
} }
[Test] [Test]
public void TestElements() public void TestElements() {
{
Bin bin = new Bin ("test-bin"); Bin bin = new Bin ("test-bin");
Element [] elements = new Element [] { Element [] elements = new Element [] {
@ -142,8 +135,7 @@ public class BinTest
} }
[Test] [Test]
public void TestGhostPad() public void TestGhostPad() {
{
new MyBin (); new MyBin ();
} }
} }

View File

@ -10,17 +10,14 @@ using NUnit.Framework;
using Gst; using Gst;
[TestFixture] [TestFixture]
public class BufferTest public class BufferTest {
{
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init() {
{
Application.Init(); Application.Init();
} }
[Test] [Test]
public void TestCaps() public void TestCaps() {
{
Gst.Buffer buffer = new Gst.Buffer (4); Gst.Buffer buffer = new Gst.Buffer (4);
Caps caps = Caps.FromString ("audio/x-raw-int"); Caps caps = Caps.FromString ("audio/x-raw-int");
@ -38,8 +35,7 @@ public class BufferTest
} }
[Test] [Test]
public void TestSubbuffer() public void TestSubbuffer() {
{
Gst.Buffer buffer = new Gst.Buffer (4); Gst.Buffer buffer = new Gst.Buffer (4);
Gst.Buffer sub = buffer.CreateSub (1, 2); Gst.Buffer sub = buffer.CreateSub (1, 2);
Assert.IsNotNull (sub); Assert.IsNotNull (sub);
@ -47,8 +43,7 @@ public class BufferTest
} }
[Test] [Test]
public void TestIsSpanFast() public void TestIsSpanFast() {
{
Gst.Buffer buffer = new Gst.Buffer (4); Gst.Buffer buffer = new Gst.Buffer (4);
Gst.Buffer sub1 = buffer.CreateSub (0, 2); Gst.Buffer sub1 = buffer.CreateSub (0, 2);
@ -62,16 +57,14 @@ public class BufferTest
Assert.IsTrue (sub1.IsSpanFast (sub2), "two subbuffers next to each other should be SpanFast"); Assert.IsTrue (sub1.IsSpanFast (sub2), "two subbuffers next to each other should be SpanFast");
} }
private void ArrayIsEqual (byte[] a, byte[] b) private void ArrayIsEqual (byte[] a, byte[] b) {
{
Assert.IsTrue (a.Length == b.Length); Assert.IsTrue (a.Length == b.Length);
for (int i = 0; i < a.Length; i++) for (int i = 0; i < a.Length; i++)
Assert.IsTrue (a[i] == b[i]); Assert.IsTrue (a[i] == b[i]);
} }
[Test] [Test]
public void TestBufferData() public void TestBufferData() {
{
byte[] data = new byte[] {0, 1, 2, 3, 4, 5}; byte[] data = new byte[] {0, 1, 2, 3, 4, 5};
Gst.Buffer buffer = new Gst.Buffer (data); Gst.Buffer buffer = new Gst.Buffer (data);

View File

@ -12,25 +12,21 @@ using NUnit.Framework;
using Gst; using Gst;
[TestFixture] [TestFixture]
public class CapsTest public class CapsTest {
{
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init() {
{
Application.Init(); Application.Init();
} }
[Test] [Test]
public void TestPlainCreation() public void TestPlainCreation() {
{
Caps caps = new Caps(); Caps caps = new Caps();
Assert.IsNotNull (caps); Assert.IsNotNull (caps);
Assert.IsFalse (caps.Handle == IntPtr.Zero, "Ooops, null handle"); Assert.IsFalse (caps.Handle == IntPtr.Zero, "Ooops, null handle");
} }
[Test] [Test]
public void TestFromString() public void TestFromString() {
{
Caps caps = Caps.FromString ("video/x-raw-yuv, " + Caps caps = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " + "format=(fourcc)I420, " +
"width=(int)384, " + "width=(int)384, " +
@ -45,8 +41,7 @@ public class CapsTest
} }
[Test] [Test]
public void TestIntersecting() public void TestIntersecting() {
{
Caps caps1 = Caps.FromString ("video/x-raw-yuv, " + Caps caps1 = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " + "format=(fourcc)I420, " +
"width=(int)[ 1,1000 ], " + "width=(int)[ 1,1000 ], " +
@ -71,8 +66,7 @@ public class CapsTest
} }
[Test] [Test]
public void TestUnion() public void TestUnion() {
{
Caps caps1 = Caps.FromString ("video/x-raw-yuv, " + Caps caps1 = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " + "format=(fourcc)I420, " +
"width=(int)640"); "width=(int)640");

View File

@ -13,17 +13,14 @@ using Gst;
using Gst.GLib; using Gst.GLib;
[TestFixture] [TestFixture]
public class ElementTest public class ElementTest {
{
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init() {
{
Application.Init(); Application.Init();
} }
[Test] [Test]
public void TestLinkNoPads() public void TestLinkNoPads() {
{
Element src = new Bin ("src"); Element src = new Bin ("src");
Element sink = new Bin ("sink"); Element sink = new Bin ("sink");
@ -47,14 +44,12 @@ public class ElementTest
} }
[Test] [Test]
public void TestAddRemovePad() public void TestAddRemovePad() {
{
new PadAddElement (); new PadAddElement ();
} }
[Test] [Test]
public void TestLink() public void TestLink() {
{
State state, pending; State state, pending;
Element source = ElementFactory.Make ("fakesrc", "source"); Element source = ElementFactory.Make ("fakesrc", "source");
@ -222,8 +217,7 @@ public class ElementTest
} }
[Test] [Test]
public void TestSubclasses () public void TestSubclasses () {
{
TestSubclassesApp.Run (); TestSubclassesApp.Run ();
} }
} }

View File

@ -9,17 +9,14 @@ using System;
using NUnit.Framework; using NUnit.Framework;
using Gst; using Gst;
public class MessageTest public class MessageTest {
{
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init() {
{
Application.Init(); Application.Init();
} }
[Test] [Test]
public void TestParsing() public void TestParsing() {
{
Message message = Message.NewEos (null); Message message = Message.NewEos (null);
Assert.IsNotNull (message); Assert.IsNotNull (message);
Assert.AreEqual (message.Type, MessageType.Eos); Assert.AreEqual (message.Type, MessageType.Eos);

View File

@ -13,17 +13,14 @@ using NUnit.Framework;
using Gst; using Gst;
[TestFixture] [TestFixture]
public class PadTest public class PadTest {
{
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init() {
{
Application.Init(); Application.Init();
} }
[Test] [Test]
public void TestPlainCreation() public void TestPlainCreation() {
{
Pad src = new Pad ("src", PadDirection.Src); Pad src = new Pad ("src", PadDirection.Src);
Pad sink = new Pad ("sink", PadDirection.Sink); Pad sink = new Pad ("sink", PadDirection.Sink);
@ -37,14 +34,12 @@ public class PadTest
Assert.AreEqual (PadDirection.Sink, sink.Direction); Assert.AreEqual (PadDirection.Sink, sink.Direction);
} }
public static Caps PadGetCapsStub(Pad pad) public static Caps PadGetCapsStub (Pad pad) {
{
return Caps.FromString ("video/x-raw-yuv"); return Caps.FromString ("video/x-raw-yuv");
} }
[Test] [Test]
public void TestFuncAssigning() public void TestFuncAssigning() {
{
Pad src = new Pad ("src", PadDirection.Src); Pad src = new Pad ("src", PadDirection.Src);
src.GetCapsFunction = new PadGetCapsFunction (PadGetCapsStub); src.GetCapsFunction = new PadGetCapsFunction (PadGetCapsStub);
@ -56,8 +51,7 @@ public class PadTest
} }
[Test] [Test]
public void TestElementPadAccessByName() public void TestElementPadAccessByName() {
{
Element element = ElementFactory.Make ("identity"); Element element = ElementFactory.Make ("identity");
Assert.IsNotNull (element); Assert.IsNotNull (element);
Assert.IsFalse (element.Handle == IntPtr.Zero, "Ooops, identity element has null handle"); Assert.IsFalse (element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
@ -79,8 +73,7 @@ public class PadTest
} }
[Test] [Test]
public void TestElementPadAccessByList() public void TestElementPadAccessByList() {
{
Element element = ElementFactory.Make ("identity"); Element element = ElementFactory.Make ("identity");
Assert.IsNotNull (element); Assert.IsNotNull (element);
Assert.IsFalse (element.Handle == IntPtr.Zero, "Ooops, identity element has null handle"); Assert.IsFalse (element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
@ -100,8 +93,7 @@ public class PadTest
} }
[Test] [Test]
public void TestLink() public void TestLink() {
{
Pad src = new Pad ("source", PadDirection.Src); Pad src = new Pad ("source", PadDirection.Src);
Assert.IsNotNull (src, "Pad could not be created"); Assert.IsNotNull (src, "Pad could not be created");
@ -115,8 +107,7 @@ public class PadTest
} }
[Test] [Test]
public void TestGetAllowedCaps() public void TestGetAllowedCaps() {
{
Caps caps; Caps caps;
Pad sink = new Pad ("sink", PadDirection.Sink); Pad sink = new Pad ("sink", PadDirection.Sink);
@ -140,15 +131,13 @@ public class PadTest
Assert.IsTrue (gotcaps.IsEqual (caps)); Assert.IsTrue (gotcaps.IsEqual (caps));
} }
bool ProbeHandler(Pad pad, Gst.Buffer buffer) bool ProbeHandler (Pad pad, Gst.Buffer buffer) {
{
//Console.WriteLine("event worked"); //Console.WriteLine("event worked");
return false; return false;
} }
[Test] [Test]
public void TestPushUnlinked() public void TestPushUnlinked() {
{
Pad src = new Pad ("src", PadDirection.Src); Pad src = new Pad ("src", PadDirection.Src);
Assert.IsNotNull (src, "Could not create src"); Assert.IsNotNull (src, "Could not create src");
Caps caps = src.AllowedCaps; Caps caps = src.AllowedCaps;

View File

@ -13,17 +13,14 @@ using Gst;
using Gst.CorePlugins; using Gst.CorePlugins;
[TestFixture] [TestFixture]
public class PipelineTest public class PipelineTest {
{
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init() {
{
Application.Init(); Application.Init();
} }
[Test] [Test]
public void TestPipeline() public void TestPipeline() {
{
Pipeline pipeline = new Pipeline(); Pipeline pipeline = new Pipeline();
Assert.IsNotNull (pipeline, "Could not create pipeline"); Assert.IsNotNull (pipeline, "Could not create pipeline");
Assert.IsNotNull (pipeline.Bus, "Bus on pipeline is null"); Assert.IsNotNull (pipeline.Bus, "Bus on pipeline is null");
@ -31,8 +28,7 @@ public class PipelineTest
} }
[Test] [Test]
public void TestAsyncStateChangeEmpty() public void TestAsyncStateChangeEmpty() {
{
Pipeline pipeline = new Pipeline(); Pipeline pipeline = new Pipeline();
Assert.IsNotNull (pipeline, "Could not create pipeline"); Assert.IsNotNull (pipeline, "Could not create pipeline");
@ -40,8 +36,7 @@ public class PipelineTest
} }
[Test] [Test]
public void TestAsyncStateChangeFakeReady() public void TestAsyncStateChangeFakeReady() {
{
Pipeline pipeline = new Pipeline(); Pipeline pipeline = new Pipeline();
Element src = ElementFactory.Make ("fakesrc"); Element src = ElementFactory.Make ("fakesrc");
Element sink = ElementFactory.Make ("fakesink"); Element sink = ElementFactory.Make ("fakesink");
@ -54,8 +49,7 @@ public class PipelineTest
} }
[Test] [Test]
public void TestAsyncStateChangeFake() public void TestAsyncStateChangeFake() {
{
bool done = false; bool done = false;
Pipeline pipeline = new Pipeline(); Pipeline pipeline = new Pipeline();
Assert.IsNotNull (pipeline, "Could not create pipeline"); Assert.IsNotNull (pipeline, "Could not create pipeline");
@ -90,10 +84,8 @@ public class PipelineTest
bool MessageReceived (Bus bus, Message message) { bool MessageReceived (Bus bus, Message message) {
MessageType type = message.Type; MessageType type = message.Type;
switch(type) switch (type) {
{ case MessageType.StateChanged: {
case MessageType.StateChanged:
{
State old, newState, pending; State old, newState, pending;
message.ParseStateChanged (out old, out newState, out pending); message.ParseStateChanged (out old, out newState, out pending);
if (message.Src == (Gst.Object) pipeline && newState == State.Playing) { if (message.Src == (Gst.Object) pipeline && newState == State.Playing) {
@ -103,25 +95,23 @@ public class PipelineTest
} }
case MessageType.Error: case MessageType.Error:
break; break;
default: break; default:
break;
} }
return true; return true;
} }
[Test] [Test]
public void TestBusAddWatch() public void TestBusAddWatch() {
{
TestBusCallback (true); TestBusCallback (true);
} }
[Test] [Test]
public void TestBusAddSignalWatch() public void TestBusAddSignalWatch() {
{
TestBusCallback (false); TestBusCallback (false);
} }
public void TestBusCallback(bool use_AddWatch) public void TestBusCallback (bool use_AddWatch) {
{
pipeline = new Pipeline(); pipeline = new Pipeline();
Assert.IsNotNull (pipeline, "Could not create pipeline"); Assert.IsNotNull (pipeline, "Could not create pipeline");
@ -138,7 +128,9 @@ public class PipelineTest
pipeline.Bus.AddWatch (new BusFunc (MessageReceived)); pipeline.Bus.AddWatch (new BusFunc (MessageReceived));
else { else {
pipeline.Bus.AddSignalWatch(); pipeline.Bus.AddSignalWatch();
pipeline.Bus.Message += delegate (object o, MessageArgs args) {MessageReceived(null, args.Message);}; pipeline.Bus.Message += delegate (object o, MessageArgs args) {
MessageReceived (null, args.Message);
};
} }
Assert.AreEqual (pipeline.SetState (State.Playing), StateChangeReturn.Async); Assert.AreEqual (pipeline.SetState (State.Playing), StateChangeReturn.Async);