gstreamer/gstreamer-sharp/NavigationQuery.cs

93 lines
3.3 KiB
C#
Raw Normal View History

2009-05-14 14:50:16 +00:00
namespace Gst.Interfaces {
using System;
using System.Runtime.InteropServices;
using System.Reflection;
using Gst.GLib;
using Gst;
using Gst.Interfaces;
2009-05-14 14:50:16 +00:00
public static class NavigationQuery {
[DllImport("libgstinterfaces-0.10.dll") ]
static extern int gst_navigation_query_get_type (IntPtr query);
2009-05-14 14:50:16 +00:00
public static Gst.Interfaces.NavigationQueryType QueryGetType (Gst.Query query) {
int raw_ret = gst_navigation_query_get_type (query == null ? IntPtr.Zero : query.Handle);
Gst.Interfaces.NavigationQueryType ret = (Gst.Interfaces.NavigationQueryType) raw_ret;
return ret;
}
2009-05-14 14:50:16 +00:00
[DllImport("libgstinterfaces-0.10.dll") ]
static extern IntPtr gst_navigation_query_new_commands ();
2009-05-14 14:50:16 +00:00
public static Gst.Query NewCommands () {
Gst.Query query = (Gst.Query) Gst.MiniObject.GetObject (gst_navigation_query_new_commands (), true);
return query;
}
2009-05-14 14:50:16 +00:00
[DllImport("libgstinterfaces-0.10.dll") ]
static extern void gst_navigation_query_set_commandsv (IntPtr query, uint n_commands, int[] cmds);
2009-05-14 14:50:16 +00:00
public static void SetCommands (Gst.Query query, Gst.Interfaces.NavigationCommand[] cmds) {
if (!query.IsWritable)
throw new ApplicationException ();
2009-05-14 14:50:16 +00:00
int[] raw_cmds = new int[cmds.Length];
for (int i = 0; i < cmds.Length; i++)
raw_cmds[i] = (int) cmds[i];
2009-05-14 14:50:16 +00:00
gst_navigation_query_set_commandsv (query.Handle, (uint) raw_cmds.Length, raw_cmds);
}
2009-05-14 14:50:16 +00:00
[DllImport("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_query_parse_commands_length (IntPtr query, out uint n_commands);
[DllImport("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_query_parse_commands_nth (IntPtr query, uint nth, out int cmd);
2009-05-14 14:50:16 +00:00
public static bool ParseCommands (Gst.Query query, out Gst.Interfaces.NavigationCommand[] cmds) {
uint len;
2009-05-14 14:50:16 +00:00
cmds = null;
if (!gst_navigation_query_parse_commands_length (query.Handle, out len))
return false;
2009-05-14 14:50:16 +00:00
cmds = new Gst.Interfaces.NavigationCommand[len];
2009-05-14 14:50:16 +00:00
for (uint i = 0; i < len; i++) {
int cmd;
2009-05-14 14:50:16 +00:00
if (!gst_navigation_query_parse_commands_nth (query.Handle, i, out cmd))
return false;
cmds[i] = (Gst.Interfaces.NavigationCommand) cmd;
}
2009-05-14 14:50:16 +00:00
return true;
}
2009-05-14 14:50:16 +00:00
[DllImport("libgstinterfaces-0.10.dll") ]
static extern IntPtr gst_navigation_query_new_angles ();
2009-05-14 14:50:16 +00:00
public static Gst.Query NewAngles () {
Gst.Query query = (Gst.Query) Gst.MiniObject.GetObject (gst_navigation_query_new_angles (), true);
return query;
}
2009-05-14 14:50:16 +00:00
[DllImport("libgstinterfaces-0.10.dll") ]
static extern void gst_navigation_query_set_angles (IntPtr query, uint cur_angle, uint n_angles);
2009-05-14 14:50:16 +00:00
public static void SetAngles (Gst.Query query, uint cur_angle, uint n_angles) {
if (!query.IsWritable)
throw new ApplicationException ();
2009-05-14 14:50:16 +00:00
gst_navigation_query_set_angles (query.Handle, cur_angle, n_angles);
}
2009-05-14 14:50:16 +00:00
[DllImport("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_query_parse_angles (IntPtr query, out uint cur_angle, out uint n_angles);
2009-05-14 14:50:16 +00:00
public static bool ParseAngles (Gst.Query query, out uint cur_angle, out uint n_angles) {
return gst_navigation_query_parse_angles (query.Handle, out cur_angle, out n_angles);
}
}
2009-05-14 14:50:16 +00:00
}