MPLS file:
    4 bytes ID == "MPLS"
    4 bytes ver == "0100" || "0200"
    32-bit BE uint - play items table start
    32-bit BE uint - mark start
    32-bit BE uint - extension start

@offset play items table start
    32-bit BE uint - table size
    16-bit BE uint - unknown
    16-bit BE uint - n_play_items, number of play items
    16-bit BE uint - n_subpaths, number of sub-path entries
    Followed by n_play_items entries of Play Item
    Followed by n_subpaths entries of Sub-path Entry

Play Item:
    16-bit BE uint - item size (not including size bytes)
    5 bytes file ID - eg '00001'
    32-bit BE uint - file type "M2TS"
    11 bits - unknown
    1 bit - angles table flag - angles_flag
    4-bit - Connection
    8-bit - STC id
    32-bit BE uint - STC start
    32-bit BE uint - STC end

    64-bit BE uint - unknown
    1 bit - unknown
    7 bit - unknown
    8 bit uint - Still type
        0 = no still. 
        1 = limited still (of still time duration)
        2 = infinite still
    16 bit uint - still time when still_type == 2
    if angles_flag, followed by:
      8-bit uint - number of angles - n_angles
      6 bit - unknown
      1 bit - angle audio different
      1 bit - seamless angle change
      followed by n_angles entries of:
        5 bytes - angle ID
        32 bits BE uint - unknown
        8 bits - STC id
    Followed by STN table
    Possibly unknown bytes after?

STN table:
    16 bit BE uint - STN table size, stn_table_size (not including size bytes)
    16 bit BE uint - unknown
    8 bit - n_video, number of Video stream entries
    8 bit - n_audio, number of Audio stream entries
    8 bit - n_pg, number of Presentation Graphics stream entries
    8 bit - n_ig, number of Interactive Graphics stream entries
    8 bit - n_video_2, number of Video2 stream entries
    8 bit - n_audio_2, number of Audio2 stream entries
    8 bit - n_pip_pg, number of Picture-In-Picture Presentation Graphics streams
    Followed by n_video entries of Stream Entry
    Followed by n_audio entries of Stream Entry
    Followed by n_pg entries of Stream Entry
    Followed by n_ig entries of Stream Entry
    Followed by n_video2 entries of Stream Entry
    Followed by n_audio2 entries of Stream Entry
    Followed by n_pip_pg entries of Stream Entry

Stream Entry:
    8 bit - stream attribute offset (attr_offset)
    8 bit - stream type
    if stream_type == 0x1 (Play Item)
      16-bit BE uint - Stream PID
    elif stream_type == 0x2 (Sub Path)
      8-bit Sub Path ID
      8-bit Sub Clip ID
      16-bit BE uint - Stream PID
    elif stream_type == 0x3 (In Mux Sub Path)
      8-bit Sub Path ID
      16-bit BE uint - Stream PID
    /* Possibly unused bytes? */

    @ offset attr_offset:
    8 bit - attributes size
    8 bit - stream type
    if video stream type (0x02 (MPEG), 0x1b (AVC) or 0xea (VC-1)):
    elif audio stream type (0x80-0x8f, 0xa0-0xaf):
      4 bit - unknown
      4 bit - unknown
      3 byte lang code
    elif subpicture stream (0x90 (PG) or 0x91 (IG)):
      3 byte lang code
    elif text stream (0x92):
      1 byte charset
      3 byte lang code
    /* Possibly unknown bytes... */

Sub-path entry:
    32-bit BE uint - table size (not including size bytes)
    8 bit - unknown
    8 bit - sub-path type
    15 bit - unknown
    1 bit - repeat flag
    8 bit - unknown
    8 bit - n_items, number of sub-path items
    n_items Item entries of:
      unknown

@offset mark start:
    32-bit BE uint - table size
    16-bit BE uint - n_entries
    followed by n_entries of:
      8-bit unknown - size?
      8 bit - Mark type
      16-bit BE uint - Play Item ID
      32-bit BE uint - Time marker
      16-bit BE uint - Entry ES PID
      32-bit BE uint - unknown

@offset extension start:
    unknown
