1 /********************************************************************
2 * Copyright(c) 2006-2009 Broadcom Corporation.
6 * Description: Common definitions for all components. Only types
7 * is allowed to be included from this file.
13 ********************************************************************
14 * This header is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License as published
16 * by the Free Software Foundation, either version 2.1 of the License.
18 * This header is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this header. If not, see <http://www.gnu.org/licenses/>.
24 *******************************************************************/
26 #ifndef _BC_DTS_DEFS_H_
27 #define _BC_DTS_DEFS_H_
29 #include "bc_dts_types.h"
32 #define BC_BIT(_x) (1 << (_x))
34 typedef enum _BC_STATUS {
41 BC_STS_INSUFF_RES = 6,
44 BC_STS_VER_MISMATCH = 9,
46 BC_STS_FW_CMD_ERR = 11,
47 BC_STS_DEC_NOT_OPEN = 12,
48 BC_STS_ERR_USAGE = 13,
49 BC_STS_IO_USER_ABORT = 14,
50 BC_STS_IO_XFR_ERROR = 15,
51 BC_STS_DEC_NOT_STARTED = 16,
52 BC_STS_FWHEX_NOT_FOUND = 17,
53 BC_STS_FMT_CHANGE = 18,
54 BC_STS_HIF_ACCESS = 19,
55 BC_STS_CMD_CANCELLED = 20,
56 BC_STS_FW_AUTH_FAILED = 21,
57 BC_STS_BOOTLOADER_FAILED = 22,
58 BC_STS_CERT_VERIFY_ERROR = 23,
59 BC_STS_DEC_EXIST_OPEN = 24,
61 BC_STS_CLK_NOCHG = 26,
63 /* Must be the last one.*/
67 /*------------------------------------------------------*
68 * Registry Key Definitions *
69 *------------------------------------------------------*/
70 #define BC_REG_KEY_MAIN_PATH "Software\\Broadcom\\MediaPC\\70010"
71 #define BC_REG_KEY_FWPATH "FirmwareFilePath"
72 #define BC_REG_KEY_SEC_OPT "DbgOptions"
77 * b[5] = Enable RSA KEY in EEPROM Support
78 * b[6] = Enable Old PIB scheme. (0 = Use PIB with video scheme)
80 * b[12] = Enable send message to NotifyIcon
84 typedef enum _BC_SW_OPTIONS {
85 BC_OPT_DOSER_OUT_ENCRYPT = BC_BIT(3),
86 BC_OPT_LINK_OUT_ENCRYPT = BC_BIT(29),
89 typedef struct _BC_REG_CONFIG{
93 #if defined(__KERNEL__) || defined(__LINUX_USER__)
95 /* Align data structures */
96 #define ALIGN(x) __declspec(align(x))
100 * b[0]..b[7] = _DtsDeviceOpenMode
102 * b[9] = Load file play back FW
103 * b[10] = Disk format (0 for HD DVD and 1 for BLU ray)
104 * b[11]-b[15] = default output resolution
105 * b[16] = Skip TX CPB Buffer Check
106 * b[17] = Adaptive Output Encrypt/Scramble Scheme
107 * b[18]-b[31] = reserved for future use
110 /* To allow multiple apps to open the device. */
111 enum _DtsDeviceOpenMode {
112 DTS_PLAYBACK_MODE = 0,
118 /* To enable the filter to selectively enable/disable fixes or erratas */
119 enum _DtsDeviceFixMode {
120 DTS_LOAD_NEW_FW = BC_BIT(8),
121 DTS_LOAD_FILE_PLAY_FW = BC_BIT(9),
122 DTS_DISK_FMT_BD = BC_BIT(10),
123 /* b[11]-b[15] : Default output resolution */
124 DTS_SKIP_TX_CHK_CPB = BC_BIT(16),
125 DTS_ADAPTIVE_OUTPUT_PER = BC_BIT(17),
126 DTS_INTELLIMAP = BC_BIT(18),
127 /* b[19]-b[21] : select clock frequency */
128 DTS_PLAYBACK_DROP_RPT_MODE = BC_BIT(22)
131 #define DTS_DFLT_RESOLUTION(x) (x<<11)
133 #define DTS_DFLT_CLOCK(x) (x<<19)
135 /* F/W File Version corresponding to S/W Releases */
137 /* S/W release: 02.04.02 F/W release 2.12.2.0 */
138 BC_FW_VER_020402 = ((12<<16) | (2<<8) | (0))
141 /*------------------------------------------------------*
142 * Stream Types for DtsOpenDecoder() *
143 *------------------------------------------------------*/
144 enum _DtsOpenDecStreamTypes {
145 BC_STREAM_TYPE_ES = 0,
146 BC_STREAM_TYPE_PES = 1,
147 BC_STREAM_TYPE_TS = 2,
148 BC_STREAM_TYPE_ES_TSTAMP = 6,
151 /*------------------------------------------------------*
152 * Video Algorithms for DtsSetVideoParams() *
153 *------------------------------------------------------*/
154 enum _DtsSetVideoParamsAlgo {
155 BC_VID_ALGO_H264 = 0,
156 BC_VID_ALGO_MPEG2 = 1,
158 BC_VID_ALGO_VC1MP = 7,
161 /*------------------------------------------------------*
162 * MPEG Extension to the PPB *
163 *------------------------------------------------------*/
164 #define BC_MPEG_VALID_PANSCAN (1)
166 typedef struct _BC_PIB_EXT_MPEG {
168 /* Always valid, defaults to picture size if no
169 * sequence display extension in the stream. */
170 uint32_t display_horizontal_size;
171 uint32_t display_vertical_size;
173 /* MPEG_VALID_PANSCAN
174 * Offsets are a copy values from the MPEG stream. */
175 uint32_t offset_count;
176 int32_t horizontal_offset[3];
177 int32_t vertical_offset[3];
181 /*------------------------------------------------------*
182 * H.264 Extension to the PPB *
183 *------------------------------------------------------*/
184 /* Bit definitions for 'other.h264.valid' field */
185 #define H264_VALID_PANSCAN (1)
186 #define H264_VALID_SPS_CROP (2)
187 #define H264_VALID_VUI (4)
189 typedef struct _BC_PIB_EXT_H264 {
190 /* 'valid' specifies which fields (or sets of
191 * fields) below are valid. If the corresponding
192 * bit in 'valid' is NOT set then that field(s)
193 * is (are) not initialized. */
196 /* H264_VALID_PANSCAN */
197 uint32_t pan_scan_count;
198 int32_t pan_scan_left[3];
199 int32_t pan_scan_right[3];
200 int32_t pan_scan_top[3];
201 int32_t pan_scan_bottom[3];
203 /* H264_VALID_SPS_CROP */
204 int32_t sps_crop_left;
205 int32_t sps_crop_right;
206 int32_t sps_crop_top;
207 int32_t sps_crop_bottom;
211 uint32_t chroma_bottom;
215 /*------------------------------------------------------*
216 * VC1 Extension to the PPB *
217 *------------------------------------------------------*/
218 #define VC1_VALID_PANSCAN (1)
220 typedef struct _BC_PIB_EXT_VC1 {
223 /* Always valid, defaults to picture size if no
224 * sequence display extension in the stream. */
225 uint32_t display_horizontal_size;
226 uint32_t display_vertical_size;
228 /* VC1 pan scan windows */
229 uint32_t num_panscan_windows;
230 int32_t ps_horiz_offset[4];
231 int32_t ps_vert_offset[4];
233 int32_t ps_height[4];
238 /*------------------------------------------------------*
239 * Picture Information Block *
240 *------------------------------------------------------*/
241 #if defined(_WIN32) || defined(_WIN64) || defined(__LINUX_USER__)
242 /* Values for 'pulldown' field. '0' means no pulldown information
243 * was present for this picture. */
245 vdecNoPulldownInfo = 0,
250 vdecTopBottomTop = 5,
251 vdecBottomTopBottom = 6,
258 /* Values for the 'frame_rate' field. */
260 vdecFrameRateUnknown = 0,
271 /* Values for the 'aspect_ratio' field. */
273 vdecAspectRatioUnknown = 0,
274 vdecAspectRatioSquare,
275 vdecAspectRatio12_11,
276 vdecAspectRatio10_11,
277 vdecAspectRatio16_11,
278 vdecAspectRatio40_33,
279 vdecAspectRatio24_11,
280 vdecAspectRatio20_11,
281 vdecAspectRatio32_11,
282 vdecAspectRatio80_33,
283 vdecAspectRatio18_11,
284 vdecAspectRatio15_11,
285 vdecAspectRatio64_33,
286 vdecAspectRatio160_99,
289 vdecAspectRatio221_1,
290 vdecAspectRatioOther = 255,
293 /* Values for the 'colour_primaries' field. */
295 vdecColourPrimariesUnknown = 0,
296 vdecColourPrimariesBT709,
297 vdecColourPrimariesUnspecified,
298 vdecColourPrimariesReserved,
299 vdecColourPrimariesBT470_2M = 4,
300 vdecColourPrimariesBT470_2BG,
301 vdecColourPrimariesSMPTE170M,
302 vdecColourPrimariesSMPTE240M,
303 vdecColourPrimariesGenericFilm,
307 vdecRESOLUTION_CUSTOM = 0x00000000, /* custom */
308 vdecRESOLUTION_480i = 0x00000001, /* 480i */
309 vdecRESOLUTION_1080i = 0x00000002, /* 1080i (1920x1080, 60i) */
310 vdecRESOLUTION_NTSC = 0x00000003, /* NTSC (720x483, 60i) */
311 vdecRESOLUTION_480p = 0x00000004, /* 480p (720x480, 60p) */
312 vdecRESOLUTION_720p = 0x00000005, /* 720p (1280x720, 60p) */
313 vdecRESOLUTION_PAL1 = 0x00000006, /* PAL_1 (720x576, 50i) */
314 vdecRESOLUTION_1080i25 = 0x00000007, /* 1080i25 (1920x1080, 50i) */
315 vdecRESOLUTION_720p50 = 0x00000008, /* 720p50 (1280x720, 50p) */
316 vdecRESOLUTION_576p = 0x00000009, /* 576p (720x576, 50p) */
317 vdecRESOLUTION_1080i29_97 = 0x0000000A, /* 1080i (1920x1080, 59.94i) */
318 vdecRESOLUTION_720p59_94 = 0x0000000B, /* 720p (1280x720, 59.94p) */
319 vdecRESOLUTION_SD_DVD = 0x0000000C, /* SD DVD (720x483, 60i) */
320 vdecRESOLUTION_480p656 = 0x0000000D, /* 480p (720x480, 60p), output bus width 8 bit, clock 74.25MHz */
321 vdecRESOLUTION_1080p23_976 = 0x0000000E, /* 1080p23_976 (1920x1080, 23.976p) */
322 vdecRESOLUTION_720p23_976 = 0x0000000F, /* 720p23_976 (1280x720p, 23.976p) */
323 vdecRESOLUTION_240p29_97 = 0x00000010, /* 240p (1440x240, 29.97p ) */
324 vdecRESOLUTION_240p30 = 0x00000011, /* 240p (1440x240, 30p) */
325 vdecRESOLUTION_288p25 = 0x00000012, /* 288p (1440x288p, 25p) */
326 vdecRESOLUTION_1080p29_97 = 0x00000013, /* 1080p29_97 (1920x1080, 29.97p) */
327 vdecRESOLUTION_1080p30 = 0x00000014, /* 1080p30 (1920x1080, 30p) */
328 vdecRESOLUTION_1080p24 = 0x00000015, /* 1080p24 (1920x1080, 24p) */
329 vdecRESOLUTION_1080p25 = 0x00000016, /* 1080p25 (1920x1080, 25p) */
330 vdecRESOLUTION_720p24 = 0x00000017, /* 720p24 (1280x720, 25p) */
331 vdecRESOLUTION_720p29_97 = 0x00000018, /* 720p29.97 (1280x720, 29.97p) */
332 vdecRESOLUTION_480p23_976 = 0x00000019, /* 480p23.976 (720*480, 23.976) */
333 vdecRESOLUTION_480p29_97 = 0x0000001A, /* 480p29.976 (720*480, 29.97p) */
334 vdecRESOLUTION_576p25 = 0x0000001B, /* 576p25 (720*576, 25p) */
335 /* For Zero Frame Rate */
336 vdecRESOLUTION_480p0 = 0x0000001C, /* 480p (720x480, 0p) */
337 vdecRESOLUTION_480i0 = 0x0000001D, /* 480i (720x480, 0i) */
338 vdecRESOLUTION_576p0 = 0x0000001E, /* 576p (720x576, 0p) */
339 vdecRESOLUTION_720p0 = 0x0000001F, /* 720p (1280x720, 0p) */
340 vdecRESOLUTION_1080p0 = 0x00000020, /* 1080p (1920x1080, 0p) */
341 vdecRESOLUTION_1080i0 = 0x00000021, /* 1080i (1920x1080, 0i) */
344 /* Bit definitions for 'flags' field */
345 #define VDEC_FLAG_EOS (0x0004)
347 #define VDEC_FLAG_FRAME (0x0000)
348 #define VDEC_FLAG_FIELDPAIR (0x0008)
349 #define VDEC_FLAG_TOPFIELD (0x0010)
350 #define VDEC_FLAG_BOTTOMFIELD (0x0018)
352 #define VDEC_FLAG_PROGRESSIVE_SRC (0x0000)
353 #define VDEC_FLAG_INTERLACED_SRC (0x0020)
354 #define VDEC_FLAG_UNKNOWN_SRC (0x0040)
356 #define VDEC_FLAG_BOTTOM_FIRST (0x0080)
357 #define VDEC_FLAG_LAST_PICTURE (0x0100)
359 #define VDEC_FLAG_PICTURE_META_DATA_PRESENT (0x40000)
361 #endif /* _WIN32 || _WIN64 */
363 enum _BC_OUTPUT_FORMAT {
369 typedef struct _BC_PIC_INFO_BLOCK {
371 uint64_t timeStamp; /* Timestamp */
372 uint32_t picture_number; /* Ordinal display number */
373 uint32_t width; /* pixels */
374 uint32_t height; /* pixels */
375 uint32_t chroma_format; /* 0x420, 0x422 or 0x444 */
379 uint32_t aspect_ratio;
380 uint32_t colour_primaries;
381 uint32_t picture_meta_payload;
384 uint32_t custom_aspect_ratio_width_height;
385 uint32_t n_drop; /* number of non-reference frames remaining to be dropped */
387 /* Protocol-specific extensions. */
389 BC_PIB_EXT_H264 h264;
390 BC_PIB_EXT_MPEG mpeg;
394 } BC_PIC_INFO_BLOCK, *PBC_PIC_INFO_BLOCK;
396 /*------------------------------------------------------*
398 *------------------------------------------------------*/
399 /* Optional flags for ProcOut Interface.*/
400 enum _POUT_OPTIONAL_IN_FLAGS_{
401 /* Flags from App to Device */
402 BC_POUT_FLAGS_YV12 = 0x01, /* Copy Data in YV12 format */
403 BC_POUT_FLAGS_STRIDE = 0x02, /* Stride size is valid. */
404 BC_POUT_FLAGS_SIZE = 0x04, /* Take size information from Application */
405 BC_POUT_FLAGS_INTERLACED = 0x08, /* copy only half the bytes */
406 BC_POUT_FLAGS_INTERLEAVED = 0x10, /* interleaved frame */
408 /* Flags from Device to APP */
409 BC_POUT_FLAGS_FMT_CHANGE = 0x10000, /* Data is not VALID when this flag is set */
410 BC_POUT_FLAGS_PIB_VALID = 0x20000, /* PIB Information valid */
411 BC_POUT_FLAGS_ENCRYPTED = 0x40000, /* Data is encrypted. */
412 BC_POUT_FLAGS_FLD_BOT = 0x80000, /* Bottom Field data */
415 #if defined(__KERNEL__) || defined(__LINUX_USER__)
416 typedef BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, void *pOut);
418 typedef BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, struct _BC_DTS_PROC_OUT *pOut);
421 /* Line 21 Closed Caption */
423 #define MAX_UD_SIZE 1792 /* 1920 - 128 */
425 typedef struct _BC_DTS_PROC_OUT {
426 uint8_t *Ybuff; /* Caller Supplied buffer for Y data */
427 uint32_t YbuffSz; /* Caller Supplied Y buffer size */
428 uint32_t YBuffDoneSz; /* Transferred Y datasize */
430 uint8_t *UVbuff; /* Caller Supplied buffer for UV data */
431 uint32_t UVbuffSz; /* Caller Supplied UV buffer size */
432 uint32_t UVBuffDoneSz; /* Transferred UV data size */
434 uint32_t StrideSz; /* Caller supplied Stride Size */
435 uint32_t PoutFlags; /* Call IN Flags */
437 uint32_t discCnt; /* Picture discontinuity count */
439 BC_PIC_INFO_BLOCK PicInfo; /* Picture Information Block Data */
441 /* Line 21 Closed Caption */
444 uint8_t UserData[MAX_UD_SIZE];
447 dts_pout_callback AppCallBack;
449 uint8_t b422Mode; /* Picture output Mode */
450 uint8_t bPibEnc; /* PIB encrypted */
451 uint8_t bRevertScramble;
455 typedef struct _BC_DTS_STATUS {
456 uint8_t ReadyListCount; /* Number of frames in ready list (reported by driver) */
457 uint8_t FreeListCount; /* Number of frame buffers free. (reported by driver) */
458 uint8_t PowerStateChange; /* Number of active state power transitions (reported by driver) */
459 uint8_t reserved_[1];
461 uint32_t FramesDropped; /* Number of frames dropped. (reported by DIL) */
462 uint32_t FramesCaptured; /* Number of frames captured. (reported by DIL) */
463 uint32_t FramesRepeated; /* Number of frames repeated. (reported by DIL) */
465 uint32_t InputCount; /* Times compressed video has been sent to the HW.
466 * i.e. Successful DtsProcInput() calls (reported by DIL) */
467 uint64_t InputTotalSize; /* Amount of compressed video that has been sent to the HW.
468 * (reported by DIL) */
469 uint32_t InputBusyCount; /* Times compressed video has attempted to be sent to the HW
470 * but the input FIFO was full. (reported by DIL) */
472 uint32_t PIBMissCount; /* Amount of times a PIB is invalid. (reported by DIL) */
474 uint32_t cpbEmptySize; /* supported only for H.264, specifically changed for
475 * Adobe. Report size of CPB buffer available.
477 uint64_t NextTimeStamp; /* TimeStamp of the next picture that will be returned
478 * by a call to ProcOutput. Added for Adobe. Reported
479 * back from the driver */
480 uint8_t reserved__[16];
484 #define BC_SWAP32(_v) \
485 ((((_v) & 0xFF000000)>>24)| \
486 (((_v) & 0x00FF0000)>>8)| \
487 (((_v) & 0x0000FF00)<<8)| \
488 (((_v) & 0x000000FF)<<24))
490 #define WM_AGENT_TRAYICON_DECODER_OPEN 10001
491 #define WM_AGENT_TRAYICON_DECODER_CLOSE 10002
492 #define WM_AGENT_TRAYICON_DECODER_START 10003
493 #define WM_AGENT_TRAYICON_DECODER_STOP 10004
494 #define WM_AGENT_TRAYICON_DECODER_RUN 10005
495 #define WM_AGENT_TRAYICON_DECODER_PAUSE 10006
498 #endif /* _BC_DTS_DEFS_H_ */