Ejemplo n.º 1
0
Archivo: t35.c Proyecto: vir/spandsp
SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model)
{
    const nsf_data_t *p;
    const model_data_t *pp;

    if (country)
        *country = t35_real_country_code_to_str(msg[0], msg[1]);
    if (vendor)
        *vendor = NULL;
    if (model)
        *model = NULL;

    if ((p = find_vendor(msg, len)) == NULL)
        return false;
    if (vendor)
        *vendor = p->vendor_name;
    if (model  &&  p->known_models)
    {
        for (pp = p->known_models;  pp->model_id;  pp++)
        {
            if (len == 1 + p->vendor_id_len + pp->model_id_size
                &&
                memcmp(&msg[1 + p->vendor_id_len], pp->model_id, pp->model_id_size) == 0)
            {
                *model = pp->model_name;
                break;
            }
        }
    }
    return true;
}
Ejemplo n.º 2
0
Archivo: t35.c Proyecto: vir/spandsp
SPAN_DECLARE(const char *) t35_vendor_to_str(const uint8_t *msg, int len)
{
    const nsf_data_t *p;

    if ((p = find_vendor(msg, len)) == NULL)
        return NULL;
    return p->vendor_name;
}
Ejemplo n.º 3
0
char *
make_display_name (const MonitorInfo *info)
{
    const char *vendor;
    int width_mm, height_mm;
    char *inches, *ret;

    if (info)
    {
	vendor = find_vendor (info->manufacturer_code);
    }
    else
    {
        /* Translators: "Unknown" here is used to identify a monitor for which
         * we don't know the vendor. When a vendor is known, the name of the
         * vendor is used. */
	vendor = C_("Monitor vendor", "Unknown");
    }

    if (info && info->width_mm != -1 && info->height_mm)
    {
	width_mm = info->width_mm;
	height_mm = info->height_mm;
    }
    else if (info && info->n_detailed_timings)
    {
	width_mm = info->detailed_timings[0].width_mm;
	height_mm = info->detailed_timings[0].height_mm;
    }
    else
    {
	width_mm = -1;
	height_mm = -1;
    }
    
    if (width_mm != -1 && height_mm != -1)
    {
	double d = sqrt (width_mm * width_mm + height_mm * height_mm);

	inches = diagonal_to_str (d / 25.4);
    }
    else
    {
	inches = NULL;
    }

    if (!inches)
	return g_strdup (vendor);

    ret = g_strdup_printf ("%s %s", vendor, inches);
    g_free (inches);

    return ret;
}