]> git.sesse.net Git - casparcg/blob - dependencies/newtek/include/AirSend_api.h
274cf7a2875221c7781e156aac67202e0c4dc93a
[casparcg] / dependencies / newtek / include / AirSend_api.h
1 #pragma once
2
3 // Are files exported ?
4 #ifdef  COMPILE_PROCESSING_AIRSEND
5 #define PROCESSING_AIRSEND_API  __declspec(dllexport)
6 #else   // COMPILE_PROCESSING_AIRSEND
7 #define PROCESSING_AIRSEND_API  __declspec(dllimport)
8 #endif  // COMPILE_PROCESSING_AIRSEND
9
10 // Create and initialize an AirSend instance. This will return NULL if it fails.
11 extern "C" PROCESSING_AIRSEND_API       
12                         void*   AirSend_Create( // The video resolution. This should be a multiple of 8 pixels wide.
13                                                                     // This is the full frame resolution and not the per field resolution
14                                                                         // so for instance a 1920x1080 interlaced video stream would store
15                                                                         // xres=1920 yres=1080
16                                                                         const int xres, const int yres, 
17                                                                         // The frame-rate as a numerator and denominator. Examples :
18                                                                         // NTSC, 480i30, 1080i30 : 30000/1001
19                                                                         // NTSC, 720p60 : 60000/1001
20                                                                         // PAL, 576i50, 1080i50 : 30000/1200
21                                                                         // PAL, 720p50 : 60000/1200
22                                                                         const int frame_rate_n, const int frame_rate_d, 
23                                                                         // Is this field interlaced or not ?
24                                                                         const bool progressive,
25                                                                         // The image aspect ratio as a floating point. For instance
26                                                                         // 4:3  = 4.0/3.0  = 1.33333
27                                                                         // 16:9 = 16.0/9.0 = 1.77778
28                                                                         const float aspect_ratio,
29                                                                         // Do we want audio ?
30                                                                         const bool audio_enabled,
31                                                                         // The number of audio channels. 
32                                                                         const int no_channels,
33                                                                         // The audio sample-rate
34                                                                         const int sample_rate );
35
36 // Destroy an instance of AirSend that was created by AirSend_Create.
37 extern "C" PROCESSING_AIRSEND_API
38                         void AirSend_Destroy( void* p_instance );
39
40 // Add a video frame. This is in YCbCr format and may have an optional alpha channel.
41 // This is stored in an uncompressed video buffer of FourCC UYVY which has 16 bits per pixel
42 // YUV 4:2:2 (Y sample at every pixel, U and V sampled at every second pixel horizontally on each line). 
43 // This means that the stride of the image is xres*2 bytes pointed to by p_ycbcr. 
44 // For fielded video, the two fields are interleaved together and it is assumed that field 0 is always
45 // above field 1 which matches all modern video formats. It is recommended that if you desire to send
46 // 486 line video that you drop the first line and the bottom 5 lines and send 480 line video. 
47 // The return value is true when connected, false when not connected.
48 extern "C" PROCESSING_AIRSEND_API
49                         bool AirSend_add_frame_ycbcr( void* p_instance, const BYTE* p_ycbcr );
50
51 extern "C" PROCESSING_AIRSEND_API
52                         bool AirSend_add_frame_ycbcr_alpha( void* p_instance, const BYTE* p_ycbcr, const BYTE* p_alpha );
53
54 // These methods allow you to add video in BGRA and BGRX formats. (BGRX is 32 bit BGR with the alpha channel
55 // ignored.) Frames are provided as uncompressed buffers. YCbCr is the preferred color space and these are
56 // provided as a conveniance.
57 // The return value is true when connected, false when not connected.
58 extern "C" PROCESSING_AIRSEND_API
59                         bool AirSend_add_frame_bgra( void* p_instance, const BYTE* p_bgra );
60 extern "C" PROCESSING_AIRSEND_API
61                         bool AirSend_add_frame_bgrx( void* p_instance, const BYTE* p_bgrx );
62
63 // Because Windows tends to create images bottom to top by default in memory, there are versions of the
64 // BGR? functions that will send the video frame vertically flipped to avoid you needing to use CPU time
65 // and memory bandwidth doing this yourself.
66 // The return value is true when connected, false when not connected.
67 extern "C" PROCESSING_AIRSEND_API
68                         bool AirSend_add_frame_bgra_flipped( void* p_instance, const BYTE* p_bgra );
69 extern "C" PROCESSING_AIRSEND_API
70                         bool AirSend_add_frame_bgrx_flipped( void* p_instance, const BYTE* p_bgrx );
71
72 // Add audio data. This should be in 16 bit PCM uncompressed and all channels are interleaved together.
73 // Because audio and video are muxed together and send to the video source it is important that you send
74 // these at the same rate since video frames will be "held" in the muxer until the corresponding audio
75 // is received so that all data can be sent in "display" order to the TriCaster.
76 // The return value is true when connected, false when not connected.
77 extern "C" PROCESSING_AIRSEND_API
78                         bool AirSend_add_audio( void* p_instance, const short* p_src, const int no_samples );
79
80 // This allows you to tell a particular TriCaster that is on "Receive" mode to watch this video source.
81 // By default, on a TriCaster "Net 1" is on port 7000, and "Net 2" is on port 7001. Note that a full implementation
82 // should use Bonjour to locate the TriCaster as described in the SDK documentation; when working this way
83 // you would always know the true port numbers.
84 extern "C" PROCESSING_AIRSEND_API
85                         void AirSend_request_connection( void* p_instance, const ULONG IP, const USHORT Port );