public Object toNative(Object arg, ToNativeContext context) { if (arg == null) { return null; } Pointer ptr = ((NativeObject) arg).handle(); // // Deal with any adjustments to the proxy neccessitated by gstreamer // breaking their reference-counting idiom with special cases // if (context instanceof MethodParameterContext) { MethodParameterContext mcontext = (MethodParameterContext) context; Method method = mcontext.getMethod(); int index = mcontext.getParameterIndex(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); if (index < parameterAnnotations.length) { Annotation[] annotations = parameterAnnotations[index]; for (int i = 0; i < annotations.length; ++i) { if (annotations[i] instanceof Invalidate) { ((Handle) arg).invalidate(); break; } else if (annotations[i] instanceof IncRef) { ((RefCountedObject) arg).ref(); break; } } } } return ptr; }
@SuppressWarnings("rawtypes") public Object toNative(Object arg, ToNativeContext context) { if (arg == null) { return null; } return EnumMapper.getInstance().intValue((Enum) arg); }
public Object toNative(Object arg0, ToNativeContext arg1) { URI uri = (URI) arg0; String uriString = uri.toString(); // Need to fixup file:/ to be file:/// for gstreamer if ("file".equals(uri.getScheme()) && uri.getHost() == null) { final String path = uri.getRawPath(); if (com.sun.jna.Platform.isWindows()) { uriString = "file:/" + path; } else { uriString = "file://" + path; } } return uriString; }
public Object toNative(Object arg, ToNativeContext context) { if (arg == null) { return null; } Pointer ptr = ((NativeObject) arg).getNativeAddress(); return ptr; }
@SuppressWarnings("unchecked") public Object toNative(Object arg, ToNativeContext context) { if (arg == null) { return null; } return EnumMapper.getInstance().intValue((Enum) arg); }
@Override public Object toNative(Object value, ToNativeContext context) { return Boolean.TRUE.equals(value) ? 1 : 0; }
@Override public Long toNative(Object input, ToNativeContext context) { return ((JnaLongEnum<?>) input).getValue(); }
@Override public Integer toNative(Object input, ToNativeContext context) { return ((KernReturnT) input).getValue(); }
@Override public Integer toNative(Object input, ToNativeContext context) { return ((JnaIntEnum<?>) input).getValue(); }
public Object toNative(Object arg, ToNativeContext context) { return arg != null ? ((NativeValue) arg).nativeValue() : null; }
public Object toNative(Object arg, ToNativeContext arg1) { return arg != null ? ((ClockTime) arg).convertTo(TimeUnit.NANOSECONDS) : 0L; }
public Object toNative(Object arg, ToNativeContext context) { // Let the default String -> native conversion handle it return arg; }
public Object toNative(Object arg, ToNativeContext context) { return Integer.valueOf(Boolean.TRUE.equals(arg) ? 1 : 0); }
public Object toNative(Object arg0, ToNativeContext arg1) { return ((GQuark) arg0).intValue(); }
public Object toNative(Object arg, ToNativeContext context) { return ((IntPtr)arg).value; }
public Object toNative(Object arg, ToNativeContext context) { return ((QueryType)arg).intValue(); }
public Object toNative(Object arg, ToNativeContext context) { return Integer.valueOf(((Boolean) arg).booleanValue() ? 1 : 0); }
public Object toNative(Object arg, ToNativeContext context) { return ((Date)arg).getTime(); }
public Object toNative(Object obj, ToNativeContext ctx) { final NativeEnum ne = (NativeEnum)obj; return ne.getNativeValue(); }