package com.walker.devolay;
public class DevolayReceiver implements AutoCloseable {
// Receive only metadata
public static final int RECEIVE_BANDWIDTH_METADATA_ONLY = -10;
// Receive only audio and metadata
public static final int RECEIVE_BANDWIDTH_AUDIO_ONLY = 10;
// Receive metadata, audio, and video at a lower bandwidth and resolution
public static final int RECEIVE_BANDWIDTH_LOWEST = 0;
// Receive metadata, audio, and video at full resolution
public static final int RECEIVE_BANDWIDTH_HIGHEST = 100;
public enum ColorFormat {
/**
* When there is an alpha channel, BGRA, otherwise BGRX
*/
BGRX_BGRA(0),
/**
* When there is an alpha channel, BGRA, otherwise UYVY
*/
UYVY_BGRA(1),
/**
* When there is an alpha channel, RGBA, otherwise BGRX
*/
RGBX_RGBA(2),
/**
* When there is an alpha channel, RGBA, otherwise UYVY
*/
UYVY_RGBA(3),
/**
* Use the fastest available color format for the incoming video signal.
* Different platforms may vary in what format this will choose.
*
* When using this format, allow_video_fields is true, and a source supplies fields, individual fields will always be delivered.
*
* For most video sources on most platforms, the following will be used:
* No alpha channel: UYVY
* Alpha channel: UYVA
*/
FASTEST(100),
/**
* Use the format that is closest to native for the incoming codec for the best quality.
* Allows for receiving on 16bpp color from many sources
*
* When using this format, allow_video_fields is true, and a source supplies fields, individual fields will always be delivered.
*
* For most video sources on most platforms, the following will be used:
* No alpha channel: P216 or UYVY
* Alpha channel: PA16 or UYVA
*/
BEST(101);
private int id;
ColorFormat(int id) {
this.id = id;
}
}
/**
* Holds the reference to the NDIlib_send_instance_t object
*/
private final long ndilibRecievePointer;
public DevolayReceiver(DevolaySource source, ColorFormat colorFormat, int receiveBandwidth, boolean allowVideoFields, String name) {
// TODO: Implement this forced reference more effectively
Devolay.loadLibraries();
this.ndilibRecievePointer = receiveCreate(source.structPointer, colorFormat.id, receiveBandwidth, allowVideoFields, name);
}
public DevolayReceiver(DevolaySource source) {
this(source, ColorFormat.UYVY_BGRA, RECEIVE_BANDWIDTH_HIGHEST, true, null);
}
public DevolayReceiver() {
// TODO: Implement this forced reference more effectively
Devolay.loadLibraries();
this.ndilibRecievePointer = receiveCreateDefaultSettings();
}