Exemplo n.º 1
0
		public static bool AddCodecDescriptionToTagList(Gst.TagList taglist, string codec_tag, Gst.Caps caps) {
			IntPtr native_codec_tag = Gst.GLib.Marshaller.StringToPtrGStrdup (codec_tag);
			bool raw_ret = gst_pb_utils_add_codec_description_to_tag_list(taglist == null ? IntPtr.Zero : taglist.Handle, native_codec_tag, caps == null ? IntPtr.Zero : caps.Handle);
			bool ret = raw_ret;
			Gst.GLib.Marshaller.Free (native_codec_tag);
			return ret;
		}
Exemplo n.º 2
0
        public static void ParseRecordToggled(Gst.Message message, out Gst.Interfaces.MixerTrack track, out bool record)
        {
            IntPtr native_ptr;

              gst_mixer_message_parse_record_toggled (message == null ? IntPtr.Zero : message.Handle, out native_ptr, out record);
              track = (MixerTrack) GLib.Object.GetObject (native_ptr, false);
        }
Exemplo n.º 3
0
 static void PushAppData (object o, Gst.App.NeedDataArgs args) {
   ulong mseconds = 0;
   if (appsrc.Clock != null)
     mseconds = appsrc.Clock.Time / Clock.MSecond;
   Gst.Buffer buffer = DrawData (mseconds);
   appsrc.PushBuffer (buffer);
 }
Exemplo n.º 4
0
		bool InvokeNative (Gst.Index index, Gst.Object writer, out string writer_string)
		{
			IntPtr native_writer_string;
			bool result = native_cb (index == null ? IntPtr.Zero : index.Handle, writer == null ? IntPtr.Zero : writer.Handle, out native_writer_string, __data);
			writer_string = Gst.GLib.Marshaller.PtrToStringGFree(native_writer_string);
			return result;
		}
 public static Gst.Message NewMissingElement(Gst.Object src, string factory)
 {
     IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (factory);
       Message msg = (Message) Gst.MiniObject.GetObject (gst_missing_element_message_new (src.Handle, native_str), true);
       GLib.Marshaller.Free (native_str);
       return msg;
 }
Exemplo n.º 6
0
Arquivo: Program.cs Projeto: zoi/Sono
        static Boolean bus_call(Gst.Bus bus, Gst.Message _msg)
        {
            switch (_msg.Type)
            {
                case Gst.MessageType.Eos:
                {
                    Console.WriteLine("End-of-stream");
                    _loop.Quit();
                    break;
                }
                case Gst.MessageType.Error:
                {
                    /*Gst.GLib.GString*/ String _debug;
                    Enum _err;

                    _msg.ParseError(out _err, out _debug);
                    //g_free(debug);

                    Console.Error.WriteLine("{0}", _debug);//_err.ToString());
                    //g_error_free(err);

                   _loop.Quit();
                    break;
                }
            default:
                break;
            }
            return true;
        }
		Gst.FlowReturn InvokeNative (Gst.Object obj, ulong offset, uint length, out Gst.Buffer buffer)
		{
			IntPtr native_buffer;
			Gst.FlowReturn result = (Gst.FlowReturn) native_cb (obj == null ? IntPtr.Zero : obj.Handle, offset, length, out native_buffer);
			buffer = Gst.MiniObject.GetObject(native_buffer, true) as Gst.Buffer;
			return result;
		}
Exemplo n.º 8
0
		public static Gst.Caps TypeFind(Gst.Object obj, Gst.Buffer buf, out Gst.TypeFindProbability prob) {
			int native_prob;
			IntPtr raw_ret = gst_type_find_helper_for_buffer(obj == null ? IntPtr.Zero : obj.Handle, buf == null ? IntPtr.Zero : buf.Handle, out native_prob);
			Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) Gst.GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Caps), true);
			prob = (Gst.TypeFindProbability) native_prob;
			return ret;
		}
Exemplo n.º 9
0
 public static bool LoadPreset (Gst.GLib.Object o, string name) {
   IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
   bool raw_ret = default_iface.LoadPreset (o.Handle, native_name);
   bool ret = raw_ret;
   Gst.GLib.Marshaller.Free (native_name);
   return ret;
 }
Exemplo n.º 10
0
  protected override FlowReturn OnTransformIp (Gst.Buffer buf) {
    if (!buf.IsWritable)
      return FlowReturn.Error;

    Cairo.ImageSurface img = new Cairo.ImageSurface (buf.Data, Cairo.Format.Rgb24, width, height, width*4);

    using (Cairo.Context context = new Cairo.Context (img)) {
      double dx = (double) ( (buf.Timestamp / Clock.MSecond) % 2180) / 5;
      context.Save ();
      context.Scale (width / 640.0, height / 480.0);
      context.MoveTo (300, 10 + dx);
      context.LineTo (500 - dx, 400);
      context.LineWidth = 4.0;
      context.Color = new Color (0, 0, 1.0);
      context.Stroke();
      context.Restore ();

      if (lastX != -1 && lastY != -1) {
        context.Color = new Color (1.0, 0, 0);
        context.Translate (lastX, lastY);
        context.Scale (Math.Min (width / 640.0, height / 480.0), Math.Min (width / 640.0, height / 480.0));
        context.Arc (0, 0, 10.0, 0.0, 2 * Math.PI);
        context.Fill();
      }
    }

    img.Destroy ();
    return base.OnTransformIp (buf);
  }
		Gst.FlowReturn InvokeNative (Gst.Pad pad, ulong offset, uint size, Gst.Caps caps, out Gst.Buffer buf)
		{
			IntPtr native_buf;
			Gst.FlowReturn result = (Gst.FlowReturn) native_cb (pad == null ? IntPtr.Zero : pad.Handle, offset, size, caps == null ? IntPtr.Zero : caps.Handle, out native_buf);
			buf = Gst.MiniObject.GetObject(native_buf) as Gst.Buffer;
			return result;
		}
Exemplo n.º 12
0
        public static void SetAngles(Gst.Query query, uint cur_angle, uint n_angles)
        {
            if (!query.IsWritable)
            throw new ApplicationException ();

              gst_navigation_query_set_angles (query.Handle, cur_angle, n_angles);
        }
Exemplo n.º 13
0
		public bool HasFieldTyped(string fieldname, Gst.GLib.GType type) {
			IntPtr native_fieldname = Gst.GLib.Marshaller.StringToPtrGStrdup (fieldname);
			bool raw_ret = gst_structure_has_field_typed(Handle, native_fieldname, type.Val);
			bool ret = raw_ret;
			Gst.GLib.Marshaller.Free (native_fieldname);
			return ret;
		}
Exemplo n.º 14
0
		public Value (Gst.GLib.GType gtype)
		{
			type = IntPtr.Zero;
			pad1 = new Padding ();
			pad2 = new Padding ();
			g_value_init (ref this, gtype.Val);
		}
Exemplo n.º 15
0
        public static void ParseOptionsListChanged(Gst.Message message, out Gst.Interfaces.MixerOptions options)
        {
            IntPtr native_options;

              gst_mixer_message_parse_options_list_changed (message == null ? IntPtr.Zero : message.Handle, out native_options);
              options = (MixerOptions) GLib.Object.GetObject (native_options, false);
        }
Exemplo n.º 16
0
		public static Gst.Caps TypeFind(Gst.Object obj, string extension) {
			IntPtr native_extension = Gst.GLib.Marshaller.StringToPtrGStrdup (extension);
			IntPtr raw_ret = gst_type_find_helper_for_extension(obj == null ? IntPtr.Zero : obj.Handle, native_extension);
			Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) Gst.GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Caps), true);
			Gst.GLib.Marshaller.Free (native_extension);
			return ret;
		}
Exemplo n.º 17
0
 public static Gst.Message NewMissingUriSource(Gst.Object src, string protocol)
 {
     IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (protocol);
       Message msg = (Message) Gst.MiniObject.GetObject (gst_missing_uri_source_message_new (src.Handle, native_str), true);
       GLib.Marshaller.Free (native_str);
       return msg;
 }
Exemplo n.º 18
0
		public ToggleRef (Gst.GLib.Object target)
		{
			handle = target.Handle;
			gch = GCHandle.Alloc (this);
			reference = target;
			g_object_add_toggle_ref (target.Handle, ToggleNotifyCallback, (IntPtr) gch);
			g_object_unref (target.Handle);
		}
Exemplo n.º 19
0
		private Gst.FlowReturn InternalShowFrame (Gst.Buffer buf)
		{
			ShowFrameNativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).ShowFrame;
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, buf == null ? IntPtr.Zero : buf.Handle);
			return (Gst.FlowReturn) __result;
		}
Exemplo n.º 20
0
    public static bool ParseKeyEvent (Gst.Event evnt, out string key) {
      IntPtr raw_key;
      bool ret = gst_navigation_event_parse_key_event (evnt.Handle, out raw_key);

      key = Gst.GLib.Marshaller.Utf8PtrToString (raw_key);

      return ret;
    }
Exemplo n.º 21
0
		public bool GetValue(ulong timestamp, ref Gst.GLib.Value value) {
			IntPtr native_value = Gst.GLib.Marshaller.StructureToPtrAlloc (value);
			bool raw_ret = gst_control_source_get_value(Handle, timestamp, native_value);
			bool ret = raw_ret;
			value = (Gst.GLib.Value) Marshal.PtrToStructure (native_value, typeof (Gst.GLib.Value));
			Marshal.FreeHGlobal (native_value);
			return ret;
		}
Exemplo n.º 22
0
		public static Gst.Caps TypeFind(Gst.Object obj, Gst.Base.TypeFindHelperGetRangeFunction func, ulong size, out Gst.TypeFindProbability prob) {
			Gst.BaseSharp.TypeFindHelperGetRangeFunctionWrapper func_wrapper = new Gst.BaseSharp.TypeFindHelperGetRangeFunctionWrapper (func);
			int native_prob;
			IntPtr raw_ret = gst_type_find_helper_get_range(obj == null ? IntPtr.Zero : obj.Handle, func_wrapper.NativeDelegate, size, out native_prob);
			Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) Gst.GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Caps), true);
			prob = (Gst.TypeFindProbability) native_prob;
			return ret;
		}
Exemplo n.º 23
0
		protected SignalCallback (Gst.GLib.Object obj, Delegate eh, System.Type argstype)
		{
			_key = _NextKey++;
			_obj = obj;
			_handler = eh;
			_argstype = argstype;
			_Instances [_key] = this;
		}
Exemplo n.º 24
0
    public static bool ParseCommand (Gst.Event evnt, out Gst.Interfaces.NavigationCommand command) {
      int raw_command;
      bool ret = gst_navigation_event_parse_command (evnt.Handle, out raw_command);

      command = (Gst.Interfaces.NavigationCommand) raw_command;

      return ret;
    }
Exemplo n.º 25
0
		private void AddValue(Gst.TagMergeMode mode, string tag, Gst.GLib.Value value) {
			IntPtr native_tag = Gst.GLib.Marshaller.StringToPtrGStrdup (tag);
			IntPtr native_value = Gst.GLib.Marshaller.StructureToPtrAlloc (value);
			gst_tag_list_add_value(Handle, (int) mode, native_tag, native_value);
			Gst.GLib.Marshaller.Free (native_tag);
			value = (Gst.GLib.Value) Marshal.PtrToStructure (native_value, typeof (Gst.GLib.Value));
			Marshal.FreeHGlobal (native_value);
		}
Exemplo n.º 26
0
    public static string GetInstallerDetail (Gst.Message msg) {
      if (!IsMissingPluginMessage (msg))
        throw new ApplicationException ();

      IntPtr raw_ret = gst_missing_plugin_message_get_installer_detail (msg.Handle);
      string ret = Gst.GLib.Marshaller.PtrToStringGFree (raw_ret);
      return ret;
    }
Exemplo n.º 27
0
		public static unsafe Gst.Element BinFromDescription(string bin_description, bool ghost_unlinked_pads, Gst.ParseContext context, Gst.ParseFlags flags) {
			IntPtr native_bin_description = Gst.GLib.Marshaller.StringToPtrGStrdup (bin_description);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = gst_parse_bin_from_description_full(native_bin_description, ghost_unlinked_pads, context == null ? IntPtr.Zero : context.Handle, (int) flags, out error);
			Gst.Element ret = Gst.GLib.Object.GetObject(raw_ret, true) as Gst.Element;
			Gst.GLib.Marshaller.Free (native_bin_description);
			if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
			return ret;
		}
Exemplo n.º 28
0
		public GhostPad (string name, Gst.PadTemplate templ) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (GhostPad)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
			Raw = gst_ghost_pad_new_no_target_from_template(native_name, templ == null ? IntPtr.Zero : templ.Handle);
			Gst.GLib.Marshaller.Free (native_name);
		}
Exemplo n.º 29
0
		public GhostPad (string name, Gst.PadDirection dir) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (GhostPad)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
			Raw = gst_ghost_pad_new_no_target(native_name, (int) dir);
			Gst.GLib.Marshaller.Free (native_name);
		}
Exemplo n.º 30
0
 public static bool RenamePreset (Gst.GLib.Object o, string old_name, string new_name) {
   IntPtr native_old_name = Gst.GLib.Marshaller.StringToPtrGStrdup (old_name);
   IntPtr native_new_name = Gst.GLib.Marshaller.StringToPtrGStrdup (new_name);
   bool raw_ret = default_iface.RenamePreset (o.Handle, native_old_name, native_new_name);
   bool ret = raw_ret;
   Gst.GLib.Marshaller.Free (native_old_name);
   Gst.GLib.Marshaller.Free (native_new_name);
   return ret;
 }