I'm trying to write EPG grabber. I use libucsi
library under linux. I can read one TS from EIT
table and decode EPG data. But it's incomplete and I don't know how to read all necessary TS.
I tried to google it, and I read some documentation but without success. Can someone help me understanding, and tell me how to read all TS for complete EPG? Has EIT some continuity id or something like that?
Thank you for your help.
[EDIT] function for reading data:
void readD(char * dedev, __u8 * data, int size_data ,int pid)
{
int defd;
if ((defd = open(dedev, O_RDWR | O_LARGEFILE )) < 0)
{
perror("opening demux failed");
return 0;
}
#define TS_BUF_SIZE (256 * 1024)
long dmx_buffer_size = TS_BUF_SIZE;
if( ioctl(defd,DMX_SET_BUFFER_SIZE,dmx_buffer_size) < 0)
{
perror("set demux filter failed");
return 0;
}
struct dmx_sct_filter_params sctFilterParams;
memset(&sctFilterParams, 0, sizeof(struct dmx_sct_filter_params));
sctFilterParams.pid=pid;
sctFilterParams.timeout=10000; //10s
sctFilterParams.flags=DMX_IMMEDIATE_START|DMX_CHECK_CRC;
if( ioctl(defd,DMX_SET_FILTER,&sctFilterParams) < 0)
{
perror("set demux filter failed");
return 0;
}
read(defd,data,size_data);
close(defd);
}
and I call it:
#define TS_PACKET_SIZE 188
__u8 pat_data[TS_PACKET_SIZE*10];
readD(dedev, pat_data, sizeof(pat_data) ,PID_EIT);
I would suspect a bad buffer size : it seems you have copied a code to filter a PAT and adapted it for EIT : how can you be sure that your section will fit in your 10 TPs
pat_data
buffer ?You should check the return code of
read
: you might need to resize your buffer or perform subsequent calls to get the whole thing.