/* Extracts stream types from a program stream map According to ISO/IEC 13818-1 ('MPEG-2 Systems') table 2-35 */
static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb)
/* Extracts stream types from a program stream map According to ISO/IEC 13818-1 ('MPEG-2 Systems') table 2-35 */
static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb)
{
    int psm_length, ps_info_length, es_map_length;
    psm_length = get_be16(pb);
    get_byte(pb);
    get_byte(pb);
    ps_info_length = get_be16(pb);
    url_fskip(pb, ps_info_length);
    es_map_length = get_be16(pb);
    while (es_map_length >= 4){
        unsigned char type      = get_byte(pb);
        unsigned char es_id     = get_byte(pb);
        uint16_t es_info_length = get_be16(pb);
        m->psm_es_type[es_id] = type;
        url_fskip(pb, es_info_length);
        es_map_length -= 4 + es_info_length;
    }
    get_be32(pb);
    return 2 + psm_length;
}