mirror of
https://github.com/freemkv/libfreemkv.git
synced 2026-10-07 18:13:10 +00:00
mux: mpg:// program-stream output and source
A container-neutral fit plan, then mpg:// as an H.222.0 program-stream sink on the PES IR and as a source through the DVD sector pipeline. PES and AU placement, start-up hold caps and 20/24-bit LPCM timing follow the spec; a clear MPEG-1/2 PS is never read as scrambled and CSS is judged per pack. E9074 for an output with no video track.
This commit is contained in:
@@ -24,6 +24,8 @@ fn css_descramble_sector_roundtrip_via_public_api() {
|
||||
// requires the pack start code as well as the flag bits — byte 0x14 means
|
||||
// something else entirely in an IFO or UDF sector.
|
||||
sector[0x00..0x04].copy_from_slice(&[0x00, 0x00, 0x01, 0xBA]);
|
||||
sector[4] = 0x44; // '01': a 13818-1 pack
|
||||
sector[0x0D] = 0xF8; // pack_stuffing_length 0
|
||||
sector[0x14] = 0x30;
|
||||
sector[0x54..0x59].copy_from_slice(&[0xDE, 0xAD, 0xBE, 0xEF, 0x42]);
|
||||
let original = sector.clone();
|
||||
|
||||
@@ -33,6 +33,8 @@ fn css_decrypt_of_an_uncrackable_sector_still_descrambles() {
|
||||
// the pack start code as well as the flag bits, because byte 0x14 means
|
||||
// something else entirely in an IFO, UDF or ISO 9660 sector.
|
||||
sector[0x00..0x04].copy_from_slice(&[0x00, 0x00, 0x01, 0xBA]);
|
||||
sector[4] = 0x44; // '01': a 13818-1 pack
|
||||
sector[0x0D] = 0xF8; // pack_stuffing_length 0
|
||||
sector[0x14] |= 0x30; // CSS scramble flag, bits 4-5
|
||||
|
||||
let title_key: [u8; 5] = [0x42, 0x13, 0x37, 0xBE, 0xEF];
|
||||
|
||||
@@ -6,7 +6,7 @@ use libfreemkv::spec::{self, SpecQuote};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
const REGISTRY: &str = include_str!("spec_quotes.txt");
|
||||
const PREFIXES: &[&str] = &["KS-", "SS-"];
|
||||
const PREFIXES: &[&str] = &["KS-", "SS-", "MS-"];
|
||||
const ELISION: &str = " … ";
|
||||
|
||||
// `<id>\t<passage>[\t// comment]` per line; `#` lines are the header. Panics on a
|
||||
|
||||
@@ -46,3 +46,34 @@ SS-13 This system call is extremely dangerous and should not be used in portable
|
||||
SS-14 Does the same thing as fsync(2) then asks the drive to flush all buffered data to the permanent storage device (arg is ignored). As this drains the entire queue of the device and acts as a barrier, data that had been fsync'd on the same device before is guaranteed to be persisted when this call returns. This is currently implemented on HFS, MS-DOS (FAT), Universal Disk Format (UDF) and APFS file systems. The operation may take quite a while to complete. Certain FireWire drives have also been known to ignore the request to flush their buffered data.
|
||||
SS-15 Typically the WriteFile and WriteFileEx functions write data to an internal buffer that the operating system writes to a disk or communication pipe on a regular basis. The FlushFileBuffers function writes all the buffered information for a specified file to the device or pipe.
|
||||
SS-23 When coupled with a store, all previous operations become ordered before any load of this value with Acquire (or stronger) ordering. In particular, all previous writes become visible to all threads that perform an Acquire (or stronger) load of this value. When coupled with a load, if the loaded value was written by a store operation with Release (or stronger) ordering, then all subsequent operations become ordered after that store. In particular, all subsequent loads will see data written before the store.
|
||||
MS-1 pack() { pack_header() while (nextbits() = = packet_start_code_prefix) { PES_packet() } }
|
||||
MS-2 pack_header() { pack_start_code 32 bslbf '01' 2 bslbf system_clock_reference_base [32..30] 3 bslbf marker_bit 1 bslbf system_clock_reference_base [29..15] 15 bslbf marker_bit 1 bslbf system_clock_reference_base [14..0] 15 bslbf marker_bit 1 bslbf system_clock_reference_extension 9 uimsbf marker_bit 1 bslbf program_mux_rate 22 uimsbf marker_bit 1 bslbf marker_bit 1 bslbf reserved 5 bslbf pack_stuffing_length 3 uimsbf
|
||||
MS-3 The value of program_mux_rate is measured in units of 50 bytes/second. The value 0 is forbidden. The value represented in program_mux_rate is used to define the time of arrival of bytes at the input to the P-STD in 2.5.2. The value encoded in the program_mux_rate field may vary from pack to pack in an ITU-T Rec. H.222.0 | ISO/IEC 13818-1 program multiplexed stream. pack_stuffing_length – A 3-bit integer specifying the number of stuffing bytes which follow this field. stuffing_byte – This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder, for example to meet the requirements of the channel. It is discarded by the decoder. In each pack header no more than 7 stuffing bytes shall be present.
|
||||
MS-4 SCR(i) = SCR_base(i) × 300 + SCR_ext(i) (2-18) where SCR_base(i) = ((system_clock_ frequency × t(i)) DIV 300) % 233 (2-19) SCR_ext(i) = ((system_clock_ frequency × t(i)) DIV 1) % 300 (2-20) The input arrival time, t(i), as given in equation 2-21, for all other bytes shall be constructed from SCR(i) and the rate at which data arrives, where the arrival rate within each pack is the value represented in the program_mux_rate field in that pack’s header. SCR(i′ ) i − i′ t(i) = + (2-21) system_clock_ frequency program_mux_rate × 50 where i′ is the index of the byte containing the last bit of the system_clock_reference_base field in the pack header i is the index of any byte in the pack, including the pack header SCR(i′) is the time encoded in the system clock reference base and extension fields in units of the system clock program_mux_rate is a field defined in 2.5.3.3. After delivery of the last byte of a pack there may be a time interval during which no bytes are delivered to the input of the P-STD. 2.5.2.3 Buffering The PES packet data from elementary stream n is passed to the input buffer for stream n, Bn. Transfer of byte i from the system target decoder input to Bn is instantaneous, so that byte i enters the buffer for stream n, of size BSn, at time t(i). Bytes present in the pack header, system headers, Program Stream Maps, Program Stream Directories, or PES packet headers of the Program Stream such as SCR, DTS, PTS, and packet_length fields, are not delivered to any of the buffers, but may be used to control the system. The input buffer sizes BS1 through BSn are given by the P-STD buffer size parameter in the syntax in equation 2-16 and equation 2-17. At the decoding time, tdn(j), all data for the access unit that has been in the buffer longest, An(j), and any stuffing bytes that immediately precede it that are present in the buffer at the time tdn(j), are removed instantaneously at time tdn(j). The decoding time tdn(j) is specified in the DTS or PTS fields. Decoding times tdn(j + 1), tdn(j + 2), ... of access units without encoded DTS or PTS fields which directly follow access unit j may be derived from information in the elementary stream. Refer to Annex C of ITU-T Rec. H.262 | ISO/IEC 13818-2, ISO/IEC 13818-3, ISO/IEC 11172-2 or ISO/IEC 11172-3. Also refer to 2.7.5. As the access unit is removed from the buffer, it is instantaneously decoded to a presentation unit. The Program Stream shall be constructed and t(i) shall be chosen so that the input buffers of size BS1 through BSn neither overflow nor underflow in the program system target decoder. That is: 0 ≤ Fn(t) ≤ BSn for all t and n and Fn(t) = 0 instantaneously before t = t(0). Fn(t) is the instantaneous fullness of P-STD buffer Bn. An exception to this condition is that the P-STD buffer Bn may underflow when the low_delay flag in the video sequence header is set to '1' (refer to 2.4.2.6) or when trick_mode status is true (refer to 2.4.3.8). For all Program Streams, the delay caused by system target decoder input buffering shall be less than or equal to one second except for still picture video data and ISO/IEC 14496 streams. The input buffering delay is the difference in time between a byte entering the input buffer and when it is decoded. Specifically: in the case of no still picture video data and no ISO/IEC 14496 stream the delay is constrained by: tdn(j)-t(i) <= 1 sec in the case of still picture video data the delay is constrained by: tdn(j)-t(i) <= 60 sec in the case of ISO/IEC 14496 streams the delay is constrained by: tdn(j)-t(i) <= 10 sec for all bytes contained in access unit j. For Program Streams, all bytes of each pack shall enter the P-STD before any byte of a subsequent pack.
|
||||
MS-5 system_header () { system_header_start_code 32 bslbf header_length 16 uimsbf marker_bit 1 bslbf rate_bound 22 uimsbf marker_bit 1 bslbf audio_bound 6 uimsbf fixed_flag 1 bslbf CSPS_flag 1 bslbf system_audio_lock_flag 1 bslbf system_video_lock_flag 1 bslbf marker_bit 1 bslbf video_bound 5 uimsbf packet_rate_restriction_flag 1 bslbf reserved_bits 7 bslbf while (nextbits () = = '1') { stream_id 8 uimsbf '11' 2 bslbf P-STD_buffer_bound_scale 1 bslbf P-STD_buffer_size_bound 13 uimsbf } }
|
||||
MS-6 The rate_bound is an integer value greater than or equal to the maximum value of the program_mux_rate field coded in any pack of the Program Stream. It may be used by a decoder to assess whether it is capable of decoding the entire stream. audio_bound – A 6-bit field. The audio_bound is an integer in the inclusive range from 0 to 32 and is set to a value greater than or equal to the maximum number of ISO/IEC 13818-3 and ISO/IEC 11172-3 audio streams in the Program Stream for which the decoding processes are simultaneously active. For the purpose of this subclause, the decoding process of an ISO/IEC 13818-3 or ISO/IEC 11172-3 audio stream is active if the STD buffer is not empty or if a Presentation Unit is being presented in the P-STD model. fixed_flag – The fixed_flag is a 1-bit flag. When set to '1' fixed bitrate operation is indicated. When set to '0' variable bitrate operation is indicated. During fixed bitrate operation, the value encoded in all system_clock_reference fields in the multiplexed ITU-T Rec. H.222.0 | ISO/IEC 13818-1 stream shall adhere to the following linear equation: SCR_base(i) = ((c1 × i + c2) DIV 300) % 233 (2-22) SCR_ext(i) = ((c1 × i + c2) DIV 300) % 300 (2-23) where c1 is a real-valued constant valid for all i c2 is a real-valued constant valid for all i i is the index in the ITU-T Rec. H.222.0 | ISO/IEC 13818-1 multiplexed stream of the byte containing the final bit of any system_clock_reference field in the stream CSPS_flag – The CSPS_flag is a 1-bit field. If its value is set to '1' the Program Stream meets the constraints defined in 2.7.9. system_audio_lock_flag – The system_audio_lock_flag is a 1-bit field indicating that there is a specified, constant rational relationship between the audio sampling rate and the system_clock_frequency in the system target decoder. The system_clock_frequency is defined in 2.5.2.1 and the audio sampling rate is specified in ISO/IEC 13818-3. The system_audio_lock_flag may only be set to '1' if, for all presentation units in all audio elementary streams in the Program Stream, the ratio of system_clock_frequency to the actual audio sampling rate, SCASR, is constant and equal to the value indicated in the following table at the nominal sampling rate indicated in the audio stream. system_clock_ frequency SCASR = (2-24) audio_sample_ rate_in _the_P−STD X The notation denotes real division. Y Nominal audio sampling 16 32 22,05 44,1 24 48 frequency (kHz) SCASR 27 000 000 27 000 000 27 000 000 27 000 000 27 000 000 27 000 000 ------------- ------------- ------------- ------------- ------------- ------------- 16 000 32 000 22 050 44 100 24 000 48 000 system_video_lock_flag – The system_video_lock_flag is a 1-bit field indicating that there is a specified, constant rational relationship between the video frame rate and the system clock frequency in the system target decoder. Subclause 2.5.2.1 defines system_clock_frequency and the video frame rate is specified in ITU-T Rec. H.262 | ISO/IEC 13818-2. The system_video_lock_flag may only be set to '1' if, for all presentation units in all video elementary streams in the ITU-T Rec. H.222.0 | ISO/IEC 13818-1 program, the ratio of system_clock_frequency to the actual video frame rate, SCFR, is constant and equal to the value indicated in the following table at the nominal frame rate indicated in the video stream. system_clock_ frequency SCFR = (2-25) frame_rate_in _the_P−STD Nominal frame rate 23,976 24 25 29,97 30 50 59,94 60 (Hz) SCFR 1 126 125 1 125 000 1 080 000 900 900 900 000 540 000 450 450 450 000 The values of the ratio SCFR are exact. The actual frame rate differs slightly from the nominal rate in cases where the nominal rate is 23,976, 29,97, or 59,94 frames per second. video_bound – The video_bound is a 5-bit integer in the inclusive range from 0 to 16 and is set to a value greater than or equal to the maximum number of ITU-T Rec. H.262 | ISO/IEC 13818-2 and ISO/IEC 11172-2 streams in the Program Stream of which the decoding processes are simultaneously active. For the purpose of this subclause, the decoding process of an ITU-T Rec. H.262 | ISO/IEC 13818-2 and ISO/IEC 11172-2 video stream is active if the P-STD buffer is not empty, or if a Presentation Unit is being presented in the P-STD model, or if the reorder buffer is not empty. packet_rate_restriction_flag – The packet_rate_restriction_flag is a 1-bit flag. If the CSPS flag is set to '1', the packet_rate_restriction_flag indicates which constraint is applicable to the packet rate, as specified in 2.7.9. If the CSPS flag is set to value of '0', then the meaning of the packet_rate_restriction_flag is undefined. reserved_bits – This 7-bit field is reserved for future use by ISO/IEC. Until otherwise specified by ITU-T | ISO/IEC it shall have the value '111 1111'.
|
||||
MS-7 Each elementary stream present in the Program Stream shall have its P-STD_buffer_bound_scale and P-STD_buffer_size_bound specified exactly once by this mechanism in each system header. P-STD_buffer_bound_scale – The P-STD_buffer_bound_scale is a 1-bit field that indicates the scaling factor used to interpret the subsequent P-STD_buffer_size_bound field. If the preceding stream_id indicates an audio stream, P-STD_buffer_bound_scale shall have the value '0'. If the preceding stream_id indicates a video stream, P-STD_buffer_bound_scale shall have the value '1'. For all other stream types, the value of the P-STD_buffer_bound_scale may be either '1' or '0'. P-STD_buffer_size_bound – The P-STD_buffer_size_bound is a 13-bit unsigned integer defining a value greater than or equal to the maximum P-STD input buffer size, BSn, over all packets for stream n in the Program Stream. If P-STD_buffer_bound_scale has the value '0', then P-STD_buffer_size_bound measures the buffer size bound in units of 128 bytes. If P-STD_buffer_bound_scale has the value '1', then P-STD_buffer_size_bound measures the buffer size bound in units of 1024 bytes.
|
||||
MS-8 program_stream_map() { packet_start_code_prefix 24 bslbf map_stream_id 8 uimsbf program_stream_map_length 16 uimsbf current_next_indicator 1 bslbf reserved 2 bslbf program_stream_map_version 5 uimsbf reserved 7 bslbf marker_bit 1 bslbf program_stream_info_length 16 uimsbf for (i = 0; i < N; i++) { descriptor() } elementary_stream_map_length 16 uimsbf for (i = 0; i < N1; i++) { stream_type 8 uimsbf elementary_stream_id 8 uimsbf elementary_stream_info_length 16 uimsbf for (i = 0; i < N2; i++) { descriptor() } } CRC_32 32 rpchof } 2.5.4.2 Semantic definition of fields in Program Stream map packet_start_code_prefix – The packet_start_code_prefix is a 24-bit code. Together with the map_stream_id that follows it constitutes a packet start code that identifies the beginning of a packet. The packet_start_code_prefix is the bit string '0000 0000 0000 0000 0000 0001' (0x000001 in hexadecimal). map_stream_id – This is an 8-bit field whose value shall be 0xBC. program_stream_map_length – The program_stream_map_length is a 16-bit field indicating the total number of bytes in the program_stream_map immediately following this field. The maximum value of this field is 1018 (0x3FA). current_next_indicator – This is a 1-bit field, when set to '1' indicates that the Program Stream Map sent is currently applicable. When the bit is set to '0', it indicates that the Program Stream Map sent is not yet applicable and shall be the next table to become valid. program_stream_map_version – This 5-bit field is the version number of the whole Program Stream Map. The version number shall be incremented by 1 modulo 32 whenever the definition of the Program Stream Map changes. When the current_next_indicator is set to '1', then the program_stream_map_version shall be that of the currently applicable Program Stream Map. When the current_next_indicator is set to '0', then the program_stream_map_version shall be that of the next applicable Program Stream Map. program_stream_info_length – The program_stream_info_length is a 16-bit field indicating the total length of the descriptors immediately following this field. marker_bit – A marker_bit is a 1-bit field that has the value '1'. elementary_stream_map_length – This is a 16-bit field specifying the total length, in bytes, of all elementary stream information in this program stream map. It includes the stream_type, elementary_stream_id, and elementary_stream_info_length fields. stream_type – This 8-bit field specifies the type of the stream according to Table 2-29. The stream_type field shall only identify elementary streams contained in PES packets. A value of 0x05 is prohibited. elementary_stream_id – The elementary_stream_id is an 8-bit field indicating the value of the stream_id field in the PES packet headers of PES packets in which this elementary stream is stored.
|
||||
MS-9 CRC_32 – This is a 32-bit field that contains the CRC value that gives a zero output of the registers in the decoder defined in Annex A after processing the entire program stream map.
|
||||
MS-10 '10' 2 bslbf PES_scrambling_control 2 bslbf PES_priority 1 bslbf data_alignment_indicator 1 bslbf copyright 1 bslbf original_or_copy 1 bslbf PTS_DTS_flags 2 bslbf ESCR_flag 1 bslbf ES_rate_flag 1 bslbf DSM_trick_mode_flag 1 bslbf additional_copy_info_flag 1 bslbf PES_CRC_flag 1 bslbf PES_extension_flag 1 bslbf PES_header_data_length 8 uimsbf if (PTS_DTS_flags = = '10') { '0010' 4 bslbf PTS [32..30] 3 bslbf marker_bit 1 bslbf PTS [29..15] 15 bslbf marker_bit 1 bslbf PTS [14..0] 15 bslbf marker_bit 1 bslbf } Table 2-17 – PES packet (continued) Syntax No. of bits Mnemonic if (PTS_DTS_flags = = '11') { '0011' 4 bslbf PTS [32..30] 3 bslbf marker_bit 1 bslbf PTS [29..15] 15 bslbf marker_bit 1 bslbf PTS [14..0] 15 bslbf marker_bit 1 bslbf '0001' 4 bslbf DTS [32..30] 3 bslbf
|
||||
MS-11 if ( PES_extension_flag = = '1') { PES_private_data_flag 1 bslbf pack_header_field_flag 1 bslbf program_packet_sequence_counter_flag 1 bslbf P-STD_buffer_flag 1 bslbf reserved 3 bslbf PES_extension_flag_2 1 bslbf if ( PES_private_data_flag = = '1') { PES_private_data 128 bslbf } if (pack_header_field_flag = = '1') { pack_field_length 8 uimsbf pack_header() } if (program_packet_sequence_counter_flag = = '1') { marker_bit 1 bslbf program_packet_sequence_counter 7 uimsbf marker_bit 1 bslbf MPEG1_MPEG2_identifier 1 bslbf original_stuff_length 6 uimsbf } if ( P-STD_buffer_flag = = '1') { '01' 2 bslbf P-STD_buffer_scale 1 bslbf P-STD_buffer_size 13 uimsbf } if ( PES_extension_flag_2 = = '1') { marker_bit 1 bslbf PES_extension_field_length 7 uimsbf for (i = 0; i < PES_extension_field_length; i++) { reserved 8 bslbf } } } for (i = 0; i < N1; i++) { stuffing_byte 8 bslbf } for (i = 0; i < N2; i++) { PES_packet_data_byte 8 bslbf } } else if ( stream_id = = program_stream_map || stream_id = = private_stream_2 || stream_id = = ECM || stream_id = = EMM || stream_id = = program_stream_directory || stream_id = = DSMCC_stream || stream_id = = ITU-T Rec. H.222.1 type E stream ) { for (i = 0; i < PES_packet_length; i++) { PES_packet_data_byte 8 bslbf } } else if ( stream_id = = padding_stream) { for (i = 0; i < PES_packet_length; i++) { padding_byte 8 bslbf } }
|
||||
MS-12 A value of 0 indicates that the PES packet length is neither specified nor bounded and is allowed only in PES packets whose payload consists of bytes from a video elementary stream contained in Transport Stream packets.
|
||||
MS-13 If the preceding stream_id indicates an audio stream, P-STD_buffer_scale shall have the value '0'. If the preceding stream_id indicates a video stream, P-STD_buffer_scale shall have the value '1'. For all other stream types, the value may be either '1' or '0'. P-STD_buffer_size – The P-STD_buffer_size is a 13-bit unsigned integer, the meaning of which is only defined if this PES packet is contained in a Program Stream. It defines the size of the input buffer, BSn, in the P-STD. If P-STD_buffer_scale has the value '0', then the P-STD_buffer_size measures the buffer size in units of 128 bytes. If P-STD_buffer_scale has the value '1', then the P-STD_buffer_size measures the buffer size in units of 1024 bytes. Thus: if (P-STD_buffer_scale = = 0) _ (2-16) BSn = P − STD_buffer_size × 128 else BSn = P − STD_buffer_size × 1024 (2-17) The encoded value of the P-STD buffer size takes effect immediately when the P-STD_buffer_size field is received by the ITU-T Rec. H.222.0 | ISO/IEC 13818-1 System Target Decoder (refer to 2.7.7). PES_extension_field_length – This is a 7-bit field which specifies the length, in bytes, of the data following this field in the PES extension field up to and including any reserved bytes. stuffing_byte – This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder, for example to meet the requirements of the channel. It is discarded by the decoder. No more than 32 stuffing bytes shall be present in one
|
||||
MS-14 In the case of a private_stream_1, private_stream_2, ECM_stream, or EMM_stream, the contents of the PES_packet_data_byte field are user definable and will not be specified by ITU-T | ISO/IEC in the future.
|
||||
MS-15 In the case of audio, if a PTS is present in PES packet header it shall refer to the first access unit commencing in the PES packet. An audio access unit commences in a PES packet if the first byte of the audio access unit is present in the PES packet. In the case of video, if a PTS is present in a PES packet header it shall refer to the access unit containing the first picture start code that commences in this PES packet.
|
||||
MS-16 Bytes present in the pack header, system headers, Program Stream Maps, Program Stream Directories, or PES packet headers of the Program Stream such as SCR, DTS, PTS, and packet_length fields, are not delivered to any of the buffers, but may be used to control the system. The input buffer sizes BS1 through BSn are given by the P-STD buffer size parameter in the syntax in equation 2-16 and equation 2-17. At the decoding time, tdn(j), all data for the access unit that has been in the buffer longest, An(j), and any stuffing bytes that immediately precede it that are present in the buffer at the time tdn(j), are removed instantaneously at time tdn(j). The decoding time tdn(j) is specified in the DTS or PTS fields. Decoding times tdn(j + 1), tdn(j + 2), ... of access units without encoded DTS or PTS fields which directly follow access unit j may be derived from information in the elementary stream. Refer to Annex C of ITU-T Rec. H.262 | ISO/IEC 13818-2, ISO/IEC 13818-3, ISO/IEC 11172-2 or ISO/IEC 11172-3. Also refer to 2.7.5. As the access unit is removed from the buffer, it is instantaneously decoded to a presentation unit. The Program Stream shall be constructed and t(i) shall be chosen so that the input buffers of size BS1 through BSn neither overflow nor underflow in the program system target decoder. That is: 0 ≤ Fn(t) ≤ BSn for all t and n and Fn(t) = 0 instantaneously before t = t(0). Fn(t) is the instantaneous fullness of P-STD buffer Bn. An exception to this condition is that the P-STD buffer Bn may underflow when the low_delay flag in the video sequence header is set to '1' (refer to 2.4.2.6) or when trick_mode status is true (refer to 2.4.3.8). For all Program Streams, the delay caused by system target decoder input buffering shall be less than or equal to one second except for still picture video data and ISO/IEC 14496 streams.
|
||||
MS-17 The Program Stream shall be constructed such that the time interval between the bytes containing the last bit of system_clock_reference_base fields in successive packs shall be less than or equal to 0.7 s.
|
||||
MS-18 The Program Stream and Transport Stream shall be constructed so that the maximum difference between coded presentation timestamps referring to each elementary video or audio stream is 0,7 s. Thus: | tpn(k) − tpn(k″) | ≤ 0.7 s for all n, k, and k″ satisfying: • Pn(k) and Pn(k″) are presentation units for which presentation timestamps are coded; • k and k″ are chosen so that there is no presentation unit, Pn(k′) with a coded presentation timestamp and with k < k′ < k″; and • No decoding discontinuity exists in elementary stream n between Pn(k) and Pn(k''). In the case of still pictures the 0,7 s constraint does not apply.
|
||||
MS-19 For each elementary stream of a Program Stream or Transport Stream, a presentation timestamp (PTS) shall be encoded for the first access unit. A decoding discontinuity exists at the start of an access unit An(j) in an elementary stream n if the decoding time tdn(j) of that access unit is greater than the largest value permissible given the specified tolerance on the system_clock_frequency. For video, except when trick mode status is true or when low_delay flag is '1', this is allowed only at the start of a video sequence. If a decoding discontinuity exists in any elementary video or audio stream in the Transport Stream or Program Stream, then a PTS shall be encoded referring to the first access unit after each decoding discontinuity except when trick mode status is true. When low_delay is '1' a PTS shall be encoded for the first access unit after an EBn or Bn underflow. A PTS may only be present in a ITU-T Rec. H.222.0 | ISO/IEC 13818-1 video or audio elementary stream PES packet header if the first byte of a picture start code or the first byte of an audio access unit is contained in the PES packet. A decoding_timestamp (DTS) shall appear in a PES packet header if and only if the following two conditions are met: • a PTS is present in the PES packet header; • the decoding time differs from the presentation time.
|
||||
MS-20 If an audio sequence is coded using an ISO/IEC 13818-3 extension bitstream, corresponding decoding/presentation units in the two layers shall have identical PTS values.
|
||||
MS-21 In a Program Stream, the P-STD_buffer_scale and P-STD_buffer_size fields shall occur in the first PES packet of each elementary stream and again whenever the value changes. They may also occur in any other PES packet. 2.7.8 Coding of system header in the Program Stream In a Program Stream, the system header may be present in any pack, immediately following the pack header. The system header shall be present in the first pack of an Program Stream. The values encoded in all the system headers in the Program Stream shall be identical.
|
||||
MS-22 0x01 ISO/IEC 11172 Video 0x02 ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream 0x03 ISO/IEC 11172 Audio 0x04 ISO/IEC 13818-3 Audio 0x05 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections 0x06 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data
|
||||
MS-23 hierarchy_embedded_layer_index – The hierarchy_embedded_layer_index is a 6-bit field that defines the hierarchy table index of the program element that needs to be accessed before decoding of the elementary stream associated with this hierarchy_descriptor. This field is undefined if the hierarchy_type value is 15 (base layer). hierarchy_channel – The hierarchy_channel is a 6-bit field that indicates the intended channel number for the associated program element in an ordered set of transmission channels. The most robust transmission channel is defined by the lowest value of this field with respect to the overall transmission hierarchy definition. NOTE – A given hierarchy_channel may at the same time be assigned to several program elements. Table 2-43 – Hierarchy descriptor Syntax No. of bits Mnemonic hierarchy_descriptor() { descriptor_tag 8 uimsbf descriptor_length 8 uimsbf reserved 4 bslbf hierarchy_type 4 uimsbf reserved 2 bslbf hierarchy_layer_index 6 uimsbf reserved 2 bslbf hierarchy_embedded_layer_index 6 uimsbf reserved 2 bslbf hierarchy_channel 6 uimsbf } Table 2-44 – Hierarchy_type field values Value Description 0 Reserved 1 ITU-T Rec. H.262 | ISO/IEC 13818-2 Spatial Scalability 2 ITU-T Rec. H.262 | ISO/IEC 13818-2 SNR Scalability 3 ITU-T Rec. H.262 | ISO/IEC 13818-2 Temporal Scalability 4 ITU-T Rec. H.262 | ISO/IEC 13818-2 Data partitioning 5 ISO/IEC 13818-3 Extension bitstream 6 ITU-T Rec.H222.0 | ISO/IEC 13818-1 Private Stream 7 ITU-T Rec. H.262 | ISO/IEC 13818-2 Multi-view Profile 8-14 Reserved 15 Base layer
|
||||
MS-24 ISO_639_language_descriptor() { descriptor_tag 8 uimsbf descriptor_length 8 uimsbf for (i = 0; i < N; i++) { ISO_639_language_code 24 bslbf audio_type 8 bslbf } }
|
||||
MS-25 4 X X hierarchy_descriptor 5 X X registration_descriptor 6 X X data_stream_alignment_descriptor 7 X X target_background_grid_descriptor 8 X X Video_window_descriptor 9 X X CA_descriptor 10 X X ISO_639_language_descriptor 11 X X System_clock_descriptor 12 X X Multiplex_buffer_utilization_descriptor 13 X X Copyright_descriptor 14 X Maximum_bitrate_descriptor 15 X X Private_data_indicator_descriptor 16 X X Smoothing_buffer_descriptor 17 X STD_descriptor 18 X X IBP_descriptor 19-26 X Defined in ISO/IEC 13818-6 27 X X MPEG-4_video_descriptor 28 X X MPEG-4_audio_descriptor 29 X X IOD_descriptor 30 X SL_descriptor 31 X X FMC_descriptor 32 X X External_ES_ID_descriptor 33 X X MuxCode_descriptor 34 X X FmxBufferSize_descriptor 35 X MultiplexBuffer_descriptor 36-63 n/a n/a ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved 64-255 n/a n/a User Private
|
||||
MS-26 This is the CRC calculated with the polynomial: x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
|
||||
MS-27 1011 1100 1 program_stream_map 1011 1101 2 private_stream_1 1011 1110 padding_stream 1011 1111 3 private_stream_2 110x xxxx ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC 14496-3 audio stream number x xxxx 1110 xxxx ITU-T Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 11172-2 or ISO/IEC 14496-2 video stream number xxxx
|
||||
MS-28 A range of private descriptors may be defined by the user. These descriptors shall commence with descriptor_tag and descriptor_length fields. For private descriptors, the value of descriptor_tag may take the values 64-55 as identified in Table 2-39. These descriptors may be placed within a program_stream_map()
|
||||
MS-29 if (startcode == PRIVATE_STREAM_1) { avio_w8(ctx->pb, id); if (id >= 0xa0) { /* LPCM (XXX: check nb_frames) */ avio_w8(ctx->pb, 7); avio_wb16(ctx->pb, 4); /* skip 3 header bytes */ avio_w8(ctx->pb, stream->lpcm_header[0]); avio_w8(ctx->pb, stream->lpcm_header[1]); avio_w8(ctx->pb, stream->lpcm_header[2]); } else if (id >= 0x40) { /* AC-3 */ avio_w8(ctx->pb, nb_frames); avio_wb16(ctx->pb, trailer_size + 1); } }
|
||||
MS-30 stream->lpcm_header[0] = 0x0c; stream->lpcm_header[1] = (freq << 4) | (((st->codecpar->bits_per_coded_sample - 16) / 4) << 6) | st->codecpar->ch_layout.nb_channels - 1; stream->lpcm_header[2] = 0x80;
|
||||
MS-31 if (stream_id != program_stream_map && stream_id != padding_stream && stream_id != private_stream_2 && stream_id != ECM && stream_id != EMM && stream_id != program_stream_directory && stream_id != DSMCC_stream && stream_id != ITU-T Rec. H.222.1 type E stream) { '10' 2 bslbf PES_scrambling_control 2 bslbf
|
||||
|
||||
+39
-1
@@ -1,6 +1,6 @@
|
||||
# Spec-governed code sites (KU design §3.6.1 rule 11): `<file>\t<fn>\t<id>`, one row per
|
||||
# (site, quote). `spec_governed_sites_cite_the_spec` checks that the body of `fn <fn>` in
|
||||
# `<file>` names `<id>`. KU rows are KS-n; Stop adds its SS-n rows here.
|
||||
# `<file>` names `<id>`. KU rows are KS-n; Stop adds its SS-n rows, mpg:// its MS-n.
|
||||
src/aacs/content.rs clear_copy_permission_indicator KS-5
|
||||
src/aacs/content.rs clear_copy_permission_indicator KS-6
|
||||
src/aacs/content.rs clear_copy_permission_indicator KS-22
|
||||
@@ -36,3 +36,41 @@ src/keys/arrival.rs side_partners KS-7
|
||||
src/keys/fmts.rs anchor KS-26
|
||||
src/keys/fmts.rs phases KS-25
|
||||
src/keys/fmts.rs phases KS-26
|
||||
src/mux/mpg/pack.rs pack_header MS-2
|
||||
src/mux/mpg/pack.rs pack_header MS-3
|
||||
src/mux/mpg/pack.rs pack_header MS-4
|
||||
src/mux/mpg/pack.rs system_header MS-5
|
||||
src/mux/mpg/pack.rs system_header MS-6
|
||||
src/mux/mpg/pack.rs system_header MS-7
|
||||
src/mux/mpg/pack.rs crc32 MS-26
|
||||
src/mux/mpg/pack.rs psm MS-8
|
||||
src/mux/mpg/pack.rs psm MS-9
|
||||
src/mux/mpg/pack.rs hierarchy_descriptor MS-23
|
||||
src/mux/mpg/pack.rs iso639_descriptor MS-24
|
||||
src/mux/mpg/pack.rs fmkv_descriptors MS-28
|
||||
src/mux/mpg/pack.rs pes_header MS-10
|
||||
src/mux/mpg/pack.rs pes_header MS-11
|
||||
src/mux/mpg/pack.rs pes_header MS-12
|
||||
src/mux/mpg/fit.rs want MS-22
|
||||
src/mux/mpg/fit.rs want MS-27
|
||||
src/mux/mpg/pstd.rs room MS-16
|
||||
src/mux/mpg/pstd.rs push MS-18
|
||||
src/mux/mpg/pstd.rs emit_pes MS-14
|
||||
src/mux/mpg/pstd.rs emit_pes MS-15
|
||||
src/mux/mpg/pstd.rs write_pack MS-16
|
||||
src/mux/mpg/pstd.rs emit_pes MS-19
|
||||
src/mux/mpg/pstd.rs emit_pes MS-21
|
||||
src/mux/mpg/pstd.rs emit_pes MS-29
|
||||
src/mux/mpg/pstd.rs write_pack MS-3
|
||||
src/mux/mpg/pstd.rs write_pack MS-4
|
||||
src/mux/mpg/pstd.rs pump MS-17
|
||||
src/mux/mpg/mod.rs first_pack_prefix MS-7
|
||||
src/mux/mpg/mod.rs first_pack_prefix MS-8
|
||||
src/mux/mpg/mod.rs first_pack_prefix MS-13
|
||||
src/mux/mpg/mod.rs first_pack_prefix MS-22
|
||||
src/mux/mpg/mod.rs first_pack_prefix MS-23
|
||||
src/mux/codec/lpcm.rs dvd_header MS-30
|
||||
src/mux/mpg/scan.rs parse_map MS-8
|
||||
src/mux/mpg/scan.rs parse_map MS-9
|
||||
src/mux/mpg/scan.rs scan MS-23
|
||||
src/css/mod.rs ps_scrambled_at MS-31
|
||||
|
||||
Reference in New Issue
Block a user