mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
cf9fd6ec9a
Also fix indention everywhere and change code to use Gst.MiniObject.GetObject() instead of GLib.Opaque.GetOpaque(). It's currently not possible to implement or use GInterfaces on mini objects but apart from that this should be a great improvement, especially new mini object classes can be defined in C# now.
378 lines
13 KiB
Text
378 lines
13 KiB
Text
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);
|
|
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);
|
|
}
|
|
|