Fix indention everywhere
This commit is contained in:
parent
bd9052c00a
commit
80a5794fc1
@ -28,8 +28,7 @@ namespace Gst {
|
||||
public string TypeName {
|
||||
get {
|
||||
return type_name;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
type_name = value;
|
||||
}
|
||||
}
|
||||
|
@ -57,8 +57,7 @@ public byte this [uint index] {
|
||||
byte **raw_ptr = (byte **) ( ( (byte*) Handle) + data_offset);
|
||||
return * ( (*raw_ptr) + index);
|
||||
}
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (index >= Size)
|
||||
throw new ArgumentOutOfRangeException ();
|
||||
if (!IsWritable)
|
||||
@ -95,8 +94,7 @@ public Gst.Caps Caps {
|
||||
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);
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsMetadataWritable)
|
||||
throw new ApplicationException ();
|
||||
gst_buffer_set_caps (Handle, value == null ? IntPtr.Zero : value.Handle);
|
||||
|
@ -101,8 +101,7 @@ public Gst.Clock Master {
|
||||
IntPtr raw_ret = gst_clock_get_master (Handle);
|
||||
Gst.Clock ret = Gst.GLib.Object.GetObject (raw_ret, true) as Gst.Clock;
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!gst_clock_set_master (Handle, value == null ? IntPtr.Zero : value.Handle))
|
||||
throw new Exception ();
|
||||
}
|
||||
|
@ -56,8 +56,7 @@ namespace Gst {
|
||||
public IntPtr Closure {
|
||||
get {
|
||||
return closure;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
closure = value;
|
||||
}
|
||||
}
|
||||
@ -65,8 +64,7 @@ namespace Gst {
|
||||
public uint HandlerId {
|
||||
get {
|
||||
return handlerId;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
handlerId = value;
|
||||
}
|
||||
}
|
||||
@ -74,8 +72,7 @@ namespace Gst {
|
||||
public Delegate RegisteredHandler {
|
||||
get {
|
||||
return registeredHandler;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
registeredHandler = value;
|
||||
}
|
||||
}
|
||||
@ -83,8 +80,7 @@ namespace Gst {
|
||||
public Type ArgsType {
|
||||
get {
|
||||
return argsType;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
argsType = value;
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,7 @@ public ulong Timestamp {
|
||||
ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset);
|
||||
return (*raw_ptr);
|
||||
}
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
@ -38,8 +37,7 @@ public Gst.Object Src {
|
||||
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
|
||||
return Gst.GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object;
|
||||
}
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
@ -64,8 +62,7 @@ public uint Seqnum {
|
||||
uint raw_ret = gst_event_get_seqnum (Handle);
|
||||
uint ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
|
@ -18,8 +18,7 @@ namespace Gst {
|
||||
public uint Domain {
|
||||
get {
|
||||
return domain_quark;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
domain_quark = value;
|
||||
}
|
||||
}
|
||||
@ -27,8 +26,7 @@ namespace Gst {
|
||||
public int Code {
|
||||
get {
|
||||
return code;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
code = value;
|
||||
}
|
||||
}
|
||||
@ -38,8 +36,7 @@ namespace Gst {
|
||||
if (message == IntPtr.Zero)
|
||||
return null;
|
||||
return Gst.GLib.Marshaller.Utf8PtrToString (message);
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (message != IntPtr.Zero)
|
||||
Gst.GLib.Marshaller.Free (message);
|
||||
message = Gst.GLib.Marshaller.StringToPtrGStrdup (value);
|
||||
|
0
gstreamer-sharp/Iterator.custom
Executable file → Normal file
0
gstreamer-sharp/Iterator.custom
Executable file → Normal file
@ -6,8 +6,7 @@ using Gst.GLib;
|
||||
namespace Gst {
|
||||
internal static class Marshaller {
|
||||
|
||||
public static IntPtr StringArrayToNullTermPointer (string[] strs)
|
||||
{
|
||||
public static IntPtr StringArrayToNullTermPointer (string[] strs) {
|
||||
if (strs == null)
|
||||
return IntPtr.Zero;
|
||||
|
||||
@ -24,8 +23,7 @@ namespace Gst {
|
||||
[DllImport ("libglib-2.0-0.dll") ]
|
||||
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)
|
||||
return new string [0];
|
||||
|
||||
|
@ -10,8 +10,7 @@ public ulong Timestamp {
|
||||
ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset);
|
||||
return (*raw_ptr);
|
||||
}
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
@ -38,8 +37,7 @@ public Gst.Object Src {
|
||||
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
|
||||
return Gst.GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object;
|
||||
}
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
@ -64,8 +62,7 @@ public uint Seqnum {
|
||||
uint raw_ret = gst_message_get_seqnum (Handle);
|
||||
uint ret = raw_ret;
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
@ -84,8 +81,7 @@ public GLib.Value StreamStatusObject {
|
||||
IntPtr raw_ret = gst_message_get_stream_status_object (Handle);
|
||||
GLib.Value ret = (Gst.GLib.Value) Marshal.PtrToStructure (raw_ret, typeof (Gst.GLib.Value));
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
|
@ -341,8 +341,7 @@ namespace Gst {
|
||||
protected virtual IntPtr Raw {
|
||||
get {
|
||||
return handle;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (handle != IntPtr.Zero)
|
||||
Objects.Remove (handle);
|
||||
handle = value;
|
||||
@ -409,8 +408,7 @@ namespace Gst {
|
||||
get {
|
||||
GstMiniObject inst_struct = (GstMiniObject) Marshal.PtrToStructure (Handle, typeof (GstMiniObject));
|
||||
return inst_struct.flags;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
GstMiniObject inst_struct = (GstMiniObject) Marshal.PtrToStructure (Handle, typeof (GstMiniObject));
|
||||
inst_struct.flags = value;
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ public object this[string property] {
|
||||
object o = v.Val;
|
||||
v.Dispose ();
|
||||
return o;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
Gst.GLib.Value v = new Gst.GLib.Value (this, property);
|
||||
v.Val = value;
|
||||
SetProperty (property, v);
|
||||
@ -75,8 +74,7 @@ static extern IntPtr gst_object_ref_sink (IntPtr raw);
|
||||
protected override IntPtr Raw {
|
||||
get {
|
||||
return base.Raw;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (value != IntPtr.Zero) {
|
||||
gst_object_ref_sink (value);
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ public string Name {
|
||||
IntPtr raw_ret = gst_structure_get_name (Handle);
|
||||
string ret = Gst.GLib.Marshaller.Utf8PtrToString (raw_ret);
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
if (!IsMutable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
|
@ -52,8 +52,7 @@ public class StreamInfo : Gst.GLib.Object {
|
||||
bool ret = (bool) val;
|
||||
val.Dispose ();
|
||||
return ret;
|
||||
}
|
||||
set {
|
||||
} set {
|
||||
Gst.GLib.Value val = new Gst.GLib.Value (this, "mute");
|
||||
val.Val = value;
|
||||
SetProperty ("mute", val);
|
||||
|
@ -2,7 +2,8 @@
|
||||
#include <gst/base/gstadapter.h>
|
||||
|
||||
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);
|
||||
|
||||
if (ret == NULL)
|
||||
|
@ -1,22 +1,25 @@
|
||||
#include <gst/gst.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
guint
|
||||
gstsharp_gst_clock_get_entries_offset (void) {
|
||||
gstsharp_gst_clock_get_entries_offset (void)
|
||||
{
|
||||
return (guint) G_STRUCT_OFFSET (GstClock, entries);
|
||||
}
|
||||
|
||||
guint
|
||||
gstsharp_gst_clock_get_times_offset (void) {
|
||||
gstsharp_gst_clock_get_times_offset (void)
|
||||
{
|
||||
return (guint) G_STRUCT_OFFSET (GstClock, times);
|
||||
}
|
||||
|
||||
|
@ -11,4 +11,3 @@ gst__controllersharp_gst__controller_controller_get_object_offset (void)
|
||||
{
|
||||
return (guint) G_STRUCT_OFFSET (GstController, object);
|
||||
}
|
||||
|
||||
|
@ -19,25 +19,28 @@ get_threshold_class (GObject *obj)
|
||||
while (HAS_PREFIX (g_type_name (gtype)))
|
||||
gtype = g_type_parent (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;
|
||||
}
|
||||
|
||||
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)
|
||||
return parent->bind (csource, pspec);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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);
|
||||
if (!klass)
|
||||
klass = g_type_class_ref (gtype);
|
||||
((GstControlSourceClass *) klass)->bind = cb;
|
||||
}
|
||||
|
||||
|
@ -29,5 +29,3 @@ gstglibsharp_g_thread_supported ()
|
||||
{
|
||||
return g_thread_supported ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,27 +2,31 @@
|
||||
#include <gst/interfaces/mixertrack.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -5,4 +5,3 @@ gstsharp_gst_task_get_cond_offset (void)
|
||||
{
|
||||
return (guint) G_STRUCT_OFFSET (GstTask, cond);
|
||||
}
|
||||
|
||||
|
@ -5,4 +5,3 @@ gst__interfacessharp_gst__interfaces_tunernorm_get_framerate_offset (void)
|
||||
{
|
||||
return (guint) G_STRUCT_OFFSET (GstTunerNorm, framerate);
|
||||
}
|
||||
|
||||
|
@ -14,14 +14,12 @@ using GLib;
|
||||
using Gst;
|
||||
using Cairo;
|
||||
|
||||
public class AppSrcDemo
|
||||
{
|
||||
public class AppSrcDemo {
|
||||
static MainLoop loop;
|
||||
static Gst.App.AppSrc appsrc;
|
||||
static Pipeline pipeline;
|
||||
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
public static void Main (string[] args) {
|
||||
Application.Init();
|
||||
loop = new MainLoop();
|
||||
|
||||
@ -50,8 +48,7 @@ public class AppSrcDemo
|
||||
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;
|
||||
if (appsrc.Clock != null)
|
||||
mseconds = appsrc.Clock.Time / Clock.MSecond;
|
||||
@ -62,11 +59,9 @@ public class AppSrcDemo
|
||||
}
|
||||
|
||||
// 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);
|
||||
using(Cairo.Context context = new Cairo.Context(img))
|
||||
{
|
||||
using (Cairo.Context context = new Cairo.Context (img)) {
|
||||
double dx = (double) (seconds % 2180) / 5;
|
||||
context.Color = new Color (1.0, 1.0, 0);
|
||||
context.Paint();
|
||||
@ -82,8 +77,7 @@ public class AppSrcDemo
|
||||
return data;
|
||||
}
|
||||
|
||||
static void MessageHandler(object sender, MessageArgs args)
|
||||
{
|
||||
static void MessageHandler (object sender, MessageArgs args) {
|
||||
Message message = args.Message;
|
||||
string text = String.Format ("Message from {0}: \t{1}", message.Src.Name, message.Type);
|
||||
switch (message.Type) {
|
||||
|
@ -15,19 +15,16 @@ using Gst.BasePlugins;
|
||||
public delegate void ErrorHandler (object o, ErrorArgs args);
|
||||
public delegate void ProgressHandler (object o, ProgressArgs args);
|
||||
|
||||
public class ErrorArgs : EventArgs
|
||||
{
|
||||
public class ErrorArgs : EventArgs {
|
||||
public string Error;
|
||||
}
|
||||
|
||||
public class ProgressArgs : EventArgs
|
||||
{
|
||||
public class ProgressArgs : EventArgs {
|
||||
public long Duration;
|
||||
public long Position;
|
||||
}
|
||||
|
||||
public class DecodeBinTranscoder : IDisposable
|
||||
{
|
||||
public class DecodeBinTranscoder : IDisposable {
|
||||
private Pipeline pipeline;
|
||||
private FileSrc filesrc;
|
||||
private FileSink filesink;
|
||||
@ -41,13 +38,11 @@ public class DecodeBinTranscoder : IDisposable
|
||||
public event ErrorHandler Error;
|
||||
public event ProgressHandler Progress;
|
||||
|
||||
public DecodeBinTranscoder()
|
||||
{
|
||||
public DecodeBinTranscoder() {
|
||||
ConstructPipeline();
|
||||
}
|
||||
|
||||
public void Transcode(string inputFile, string outputFile)
|
||||
{
|
||||
public void Transcode (string inputFile, string outputFile) {
|
||||
filesrc.Location = inputFile;
|
||||
filesink.Location = outputFile;
|
||||
|
||||
@ -55,21 +50,18 @@ public class DecodeBinTranscoder : IDisposable
|
||||
progress_timeout = GLib.Timeout.Add (250, OnProgressTimeout);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
public void Dispose() {
|
||||
pipeline.Dispose();
|
||||
}
|
||||
|
||||
protected virtual void OnFinished()
|
||||
{
|
||||
protected virtual void OnFinished() {
|
||||
EventHandler handler = Finished;
|
||||
if (handler != null) {
|
||||
handler (this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnError(string error)
|
||||
{
|
||||
protected virtual void OnError (string error) {
|
||||
ErrorHandler handler = Error;
|
||||
if (handler != null) {
|
||||
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;
|
||||
if (handler != null) {
|
||||
ProgressArgs args = new ProgressArgs();
|
||||
@ -89,8 +80,7 @@ public class DecodeBinTranscoder : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
private void ConstructPipeline()
|
||||
{
|
||||
private void ConstructPipeline() {
|
||||
pipeline = new Pipeline ("pipeline");
|
||||
|
||||
filesrc = ElementFactory.Make ("filesrc", "filesrc") as FileSrc;
|
||||
@ -109,8 +99,7 @@ public class DecodeBinTranscoder : IDisposable
|
||||
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");
|
||||
|
||||
if (sinkpad.IsLinked) {
|
||||
@ -127,8 +116,7 @@ public class DecodeBinTranscoder : IDisposable
|
||||
args.Pad.Link (sinkpad);
|
||||
}
|
||||
|
||||
private bool OnBusMessage(Bus bus, Message message)
|
||||
{
|
||||
private bool OnBusMessage (Bus bus, Message message) {
|
||||
switch (message.Type) {
|
||||
case MessageType.Error:
|
||||
string msg;
|
||||
@ -147,8 +135,7 @@ public class DecodeBinTranscoder : IDisposable
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool OnProgressTimeout()
|
||||
{
|
||||
private bool OnProgressTimeout() {
|
||||
long duration, position;
|
||||
Gst.Format fmt = Gst.Format.Time;
|
||||
|
||||
@ -161,8 +148,7 @@ public class DecodeBinTranscoder : IDisposable
|
||||
|
||||
private static GLib.MainLoop loop;
|
||||
|
||||
public static void Main(string [] args)
|
||||
{
|
||||
public static void Main (string [] args) {
|
||||
if (args.Length < 2) {
|
||||
Console.WriteLine ("Usage: mono decodebin-transcoder.exe <input-file> <output-file>");
|
||||
return;
|
||||
|
@ -2,18 +2,15 @@ using System;
|
||||
using Gst;
|
||||
using GLib;
|
||||
|
||||
public class HelloWorld
|
||||
{
|
||||
public class HelloWorld {
|
||||
private MainLoop loop;
|
||||
private Element pipeline, source, parser, decoder, conv, identity, sink;
|
||||
|
||||
public static void Main(string [] args)
|
||||
{
|
||||
public static void Main (string [] args) {
|
||||
new HelloWorld (args);
|
||||
}
|
||||
|
||||
public HelloWorld(string [] args)
|
||||
{
|
||||
public HelloWorld (string [] args) {
|
||||
Application.Init();
|
||||
|
||||
loop = new MainLoop();
|
||||
@ -65,8 +62,7 @@ public class HelloWorld
|
||||
pipeline.Dispose();
|
||||
}
|
||||
|
||||
private bool BusCall(Bus bus, Message message)
|
||||
{
|
||||
private bool BusCall (Bus bus, Message message) {
|
||||
switch (message.Type) {
|
||||
case MessageType.Error:
|
||||
string msg;
|
||||
@ -87,14 +83,12 @@ public class HelloWorld
|
||||
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;
|
||||
Console.WriteLine (buffer.Duration + "\t" + buffer.Timestamp);
|
||||
}
|
||||
|
||||
void OnPadAdded(object o, PadAddedArgs args)
|
||||
{
|
||||
void OnPadAdded (object o, PadAddedArgs args) {
|
||||
Console.WriteLine ("Entered OnPadAdded");
|
||||
Pad sinkpad = decoder.GetStaticPad ("sink");
|
||||
args.Pad.Link (sinkpad);
|
||||
|
@ -9,10 +9,8 @@ using System;
|
||||
using Gst;
|
||||
|
||||
|
||||
public class MP3LaunchParse
|
||||
{
|
||||
static void EventLoop (Element pipe)
|
||||
{
|
||||
public class MP3LaunchParse {
|
||||
static void EventLoop (Element pipe) {
|
||||
Bus bus = pipe.Bus;
|
||||
Message message = null;
|
||||
|
||||
@ -24,8 +22,7 @@ public class MP3LaunchParse
|
||||
System.Application.Exit();
|
||||
}
|
||||
|
||||
switch(message.Type)
|
||||
{
|
||||
switch (message.Type) {
|
||||
case MessageType.Eos:
|
||||
message.Dispose();
|
||||
return;
|
||||
@ -40,8 +37,7 @@ public class MP3LaunchParse
|
||||
}
|
||||
}
|
||||
|
||||
public static void Main(string [] args)
|
||||
{
|
||||
public static void Main (string [] args) {
|
||||
Application.Init();
|
||||
|
||||
if (args.Length != 1) {
|
||||
|
@ -3,15 +3,13 @@ using GLib;
|
||||
using Gst;
|
||||
using Gst.BasePlugins;
|
||||
|
||||
public class PlayBinPlayer
|
||||
{
|
||||
public class PlayBinPlayer {
|
||||
private static MainLoop loop;
|
||||
private static string[] songs;
|
||||
private static int song_idx = 0;
|
||||
private static PlayBin play;
|
||||
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
public static void Main (string[] args) {
|
||||
if (args.Length < 1) {
|
||||
Console.WriteLine ("usage: mono playbin-player.exe audio_file_uri");
|
||||
return;
|
||||
@ -36,8 +34,7 @@ public class PlayBinPlayer
|
||||
loop.Run ();
|
||||
}
|
||||
|
||||
private static bool BusCb (Bus bus, Message message)
|
||||
{
|
||||
private static bool BusCb (Bus bus, Message message) {
|
||||
switch (message.Type) {
|
||||
case MessageType.Error:
|
||||
Enum err;
|
||||
|
@ -8,8 +8,7 @@ using Gst;
|
||||
using System;
|
||||
|
||||
public class QueueExample {
|
||||
public static void Main(string [] args)
|
||||
{
|
||||
public static void Main (string [] args) {
|
||||
Application.Init();
|
||||
|
||||
if (args.Length != 1) {
|
||||
@ -38,8 +37,7 @@ public class QueueExample {
|
||||
pipeline.SetState (State.Null);
|
||||
}
|
||||
|
||||
static void EventLoop(Element pipe)
|
||||
{
|
||||
static void EventLoop (Element pipe) {
|
||||
Bus bus = pipe.Bus;
|
||||
|
||||
while (true) {
|
||||
|
@ -2,12 +2,10 @@ using System;
|
||||
using Gst;
|
||||
using Gst.CorePlugins;
|
||||
|
||||
public static class GstTypefindTest
|
||||
{
|
||||
public static class GstTypefindTest {
|
||||
private static TypeFindElement typefind;
|
||||
|
||||
public static void Main(string [] args)
|
||||
{
|
||||
public static void Main (string [] args) {
|
||||
Application.Init();
|
||||
|
||||
Pipeline pipeline = new Pipeline ("pipeline");
|
||||
@ -29,8 +27,7 @@ public static class GstTypefindTest
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -11,24 +11,20 @@ using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
[TestFixture]
|
||||
public class ApplicationTest
|
||||
{
|
||||
public class ApplicationTest {
|
||||
[Test]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
Gst.Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InitArgs()
|
||||
{
|
||||
public void InitArgs() {
|
||||
string [] args = { "arg_a", "arg_b" };
|
||||
Gst.Application.Init ("gstreamer-sharp-test", ref args);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InitArgsCheck()
|
||||
{
|
||||
public void InitArgsCheck() {
|
||||
string [] args = { "arg_a", "arg_b" };
|
||||
Gst.Application.InitCheck ("gstreamer-sharp-test", ref args);
|
||||
}
|
||||
|
@ -14,17 +14,14 @@ using Gst;
|
||||
using Gst.CorePlugins;
|
||||
|
||||
[TestFixture]
|
||||
public class BinTest
|
||||
{
|
||||
public class BinTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAdd()
|
||||
{
|
||||
public void TestAdd() {
|
||||
Bin bin = new Bin ("test-bin");
|
||||
Element e1 = new FakeSrc ("fakesrc");
|
||||
Element e2 = new FakeSink ("fakesink");
|
||||
@ -39,8 +36,7 @@ public class BinTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddRemove()
|
||||
{
|
||||
public void TestAddRemove() {
|
||||
Bin bin = ElementFactory.Make ("bin") as Bin;
|
||||
Assert.IsNotNull (bin, "Could not create bin");
|
||||
|
||||
@ -65,8 +61,7 @@ public class BinTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetByName()
|
||||
{
|
||||
public void TestGetByName() {
|
||||
Bin bin = new Bin ("test-bin");
|
||||
Element e1 = ElementFactory.Make ("fakesrc", "element-name");
|
||||
bin.Add (e1);
|
||||
@ -78,8 +73,7 @@ public class BinTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetChildByIndex()
|
||||
{
|
||||
public void TestGetChildByIndex() {
|
||||
Bin bin = new Bin ("test-bin");
|
||||
|
||||
Element [] elements = new Element [] {
|
||||
@ -101,8 +95,7 @@ public class BinTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestElements()
|
||||
{
|
||||
public void TestElements() {
|
||||
Bin bin = new Bin ("test-bin");
|
||||
|
||||
Element [] elements = new Element [] {
|
||||
@ -142,8 +135,7 @@ public class BinTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGhostPad()
|
||||
{
|
||||
public void TestGhostPad() {
|
||||
new MyBin ();
|
||||
}
|
||||
}
|
||||
|
@ -10,17 +10,14 @@ using NUnit.Framework;
|
||||
using Gst;
|
||||
|
||||
[TestFixture]
|
||||
public class BufferTest
|
||||
{
|
||||
public class BufferTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCaps()
|
||||
{
|
||||
public void TestCaps() {
|
||||
Gst.Buffer buffer = new Gst.Buffer (4);
|
||||
Caps caps = Caps.FromString ("audio/x-raw-int");
|
||||
|
||||
@ -38,8 +35,7 @@ public class BufferTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSubbuffer()
|
||||
{
|
||||
public void TestSubbuffer() {
|
||||
Gst.Buffer buffer = new Gst.Buffer (4);
|
||||
Gst.Buffer sub = buffer.CreateSub (1, 2);
|
||||
Assert.IsNotNull (sub);
|
||||
@ -47,8 +43,7 @@ public class BufferTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIsSpanFast()
|
||||
{
|
||||
public void TestIsSpanFast() {
|
||||
Gst.Buffer buffer = new Gst.Buffer (4);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
private void ArrayIsEqual (byte[] a, byte[] b)
|
||||
{
|
||||
private void ArrayIsEqual (byte[] a, byte[] b) {
|
||||
Assert.IsTrue (a.Length == b.Length);
|
||||
for (int i = 0; i < a.Length; i++)
|
||||
Assert.IsTrue (a[i] == b[i]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBufferData()
|
||||
{
|
||||
public void TestBufferData() {
|
||||
byte[] data = new byte[] {0, 1, 2, 3, 4, 5};
|
||||
|
||||
Gst.Buffer buffer = new Gst.Buffer (data);
|
||||
|
@ -12,25 +12,21 @@ using NUnit.Framework;
|
||||
using Gst;
|
||||
|
||||
[TestFixture]
|
||||
public class CapsTest
|
||||
{
|
||||
public class CapsTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPlainCreation()
|
||||
{
|
||||
public void TestPlainCreation() {
|
||||
Caps caps = new Caps();
|
||||
Assert.IsNotNull (caps);
|
||||
Assert.IsFalse (caps.Handle == IntPtr.Zero, "Ooops, null handle");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFromString()
|
||||
{
|
||||
public void TestFromString() {
|
||||
Caps caps = Caps.FromString ("video/x-raw-yuv, " +
|
||||
"format=(fourcc)I420, " +
|
||||
"width=(int)384, " +
|
||||
@ -45,8 +41,7 @@ public class CapsTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIntersecting()
|
||||
{
|
||||
public void TestIntersecting() {
|
||||
Caps caps1 = Caps.FromString ("video/x-raw-yuv, " +
|
||||
"format=(fourcc)I420, " +
|
||||
"width=(int)[ 1,1000 ], " +
|
||||
@ -71,8 +66,7 @@ public class CapsTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUnion()
|
||||
{
|
||||
public void TestUnion() {
|
||||
Caps caps1 = Caps.FromString ("video/x-raw-yuv, " +
|
||||
"format=(fourcc)I420, " +
|
||||
"width=(int)640");
|
||||
|
@ -13,17 +13,14 @@ using Gst;
|
||||
using Gst.GLib;
|
||||
|
||||
[TestFixture]
|
||||
public class ElementTest
|
||||
{
|
||||
public class ElementTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLinkNoPads()
|
||||
{
|
||||
public void TestLinkNoPads() {
|
||||
Element src = new Bin ("src");
|
||||
Element sink = new Bin ("sink");
|
||||
|
||||
@ -47,14 +44,12 @@ public class ElementTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddRemovePad()
|
||||
{
|
||||
public void TestAddRemovePad() {
|
||||
new PadAddElement ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLink()
|
||||
{
|
||||
public void TestLink() {
|
||||
State state, pending;
|
||||
|
||||
Element source = ElementFactory.Make ("fakesrc", "source");
|
||||
@ -222,8 +217,7 @@ public class ElementTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSubclasses ()
|
||||
{
|
||||
public void TestSubclasses () {
|
||||
TestSubclassesApp.Run ();
|
||||
}
|
||||
}
|
||||
|
@ -9,17 +9,14 @@ using System;
|
||||
using NUnit.Framework;
|
||||
using Gst;
|
||||
|
||||
public class MessageTest
|
||||
{
|
||||
public class MessageTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestParsing()
|
||||
{
|
||||
public void TestParsing() {
|
||||
Message message = Message.NewEos (null);
|
||||
Assert.IsNotNull (message);
|
||||
Assert.AreEqual (message.Type, MessageType.Eos);
|
||||
|
@ -13,17 +13,14 @@ using NUnit.Framework;
|
||||
using Gst;
|
||||
|
||||
[TestFixture]
|
||||
public class PadTest
|
||||
{
|
||||
public class PadTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPlainCreation()
|
||||
{
|
||||
public void TestPlainCreation() {
|
||||
Pad src = new Pad ("src", PadDirection.Src);
|
||||
Pad sink = new Pad ("sink", PadDirection.Sink);
|
||||
|
||||
@ -37,14 +34,12 @@ public class PadTest
|
||||
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");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFuncAssigning()
|
||||
{
|
||||
public void TestFuncAssigning() {
|
||||
Pad src = new Pad ("src", PadDirection.Src);
|
||||
src.GetCapsFunction = new PadGetCapsFunction (PadGetCapsStub);
|
||||
|
||||
@ -56,8 +51,7 @@ public class PadTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestElementPadAccessByName()
|
||||
{
|
||||
public void TestElementPadAccessByName() {
|
||||
Element element = ElementFactory.Make ("identity");
|
||||
Assert.IsNotNull (element);
|
||||
Assert.IsFalse (element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
|
||||
@ -79,8 +73,7 @@ public class PadTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestElementPadAccessByList()
|
||||
{
|
||||
public void TestElementPadAccessByList() {
|
||||
Element element = ElementFactory.Make ("identity");
|
||||
Assert.IsNotNull (element);
|
||||
Assert.IsFalse (element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
|
||||
@ -100,8 +93,7 @@ public class PadTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLink()
|
||||
{
|
||||
public void TestLink() {
|
||||
Pad src = new Pad ("source", PadDirection.Src);
|
||||
Assert.IsNotNull (src, "Pad could not be created");
|
||||
|
||||
@ -115,8 +107,7 @@ public class PadTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetAllowedCaps()
|
||||
{
|
||||
public void TestGetAllowedCaps() {
|
||||
Caps caps;
|
||||
|
||||
Pad sink = new Pad ("sink", PadDirection.Sink);
|
||||
@ -140,15 +131,13 @@ public class PadTest
|
||||
Assert.IsTrue (gotcaps.IsEqual (caps));
|
||||
}
|
||||
|
||||
bool ProbeHandler(Pad pad, Gst.Buffer buffer)
|
||||
{
|
||||
bool ProbeHandler (Pad pad, Gst.Buffer buffer) {
|
||||
//Console.WriteLine("event worked");
|
||||
return false;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPushUnlinked()
|
||||
{
|
||||
public void TestPushUnlinked() {
|
||||
Pad src = new Pad ("src", PadDirection.Src);
|
||||
Assert.IsNotNull (src, "Could not create src");
|
||||
Caps caps = src.AllowedCaps;
|
||||
|
@ -13,17 +13,14 @@ using Gst;
|
||||
using Gst.CorePlugins;
|
||||
|
||||
[TestFixture]
|
||||
public class PipelineTest
|
||||
{
|
||||
public class PipelineTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPipeline()
|
||||
{
|
||||
public void TestPipeline() {
|
||||
Pipeline pipeline = new Pipeline();
|
||||
Assert.IsNotNull (pipeline, "Could not create pipeline");
|
||||
Assert.IsNotNull (pipeline.Bus, "Bus on pipeline is null");
|
||||
@ -31,8 +28,7 @@ public class PipelineTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAsyncStateChangeEmpty()
|
||||
{
|
||||
public void TestAsyncStateChangeEmpty() {
|
||||
Pipeline pipeline = new Pipeline();
|
||||
Assert.IsNotNull (pipeline, "Could not create pipeline");
|
||||
|
||||
@ -40,8 +36,7 @@ public class PipelineTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAsyncStateChangeFakeReady()
|
||||
{
|
||||
public void TestAsyncStateChangeFakeReady() {
|
||||
Pipeline pipeline = new Pipeline();
|
||||
Element src = ElementFactory.Make ("fakesrc");
|
||||
Element sink = ElementFactory.Make ("fakesink");
|
||||
@ -54,8 +49,7 @@ public class PipelineTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAsyncStateChangeFake()
|
||||
{
|
||||
public void TestAsyncStateChangeFake() {
|
||||
bool done = false;
|
||||
Pipeline pipeline = new Pipeline();
|
||||
Assert.IsNotNull (pipeline, "Could not create pipeline");
|
||||
@ -90,10 +84,8 @@ public class PipelineTest
|
||||
bool MessageReceived (Bus bus, Message message) {
|
||||
MessageType type = message.Type;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case MessageType.StateChanged:
|
||||
{
|
||||
switch (type) {
|
||||
case MessageType.StateChanged: {
|
||||
State old, newState, pending;
|
||||
message.ParseStateChanged (out old, out newState, out pending);
|
||||
if (message.Src == (Gst.Object) pipeline && newState == State.Playing) {
|
||||
@ -103,25 +95,23 @@ public class PipelineTest
|
||||
}
|
||||
case MessageType.Error:
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBusAddWatch()
|
||||
{
|
||||
public void TestBusAddWatch() {
|
||||
TestBusCallback (true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBusAddSignalWatch()
|
||||
{
|
||||
public void TestBusAddSignalWatch() {
|
||||
TestBusCallback (false);
|
||||
}
|
||||
|
||||
public void TestBusCallback(bool use_AddWatch)
|
||||
{
|
||||
public void TestBusCallback (bool use_AddWatch) {
|
||||
pipeline = new Pipeline();
|
||||
Assert.IsNotNull (pipeline, "Could not create pipeline");
|
||||
|
||||
@ -138,7 +128,9 @@ public class PipelineTest
|
||||
pipeline.Bus.AddWatch (new BusFunc (MessageReceived));
|
||||
else {
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user