Esempio n. 1
0
const char_t* TinfoDecVideo::TinfoValueDecVideo::getInputAspect(char_t *s, bool &wasChange, size_t buflen)
{
    unsigned int sar1 = 0, sar2 = 0, dar1 = 0, dar2 = 0;
    bool sarOk = deciV->getInputSAR(&sar1, &sar2) == S_OK;
    bool darOk = deciV->getInputDAR(&dar1, &dar2) == S_OK;
    if (oldSar1 != sar1 || oldSar2 != sar2 || oldDar1 != dar1 || oldDar2 != dar2) {
        if (sarOk) {
            tsprintf(s, _l("SAR: %u/%u, "), sar1, sar2);
        } else {
            tsprintf(s, _l("SAR: N/A, "));
        }

        if (darOk) {
            strncatf(s, buflen, _l("DAR: %u/%u"), dar1, dar2);
        } else {
            strncatf(s, buflen, _l("DAR: N/A"));
        }
        wasChange = true;
    }
    oldSar1 = sar1;
    oldSar2 = sar2;
    oldDar1 = dar1;
    oldDar2 = dar2;
    return s;
}
Esempio n. 2
0
void TdecoderOptionsPage::getTip(char_t *tipS, size_t len)
{
    tsnprintf_s(tipS, len, _TRUNCATE, _l("IDCT: %s"), Tlibavcodec::idctNames[cfgGet(IDFF_idct)]);
    int bugs = cfgGet(IDFF_workaroundBugs);
    if (bugs && bugs != FF_BUG_AUTODETECT) {
        strncatf(tipS, len, _l("\nBugs workaround"));
    }
}
Esempio n. 3
0
bool TlevelsSettings::getTip(unsigned int pageId, char_t *tipS, size_t len)
{
    tsnprintf_s(tipS, len, _TRUNCATE, _l("%s\nInput min: %i, input max: %i, output min:%i, output max:%i\nGamma correction: %5.2f"), modes[mode], inMin, inMax, outMin, outMax, gamma / 100.0f);
    if (posterize != 255) {
        strncatf(tipS, len, _l("\nPosterizing to %i levels"), posterize);
    }
    return true;
}
Esempio n. 4
0
bool TeqSettings::getTip(unsigned int pageId, char_t *tipS, size_t len)
{
    char_t tip[200] = _l("");
    for (int i = 0; i < 10; i++) {
        strncatf(tip, countof(tip), _l("%.2f, "), ((highdb - lowdb) * (&eq0)[i] / 200 + lowdb) / 100.0f);
    }
    *strrchr(tip, ',') = '\0';
    tsnprintf_s(tipS, len, _TRUNCATE, _l("%s%s"), tip, super ? _l("\nSuperEQ") : _l(""));
    tipS[len - 1] = '\0';
    return true;
}
Esempio n. 5
0
bool TsubtitlesSettings::getTip(unsigned int pageId, char_t *buf, size_t len)
{
    if (pageId == 1) {
        char_t tipS[256];
        char_t horiz[256], vert[256];
        getPosHoriz(posX, horiz, NULL, 0, countof(horiz));
        getPosVert(posY, vert, NULL, 0, countof(vert));
        tsnprintf_s(tipS, countof(tipS), _TRUNCATE, _l("%s, %s"), horiz, vert);
        if (delay != delayDef) {
            strncatf(tipS, countof(tipS), _l("\nDelay: %i ms"), delay);
        }
        if (speed != speedDef || speed2 != speedDef) {
            strncatf(tipS, countof(tipS), _l("\nSpeed: %i/%i"), speed, speed2);
        }
        ff_strncpy(buf, tipS, len);
        buf[len - 1] = '\0';
    } else if (pageId == 2) {
        font.getTip(buf, len);
    }
    return true;
}
Esempio n. 6
0
void TOSDpageDec::lv2osdFormat(void)
{
    char_t format[1024] = _l("");
    int cnt = ListView_GetItemCount(hlv);
    for (int i = 0; i < cnt; i++)
        if (ListView_GetCheckState(hlv, i)) {
            strncatf(format, countof(format), _l("%i "), lvGetItemParam(IDC_LV_OSD_LINES, i));
        }
    if (format[strlen(format) - 1] == ' ') {
        format[strlen(format) - 1] = '\0';
    }
    cfgSet(IDFF_OSDformat, format);
    parent->setChange();
}
Esempio n. 7
0
void TlevelsPage::levels2dlg(void)
{
    setCheck(IDC_CHB_LEVELS_ONLYLUMA,cfgGet(IDFF_levelsOnlyLuma));
    int x=cfgGet(IDFF_levelsGamma);
    tbrSet(IDC_TBR_LEVELS_GAMMA,x);
    char_t pomS[256];
    tsnprintf_s(pomS, countof(pomS), _TRUNCATE, _l("%s %3.2f"), _(IDC_LBL_LEVELS_GAMMA), float(x/100.0));
    if (x==100) {
        strncatf(pomS, countof(pomS), _l(" (%s)"),_(IDC_LBL_LEVELS_GAMMA,_l("off")));
    }
    setDlgItemText(m_hwnd,IDC_LBL_LEVELS_GAMMA,pomS);
    tbrSet(IDC_TBR_LEVELS_POSTERIZE,cfgGet(IDFF_levelsPosterize),IDC_LBL_LEVELS_POSTERIZE);
    SetDlgItemInt(m_hwnd,IDC_ED_Y_MAX_DELTA ,deci->getParam2(IDFF_levelsYmaxDelta ),FALSE);
    SetDlgItemInt(m_hwnd,IDC_ED_Y_THRESHOLD ,deci->getParam2(IDFF_levelsYthreshold ),FALSE);
    SetDlgItemInt(m_hwnd,IDC_ED_Y_TEMPORAL ,deci->getParam2(IDFF_levelsYtemporal ),FALSE);
    mode2dlg();
}
Esempio n. 8
0
void TresizeAspectPage::aspect2dlg(void)
{
    int ra = cfgGet(IDFF_isAspect);
    setCheck(IDC_RBT_ASPECT_NO  , ra == 0);
    setCheck(IDC_RBT_ASPECT_KEEP, ra == 1);
    setCheck(IDC_RBT_ASPECT_USER, ra == 2);
    char_t pomS[256];
    unsigned int a1, a2;
    if (deciV->getInputDAR(&a1, &a2) == S_OK) {
        setText(IDC_RBT_ASPECT_KEEP, _l("%s %3.2f:1"), _(IDC_RBT_ASPECT_KEEP), float(a1) / a2);
    }
    int aspectI = cfgGet(IDFF_hwOverlayAspect);
    tbrSet(IDC_TBR_HWOVERLAY_ASPECT, aspectI / 256);
    tsnprintf_s(pomS, countof(pomS), _TRUNCATE, _l("%s "), _(IDC_LBL_HWOVERLAY_ASPECT));
    if (aspectI == 0) {
        strncat_s(pomS, countof(pomS), _(IDC_LBL_HWOVERLAY_ASPECT, _l("default")), _TRUNCATE);
    } else {
        strncatf(pomS, countof(pomS), _l("%3.2f:1"), float(aspectI / 65536.0));
    }
    setDlgItemText(m_hwnd, IDC_LBL_HWOVERLAY_ASPECT, pomS);
}
Esempio n. 9
0
void pktgen_config_ports(void)
{
    uint32_t lid, pid, i, s, q, sid;
    rxtx_t	rt;
    pkt_seq_t   * pkt;
    port_info_t     * info;
    char buff[RTE_MEMZONE_NAMESIZE];
    int32_t ret, cache_size;
	char output_buff[256] = { 0 };

    // Find out the total number of ports in the system.
    // We have already blacklisted the ones we needed to in main routine.
    pktgen.nb_ports = rte_eth_dev_count();
    if (pktgen.nb_ports > RTE_MAX_ETHPORTS)
        pktgen.nb_ports = RTE_MAX_ETHPORTS;

    if ( pktgen.nb_ports == 0 )
		pktgen_log_panic("*** Did not find any ports to use ***");

    pktgen.starting_port = 0;

    // Setup the number of ports to display at a time
	if ( pktgen.nb_ports > pktgen.nb_ports_per_page )
		pktgen.ending_port = pktgen.starting_port + pktgen.nb_ports_per_page;
	else
		pktgen.ending_port = pktgen.starting_port + pktgen.nb_ports;

    wr_port_matrix_dump(pktgen.l2p);

    pktgen_log_info("Configuring %d ports, MBUF Size %d, MBUF Cache Size %d",
    		pktgen.nb_ports, MBUF_SIZE, MBUF_CACHE_SIZE);

    // For each lcore setup each port that is handled by that lcore.
    for(lid = 0; lid < RTE_MAX_LCORE; lid++) {

        if ( wr_get_map(pktgen.l2p, RTE_MAX_ETHPORTS, lid) == 0 )
            continue;

		// For each port attached or handled by the lcore
        for(pid = 0; pid < pktgen.nb_ports; pid++) {

        	// If non-zero then this port is handled by this lcore.
            if ( wr_get_map(pktgen.l2p, pid, lid) == 0 )
                continue;
        	wr_set_port_private(pktgen.l2p, pid, &pktgen.info[pid]);
        	pktgen.info[pid].pid = pid;
        }
    }
    wr_dump_l2p(pktgen.l2p);

    pktgen.total_mem_used = 0;

    for(pid = 0; pid < pktgen.nb_ports; pid++) {
    	// Skip if we do not have any lcores attached to a port.
    	if ( (rt.rxtx = wr_get_map(pktgen.l2p, pid, RTE_MAX_LCORE)) == 0 )
            continue;

		pktgen.port_cnt++;
		snprintf(output_buff, sizeof(output_buff),
				"Initialize Port %d -- TxQ %d, RxQ %d", pid, rt.tx, rt.rx);

        info = wr_get_port_private(pktgen.l2p, pid);

		// Create the pkt header structures for transmitting sequence of packets.
		snprintf(buff, sizeof(buff), "seq_hdr_%d", pid);
		info->seq_pkt = (pkt_seq_t *)rte_zmalloc(buff, (sizeof(pkt_seq_t) * NUM_TOTAL_PKTS), RTE_CACHE_LINE_SIZE);
		if ( info->seq_pkt == NULL )
			pktgen_log_panic("Unable to allocate %d pkt_seq_t headers", NUM_TOTAL_PKTS);

		info->seqIdx    = 0;
		info->seqCnt    = 0;

		info->nb_mbufs  = MAX_MBUFS_PER_PORT;
		cache_size = (info->nb_mbufs > RTE_MEMPOOL_CACHE_MAX_SIZE)?
							RTE_MEMPOOL_CACHE_MAX_SIZE : info->nb_mbufs;

		pktgen_port_conf_setup(pid, &rt, &default_port_conf);

		if ( (ret = rte_eth_dev_configure(pid, rt.rx, rt.tx, &info->port_conf)) < 0)
			pktgen_log_panic("Cannot configure device: port=%d, Num queues %d,%d (%d)%s",
					pid, rt.rx, rt.tx, errno, rte_strerror(-ret));

		pkt = &info->seq_pkt[SINGLE_PKT];

		// Grab the source MAC addresses */
		rte_eth_macaddr_get(pid, &pkt->eth_src_addr);
		pktgen_log_info("%s,  Src MAC %02x:%02x:%02x:%02x:%02x:%02x", output_buff,
				pkt->eth_src_addr.addr_bytes[0],
				pkt->eth_src_addr.addr_bytes[1],
				pkt->eth_src_addr.addr_bytes[2],
				pkt->eth_src_addr.addr_bytes[3],
				pkt->eth_src_addr.addr_bytes[4],
				pkt->eth_src_addr.addr_bytes[5]);

		// Copy the first Src MAC address in SINGLE_PKT to the rest of the sequence packets.
		for (i = 0; i < NUM_SEQ_PKTS; i++)
			ethAddrCopy( &info->seq_pkt[i].eth_src_addr, &pkt->eth_src_addr );

		pktgen.mem_used = 0;

		for(q = 0; q < rt.rx; q++) {
			// grab the socket id value based on the lcore being used.
			sid		= rte_lcore_to_socket_id(wr_get_port_lid(pktgen.l2p, pid, q));

			// Create and initialize the default Receive buffers.
			info->q[q].rx_mp = pktgen_mbuf_pool_create("Default RX", pid, q, info->nb_mbufs, sid, cache_size);
			if ( info->q[q].rx_mp == NULL )
				pktgen_log_panic("Cannot init port %d for Default RX mbufs", pid);

			ret = rte_eth_rx_queue_setup(pid, q, pktgen.nb_rxd, sid, &info->rx_conf, pktgen.info[pid].q[q].rx_mp);
			if (ret < 0)
				pktgen_log_panic("rte_eth_rx_queue_setup: err=%d, port=%d, %s", ret, pid, rte_strerror(-ret));
		}
		pktgen_log_info("");

		for(q = 0; q < rt.tx; q++) {
			// grab the socket id value based on the lcore being used.
			sid		= rte_lcore_to_socket_id(wr_get_port_lid(pktgen.l2p, pid, q));

			// Create and initialize the default Transmit buffers.
			info->q[q].tx_mp = pktgen_mbuf_pool_create("Default TX", pid, q, MAX_MBUFS_PER_PORT, sid, cache_size);
			if ( info->q[q].tx_mp == NULL )
				pktgen_log_panic("Cannot init port %d for Default TX mbufs", pid);

			// Create and initialize the range Transmit buffers.
			info->q[q].range_mp = pktgen_mbuf_pool_create("Range TX", pid, q, MAX_MBUFS_PER_PORT,	sid, 0);
			if ( info->q[q].range_mp == NULL )
				pktgen_log_panic("Cannot init port %d for Range TX mbufs", pid);

			// Create and initialize the sequence Transmit buffers.
			info->q[q].seq_mp = pktgen_mbuf_pool_create("Sequence TX", pid, q, MAX_MBUFS_PER_PORT, sid, cache_size);
			if ( info->q[q].seq_mp == NULL )
				pktgen_log_panic("Cannot init port %d for Sequence TX mbufs", pid);

			// Used for sending special packets like ARP requests
			info->q[q].special_mp = pktgen_mbuf_pool_create("Special TX", pid, q, MAX_SPECIAL_MBUFS, sid, cache_size);
			if (info->q[q].special_mp == NULL)
				pktgen_log_panic("Cannot init port %d for Special TX mbufs", pid);

			// Setup the PCAP file for each port
			if ( pktgen.info[pid].pcap != NULL ) {
				if ( pktgen_pcap_parse(pktgen.info[pid].pcap, info, q) == -1 )
					pktgen_log_panic("Cannot load PCAP file for port %d", pid);
			}
			// Find out the link speed to program the WTHRESH value correctly.
			pktgen_get_link_status(info, pid, 0);

			//info->tx_conf.tx_thresh.wthresh = (info->link.link_speed == 1000)? TX_WTHRESH_1GB : TX_WTHRESH;

			ret = rte_eth_tx_queue_setup(pid, q, pktgen.nb_txd, sid, &info->tx_conf);
			if (ret < 0)
				pktgen_log_panic("rte_eth_tx_queue_setup: err=%d, port=%d, %s", ret, pid, rte_strerror(-ret));
#if 0
			ret = rte_eth_dev_flow_ctrl_set(pid, &fc_conf);
			if (ret < 0)
				pktgen_log_panic("rte_eth_dev_flow_ctrl_set: err=%d, port=%d, %s", ret, pid, rte_strerror(-ret));
#endif
			pktgen_log_info("");
		}
		pktgen_log_info("%*sPort memory used = %6lu KB", 71, " ", (pktgen.mem_used + 1023)/1024);
	}
    pktgen_log_info("%*sTotal memory used = %6lu KB", 70, " ", (pktgen.total_mem_used + 1023)/1024);

    // Start up the ports and display the port Link status
    for(pid = 0; pid < pktgen.nb_ports; pid++) {
        if ( wr_get_map(pktgen.l2p, pid, RTE_MAX_LCORE) == 0 )
            continue;

        info = wr_get_port_private(pktgen.l2p, pid);

        /* Start device */
        if ( (ret = rte_eth_dev_start(pid)) < 0 )
            pktgen_log_panic("rte_eth_dev_start: port=%d, %s", pid, rte_strerror(-ret));

        pktgen_get_link_status(info, pid, 1);

        if (info->link.link_status) {
            snprintf(output_buff, sizeof(output_buff), "Port %2d: Link Up - speed %u Mbps - %s", pid,
                   (uint32_t) info->link.link_speed,
                   (info->link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
                   ("full-duplex") : ("half-duplex"));
        } else
            snprintf(output_buff, sizeof(output_buff), "Port %2d: Link Down", pid);


        // If enabled, put device in promiscuous mode.
        if (pktgen.flags & PROMISCUOUS_ON_FLAG) {
			strncatf(output_buff, " <Enable promiscuous mode>");
            rte_eth_promiscuous_enable(pid);
        }

		pktgen_log_info("%s", output_buff);
    	pktgen.info[pid].seq_pkt[SINGLE_PKT].pktSize = MIN_PKT_SIZE;

        // Setup the port and packet defaults. (must be after link speed is found)
        for (s = 0; s < NUM_TOTAL_PKTS; s++)
            pktgen_port_defaults(pid, s);

        pktgen_range_setup(info);

		pktgen_rnd_bits_init(&pktgen.info[pid].rnd_bitfields);
    }
	pktgen_log_info("");

	for (sid = 0; sid < wr_coremap_cnt(pktgen.core_info, pktgen.core_cnt, 0); sid++)
		pktgen_packet_capture_init(&pktgen.capture[sid], sid);
}
Esempio n. 10
0
void
pktgen_print_packet_dump(void)
{
	port_info_t *info;

	unsigned int pid;
	unsigned int i, j;
	unsigned char *pdata;
	uint32_t plen;
	char buff[4096];

	for (pid = 0; pid < RTE_MAX_ETHPORTS; pid++) {
		if (wr_get_map(pktgen.l2p, pid, RTE_MAX_LCORE) == 0)
			continue;

		info = &pktgen.info[pid];
		for (; info->dump_head < info->dump_tail; ++info->dump_head) {
			pdata =
			        (unsigned char *)info->dump_list[info->
			                                         dump_head
			        ].data;
			plen = info->dump_list[info->dump_head].len;

			snprintf(buff, sizeof(buff),
			         "Port %d, packet with length %d:", pid, plen);

			for (i = 0; i < plen; i += 16) {
				strncatf(buff, "\n\t");

				/* Byte counter */
				strncatf(buff, "%06x: ", i);

				for (j = 0; j < 16; ++j) {
					/* Hex. value of character */
					if (i + j < plen)
						strncatf(buff, "%02x ",
						         pdata[i + j]);
					else
						strncatf(buff, "   ");

					/* Extra padding after 8 hex values for readability */
					if ((j + 1) % 8 == 0)
						strncatf(buff, " ");
				}

				/* Separate hex. values and raw characters */
				strncatf(buff, "\t");

				for (j = 0; j < 16; ++j)
					if (i + j < plen)
						strncatf(buff, "%c",
						         isprint(pdata[i +
						                       j]) ?
						         pdata[
						                 i + j] : '.');
			}
			pktgen_log_info("%s", buff);

			rte_free(info->dump_list[info->dump_head].data);
			info->dump_list[info->dump_head].data = NULL;
		}
	}
}
Esempio n. 11
0
void ToutsfsPage::getTip(char_t *tipS, size_t len)
{
    if (cfgGet(IDFF_videoDelay)) {
        strncatf(tipS, len, _l("\nAudio delay: %i msec"), cfgGet(IDFF_audio_decoder_delay));
    }
}