FireBirdLib - Topfield TMS PVR TAP Programming Library
HDD_FindPCR.c
Go to the documentation of this file.
1
#include "
libFireBird.h
"
2
3
int
HDD_FindPCR
(
const
byte
*pBuffer, dword
BufferSize
, word PID)
4
{
5
TRACEENTER
();
6
7
dword i = 0;
8
dword PCR;
9
10
if
(PID > 0x1ffe)
11
{
12
TRACEEXIT
();
13
return
-1;
14
}
15
16
do
17
{
18
if
((pBuffer[i + 0] == 0x47) && ((((pBuffer[i + 1] & 0x1f) == (PID >> 8)) && (pBuffer[i + 2] == (PID & 0xff))) || PID == 0) && ((pBuffer[i + 3] & 0x20) != 0) && (pBuffer[i + 4] > 0) && ((pBuffer[i + 5] & 0x10) != 0))
19
{
20
//Extract the time out of the PCR bit pattern
21
//The PCR is clocked by a 90kHz generator. To convert to minutes
22
//the 33 bit number can be shifted right 6 times and divided by 84375
23
PCR = (pBuffer[i + 6] << 19) | (pBuffer[i + 7] << 11) | (pBuffer[i + 8] << 3) | (pBuffer[i + 9] >> 5);
24
PCR /= 84375;
25
26
TRACEEXIT
();
27
return
(
int
) PCR;
28
}
29
i += 188;
30
}
while
(i < (
BufferSize
- 188));
31
32
TRACEEXIT
();
33
return
-1;
34
}
BufferSize
dword BufferSize
Definition:
INIOpenFile.c:7
HDD_FindPCR
int HDD_FindPCR(const byte *pBuffer, dword BufferSize, word PID)
Definition:
HDD_FindPCR.c:3
libFireBird.h
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
rec
HDD_FindPCR.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3