An integrated circuit of a recording apparatus that records, on a recording medium, an AV stream, stream information, and a restoration program calculating a restoration parameter when executed, the AV stream including a primary video stream and a secondary video stream, the integrated circuit comprising:
- a multiplexer circuit that multiplexes a masked table with respect to each of TS packets composing the primary video stream and TS packets composing the secondary video stream, and thereby obtains the primary video stream and the secondary video stream;
- a first entry map generator circuit that generates a first entry map indicating a plurality of associations each associating (a) a start position of, among the TS packets composing the primary video stream, a group of TS packets which constitute an entry point storing therein an intra-frame encoded image with (b) a presentation time stamp of the group of TS packets of the primary video stream;
- a second entry map generator circuit that generates a second entry map indicating a plurality of associations each associating (a) a start position of, among the TS packets composing the secondary video stream, a group of TS packets which constitute an entry point storing therein an intra-frame encoded image with (b) a presentation time stamp of the group of TS packets of the secondary video stream;
- a specification circuit that divides each of the primary video stream and the secondary video stream into a plurality of restoration segments according to the first entry map and the second entry map, respectively, and specifies as untransformable packets, among the TS packets multiplexed in the restoration segments, each TS packet which constitutes one of the entry points of the secondary video stream and whose presentation time stamp is closest to the presentation time stamp of every N-th entry point of the primary video stream, N being an integer of 2 or more;
- a transformation circuit that obtains the AV stream by performing a restorable transformation with respect to some of TS packets among the TS packets in the restoration segments other than the untransformable TS packets, the restorable transformation being a replacement of the TS packets with another piece of data and a transformed TS packet obtained through the restorable transformation being restorable by using a restoration parameter;
- a program generator circuit that generates the restoration program;
- and
- a recorder circuit that records, onto a recording medium, the AV stream, the first entry map, the second entry map, and the restoration program, wherein
- the restoration program, when executed, restores a transformed TS packet by (i) calculating a restoration parameter for the restoration segment including the transformed TS packet based on a segment identifier provided to the restoration segment, (ii) performing a calculation using the masked table and the restoration parameter, and (iii) overwriting the transformed TS packet with a result of the calculation, the restoration program calculating a different restoration parameter for each of the restoration segments, and
- each of the restoration segments, other than a final one of the restoration segments, has the same fixed number of entry points.