source: tools/oebuild/data/pti_np/ts_makros.h @ 45168

Last change on this file since 45168 was 45168, checked in by obi, 19 months ago

add oebuild building files

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#ifndef ts_makros_123
2#define ts_makros_123
3
4/* ********************************************* */
5/* Helper Functions to access ts header fields */
6/* ********************************************* */
7
8static inline u16 ts_pid(const u8 *buf)
9{
10        return ((buf[1] & 0x1f) << 8) + buf[2];
11}
12
13static inline u8 ts_cc(const u8 *buf)
14{
15        return (buf[3] & 0x0f);
16}
17
18static inline u8 ts_scrambled(const u8 *buf)
19{
20        return (buf[3] & 0xc0);
21}
22
23static inline u8 ts_error(const u8 *buf)
24{
25        return (buf[1] & 0x80);
26}
27
28static inline u8 ts_payload_unit(const u8 *buf)
29{
30        return (buf[1] & 0x40);
31}
32
33static inline u8 ts_priority(const u8 *buf)
34{
35        return (buf[1] & 0x20);
36}
37
38static inline u8 ts_adaptation(const u8 *buf)
39{
40        return (buf[3] & 0x30);
41}
42
43static inline u8 ts_sync(const u8 *buf)
44{
45        return (buf[0]);
46}
47
48/* ********************************************* */
49/* TS Packet Checker functions */
50/* ********************************************* */
51
52static inline int getOutOfSync(u8 *data, int num)
53{
54        int count = 0;
55        int vLoop;
56        for (vLoop = 0; vLoop < num; vLoop++)
57        {
58                if (data[0] != 0x47)
59                        count++;
60                data += 188;
61        }
62        return count;
63}
64
65static inline int isPacketValid(u8 *data)
66{
67        return ((ts_sync(data) == 0x47) && (ts_error(data) == 0));
68}
69
70#endif
Note: See TracBrowser for help on using the repository browser.