1

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);
n0p
  • 3,399
  • 2
  • 29
  • 50
Alrick
  • 79
  • 9
  • What do you mean by "incomplete" ? What is missing to your EPG ? You also might want to filter the `SDT` to get some informations about the service (name, provider, scrambling status, etc...) – n0p Nov 24 '14 at 16:17
  • @Coconop I get only few events for example 5, but i need to build complete xmltv file. And when I run my programme it returns different events every time. – Alrick Nov 25 '14 at 23:39
  • Is it a TS file or is it a live source ? On live, services are added/removed on-the-fly so it is normal to get different results. Could you show how you are filtering the EITs ? – n0p Nov 26 '14 at 08:11
  • @Coconop It's live source. And i think you don't understand me. So i try to rewrite my problem. For example, the a set of "n" programs is transmitted ( to ). So I should have programs 1 to n, but I have only programs 1 to 5 , or 5 to 10, just a part of the set of programs. And my question is still same. – Alrick Nov 27 '14 at 07:23
  • Ok I get it. But without code, it is hard to tell why you are missing some programs... – n0p Nov 27 '14 at 08:15
  • @Coconop I add function for reading data. – Alrick Nov 27 '14 at 08:36

1 Answers1

1

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.

n0p
  • 3,399
  • 2
  • 29
  • 50