source: svn/trunk/newcon3bcm2_21bu/dta/src/dcc/include/bdccengine.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 15.9 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2002-2006, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bdccengine.h $
11 * $brcm_Revision: 6 $
12 * $brcm_Date: 9/22/06 1:33p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /BSEAV/lib/ccgfx/include/bdccengine.h $
19 *
20 * 6   9/22/06 1:33p btosi
21 * PR22275: added support for clearing the screen if the CC data stream
22 * stops for an extended period (30 seconds)
23 *
24 * 5   9/15/06 12:07p btosi
25 * PR22275: added support for font edges
26 *
27 * 4   8/23/06 9:00a btosi
28 * PR22275: added support for specifying the "Safe Title" area
29 *
30 * 3   8/17/06 1:13p btosi
31 * PR22275: reworked the API to support loading/unloading fonts files
32 *
33 * 2   7/17/06 1:35p btosi
34 * PR22275: added wrapper routine BDCC_ENG_Process, support for resetting
35 * the library and logic to update the time counter
36 *
37 * 1   5/9/05 3:50p shyam
38 * PR 8365 : Add other sub-modules of ccgfx
39 *
40 ***************************************************************************/
41
42
43#ifndef BDCCENGINE_H
44#define BDCCENGINE_H
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50
51/***************************************************************************
52 *                         708 Rendering Engine
53 *                         --------------------
54 *
55 * This Rendering Engine API is a wrapper around several lower-level 708
56 * libraries.  In most cases, it is expected that this API will be used
57 * instead of the lower-level APIs.  In those cases in which the customer/
58 * system integrator has a need that isn't covered here, this code then
59 * serves as example code.
60 *
61 * Scope
62 *
63 * This API wraps the 708 DTVCC rendering and 608 Transcoding libraries
64 * but does not wrap the APIs used to extract Closed Captioning streams
65 * from MPEG User Data or from analog Line 21.  Furthermore, it does not
66 * wrap the API for inserting 608 back into Line 21 on analog output.
67 *
68 * 608 and 708
69 *
70 * The Rendering Engine has two main entry points, one each for 708 rendering
71 * and 608 transcoding.  Higher level system/driver code is expected to call the
72 * appropriate API to extract the Closed Captioning data from the input, be it
73 * the MPEG API (ie., bcmMPIReadClosedCaptionStatus) or the CCDecoder API
74 * (bCCDProcess), and then call one of these two entry points in this API:
75 * BDCC_ENG_Process608 or BDCC_ENG_Process708.
76 *
77 * This API has these features:
78 *
79 * 1.  manages the circular buffers
80 * 2.  sequences the calls to the lower-level APIs
81 * 3.  allows caller control over field and service numbers
82 * 4.  allows caller ability to override various DTVCC attributes
83 * 5.  provides reset
84 * 6.  context-less:  all processing done on _ProcessXxx and _Periodic calls
85 *
86 ***************************************************************************/   
87
88
89
90                                /*********************
91                                 *
92                                 * Includes
93                                 *
94                                 *********************/
95                                 
96#include "bdcc.h"
97#include "bccwinlib.h"
98
99                                /*********************
100                                 *
101                                 * Defines
102                                 *
103                                 *********************/
104                                 
105
106
107
108                                /*********************
109                                 *
110                                 * Types
111                                 *
112                                 *********************/
113                                 
114/***************************************************************************
115Summary:
116        The close caption types the Engine can handle
117
118Description:
119        The close caption types the Engine can handle
120
121See Also:
122       
123****************************************************************************/
124typedef enum BDCC_ENG_Type
125{
126    BDCC_ENG_Type_NoChange, /* used when reseting the library and reusing the same modes */
127    BDCC_ENG_Type_e608,         /* Input 608 stream is transcoded to 708 and displayed as graphics */
128        BDCC_ENG_Type_e708      /* 708 stream is natively displayed as graphics */
129   
130} BDCC_ENG_Type ;
131
132typedef struct BDCC_ENG_Settings
133{
134    /*
135    ** TODO: per the standard, use 32 for both 4:3 and 16:9.
136    ** We can probably get rid of the "Columns" element.
137    */
138    int Columns ;                       /* number of columns for DTVCC grid use 32 for 4:3 and 42 for 16:9 */
139   
140    int iCharCellWidth;         /* pixel width for char cell, must be compatible with font/glyph design */
141    int iCharCellHeight;        /* pixel height for char cell, must be compatible with font/glyph design */
142    int iSafeTitleX;                /* how much the CC window needs to be indented in the X direction */
143    int iSafeTitleY;                /* how much the CC window needs to be indented in the Y direction */
144    int iEdgeWidth;             /* width of the character edges in pixels */
145
146    unsigned int    uiTimeOutMilliSecs;     /* if no data for this period of time, clear the screen    */
147   
148} BDCC_ENG_Settings ;
149
150
151/***************************************************************************
152Summary:
153        The handle to the Close Caption engine.
154
155Description:
156        The handle to the Close Caption engine.
157
158See Also:
159       
160****************************************************************************/
161typedef struct BDCC_ENG_P_Object *BDCC_ENG_Handle ;
162
163
164                                /*********************
165                                 *
166                                 * API Entry Points
167                                 *
168                                 *********************/
169
170/**************************************************************************               
171 * 
172 * Function:            BDCC_ENG_GetDefaultSettings   
173 *     
174 * Inputs:                       
175 *                                      pEngineSettings         - BDCC_ENG_Settings structure
176 *   
177 * Outputs:                           
178 *                                      hEngine                         - init'ed by this function
179 * 
180 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
181 *   
182 * Description:               
183 *         
184 * This function return the default and recommended values for various engine settings.
185 *
186 * See Also:
187 *    BDCC_ENG_Open
188 *               
189 **************************************************************************/ 
190BDCC_Error BDCC_ENG_GetDefaultSettings(
191        BDCC_ENG_Settings *pEngineSettings);
192
193BDCC_Error BDCC_ENG_GetSettings( BDCC_ENG_Handle hEngine, BDCC_ENG_Settings *pEngineSettings );
194BDCC_Error BDCC_ENG_SetSettings( BDCC_ENG_Handle hEngine, BDCC_ENG_Settings *pEngineSettings );
195
196
197/**************************************************************************               
198 * 
199 * Function:            BDCC_ENG_Open   
200 *     
201 * Inputs:                       
202 *                                phEngine                      - Pointer to a Handle used to return the
203 *                                                                      Engine handle
204 *                                hWinLibHandle              - Handle from the lowest graphics 
205 *                                                                      abstraction layer. Opened seperately.
206 *                                      iCcService                              - CCx for 608 (1 to 4)
207 *                                                                                Service Number for 708 (0 to 63)
208 *                                      Type                            - BDCC_ENG_Type_e608 or
209 *                                                                      BDCC_ENG_Type_e708
210 *                                      pEngineSettings         - BDCC_ENG_Settings structure
211 *
212 * Outputs:
213 *                                      hEngine                         - init'ed by this function
214 * 
215 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
216 *   
217 * Description:
218 *         
219 * This function inits the buffers used for 708 DTVCC Closed     
220 * Captioning processing.  The 'Type' argument, in effect, is announcing
221 * which processing entry point will be called during normal processing.
222 * To switch between 608 and 708 (or to switch any of the init args),
223 * BDCC_ENG_Close and BDCC_ENG_Open must be called again -- or
224 * alternatively, BDCC_ENG_Reset.
225 *
226 * See Also:
227 *    BDCC_ENG_Close
228 *    BDCC_ENG_Reset
229 *               
230 **************************************************************************/ 
231BDCC_Error BDCC_ENG_Open(
232        BDCC_ENG_Handle *phEngine, 
233        BCCGFX_WINLIB_P_Handle hWinLibHandle
234        );
235
236BDCC_Error BDCC_ENG_Init(
237        BDCC_ENG_Handle hEngine, 
238        int iCcService,
239        BDCC_ENG_Type Type
240        );
241/**************************************************************************               
242 * 
243 * Function:            BDCC_ENG_Close   
244 *     
245 * Inputs:                       
246 *                                      hEngine                         - init'ed previously by BDCC_ENG_Open   
247 *   
248 * Outputs:                           
249 * 
250 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
251 *   
252 * Description:               
253 *         
254 * This function undoes the initialization of BDCC_ENG_Open().
255 *
256 * See Also:
257 *    BDCC_ENG_Reset
258 *    BDCC_ENG_Open
259 *               
260 **************************************************************************/ 
261BDCC_Error BDCC_ENG_Close(BDCC_ENG_Handle hEngine);
262
263
264/**************************************************************************               
265 * 
266 * Function:            BDCC_ENG_Reset   
267 *     
268 * Inputs:                       
269 *                                      hEngine                         - init'ed previously by BDCC_ENG_Open   
270 *                                      iCcService                              - CCx for 608 (1 to 4)
271 *                                                                                Service Number for 708 (0 to 63)
272 *                                      Type                            - 608, 708  or "NoChange"
273 *                                      Columns                         - number of columns for DTVCC grid
274 *                                                                                use 32 for 4:3 and 42 for 16:9
275 *                                      CharCell_Width          - pixel width for char cell, must be
276 *                                                                                compatible with font/glyph design
277 *                                      CharCell_Height         - pixel height for char cell, must be
278 *                                                                                compatible with font/glyph design
279 *   
280 * Outputs:                           
281 * 
282 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
283 *   
284 * Description:               
285 *         
286 * BDCC_ENG_Reset is logically equivalent to the sequence BDCC_ENG_Close()
287 * followed by BDCC_ENG_Open(). 
288 *
289 * Note:  This function is provided in case some advantage can be gained by
290 * consolidating _Fini and _Init.  For example, memory need not be free and
291 * re-aquired which has an effect on memory fragmentation.  Treat this function
292 * as a soft reset and the sequence _Fini and _Init as a hard reset.
293 *
294 * If Type is BDCC_ENG_Type_NoChange, then the reset is performed using the current
295 * parameters and Type, iCcService, Columns, CharCell_Xxx are ignored.
296 *
297 * See Also:
298 *    BDCC_ENG_Close
299 *    BDCC_ENG_Open
300 *               
301 **************************************************************************/ 
302BDCC_Error BDCC_ENG_Reset(
303        BDCC_ENG_Handle hEngine, 
304        bool bNoChange,
305        BDCC_ENG_Type Type,
306        int iCcService
307        );
308
309/**************************************************************************               
310 * 
311 * Function:            BDCC_ENG_Process   
312 *     
313 * Inputs:                       
314 *                                      hEngine                 - init'ed previously by BDCC_ENG_Open 
315 *                                      pTriplets                       - ptr to buf of triplets (field,cc1,cc2)
316 *                                      NumTriplets             - count = num_bytes / 3
317 *   
318 * Outputs:                           
319 * 
320 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
321 *   
322 * Description:               
323 *         
324 * Primarily a wrapper routine around the other BDCC functions.  Provides a single
325 * entry point to simplify the interface for the application.
326 *
327 * If this function returns BDCC_Error_eBufferOverflow, it is expected that the
328 * caller will call again to DccEngine_Reset.
329 *
330 **************************************************************************/ 
331BDCC_Error BDCC_ENG_Process(
332        BDCC_ENG_Handle hEngine,
333        unsigned char * pTriplets,
334        int NumTriplets);
335
336/**************************************************************************               
337 * 
338 * Function:            BDCC_ENG_Process608   
339 *     
340 * Inputs:                       
341 *                                      hEngine                 - init'ed previously by BDCC_ENG_Open 
342 *                                      pTriplets                       - ptr to buf of triplets (field,cc1,cc2)
343 *                                      NumTriplets             - count = num_bytes / 3
344 *   
345 * Outputs:                           
346 * 
347 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
348 *   
349 * Description:               
350 *         
351 * This function sends the CC pairs matching the supplied Field through
352 * the required processing for rendering.  This includes the 608 Transcoder.
353 *
354 * If this function returns BDCC_Error_eErrBufferOverflow, it is expected that the
355 * caller will call again to BDCC_ENG_Reset.
356 *
357 **************************************************************************/ 
358BDCC_Error BDCC_ENG_Process608(
359        BDCC_ENG_Handle hEngine,
360        unsigned char * pTriplets,
361        int NumTriplets);
362
363
364/**************************************************************************               
365 * 
366 * Function:            BDCC_ENG_Process708   
367 *     
368 * Inputs:                       
369 *                                      hEngine                         - init'ed previously by BDCC_ENG_Open 
370 *                                      pTriplets                       - ptr to buf of triplets (cc_type,cc1,cc2)
371 *                                      NumTriplets                     - count = num_bytes / 3
372 *   
373 * Outputs:                           
374 * 
375 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
376 *   
377 * Description:               
378 *         
379 * This function does the packet/service/coding/interpretation layers
380 * of the 708 DTVCC spec.  It filters on the Service Number provided in the
381 * previous _Init or _Reset call, as the iCcService argument.
382 *
383 * If this function returns BDCC_Error_eErrBufferOverflow, it is expected that the
384 * caller will call again to BDCC_ENG_Reset.
385 *
386 **************************************************************************/ 
387BDCC_Error BDCC_ENG_Process708(
388        BDCC_ENG_Handle hEngine,
389        unsigned char * pTriplets,
390        int NumTriplets);
391
392
393/**************************************************************************               
394 * 
395 * Function:            BDCC_ENG_Override   
396 *     
397 * Inputs:                       
398 *                                      hEngine                         - init'ed previously by BDCC_ENG_Open 
399 *                                      OverrideMask            - bitmask of overridden attributes
400 *                                      pOverrides                      - structure of overrides
401 *   
402 * Outputs:                           
403 * 
404 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
405 *   
406 * Description:               
407 *         
408 * This function allows the caller to override some of the 708 DTVCC
409 * interpretation attributes, such as pen size, font style and colors.
410 *
411 * The OverrideMask argument is a bitmask that identifies which of
412 * structure members of *pOverrides are valid and hence overridden.  The
413 * mask is absolute, not relative, meaning that overrides from a previous
414 * call will be 'forgotten' if not also included in the present call.  To
415 * undo all overrides and revert to the stream-supplied attributes, set
416 * the OverrideMask arg to 0.
417 *
418 * The supported overrides are (as defined in bcmDccCoding.h):
419 *
420 *    UPM_PENSIZE
421 *    UPM_FONTSTYLE
422 *    UPM_PENFG
423 *    UPM_PENBG
424 *    UPM_EDGECOLOR
425 *    UPM_EDGETYPE
426 *
427 **************************************************************************/ 
428BDCC_Error BDCC_ENG_Override(
429        BDCC_ENG_Handle hEngine,
430        unsigned int OverrideMask, 
431        BDCC_ENG_OverRides * pOverrides);
432       
433
434/**************************************************************************               
435 * 
436 * Function:            BDCC_ENG_Periodic   
437 *     
438 * Inputs:                       
439 *                                      hEngine                         - init'ed previously by BDCC_ENG_Open 
440 *   
441 * Outputs:                           
442 * 
443 * Returns:                     BDCC_Error_eSuccess or standard BDCC_Error error code     
444 *   
445 * Description:               
446 *   
447 * This function provides the Engine API a mechanism to do sequenced
448 * effects.  This is used for flashing and smooth scrolling.  The usPeriod
449 * arg is set to an average value.  For example, if this is driven from a
450 * field interrupt, it can be set to 16683 for a 59.94 Hz field rate.
451 *
452 **************************************************************************/ 
453BDCC_Error BDCC_ENG_Periodic( BDCC_ENG_Handle hEngine );
454
455
456/*
457** Data types and routines associated with managing fonts.
458*/
459
460typedef struct BDCC_FONT_DESCRIPTOR
461{
462    void *              hFont;
463    char *              pszFontFile;  /*name and path to the font file */
464    int                   iFontSize;
465    int                 iMaxGlyphHeight;
466    int                 iMaxGlyphWidth;   
467   
468} BDCC_FONT_DESCRIPTOR;
469 
470BDCC_Error BDCC_ENG_LoadFont( 
471        BDCC_ENG_Handle hEngine,
472    BDCC_FONT_DESCRIPTOR * pFontDesc, 
473    int iNumToMeasure,
474    char * pszCharsToMeasure
475    );
476BDCC_Error BDCC_ENG_UnloadFont( BDCC_ENG_Handle hEngine,  BDCC_FONT_DESCRIPTOR * pFontDesc );
477BDCC_Error BDCC_ENG_AssignFont( BDCC_ENG_Handle hEngine,  BDCC_FONT_DESCRIPTOR * pFontDesc,  BDCC_PenStyle penStyle, BDCC_FontStyle fontStyle );
478
479#ifdef __cplusplus
480}
481#endif
482
483#endif /* BDCCENGINE_H */
484
485
Note: See TracBrowser for help on using the repository browser.