示例#1
0
文件: AppSrc.cs 项目: jwzl/ossbuild
 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);
 }
		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;
		}
示例#3
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);
        }
示例#4
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);
        }
示例#5
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);
        }
示例#6
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);
  }
示例#7
0
文件: Program.cs 项目: 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;
        }
 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;
 }
示例#9
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;
		}
示例#10
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;
		}
示例#11
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;
 }
 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;
 }
		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;
		}
示例#14
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;
		}
示例#15
0
文件: Value.cs 项目: jwzl/ossbuild
		public Value (Gst.GLib.GType gtype)
		{
			type = IntPtr.Zero;
			pad1 = new Padding ();
			pad2 = new Padding ();
			g_value_init (ref this, gtype.Val);
		}
示例#16
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;
		}
		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;
		}
示例#18
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;
    }
示例#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;
		}
示例#20
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);
		}
示例#21
0
		protected SignalCallback (Gst.GLib.Object obj, Delegate eh, System.Type argstype)
		{
			_key = _NextKey++;
			_obj = obj;
			_handler = eh;
			_argstype = argstype;
			_Instances [_key] = this;
		}
示例#22
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;
    }
示例#23
0
文件: TagList.cs 项目: jwzl/ossbuild
		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);
		}
示例#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;
    }
示例#25
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;
		}
示例#26
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;
		}
示例#27
0
文件: Parse.cs 项目: jwzl/ossbuild
		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;
		}
示例#28
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;
 }
示例#29
0
文件: GhostPad.cs 项目: jwzl/ossbuild
		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);
		}
示例#30
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Gst gst = await db.Gsts.FindAsync(id);

            db.Gsts.Remove(gst);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#31
0
文件: GhostPad.cs 项目: jwzl/ossbuild
		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);
		}
示例#32
0
        public void AddGstReturnsOriginalMoneyIncreasedByGSTAmount()
        {
            Money money    = new Money(1900.5m, CurrencyFixture.NewZealandDollar);
            Gst   gst      = new Gst(12.5m);
            Money expected = money.Multiply(gst.Multiplier);

            Money actual = money.Add(gst);

            actual.Should().Be(expected);
        }
示例#33
0
        public void SubtractGstReturnsOriginalMoneyIncreasedByGSTAmount()
        {
            Money money    = new MoneyBuilder().WithPrice(1900.5m).Build();
            Gst   gst      = new Gst(12.5m);
            Money expected = money.Multiply(gst.GstFraction / gst.Multiplier);

            Money actual = money.GstPaid(gst);

            actual.Should().Be(expected);
        }
示例#34
0
        public async Task <ActionResult> Edit([Bind(Include = "id,Name,GstNo,CenterGst,StateGst,TotalGst")] Gst gst)
        {
            if (ModelState.IsValid)
            {
                db.Entry(gst).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(gst));
        }
示例#35
0
        public async Task <ActionResult> Create([Bind(Include = "id,Name,GstNo,CenterGst,StateGst,TotalGst")] Gst gst)
        {
            if (ModelState.IsValid)
            {
                db.Gsts.Add(gst);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(gst));
        }
示例#36
0
        // GET: Gsts/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Gst gst = await db.Gsts.FindAsync(id);

            if (gst == null)
            {
                return(HttpNotFound());
            }
            return(View(gst));
        }
示例#37
0
        public void TestGngst()
        {
            string input = "$GNGST,172814.0,0.006,0.023,0.020,273.6,0.023,0.020,0.031*74";
            var    msg   = NmeaMessage.Parse(input);

            Assert.IsInstanceOfType(msg, typeof(Gst));
            Gst gst = (Gst)msg;

            Assert.AreEqual(new TimeSpan(17, 28, 14), gst.FixTime);
            Assert.AreEqual(0.006, gst.Rms);
            Assert.AreEqual(0.023, gst.SemiMajorError);
            Assert.AreEqual(0.02, gst.SemiMinorError);
            Assert.AreEqual(273.6, gst.ErrorOrientation);
            Assert.AreEqual(0.023, gst.SigmaLatitudeError);
            Assert.AreEqual(0.020, gst.SigmaLongitudeError);
            Assert.AreEqual(0.031, gst.SigmaHeightError);
        }