| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2010, 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: budp.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/2 $ |
|---|
| 12 | * $brcm_Date: 7/27/10 7:13p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/udp/budp.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/2 7/27/10 7:13p darnstein |
|---|
| 21 | * SW3548-3022: Some data structures involving SCTE-20 and SCTE-21 are |
|---|
| 22 | * moved from BVBI portiing interface to BUDP commonutils module. |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/1 7/27/10 5:04p darnstein |
|---|
| 25 | * SW3548-3022: userdata parsing software. |
|---|
| 26 | * |
|---|
| 27 | ***************************************************************************/ |
|---|
| 28 | |
|---|
| 29 | /*= Module Overview ********************************************************* |
|---|
| 30 | <verbatim> |
|---|
| 31 | |
|---|
| 32 | Overview |
|---|
| 33 | BUDP module parses userdata from MPEG-2 and AVC bitstreams. |
|---|
| 34 | |
|---|
| 35 | </verbatim> |
|---|
| 36 | ***************************************************************************/ |
|---|
| 37 | |
|---|
| 38 | #ifndef BUDP_H__ |
|---|
| 39 | #define BUDP_H__ |
|---|
| 40 | |
|---|
| 41 | #include "berr.h" |
|---|
| 42 | #include "berr_ids.h" |
|---|
| 43 | |
|---|
| 44 | #ifdef __cplusplus |
|---|
| 45 | extern "C" { |
|---|
| 46 | #endif |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | /***************************************************************************** |
|---|
| 50 | Module specific standard BERR codes |
|---|
| 51 | *****************************************************************************/ |
|---|
| 52 | |
|---|
| 53 | #define BERR_BUDP_NO_DATA BERR_MAKE_CODE(BERR_UDP_ID, 0x0000) |
|---|
| 54 | #define BERR_BUDP_PARSE_ERROR BERR_MAKE_CODE(BERR_UDP_ID, 0x0001) |
|---|
| 55 | #define BERR_BUDP_SOURCE_CHECK BERR_MAKE_CODE(BERR_UDP_ID, 0x0002) |
|---|
| 56 | |
|---|
| 57 | /* Programming note: |
|---|
| 58 | * ---------------- |
|---|
| 59 | * The above error code BERR_BUDP_SOURCE_CHECK indicates that parsing is |
|---|
| 60 | * successful. However, because the data was encoded into an MPEG sequence |
|---|
| 61 | * header or GOP header, this data is not suitable for text output. |
|---|
| 62 | */ |
|---|
| 63 | |
|---|
| 64 | /***************************************************************************** |
|---|
| 65 | * Structures |
|---|
| 66 | *****************************************************************************/ |
|---|
| 67 | |
|---|
| 68 | typedef struct BUDP_SCTE_CC_Data |
|---|
| 69 | { |
|---|
| 70 | uint8_t valid; |
|---|
| 71 | uint8_t priority; |
|---|
| 72 | uint8_t line_number; /* Between 10 and 41, inclusive. */ |
|---|
| 73 | uint8_t cc_data_1; |
|---|
| 74 | uint8_t cc_data_2; |
|---|
| 75 | |
|---|
| 76 | } BUDP_SCTE_CC_Data; |
|---|
| 77 | |
|---|
| 78 | typedef struct BUDP_SCTE_NRTV_Data |
|---|
| 79 | { |
|---|
| 80 | uint8_t valid; |
|---|
| 81 | uint8_t priority; |
|---|
| 82 | uint8_t line_number; /* Between 10 and 41, inclusive. */ |
|---|
| 83 | uint8_t sequence_number; |
|---|
| 84 | uint8_t segment_number; |
|---|
| 85 | uint8_t y_data[32]; |
|---|
| 86 | uint8_t cbcr_data[32]; |
|---|
| 87 | |
|---|
| 88 | } BUDP_SCTE_NRTV_Data; |
|---|
| 89 | |
|---|
| 90 | typedef struct BUDP_SCTE_Mono_Data |
|---|
| 91 | { |
|---|
| 92 | bool first_segment_flag; |
|---|
| 93 | bool last_segment_flag; |
|---|
| 94 | uint8_t line_number; /* Between 10 and 41, inclusive. */ |
|---|
| 95 | uint16_t first_pixel_position; |
|---|
| 96 | uint8_t n_pixels; |
|---|
| 97 | uint8_t Y_data[256]; |
|---|
| 98 | |
|---|
| 99 | } BUDP_SCTE_Mono_Data; |
|---|
| 100 | |
|---|
| 101 | #define BUDP_SCTE_MAX_ITEMS 32 |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | /***************************************************************************** |
|---|
| 105 | Summary: |
|---|
| 106 | Structure for holding SCTE data |
|---|
| 107 | |
|---|
| 108 | Description: |
|---|
| 109 | The BUDP_SCTE_Data structure is a container for an entire field of |
|---|
| 110 | SCTE data. |
|---|
| 111 | |
|---|
| 112 | The BUDP_SCTE_Data structure contains _size elements, _count |
|---|
| 113 | elements, and data pointers. |
|---|
| 114 | |
|---|
| 115 | The user is responsible for setting the data pointers to |
|---|
| 116 | reasonable values. However, if the corresponding _count |
|---|
| 117 | element is zero, then software will not make use of |
|---|
| 118 | the data pointer. Software does not allocate or free |
|---|
| 119 | memory indicated by the data pointers in any case. |
|---|
| 120 | |
|---|
| 121 | The _size elements are for the convenience of the user, |
|---|
| 122 | they are not used by software. |
|---|
| 123 | |
|---|
| 124 | The _count elements indicate the amount of data contained |
|---|
| 125 | in the corresponding data pointers. The units of the _count |
|---|
| 126 | elements vary, but they are defined below. |
|---|
| 127 | |
|---|
| 128 | *****************************************************************************/ |
|---|
| 129 | typedef struct BUDP_SCTE_Data |
|---|
| 130 | { |
|---|
| 131 | size_t cc_count; /* Number of meaningful entries in the |
|---|
| 132 | following cc_data array. */ |
|---|
| 133 | size_t cc_size; /* Capacity of following cc_data array, |
|---|
| 134 | in units of BUDP_SCTE_CC_Data. */ |
|---|
| 135 | BUDP_SCTE_CC_Data* cc_data; /* The closed caption data. If zero, |
|---|
| 136 | then no space has been allocated. */ |
|---|
| 137 | size_t nrtv_count; /* Number of meaningful entries in the |
|---|
| 138 | following nrtv_data array. Must be |
|---|
| 139 | zero or one. */ |
|---|
| 140 | size_t nrtv_size; /* Capacity of following nrtv_data |
|---|
| 141 | array, in units of |
|---|
| 142 | BUDP_SCTE_NRTV_Data */ |
|---|
| 143 | BUDP_SCTE_NRTV_Data* nrtv_data; /* The NRTV data. If zero, then no |
|---|
| 144 | space has been allocated. */ |
|---|
| 145 | size_t pam_count; /* Number of meaningful bytes in the |
|---|
| 146 | following luma_PAM_data buffer. The |
|---|
| 147 | maximum value allowed is 4095. */ |
|---|
| 148 | size_t pam_size; /* Capacity of following luma_PAM_data |
|---|
| 149 | buffer, in bytes. If zero, then no |
|---|
| 150 | space has been allocated. */ |
|---|
| 151 | uint8_t* luma_PAM_data; /* Buffer containing one piece of |
|---|
| 152 | luma_PAM_data, as defined in SCTE-21 |
|---|
| 153 | section 5.5. */ |
|---|
| 154 | size_t mono_count; /* Number of meaningful entries in the |
|---|
| 155 | following mono_data array. Must be |
|---|
| 156 | zero, one, or two. */ |
|---|
| 157 | size_t mono_size; /* Capacity of following mono_data |
|---|
| 158 | array, in units of |
|---|
| 159 | BUDP_SCTE_Mono_Data */ |
|---|
| 160 | BUDP_SCTE_Mono_Data* mono_data; /* The monochrome data. If zero, then |
|---|
| 161 | no space has been allocated. */ |
|---|
| 162 | uint8_t field_number; /* Field number, from SCTE data |
|---|
| 163 | structure. In the case of SCTE 20 |
|---|
| 164 | ATSC CC data, it is field_type. In |
|---|
| 165 | the case of monochrome data, this is |
|---|
| 166 | the field_parity element. */ |
|---|
| 167 | } BUDP_SCTE_Data; |
|---|
| 168 | |
|---|
| 169 | #ifdef __cplusplus |
|---|
| 170 | } |
|---|
| 171 | #endif |
|---|
| 172 | |
|---|
| 173 | #endif /* BUDP_H__ */ |
|---|