summaryrefslogtreecommitdiff
path: root/gstreamer-sharp/Query.custom
blob: 086118f479074d2a665485061d6fbb0c4138b63d (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
public Query (GLib.Value val) : base (val) { }

private Gst.Structure cached_structure = null;

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_get_structure (IntPtr raw);

public Gst.Structure Structure {
  get  {
    if (cached_structure != null)
      return cached_structure;

    IntPtr raw_ret = gst_query_get_structure (Handle);
    Gst.Structure ret = raw_ret == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Structure), true);
    if (ret != null)
      ret.FreeNative = false;
    cached_structure = ret;
    return ret;
  }
}

~Query () {
  if (cached_structure != null)
    cached_structure.CreateNativeCopy ();
  cached_structure = null;
}

public string TypeName {
  get {
    return GetTypeName (Type);
  }
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_application (QueryType type, IntPtr structure);

public static Query NewApplication (Gst.QueryType type, Structure structure) {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_application (type, (structure != null) ? structure.Handle : IntPtr.Zero), true);
  query.cached_structure = structure;
  structure.FreeNative = false;

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_convert (Gst.Format src_format, long value, Gst.Format dest_format);

public static Query NewConvert (Gst.Format src_format, long value, Gst.Format dest_format) {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_convert (src_format, value, dest_format), true);

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_convert (IntPtr query, Gst.Format src_format, long src_value, Gst.Format dest_format, long dest_value);

public void SetConvert (Gst.Format src_format, long src_value, Gst.Format dest_format, long dest_value) {
  if (Type != QueryType.Convert)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_convert (Handle, src_format, src_value, dest_format, dest_value);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_convert (IntPtr query, out Gst.Format src_format, out long src_value, out Gst.Format dest_format, out long dest_value);

public void ParseConvert (out Gst.Format src_format, out long src_value, out Gst.Format dest_format, out long dest_value) {
  if (Type != QueryType.Convert)
    throw new ApplicationException ();

  gst_query_parse_convert (Handle, out src_format, out src_value, out dest_format, out dest_value);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_position (Gst.Format format);

public static Query NewPosition (Gst.Format format) {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_position (format), true);

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_position (IntPtr query, Gst.Format format, long cur);

public void SetPosition (Gst.Format format, long cur) {
  if (Type != QueryType.Position)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_position (Handle, format, cur);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_position (IntPtr query, out Gst.Format format, out long cur);

public void ParsePosition (out Gst.Format format, out long cur) {
  if (Type != QueryType.Position)
    throw new ApplicationException ();

  gst_query_parse_position (Handle, out format, out cur);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_duration (Gst.Format format);

public static Query NewDuration (Gst.Format format) {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_duration (format), true);

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_duration (IntPtr query, Gst.Format format, long duration);

public void SetDuration (Gst.Format format, long duration) {
  if (Type != QueryType.Duration)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_duration (Handle, format, duration);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_duration (IntPtr query, out Gst.Format format, out long duration);

public void ParseDuration (out Gst.Format format, out long duration) {
  if (Type != QueryType.Duration)
    throw new ApplicationException ();

  gst_query_parse_duration (Handle, out format, out duration);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_latency ();

public static Query NewLatency() {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_latency (), true);

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_latency (IntPtr query, bool live, ulong min, ulong max);

public void SetLatency (bool live, ulong min, ulong max) {
  if (Type != QueryType.Latency)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_latency (Handle, live, min, max);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_latency (IntPtr query, out bool live, out ulong min, out ulong max);

public void ParseLatency (out bool live, out ulong min, out ulong max) {
  if (Type != QueryType.Latency)
    throw new ApplicationException ();

  gst_query_parse_latency (Handle, out live, out min, out max);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_seeking (Gst.Format format);

public static Query NewSeeking (Gst.Format format) {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_seeking (format), true);

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_seeking (IntPtr query, Gst.Format format, bool seekable, long segment_start, long segment_stop);

public void SetSeeking (Gst.Format format, bool seekable, long segment_start, long segment_stop) {
  if (Type != QueryType.Seeking)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_seeking (Handle, format, seekable, segment_start, segment_stop);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_seeking (IntPtr query, out Gst.Format format, out bool seekable, out long segment_start, out long segment_stop);

public void ParseSeeking (out Gst.Format format, out bool seekable, out long segment_start, out long segment_stop) {
  if (Type != QueryType.Seeking)
    throw new ApplicationException ();

  gst_query_parse_seeking (Handle, out format, out seekable, out segment_start, out segment_stop);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_formats ();

public static Query NewFormats() {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_formats (), true);

  return query;
}

public void SetFormats (Gst.Format[] formats) {
  if (Type != QueryType.Formats)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  Structure s = this.Structure;
  Gst.List l = new Gst.List (formats);
  s["formats"] = l;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_formats_length (IntPtr query, out uint n_formats);
[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_formats_nth (IntPtr query, uint nth, out Gst.Format format);

public void ParseFormats (out Gst.Format[] formats) {
  if (Type != QueryType.Formats)
    throw new ApplicationException ();

  uint length;
  gst_query_parse_formats_length (Handle, out length);

  formats = new Gst.Format[length];

  for (uint i = 0; i < length; i++)
    gst_query_parse_formats_nth (Handle, i, out formats[i]);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_segment (Gst.Format format);

public static Query NewSegment (Gst.Format format) {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_segment (format), true);

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_segment (IntPtr query, double rate, Gst.Format format, long segment_start, long segment_stop);

public void SetSegment (double rate, Gst.Format format, long segment_start, long segment_stop) {
  if (Type != QueryType.Segment)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_segment (Handle, rate, format, segment_start, segment_stop);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_segment (IntPtr query, out double rate, out Gst.Format format, out long segment_start, out long segment_stop);

public void ParseSegment (out double rate, out Gst.Format format, out long segment_start, out long segment_stop) {
  if (Type != QueryType.Segment)
    throw new ApplicationException ();

  gst_query_parse_segment (Handle, out rate, out format, out segment_start, out segment_stop);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_buffering (Gst.Format format);

public static Query NewBuffering (Gst.Format format) {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_buffering (format), true);

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_buffering_percent (IntPtr query, bool busy, int percent);

public void SetBufferingPercent (bool busy, int percent) {
  if (Type != QueryType.Buffering)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_buffering_percent (Handle, busy, percent);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_buffering_percent (IntPtr query, out bool busy, out int percent);

public void ParseBufferingPercent (out bool busy, out int percent) {
  if (Type != QueryType.Buffering)
    throw new ApplicationException ();

  gst_query_parse_buffering_percent (Handle, out busy, out percent);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_buffering_stats (IntPtr query, Gst.BufferingMode mode, int avg_in, int avg_out, long buffering_left);

public void SetBufferingStats (Gst.BufferingMode mode, int avg_in, int avg_out, long buffering_left) {
  if (Type != QueryType.Buffering)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_buffering_stats (Handle, mode, avg_in, avg_out, buffering_left);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_buffering_stats (IntPtr query, out Gst.BufferingMode mode, out int avg_in, out int avg_out, out long buffering_left);

public void ParseBufferingStats (out Gst.BufferingMode mode, out int avg_in, out int avg_out, out long buffering_left) {
  if (Type != QueryType.Buffering)
    throw new ApplicationException ();

  gst_query_parse_buffering_stats (Handle, out mode, out avg_in, out avg_out, out buffering_left);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_buffering_range (IntPtr query, Gst.Format format, long start, long stop, long estimated_total);

public void SetBufferingRange (Gst.Format format, long start, long stop, long estimated_total) {
  if (Type != QueryType.Buffering)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  gst_query_set_buffering_range (Handle, format, start, stop, estimated_total);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_buffering_range (IntPtr query, out Gst.Format format, out long start, out long stop, out long estimated_total);

public void ParseBufferingRange (out Gst.Format format, out long start, out long stop, out long estimated_total) {
  if (Type != QueryType.Buffering)
    throw new ApplicationException ();

  gst_query_parse_buffering_range (Handle, out format, out start, out stop, out estimated_total);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_uri ();

public static Query NewUri() {
  Query query = (Query) Gst.MiniObject.GetObject (gst_query_new_uri (), true);

  return query;
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_set_uri (IntPtr query, IntPtr uri);

public void SetUri (string uri) {
  if (Type != QueryType.Uri)
    throw new ApplicationException ();
  if (!IsWritable)
    throw new ApplicationException ();

  IntPtr raw_string = GLib.Marshaller.StringToPtrGStrdup (uri);
  gst_query_set_uri (Handle, raw_string);
  GLib.Marshaller.Free (raw_string);
}

[DllImport ("gstreamer-0.10.dll") ]
static extern void gst_query_parse_uri (IntPtr query, out IntPtr uri);

public void ParseUri (out string uri) {
  if (Type != QueryType.Uri)
    throw new ApplicationException ();

  IntPtr raw_string;
  gst_query_parse_uri (Handle, out raw_string);

  uri = GLib.Marshaller.Utf8PtrToString (raw_string);
}