source: svn/branches/kctv/newcon3bcm2_21bu/BSEAV/lib/scte_27/scte_27.h

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

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 6.1 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2009, 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:  $
11 * $brcm_Revision:  $
12 * $brcm_Date: $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log:  $
19 *
20 ***************************************************************************/
21#ifndef SCTE_27_H__
22#define SCTE_27_H__
23
24#include "bstd.h"
25#include "bos.h"
26#include "genericlist.h"
27
28#define SCTE_27_STK_SIZE                1024            /* words */
29
30#define SUBTITLE_STREAM_TYPE            0x82            /* OpenCable Subtitle */
31#define SUBTITLE_SECTION_ID                     0xc6            /* table ID */
32
33typedef struct subtitle_message {
34        uint8_t  table_ID;                                              // 8 bits
35        uint16_t section_length;                // 12 bits
36
37        uint8_t segmentation_overlay_included;  // 1 bit
38
39        // for segmentation overlay included
40        uint16_t table_extension;               // 16 bits, table ID for segmented packet
41        uint16_t last_segment_number;           // 12 bits
42        uint16_t segment_number;                // 12 bits
43
44        /* Body */
45        uint32_t  ISO_639_language_code;                // 3 bits
46        uint8_t   pre_clear_display;                    // 1
47        uint8_t   immediate;                                    // 1
48        uint8_t   display_standard;                             // 5 bits
49
50        /* Out-Cure Time */
51        uint32_t  display_in_PTS;                               // 32
52
53        /* Subtitle Format */
54        uint8_t   subtitle_type;                                // 4
55
56        /* Display Duration */
57        uint16_t  display_duration;                             // 11, 1 - 2000
58
59        /* BLock Length */
60        uint16_t  block_length;                                 // 16
61
62        /* for simple bitmap which is supported only */
63        uint8_t   background_style;                             // 1
64        uint8_t   outline_style;                                // 2
65
66        /* Subtitle Color */
67        uint8_t Y_component;
68        uint8_t opaque_enable;
69        uint8_t Cr_component;
70        uint8_t Cb_component;
71
72        uint16_t bitmap_top_H_coordinate;
73        uint16_t bitmap_top_V_coordinate;
74        uint16_t bitmap_bottom_H_coordinate;
75        uint16_t bitmap_bottom_V_coordinate;
76
77        /* for framed background style */
78        uint16_t frame_top_H_coordinate;
79        uint16_t frame_top_V_coordinate;
80        uint16_t frame_bottom_H_coordinate;
81        uint16_t frame_bottom_V_coordinate;
82        uint8_t  frame_Y_component;
83        uint8_t  frame_opaque_enable;
84        uint8_t  frame_Cr_component;
85        uint8_t  frame_Cb_component;
86
87        /* for outline outline style */
88        uint8_t  outline_thickness;
89        uint8_t  outline_Y_component;
90        uint8_t  outline_opaque_enable;
91        uint8_t  outline_Cr_component;
92        uint8_t  outline_Cb_component;
93
94        /* for drop shadow outline style */
95        uint8_t  shadow_right;
96        uint8_t  shadow_bottom;
97        uint8_t  shadow_Y_component;
98        uint8_t  shadow_opaque_enable;
99        uint8_t  shadow_Cr_component;
100        uint8_t  shadow_Cb_component;
101
102        uint16_t bitmap_length;
103
104        /* Uncompressed Bitmap */
105        uint32_t    bitmap_size;                /* if not zero, means there uncompressed data */
106        uint8_t     *bitmap_data;               /* if not NULL, data buffer allowed */
107
108        /* variables for clearing subttle */
109        uint16_t top_H;
110        uint16_t top_V;
111        uint16_t bottom_H;
112        uint16_t bottom_V;
113        uint32_t display_out_PTS;               /* time to clear (out-cue) time */
114} subtitle_message, *psubtitle_message;
115
116/* Subtitle Message State */
117typedef enum {
118        SMS_NONE,
119        SMS_RENDER,                     /* to render */
120        SMS_ERASE,                      /* to rease due to out-cue time */
121} subtitle_message_state;
122
123/* Outline Style */
124typedef enum {
125        OS_NONE,
126        OS_OUTLINE,
127        OS_DROP_SHADOW,
128        OS_RESERVED
129} OS;
130
131/* Subtitle Command */
132typedef enum SC {
133        SC_NONE,                        /* no event */
134        SC_RENDER,                      /* render subtile event */
135        SC_CLEAR,                       /* clear subtitle event */
136        SC_IDLE,                        /* idle. Used for dynamic format change if we don't want to exit from the task */
137        SC_MAX                          /* idle. Used for dynamic format change if we don't want to exit from the task */
138} SC;
139
140#define SUBTITLE_TYPE_SIMPLE_BITMAP                     1       /* bitmap type we supported */
141
142#define MAX_SUBTITLE_MESSAGE                            4       /* currently 4 (found out of buffer in 3) */
143#define MAX_SUBTITLE_EVENTS                                     8       /* max subtitle events */
144
145#define PCRS_PER_SEC                                            45000   /* 45KHz clock ticks */
146#define PCRS_PER_MSEC                                           45              /* clock ticks per ms */
147
148typedef struct {
149        LINKS_T     links;
150
151        psubtitle_message   msg;        /* pointer to subtitle message structure */
152} scte_27_data, *pscte_27_data;
153
154typedef struct {
155        b_mutex_t       mutex;                          /* mutex for list handling */
156        void            *v_app;                         /* pointer to application data structure */
157        uint8_t         *bitmap;                        /* pointer to uncompress bitmap to rendering */
158        uint16_t        bitmap_size;            /* uncompress bitmap size */
159        bool            enabled;                        /* subtitle rendering enabled or not */
160
161        b_task_t        task;
162        unsigned int stack[SCTE_27_STK_SIZE];
163        b_queue_t       queue;
164        b_event_t       event[MAX_SUBTITLE_EVENTS];
165        b_event_t       cmd_array[SC_MAX];
166
167        /* global variable to track segmented subtitle message */
168        uint16_t        table_extension;             
169        uint16_t        last_segment_number;
170        uint16_t        segment_number;
171        bool            segmented;                      /* segmented subtilte packet */
172        uint8_t         *segment_data;          /* pointer to a buffer holding segmented data */
173        uint16_t        segment_data_size;      /* size of one segmented data */
174
175        LIST_T          free_list;                      /* free list */
176        LIST_T          render_list;            /* list for the subtitle to be rendered */
177        LIST_T          clear_list;                     /* list for the subtutle to be cleared */       
178        pscte_27_data   pdata;                  /* pointer to a scte 27 data for holding segmented subtitle data */
179} scte_27_handle, *pscte_27_handle;
180
181/* List TYPE */
182typedef enum {
183        LT_FREE,
184        LT_RENDER,
185        LT_CLEAR,
186        LT_MAX
187} LT;
188
189/* Definitions for identifying language standardized by ISO 639 specification   */
190#define ISO639English       0x00656E67  // eng
191#define ISO639Spanish       0x00737061  // spa
192#define ISO639Spanish2      0x0065736C  // esl
193#define ISO639Portuguese    0x00706F72  // por
194#define ISO639French        0x00667265  // fre
195#define ISO639French2       0x00667261  // fra
196
197/* function prototype */
198pscte_27_handle scte_27_init(void *v_app);
199void scte_27_deinit(pscte_27_handle pscte_27);
200bool scte_27_reset(pscte_27_handle pscte_27);
201void scte_27_enable(pscte_27_handle pscte_27, int enable);
202
203/* function prototype related to subtitle handling*/
204bool scte_27_parse_subtitle(pscte_27_handle pscte_27, unsigned char *data, int length, scte_27_data *pdata);
205
206#endif /* SCTE_27_H__ */
Note: See TracBrowser for help on using the repository browser.