Patent ID: 6873629

Claim:
A method of converting a data stream received in a specified Transport Stream (TS) format into an output data stream in a specified Program Stream (PS) format, the TS format being one in which at least first and second packetised elementary streams of encoded information relating to a desired programme have been further packetised into TS packets and multiplexed together with further streams relating to different programmes, the PS format being one in which the first and second elementary streams and optionally others relating generally to a selected programme are packetised and their packets interleaved to form a multiplexed stream of PS packs, each PS pack including a pack header and one or more whole packets of the packetised elementary streams, wherein said method comprises: (a) extracting from the received data stream program mapping information identifying a current stream index for each of the first and second elementary streams; (b) filtering data of the received data stream to extract packets carrying the desired elementary streams; (c) parsing the first and second elementary streams in accordance with packet header information to identify a sequence of presentation units within the payload of each desired elementary stream; (d) writing the presentation units of each stream in sequence into first and second payload queues respectively prior to re-multiplexing; (e) determining, in accordance with a synchronous relationship between the elementary streams and with a PS target decoder model and PS stream constraints, a valid PS schedule for re-multiplexing payload data from the first and second payload queues into a series of PS packs; and (f) in accordance with the determined PS schedule, retrieving said payload data from each queue, inserting packet headers so as to re-packetise each elementary stream, generating PS pack headers and multiplexing the packets of the first and second elementary streams into a series of PS packs so as to generate said output data stream; wherein the PS schedule determined in step (e) is dependent on the scheduling of presentation units within the received TS format signal.