Пример #1
0
class BroadcasterInformationSection(Section):
    """ブロードキャスタ情報セクション BIT (ARIB-STD-B10-2-5.2.13)"""

    _pids = [0x24]
    _table_ids = [0xC4]

    table_id = uimsbf(8)
    section_syntax_indicator = bslbf(1)
    reserved_future_use_1 = bslbf(1)
    reserved_1 = bslbf(2)
    section_length = uimsbf(12)
    original_network_id = uimsbf(16)
    reserved_2 = bslbf(2)
    version_number = uimsbf(5)
    current_next_indicator = bslbf(1)
    section_number = uimsbf(8)
    last_section_number = uimsbf(8)
    reserved_future_use_2 = bslbf(3)
    broadcast_view_propriety = bslbf(1)
    first_descriptors_length = uimsbf(12)
    descriptors = descriptors(first_descriptors_length)

    @loop(lambda self: (self.section_length -
                        (self.first_descriptors_length + 11)))
    class broadcasters(Syntax):
        broadcaster_id = uimsbf(8)
        reserved_future_use = bslbf(4)
        broadcaster_descriptor_length = uimsbf(12)
        descriptors = descriptors(broadcaster_descriptor_length)

    CRC_32 = rpchof(32)
Пример #2
0
class BouquetAssociationSection(Section):
    """ブーケアソシエーションセクション BAT (ARIB-STD-B10-2-5.2.5)"""

    _pids = [0x11]
    _table_ids = [0x4A]

    table_id = uimsbf(8)
    section_syntax_indicator = bslbf(1)
    reserved_future_use_1 = bslbf(1)
    reserved_1 = bslbf(2)
    section_length = uimsbf(12)
    bouquet_id = uimsbf(16)
    reserved_2 = bslbf(2)
    version_number = uimsbf(5)
    current_next_indicator = bslbf(1)
    section_number = uimsbf(8)
    last_section_number = uimsbf(8)
    reserved_future_use_2 = bslbf(4)
    bouquet_descriptors_length = uimsbf(12)
    bouquet_descriptors = descriptors(bouquet_descriptors_length)
    reserved_future_use_3 = bslbf(4)
    transport_stream_loop_length = uimsbf(12)

    @loop(transport_stream_loop_length)
    class transport_streams(Syntax):
        transport_stream_id = uimsbf(16)
        original_network_id = uimsbf(16)
        reserved_future_use = bslbf(4)
        transport_descriptors_length = uimsbf(12)
        descriptors = descriptors(transport_descriptors_length)

    CRC_32 = rpchof(32)
Пример #3
0
 class maps(Syntax):
     stream_type = uimsbf(8)
     reserved_1 = bslbf(3)
     elementary_PID = uimsbf(13)
     reserved_2 = bslbf(4)
     ES_info_length = uimsbf(12)
     descriptors = descriptors(ES_info_length)
Пример #4
0
class CommonDataSection(Section):
    """全受信機共通データセクション CDT (ARIB-STD-B21-12.2.2.2)"""

    _pids = [0x29]
    _table_ids = [0xC8]

    table_id = uimsbf(8)
    section_syntax_indicator = bslbf(1)
    reserved_future_use_1 = bslbf(1)
    reserved_1 = bslbf(2)
    section_length = uimsbf(12)
    download_data_id = uimsbf(16)
    reserved_2 = bslbf(2)
    version_number = uimsbf(5)
    current_next_indicator = bslbf(1)
    section_number = uimsbf(8)
    last_section_number = uimsbf(8)
    original_network_id = uimsbf(16)
    data_type = uimsbf(8)
    reserved_future_use_2 = bslbf(4)
    descriptors_loop_length = uimsbf(12)
    descriptors = descriptors(descriptors_loop_length)

    # 地上デジタル放送ではdata_module_byteはCDT伝送方式サービスロゴである (ARIB-TR-B14-1-5.4.1.2)
    logo_type = uimsbf(8)
    reserved_future_use_3 = bslbf(7)
    logo_id = uimsbf(9)
    reserved_future_use_4 = bslbf(4)
    logo_version = uimsbf(12)
    data_size = uimsbf(16)
    data_byte = raw(data_size)

    CRC_32 = rpchof(32)
Пример #5
0
class NetworkInformationSection(Section):
    """ネットワーク情報セクション NIT (ARIB-STD-B10-2-5.2.4)"""

    _pids = [0x10]
    _table_ids = [0x40, 0x41]

    table_id = uimsbf(8)
    section_syntax_indicator = bslbf(1)
    reserved_future_use_1 = bslbf(1)
    reserved_1 = bslbf(2)
    section_length = uimsbf(12)
    network_id = uimsbf(16)
    reserved_2 = bslbf(2)
    version_number = uimsbf(5)
    current_next_indicator = bslbf(1)
    section_number = uimsbf(8)
    last_section_number = uimsbf(8)
    reserved_future_use_2 = bslbf(4)
    network_descriptors_length = uimsbf(12)
    network_descriptors = descriptors(network_descriptors_length)
    reserved_future_use_3 = bslbf(4)
    transport_stream_loop_length = uimsbf(12)

    @loop(transport_stream_loop_length)
    class transport_streams(Syntax):
        transport_stream_id = uimsbf(16)
        original_network_id = uimsbf(16)
        reserved_future_use = bslbf(4)
        transport_descriptors_length = uimsbf(12)
        descriptors = descriptors(transport_descriptors_length)

    CRC_32 = rpchof(32)
Пример #6
0
 class events(Syntax):
     event_id = uimsbf(16)
     start_time = mjd(40)
     duration = bcdtime(24)
     running_status = uimsbf(3)
     free_CA_mode = bslbf(1)
     descriptors_loop_length = uimsbf(12)
     descriptors = descriptors(descriptors_loop_length)
Пример #7
0
 class relations(Syntax):
     node_id = uimsbf(16)
     collection_mode = uimsbf(4)
     reserved_future_use_1 = bslbf(4)
     parent_node_id = uimsbf(16)
     reference_number = uimsbf(8)
     reserved_future_use_2 = bslbf(4)
     descriptors_loop_length = uimsbf(12)
     descriptors = descriptors(descriptors_loop_length)
Пример #8
0
 class services(Syntax):
     service_id = uimsbf(16)
     reserved_future_use = bslbf(3)
     EIT_user_defined_flags = bslbf(3)
     EIT_schedule_flag = bslbf(1)
     EIT_present_following_flag = bslbf(1)
     running_status = uimsbf(3)
     free_CA_mode = bslbf(1)
     descriptors_loop_length = uimsbf(12)
     descriptors = descriptors(descriptors_loop_length)
Пример #9
0
class TimeOffsetSection(Section):
    """時刻日付オフセットセクション TOT (ARIB-STD-B10-2-5.2.9)"""

    _pids = [0x14]
    _table_ids = [0x73]

    table_id = uimsbf(8)
    section_syntax_indicator = bslbf(1)
    reserved_future_use = bslbf(1)
    reserved1 = bslbf(2)
    section_length = uimsbf(12)
    JST_time = mjd(40)
    reserved_2 = bslbf(4)
    descriptors_loop_length = uimsbf(12)
    descriptors = descriptors(descriptors_loop_length)
    CRC_32 = rpchof(32)
Пример #10
0
class ConditionalAccessSection(Section):
    """限定受信セクション CAT (ISO 13818-1 2.4.4.6)"""

    _pids = [0x01]
    _table_ids = [0x01]

    table_id = uimsbf(8)
    section_syntax_indicator = bslbf(1)
    reserved_future_use = bslbf(1)
    reserved_1 = bslbf(2)
    section_length = uimsbf(12)
    reserved_2 = bslbf(18)
    version_number = uimsbf(5)
    current_next_indicator = bslbf(1)
    section_number = uimsbf(8)
    last_section_number = uimsbf(8)
    descriptors = descriptors(lambda self: self.section_length - 9)
    CRC_32 = rpchof(32)
Пример #11
0
    class groups(Syntax):
        group = bslbf(4)
        target_version = uimsbf(12)
        new_version = uimsbf(12)
        download_level = bslbf(2)
        version_indicator = bslbf(2)
        content_description_length = uimsbf(12)
        reserved = bslbf(4)
        schedule_description_length = uimsbf(12)
        schedule_timeshift_information = uimsbf(4)

        @loop(schedule_description_length)
        class schedules(Syntax):
            start_time = mjd(40)
            duration = bcdtime(24)

        descriptors = descriptors(lambda self:
                                  (self.content_description_length - self.
                                   schedule_description_length))
Пример #12
0
class IndexTransmissionSection(Section):
    """番組インデックス送出情報セクション ITT (ARIB-STD-B10-2-5.1.3)"""

    _table_ids = [0xD2]

    table_id = uimsbf(8)
    section_syntax_indicator = bslbf(1)
    reserved_future_use_1 = bslbf(1)
    reserved_1 = bslbf(2)
    section_length = uimsbf(12)
    event_id = uimsbf(16)
    reserved_2 = bslbf(2)
    version_number = uimsbf(5)
    current_next_indicator = bslbf(1)
    section_number = uimsbf(8)
    last_section_number = uimsbf(8)
    reserved_future_use_2 = uimsbf(4)
    descriptors_loop_length = uimsbf(12)
    descriptors = descriptors(descriptors_loop_length)
    CRC_32 = rpchof(32)
Пример #13
0
class ProgramMapSection(Section):
    """Program Map Section PMT (ISO 13818-1 2.4.4.8)"""

    _table_ids = [0x02]

    table_id = uimsbf(8)
    section_syntax_indicator = bslbf(1)
    reserved_future_use = bslbf(1)
    reserved_1 = bslbf(2)
    section_length = uimsbf(12)
    program_number = uimsbf(16)
    reserved_2 = bslbf(2)
    version_number = uimsbf(5)
    current_next_indicator = bslbf(1)
    section_number = uimsbf(8)
    last_section_number = uimsbf(8)
    reserved_3 = bslbf(3)
    PCR_PID = uimsbf(13)
    reserved_4 = bslbf(4)
    program_info_length = uimsbf(12)
    descriptors = descriptors(program_info_length)

    @loop(lambda self: self.section_length - (13 + self.program_info_length))
    class maps(Syntax):
        stream_type = uimsbf(8)
        reserved_1 = bslbf(3)
        elementary_PID = uimsbf(13)
        reserved_2 = bslbf(4)
        ES_info_length = uimsbf(12)
        descriptors = descriptors(ES_info_length)

    CRC_32 = rpchof(32)

    @property
    def caption_pid(self):
        """字幕データのあるPIDを返す。

        字幕データはStream_typeが0x06(private data)で
        ストリーム識別記述子のcomponent_tagが0x87であるもの。
        参考: http://linux.papa.to/?date=20081224#p01

        """
        for stream in self.maps:
            try:
                if stream.stream_type == 0x06 and\
                        stream.descriptors[StreamIdentifierDescriptor][0].component_tag == 0x87:
                    return stream.elementary_PID
            except KeyError:
                pass

    def video_pids(self):
        "動画パケットの PID を返すジェネレータ" ""

        video_types = (0x01, 0x02, 0x10)
        for stream in self.maps:
            if stream.stream_type in video_types:
                yield stream.elementary_PID

    def audio_pids(self):
        """音声パケットの PID を返すジェネレータ"""

        audio_types = (0x03, 0x04, 0x0F, 0x11)
        for stream in self.maps:
            if stream.stream_type in audio_types:
                yield stream.elementary_PID
Пример #14
0
 class links(Syntax):
     description_id = uimsbf(16)
     reserved_future_use = bslbf(12)
     descriptors_loop_length = uimsbf(12)
     descriptors = descriptors(descriptors_loop_length)
Пример #15
0
 class transport_streams(Syntax):
     transport_stream_id = uimsbf(16)
     original_network_id = uimsbf(16)
     reserved_future_use = bslbf(4)
     transport_descriptors_length = uimsbf(12)
     descriptors = descriptors(transport_descriptors_length)
Пример #16
0
 class broadcasters(Syntax):
     broadcaster_id = uimsbf(8)
     reserved_future_use = bslbf(4)
     broadcaster_descriptor_length = uimsbf(12)
     descriptors = descriptors(broadcaster_descriptor_length)
Пример #17
0
 class events(Syntax):
     local_event_id = uimsbf(16)
     reserved_fugure_use = bslbf(4)
     descriptors_loop_length = uimsbf(12)
     descriptors = descriptors(descriptors_loop_length)