summaryrefslogtreecommitdiff
path: root/gstreamer-sharp/Element.custom
blob: c39fcf8895b562ae87a514221de2926841dbc72f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

public object this[string property] {
  get {
    return GetProperty (property).Val;
  }
  set {
    SetProperty (property, value);
  }
}

public new GLib.Value GetProperty (string propertyName) {
  return base.GetProperty (propertyName);
}

public new void SetProperty (string propertyName, GLib.Value value) {
  base.SetProperty (propertyName, value);
}

public void SetProperty (string propertyName, object value) {
  base.SetProperty (propertyName, new GLib.Value (value));
}

public void SetProperty (string propertyName, string value) {
  base.SetProperty (propertyName, new GLib.Value (value));
}

public void SetProperty (string propertyName, int value) {
  base.SetProperty (propertyName, new GLib.Value (value));
}

public void SetProperty (string propertyName, double value) {
  base.SetProperty (propertyName, new GLib.Value (value));
}

public void SetProperty (string propertyName, bool value) {
  base.SetProperty (propertyName, new GLib.Value (value));
}


public bool QueryPosition (Gst.Format format, out long current) {
  return gst_element_query_position (Handle, ref format, out current);
}


public bool QueryDuration (Gst.Format format, out long duration) {
  return gst_element_query_duration (Handle, ref format, out duration);
}

public void Connect (string signal, DynamicSignalHandler handler) {
  DynamicSignal.Connect (this, signal, handler);
}

public void Disconnect (string signal, DynamicSignalHandler handler) {
  DynamicSignal.Disconnect (this, signal, handler);
}

public object Emit (string signal, params object[] parameters) {
  return DynamicSignal.Emit (this, signal, parameters);
}

[DllImport ("gobject-2.0-0.dll")]
static extern IntPtr g_object_ref (IntPtr raw);

public bool AddPad (Pad p) {
  bool ret = gst_element_add_pad (this.Handle, p == null ? IntPtr.Zero : p.Handle);
  if (ret)
    g_object_ref (p.Handle);
  return ret;
}

public static bool LinkMany (params Element [] elements) {
  for (int i = 0; i < elements.Length - 1; i++) {
    if (!elements[i].Link (elements[i+1]))
      return false;
  }

  return true;
}

public static void UnlinkMany (params Element [] elements) {
  for (int i = 0; i < elements.Length - 1; i++) {
    elements[i].Unlink (elements[i+1]);
  }
}


[DllImport ("gstreamer-0.10.dll") ]
private static extern bool gst_element_query_position (IntPtr raw, ref Format format, out long cur);

[DllImport ("gstreamer-0.10.dll") ]
private static extern bool gst_element_query_duration (IntPtr raw, ref Format format, out long duration);

[DllImport ("gstreamer-0.10.dll") ]
static extern bool gst_element_add_pad (IntPtr raw, IntPtr pad);