Okay, I've written a program to generate a ProjectX .Xcl file from a transport stream file.
The source code is in svn at
For anyone who wants a compiled version
The zip includes a bat file (NowAndNext.bat) which runs my program and then loads the file in ProjectX with the .Xcl file.
You'll need to edit NowAndNext.bat near the top of the file to specify the location of your ProjectX install, ProjectX ini file, and the ProjectX output location.
When you run the program you should see something like this
opening Z:\TV\`Movies\(2011-10-29 20-35) Timeline - TEN Digital.ts
First PCR 14:42:33.575139
File Length 7023375272
Sample 2458591808 35.01% name=Timeline
Show Start 383355688 5.46% name=Night At The Museum: Battle Of The Smith
Show End 5920582386 84.30% name=Alien Siege
writing Z:\TV\`Movies\(2011-10-29 20-35) Timeline - TEN Digital.ts.Xcl
Feel free to use any of the code in comskip. I've written it in c++, but tried to avoid most c++ specific code so you shouldn't have too much trouble incorperating it. I assume you've already got your own code for parsing transport streams so you probably don't need that part of my program, except if you haven't parsed EIT tables then you could use ParseEITTable and ParseEITEvents in transport_packet.cpp
Here's a few details of what I've done. The main work is done in the ProcessNowAndNext method in main.cpp. First up the PAT and PMTs are read to determine the service_id (aka program_number) to use. You must already do this in comskip so we can skip down to around line 232.
Here I read the next EIT packet belonging to the stream_id starting from testPositionFileOffset, which is a percentage of the way through the file. The percentage is defined at the start of the method and is currently set to 35%. From this packet I grab event_id_of_show.
Next I do a binary search for the last EIT packet before the test point that has a different event_id. From this I store the file position of this packet in fileOffsetStart. In the same way I then do a binary search for the first packet after the show with a different event_id and store that position in fileOffsetEnd.
Using fileOffsetStart and fileOffsetEnd I write the .Xcl and we're done.
I've tested this on a dozen files so far and all have worked really well. There was one where the start offset was a few seconds into the show so I'm thinking of adding the ability to specify a number of seconds padding to the start and end positions just in case the event_id change is a little off.
If you have any questions just ask. I'm happy to help.