2 #ifndef BLUE_LINUX_CODE
\r
3 #ifndef HANCUTILS_USE_STATIC_LIB
\r
4 #ifdef HANCUTILS_EXPORTS
\r
5 #define HANCUTILS_API __declspec(dllexport)
\r
6 #elif defined(__APPLE__)
\r
7 #define HANCUTILS_API
\r
8 #define ATLTRACE printf
\r
10 #define HANCUTILS_API __declspec(dllimport)
\r
13 #define HANCUTILS_API
\r
16 #define HANCUTILS_API
\r
19 #include "BlueDriver_p.h"
\r
27 @defgroup hanc_manipilation_function Embedded audio
\r
31 #pragma pack(push, hanc_struct, 1)
\r
34 @brief The structure is used to extract/insert Embedded audio to and from the HANC stream of Greed and Leon based cards.*/
\r
36 struct hanc_stream_info_struct
\r
38 BLUE_INT32 AudioDBNArray[4]; /**< Contains the DBN values that should be used for each of the embedded audio groups*/
\r
39 BLUE_INT32 AudioChannelStatusBlock[4]; /**< channel status block information for each of the embedded audio group*/
\r
40 BLUE_UINT32 flag_valid_time_code; /**< flag which identifies the validity of the time code member in the #hanc_stream_info_struct*/
\r
41 BLUE_UINT64 time_code; /**< RP188 time code that was extracted from the HANC buffer or RP188 timecode which should be inserted
\r
42 into the HANC buffer*/
\r
43 BLUE_UINT32* hanc_data_ptr; /**< Hanc Buffer which should be used as the source or destination for either extraction or insertion */
\r
44 BLUE_UINT32 video_mode; /**< video mode which this hanc buffer which be used with. We need this information for do the required audio distribution
\r
46 BLUE_UINT64 ltc_time_code;
\r
47 BLUE_UINT64 sd_vitc_time_code;
\r
48 BLUE_UINT64 rp188_ltc_time_code;
\r
49 BLUE_UINT32 pad[126];
\r
52 #define AUDIO_INPUT_SOURCE_EMB 0
\r
53 #define AUDIO_INPUT_SOURCE_AES 1
\r
54 struct hanc_decode_struct
\r
56 void* audio_pcm_data_ptr; // Buffer which would be used to store the extracted PCM
\r
57 // audio data. Must be filled in by app before calling function.
\r
58 BLUE_UINT32 audio_ch_required_mask; // which all audio channels should be extracted from the
\r
59 // audio frame .Must be filled in by app before calling function.
\r
60 BLUE_UINT32 type_of_sample_required;// type of destination audio channel
\r
61 //ie 16 bit ,24 bit or 32 bit PCM data .
\r
62 //Must be filled in by app before calling function.
\r
63 BLUE_UINT32 no_audio_samples; // this would contain how many audio samples has been decoded from
\r
65 BLUE_UINT64 timecodes[7]; // Would extract the timecode information from the audio frame.
\r
66 void * raw_custom_anc_pkt_data_ptr; // This buffer would contain the raw ANC packets that was found in the orac hanc buffer.
\r
67 // this would contain any ANC packets that is not of type embedded audio and RP188 TC.
\r
68 //Must be filled in by app before calling function. can be NULL
\r
69 BLUE_UINT32 sizeof_custom_anc_pkt_data_ptr; // size of the ANC buffer array
\r
70 //Must be filled in by app before calling function. can be NULL
\r
71 BLUE_UINT32 avail_custom_anc_pkt_data_bytes;// how many custom ANC packets has been decoded into raw_hanc_pkt_data_ptr
\r
72 //Must be filled in by app before calling function. can be NULL
\r
73 BLUE_UINT32 audio_input_source; // Used to select the audio input source.
\r
74 // whether it is AES or Embedded.
\r
75 //Must be filled in by app before calling function.
\r
76 BLUE_UINT32 audio_temp_buffer[16]; // this is used to store split audio sample
\r
77 // which did not contain all its audio channels
\r
78 // in one audio frame
\r
79 //Must be initialised to zero by app before first instantiating the function.
\r
80 BLUE_UINT32 audio_split_buffer_mask; // The mask would be used to make a note of
\r
81 // split audio sample information for a frame.
\r
82 //Must be initialised to zero by app before first instantiating the function.
\r
83 BLUE_UINT32 max_expected_audio_sample_count; // specify the maximum number of audio samples
\r
84 // that the audio pcm buffer can contain.
\r
85 //Must be filled in by app before calling function.
\r
86 BLUE_UINT32 pad[124];
\r
89 #pragma pack(pop, hanc_struct)
\r
91 HANCUTILS_API BLUE_UINT32 encode_hanc_frame(struct hanc_stream_info_struct* hanc_stream_ptr,
\r
92 void* audio_pcm_ptr,
\r
93 BLUE_UINT32 no_audio_ch,
\r
94 BLUE_UINT32 no_audio_samples,
\r
95 BLUE_UINT32 nTypeOfSample,
\r
96 BLUE_UINT32 emb_audio_flag);
\r
98 HANCUTILS_API BLUE_UINT32 encode_hanc_frame_ex( BLUE_UINT32 card_type,
\r
99 struct hanc_stream_info_struct* hanc_stream_ptr,
\r
100 void* audio_pcm_ptr,
\r
101 BLUE_UINT32 no_audio_ch,
\r
102 BLUE_UINT32 no_audio_samples,
\r
103 BLUE_UINT32 nTypeOfSample,
\r
104 BLUE_UINT32 emb_audio_flag);
\r
107 HANCUTILS_API BLUE_UINT32 encode_hanc_frame_with_ucz( BLUE_UINT32 card_type,
\r
108 struct hanc_stream_info_struct* hanc_stream_ptr,
\r
109 void* audio_pcm_ptr,
\r
110 BLUE_UINT32 no_audio_ch,
\r
111 BLUE_UINT32 no_audio_samples,
\r
112 BLUE_UINT32 nTypeOfSample,
\r
113 BLUE_UINT32 emb_audio_flag,
\r
114 BLUE_UINT8* pUCZBuffer);
\r
116 HANCUTILS_API BLUE_UINT32 create_embed_audiosample( void* raw_data_ptr,
\r
117 BLUE_UINT32* emb_data_ptr,
\r
118 BLUE_UINT32 channels_per_audio_sample,
\r
119 BLUE_UINT32 bytes_per_ch,
\r
120 BLUE_UINT32 no_samples,
\r
121 BLUE_UINT32 emb_audio_flags,
\r
122 BLUE_UINT8* Audio_Groups_DBN_Array,
\r
123 BLUE_UINT8* Audio_Groups_statusblock_Array);
\r
125 HANCUTILS_API BLUE_UINT32* get_embed_audio_distribution_array(BLUE_UINT32 video_mode, BLUE_UINT32 sequence_no);
\r
126 //HANCUTILS_API BLUE_UINT32 * GetAudioFrameSequence(BLUE_UINT32 video_output_standard);
\r
128 HANCUTILS_API bool hanc_stream_analyzer(BLUE_UINT32 *src_hanc_buffer,struct hanc_stream_info_struct * hanc_stream_ptr);
\r
129 HANCUTILS_API bool orac_hanc_stream_analyzer(BLUE_UINT32 card_type,BLUE_UINT32 *src_hanc_buffer,struct hanc_decode_struct * decode_ptr,char * analyzer_output_file);
\r
130 HANCUTILS_API bool hanc_decoder_ex( BLUE_UINT32 card_type,
\r
131 BLUE_UINT32* src_hanc_buffer,
\r
132 struct hanc_decode_struct* hanc_decode_struct_ptr);
\r
139 @defgroup vanc_manipilation_function vanc packet I/O
\r
145 @brief enumerator used by VANC manipulation function on HD cards to notify whether
\r
146 VANC pakcet shoule be inserted/extracted from VANC Y buffers or VANC CbCr buffer.
\r
147 This enumerator will only be used on HD video modes as it is the only with
\r
148 2 type of ANC bufers ir Y and CbCr. On SD Modes the ANC data is inserted across
\r
149 both Y anc CbCr values.
\r
152 enum blue_vanc_pkt_type_enum
\r
154 blue_vanc_pkt_y_comp=0, /**< ANC pkt should be inserted/extracted from the Y component buffer*/
\r
155 blue_vanc_pkt_cbcr_comp=1 /**< ANC pkt should be inserted/extracted from the CbCr component buffer*/
\r
159 @brief Use this function to initialise VANC buffer before inserting any packets into the buffer
\r
160 @param CardType type of bluefish card to which this vanc buffer was transferred to.
\r
161 @param nVideoMode video mode under which this vanc buffer will be used.
\r
162 @param pixels_per_line width in pixels of the vanc buffer that has to be initialised.
\r
163 @param lines_per_frame height of the vanc buffer that has to be initialised.
\r
164 @param pVancBuffer vanc buffer which has to be initialised.
\r
168 HANCUTILS_API BLUE_UINT32 blue_init_vanc_buffer(BLUE_UINT32 CardType,BLUE_UINT32 nVideoMode,BLUE_UINT32 pixels_per_line,BLUE_UINT32 lines_per_frame,BLUE_UINT32 * pVancBuffer);
\r
170 @brief this function can be used to extract ANC packet from HD cards. Currently we can only extract packets in the VANC space.
\r
171 @param CardType type of the card from which the vanc buffer was captured.
\r
172 @param vanc_pkt_type This parameter denotes whether to search for the VANC packet in Y Space or Cb/Cr Space.
\r
173 The values this parameter accepts are defined in the enumerator #blue_vanc_pkt_type_enum
\r
174 @param src_vanc_buffer Vanc buffer which was captured from bluefish card
\r
175 @param src_vanc_buffer_size size of the vanc buffer which should be parsed for the specified vanc packet
\r
176 @param pixels_per_line specifies how many pixels are there in each line of VANC buffer
\r
177 @param vanc_pkt_did specifies the DID of the Vanc packet which should be extracted from the buffer
\r
178 @param vanc_pkt_sdid Returns the SDID of the extracted VANC packet
\r
179 @param vanc_pkt_data_length returns the size of the extracted VANC packet. The size is specifed as number of UDW words
\r
180 that was contained in the packet
\r
181 @param vanc_pkt_data_ptr pointer to UDW of the VANC packets . The 10 bit UDW words are packed in a 16 bit integer. The bottom 10 bit of the
\r
182 16 bit word contains the UDW data.
\r
183 @param vanc_pkt_line_no line number where the packet was found .
\r
188 HANCUTILS_API BLUE_INT32 vanc_pkt_extract(
\r
189 BLUE_UINT32 CardType,
\r
190 BLUE_UINT32 vanc_pkt_type,
\r
191 BLUE_UINT32 * src_vanc_buffer,
\r
192 BLUE_UINT32 src_vanc_buffer_size,
\r
193 BLUE_UINT32 pixels_per_line,
\r
194 BLUE_UINT32 vanc_pkt_did,
\r
195 BLUE_UINT16 * vanc_pkt_sdid,
\r
196 BLUE_UINT16 * vanc_pkt_data_length,
\r
197 BLUE_UINT16 * vanc_pkt_data_ptr,
\r
198 BLUE_UINT16 * vanc_pkt_line_no);
\r
201 @brief use this function to insert ANC packets into the VANC space of the HD cards.
\r
202 @param CardType type of the card from which the vanc buffer was captured.
\r
203 @param vanc_pkt_type This parameter denotes whether to search for the VANC packet in Y Space or Cb/Cr Space.
\r
204 The values this parameter accepts are defined in the enumerator #blue_vanc_pkt_type_enum
\r
205 @param vanc_pkt_line_no line in th VANC buffer where the ANC packet should inserted.
\r
206 @param vanc_pkt_buffer vanc ANC packet which should be inserted into the VANC buffer.
\r
207 @param vanc_pkt_buffer_size size of the ANC packet including the checksum ,ADF , SDID, DID and Data Count
\r
208 @param dest_vanc_buffer VANC buffer into which the ANC packet will be inserted into.
\r
209 @param pixels_per_line specifies how many pixels are there in each line of VANC buffer
\r
211 HANCUTILS_API BLUE_INT32 vanc_pkt_insert(
\r
212 BLUE_UINT32 CardType,
\r
213 BLUE_UINT32 vanc_pkt_type,
\r
214 BLUE_UINT32 vanc_pkt_line_no,
\r
215 BLUE_UINT32 * vanc_pkt_buffer,
\r
216 BLUE_UINT32 vanc_pkt_buffer_size,
\r
217 BLUE_UINT32 * dest_vanc_buffer,
\r
218 BLUE_UINT32 pixels_per_line);
\r
223 @defgroup vanc_decode_encoder_helper ANC encoder/decoder
\r
226 HANCUTILS_API BLUE_UINT32 decode_eia_708b_pkt(BLUE_UINT32 CardType,BLUE_UINT16 * vanc_pkt_data_ptr,BLUE_UINT16 pkt_udw_count,BLUE_UINT16 eia_pkt_subtype,BLUE_UINT8 * decoded_ch_str);
\r
227 //#ifndef BLUE_LINUX_CODE
\r
228 //HANCUTILS_API BLUE_UINT64 decode_rp188_packet(BLUE_UINT32 CardType,BLUE_UINT32 * src_vanc_buffer,BLUE_UINT32 UDW_Count,BLUE_UINT64 *rp188_dbb);
\r
229 //HANCUTILS_API bool blue_vitc_decoder_8bit_fmt(BLUE_UINT8 * raw_vbi_ptr,BLUE_UINT32 pixels_per_line,BLUE_UINT32 mem_fmt,BLUE_UINT32 vitc_line_no,BLUE_UINT64 * vitc_time_code);
\r
230 //HANCUTILS_API bool blue_vitc_decoder_10bit_v210(BLUE_UINT8 * raw_vbi_ptr, BLUE_UINT32 vitc_line_no, BLUE_UINT64 * vitc_time_code);
\r
231 //HANCUTILS_API unsigned int create_rp188_pkt(
\r
232 // BLUE_UINT32 cardType,
\r
233 // BLUE_UINT32 * emb_data_ptr,
\r
234 // BLUE_UINT32 line_no,
\r
235 // BLUE_UINT32 start_new_line,
\r
236 // BLUE_UINT64 timecode,
\r
237 // BLUE_UINT64 rp188_dbb);
\r