public void Send(ref NDIlib.audio_frame_interleaved_16s_t audioFrame) { if (_sendInstancePtr == IntPtr.Zero) { return; } NDIlib.util_send_send_audio_interleaved_16s(_sendInstancePtr, ref audioFrame); }
public bool PtzStorePreset(int index) { if (!_isPtz || _recvInstancePtr == IntPtr.Zero || index < 0 || index > 99) { return(false); } return(NDIlib.recv_ptz_store_preset(_recvInstancePtr, index)); }
public bool IsRecording() { if (!_canRecord || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_recording_is_recording(_recvInstancePtr)); }
public bool PtzRecallPreset(int index, double speed) { if (!_isPtz || _recvInstancePtr == IntPtr.Zero || index < 0 || index > 99) { return(false); } return(NDIlib.recv_ptz_recall_preset(_recvInstancePtr, index, (float)speed)); }
public bool SetPtzFocusSpeed(double speed) { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_focus_speed(_recvInstancePtr, (float)speed)); }
public bool PtzWhiteBalanceManual(double red, double blue) { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_white_balance_manual(_recvInstancePtr, (float)red, (float)blue)); }
public bool PtzExposureAuto() { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_exposure_auto(_recvInstancePtr)); }
public bool PtzWhiteBalanceIndoor() { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_white_balance_indoor(_recvInstancePtr)); }
public bool PtzWhiteBalanceOneShot() { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_white_balance_oneshot(_recvInstancePtr)); }
// Determine the current tally sate. If you specify a timeout then it will wait until it has changed, otherwise it will simply poll it // and return the current tally immediately. The return value is whether anything has actually change (true) or whether it timed out (false) public bool GetTally(ref NDIlib.tally_t tally, int timeout) { if (_sendInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.send_get_tally(_sendInstancePtr, ref tally, (uint)timeout)); }
void ReleaseSendInstance() { if (_sendInstance == IntPtr.Zero) { return; } NDIlib.send_destroy(_sendInstance); _sendInstance = IntPtr.Zero; }
public bool GetRecordingTimes(ref NDIlib.recv_recording_time_t recordingTimes) { if (!_canRecord || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_recording_get_times(_recvInstancePtr, ref recordingTimes)); }
public bool RecordingSetAudioLevel(double level) { if (!_canRecord || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_recording_set_audio_level(_recvInstancePtr, (float)level)); }
public bool SetPtzZoomSpeed(double value) { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_zoom_speed(_recvInstancePtr, (float)value)); }
public bool SetPtzPanTiltSpeed(double panSpeed, double tiltSpeed) { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_pan_tilt_speed(_recvInstancePtr, (float)panSpeed, (float)tiltSpeed)); }
public void Send(ref NDIlib.audio_frame_v2_t audioFrame) { if (_sendInstancePtr == IntPtr.Zero) { return; } NDIlib.send_send_audio_v2(_sendInstancePtr, ref audioFrame); }
public void Send(ref NDIlib.video_frame_v2_t videoFrame) { if (_sendInstancePtr == IntPtr.Zero) { return; } NDIlib.send_send_video_v2(_sendInstancePtr, ref videoFrame); }
// Get the current number of receivers connected to this source. This can be used to avoid even rendering when nothing is connected to the video source. // which can significantly improve the efficiency if you want to make a lot of sources available on the network. If you specify a timeout that is not // 0 then it will wait until there are connections for this amount of time. public int GetConnections(int waitMs) { if (_sendInstancePtr == IntPtr.Zero) { return(0); } return(NDIlib.send_get_no_connections(_sendInstancePtr, (uint)waitMs)); }
public bool PtzExposureManual(double level) { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_exposure_manual(_recvInstancePtr, (float)level)); }
void ReleaseNdiFind() { if (_ndiFind == IntPtr.Zero) { return; } NDIlib.find_destroy(_ndiFind); _ndiFind = IntPtr.Zero; }
// Stop recording. public bool RecordingStop() { if (!_canRecord || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_recording_stop(_recvInstancePtr)); }
public bool PtzAutoFocus() { if (!_isPtz || _recvInstancePtr == IntPtr.Zero) { return(false); } return(NDIlib.recv_ptz_auto_focus(_recvInstancePtr)); }
// connect to an NDI source in our Dictionary by name public void Connect(Source source) { // just in case we're already connected // _delegateUpdateDynImage = UpdateDynImage; Disconnect(); // Sanity if (source == null || (String.IsNullOrEmpty(source.Name))) { return; } // a source_t to describe the source to connect to. NDIlib.source_t source_t = new NDIlib.source_t() { p_ndi_name = UTF.StringToUtf8(source.Name) }; // make a description of the receiver we want NDIlib.recv_create_v3_t recvDescription = new NDIlib.recv_create_v3_t() { // the source we selected source_to_connect_to = source_t, // we want BGRA frames for this example color_format = NDIlib.recv_color_format_e.recv_color_format_BGRX_BGRA, // we want full quality - for small previews or limited bandwidth, choose lowest bandwidth = NDIlib.recv_bandwidth_e.recv_bandwidth_highest, // let NDIlib deinterlace for us if needed allow_video_fields = false }; // create a new instance connected to this source _recvInstancePtr = NDIlib.recv_create_v3(ref recvDescription); // free the memory we allocated with StringToUtf8 Marshal.FreeHGlobal(source_t.p_ndi_name); // did it work? System.Diagnostics.Debug.Assert(_recvInstancePtr != IntPtr.Zero, "Failed to create NDI receive instance."); if (_recvInstancePtr != IntPtr.Zero) { // We are now going to mark this source as being on program output for tally purposes (but not on preview) SetTallyIndicators(true, false); _source = source; // start up a thread to receive on _receiveThread = new Thread(ReceiveThreadProc) { IsBackground = true, Name = "NdiReceiveThread" }; _receiveThread.Start(); } }
void Start() { var name = Marshal.StringToHGlobalAnsi("Test Server"); var sendOptions = new NDIlib.send_create_t { p_ndi_name = name }; _sendInstance = NDIlib.send_create(ref sendOptions); Marshal.FreeHGlobal(name); }
// connect to an NDI source in our Dictionary by name public void Connect(NDIlib.recv_color_format_e colorFormat) { // just in case we're already connected Disconnect(); // a source_t to describe the source to connect to. NDIlib.source_t source_t = new NDIlib.source_t() { p_ndi_name = UTF.StringToUtf8(_sourceName) }; // make a description of the receiver we want NDIlib.recv_create_v3_t recvDescription = new NDIlib.recv_create_v3_t() { // the source we selected source_to_connect_to = source_t, // we want BGRA frames for this example color_format = colorFormat, // we want full quality - for small previews or limited bandwidth, choose lowest bandwidth = _videoEnabled ? NDIlib.recv_bandwidth_e.recv_bandwidth_highest : NDIlib.recv_bandwidth_e.recv_bandwidth_audio_only, // let NDIlib deinterlace for us if needed allow_video_fields = false, // The name of the NDI receiver to create. This is a NULL terminated UTF8 string and should be // the name of receive channel that you have. This is in many ways symettric with the name of // senders, so this might be "Channel 1" on your system. p_ndi_recv_name = UTF.StringToUtf8(_receiverName) }; // create a new instance connected to this source _recvInstancePtr = NDIlib.recv_create_v3(ref recvDescription); // free the memory we allocated with StringToUtf8 Marshal.FreeHGlobal(source_t.p_ndi_name); Marshal.FreeHGlobal(recvDescription.p_ndi_recv_name); // did it work? System.Diagnostics.Debug.Assert(_recvInstancePtr != IntPtr.Zero, "Failed to create NDI receive instance."); if (_recvInstancePtr != IntPtr.Zero) { // We are now going to mark this source as being on program output for tally purposes (but not on preview) SetTallyIndicators(true, false); // start up a thread to receive on _receiveThread = new Thread(ReceiveThreadProc) { IsBackground = true, Name = "NdiExampleReceiveThread" }; _receiveThread.Start(); } }
public bool Init() { // Not required, but "correct". (see the SDK documentation) if (!NDIlib.initialize()) { // Cannot run NDI. Most likely because the CPU is not sufficient (see SDK documentation). // you can check this directly with a call to NDIlib.is_supported_CPU() CustomMessageBox.Show("Cannot run NDI"); return(false); } return(true); }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_memoryOwned && _ndiAudioFrame.p_data != IntPtr.Zero) { Marshal.FreeHGlobal(_ndiAudioFrame.p_data); _ndiAudioFrame.p_data = IntPtr.Zero; } NDIlib.destroy(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_sendInstancePtr != IntPtr.Zero) { NDIlib.send_destroy(_sendInstancePtr); _sendInstancePtr = IntPtr.Zero; } NDIlib.destroy(); } }
void SetTallyIndicators(bool onProgram, bool onPreview) { // we need to have a receive instance if (_recvInstancePtr != IntPtr.Zero) { // set up a state descriptor NDIlib.tally_t tallyState = new NDIlib.tally_t() { on_program = onProgram, on_preview = onPreview }; // set it on the receiver instance NDIlib.recv_set_tally(_recvInstancePtr, ref tallyState); } }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { // tell the thread to exit _exitThread = true; // wait for it to exit if (_receiveThread != null) { _receiveThread.Join(); _receiveThread = null; } //// Stop the audio device if needed //if (_wasapiOut != null) //{ // _wasapiOut.Stop(); // _wasapiOut.Dispose(); // _wasapiOut = null; //} videoFrames.Dispose(); outputTexture.Dispose(); } // Destroy the receiver if (_recvInstancePtr != IntPtr.Zero) { NDIlib.recv_destroy(_recvInstancePtr); _recvInstancePtr = IntPtr.Zero; } // Not required, but "correct". (see the SDK documentation) NDIlib.destroy(); Marshal.FreeCoTaskMem(buffer0); Marshal.FreeCoTaskMem(buffer1); _disposed = true; } }