| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 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: bdemux_ts.h $ |
|---|
| 11 | * $brcm_Revision: 1 $ |
|---|
| 12 | * $brcm_Date: 10/16/06 11:35a $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * MPEG-2 Demux library |
|---|
| 17 | * |
|---|
| 18 | * Revision History: |
|---|
| 19 | * |
|---|
| 20 | * $brcm_Log: /BSEAV/lib/utils/bdemux_ts.h $ |
|---|
| 21 | * |
|---|
| 22 | * 1 10/16/06 11:35a vsilyaev |
|---|
| 23 | * PR 24956 PR 24844: Software MPEG-2 TS and PES demultiplexor |
|---|
| 24 | * |
|---|
| 25 | * |
|---|
| 26 | *******************************************************************************/ |
|---|
| 27 | |
|---|
| 28 | #ifndef _BDEMUX_TS_H__ |
|---|
| 29 | #define _BDEMUX_TS_H__ |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | #define BDEMUX_TS_ERROR (1<<0) |
|---|
| 33 | #define BDEMUX_TS_DISCONTINUITY (1<<1) |
|---|
| 34 | #define BDEMUX_TS_MARKED_DISCONTINUITY (1<<2) |
|---|
| 35 | #define BDEMUX_TS_PAYLOAD_UNIT_START (1<<3) |
|---|
| 36 | |
|---|
| 37 | #define B_TS_SYNC 0x47 |
|---|
| 38 | #define B_TS_PKT_LEN 188 |
|---|
| 39 | |
|---|
| 40 | #define B_TS_LOAD8(ptr, off) ((((uint8_t *)(ptr))[(off)+0])) |
|---|
| 41 | #define B_TS_LOAD16(ptr, off) (((uint16_t)((uint8_t *)(ptr))[(off)+0]<<8) | ((uint16_t)((uint8_t *)(ptr))[(off)+1])) |
|---|
| 42 | |
|---|
| 43 | #define B_TS_LOAD32(ptr, off) (((uint32_t)((uint8_t *)(ptr))[(off)+0]<<24) | ((uint32_t)((uint8_t *)(ptr))[(off)+1]<<16) | ((uint32_t)((uint8_t *)(ptr))[(off)+2]<<8) | ((uint32_t)((uint8_t *)(ptr))[(off)+3])) |
|---|
| 44 | |
|---|
| 45 | #ifdef __cplusplus |
|---|
| 46 | extern "C" |
|---|
| 47 | { |
|---|
| 48 | #endif |
|---|
| 49 | |
|---|
| 50 | typedef struct bdemux_ts { |
|---|
| 51 | uint16_t pid; |
|---|
| 52 | uint8_t continuity_counter; |
|---|
| 53 | uint8_t flags; |
|---|
| 54 | BDBG_OBJECT(bdemux_ts) |
|---|
| 55 | } bdemux_ts; |
|---|
| 56 | |
|---|
| 57 | typedef enum {bdemux_ts_action_hold, bdemux_ts_action_consume} bdemux_ts_action; |
|---|
| 58 | |
|---|
| 59 | void bdemux_ts_init(bdemux_ts *ts, uint16_t pid); |
|---|
| 60 | int bdemux_ts_feed(bdemux_ts *ts, const uint8_t *data, size_t len); |
|---|
| 61 | bdemux_ts_action bdemux_ts_data(bdemux_ts *ts, unsigned flags, const uint8_t *data, size_t len); |
|---|
| 62 | #ifdef __cplusplus |
|---|
| 63 | } |
|---|
| 64 | #endif |
|---|
| 65 | |
|---|
| 66 | #endif /* _BDEMUX_TS_H__ */ |
|---|
| 67 | |
|---|