Search code examples
c++videolive555

Live555 TSX file indexing


I'm looking at the Live555 media server. It has an executable that's used to "index" transport stream videos and is named / used like this:

MPEG2TransportStreamIndexer video.ts 

So if a video is named TransportStreamVideo.ts the indexer creates a file named TransportStreamVideo.tsx. Notice the same name as the video file just adds an 'x' or extension is ".tsx

I know this is for 'trick play' but I'm wondering just how this works internally.

So my question is: how does Live555 use the '.ts' file and '.tsx' file together?

Is a completely new stream produced to send out to be displayed on the client video display?


Solution

  • If you look to the code of live555MediaServer in file DynamicRTSPServer.cpp, you will see that the session is created like this:

      } else if (strcmp(extension, ".ts") == 0) {
        // Assumed to be a MPEG Transport Stream file:
        // Use an index file name that's the same as the TS file name, except with ".tsx":
        unsigned indexFileNameLen = strlen(fileName) + 2; // allow for trailing "x\0"
        char* indexFileName = new char[indexFileNameLen];
        sprintf(indexFileName, "%sx", fileName);
        NEW_SMS("MPEG Transport Stream");
        sms->addSubsession(MPEG2TransportFileServerMediaSubsession::createNew(env, fileName, indexFileName, reuseSource));
        delete[] indexFileName;
      } 
    

    The MPEG2TransportFileServerMediaSubsession object use the .ts file and its associated .tsx index.

    The tsx file is not a new stream it is an index on the transport stream file.