Beispiel #1
0
QString MasterGuideTable::toStringXML(uint indent_level) const
{
    QString indent_0 = xml_indent(indent_level);
    QString indent_1 = xml_indent(indent_level + 1);
    QString indent_2 = xml_indent(indent_level + 2);

    QString str =
        QString("%1<MasterGuideSection table_count=\"%2\" "
                "global_descriptors_length=\"%3\"\n%4%5>\n")
        .arg(indent_0)
        .arg(TableCount())
        .arg(GlobalDescriptorsLength())
        .arg(indent_1)
        .arg(PSIPTable::XMLValues(indent_level + 1));

    vector<const unsigned char*> gdesc =
        MPEGDescriptor::Parse(GlobalDescriptors(), GlobalDescriptorsLength());
    for (uint i = 0; i < gdesc.size(); i++)
    {
        str += MPEGDescriptor(gdesc[i], 300)
            .toStringXML(indent_level + 1) + "\n";
    }

    if (_ptrs.size() < TableCount())
        LOG(VB_GENERAL, LOG_ERR, "MasterGuideTable::toStringXML(): Table count mismatch");

    for (uint i = 0; i < TableCount() && i < _ptrs.size(); i++)
    {
        str += QString(
            "%1<Table pid=\"0x%2\" version=\"%3\""
            "\n%4type=\"0x%5\" type_desc=\"%6\""
            "\n%7number_bytes=\"%8\" table_descriptors_length=\"%9\"")
            .arg(indent_1)
            .arg(TablePID(i),4,16,QChar('0'))
            .arg(TableVersion(i))
            .arg(indent_1)
            .arg(TableType(i),4,16,QChar('0'))
            .arg(TableClassString(i))
            .arg(indent_2)
            .arg(TableDescriptorsBytes(i))
            .arg(TableDescriptorsLength(i));

        vector<const unsigned char*> desc =
            MPEGDescriptor::Parse(
                TableDescriptors(i), TableDescriptorsLength(i));
        str += (desc.empty()) ? " />\n" : ">\n";
        for (uint i = 0; i < desc.size(); i++)
        {
            str += MPEGDescriptor(desc[i], 300)
                .toStringXML(indent_level + 2) + "\n";
        }

        if (!desc.empty())
            str += indent_1 + "</Table>\n";
    }

    return str + "</MasterGuideSection>";
}
Beispiel #2
0
void MasterGuideTable::Parse(void) const
{
    _ptrs.clear();
    _ptrs.push_back(const_cast<unsigned char*>(psipdata()) + 3);
    for (uint i = 0; i < TableCount(); i++)
        _ptrs.push_back(_ptrs[i] + 11 + TableDescriptorsLength(i));
}
Beispiel #3
0
int QTableManager::TableExist(QString name)
    {
        for (int i = 0 ;i<=TableCount()-1;i++){
                if (ProjectData->getTable(i)->GetCaption()==name)
                    return i;
            }
        return -1;
}
Beispiel #4
0
QString MasterGuideTable::toString(void) const
{
    QString str;
    str.append(QString("Master Guide Section\n%1"
                       "      table_count(%2)\n")
               .arg(PSIPTable::toString())
               .arg(TableCount()));

    if (_ptrs.size() < TableCount())
        LOG(VB_GENERAL, LOG_ERR, "MasterGuideTable::toString(): Table count mismatch");

    for (uint i = 0; i < TableCount() && i < _ptrs.size(); i++)
    {
        str.append(QString("  Table #%1 ").arg(i, 2, 10));
        str.append(QString("pid(0x%1) ver(%2) ")
                   .arg(TablePID(i), 0, 16).arg(TableVersion(i), 2, 10));
        str.append(QString("size(%1) desc_len(%2) type: %4 %3 \n")
                   .arg(TableDescriptorsBytes(i), 4, 10)
                   .arg(TableDescriptorsLength(i))
                   .arg(TableClassString(i)).arg(TableType(i)));
        if (0 != TableDescriptorsLength(i))
        {
            vector<const unsigned char*> desc =
                MPEGDescriptor::Parse(TableDescriptors(i),
                                      TableDescriptorsLength(i));
            for (uint i = 0; i < desc.size(); i++)
                str.append(QString("  %1\n")
                           .arg(MPEGDescriptor(desc[i]).toString()));
        }
    }
    if (0 != GlobalDescriptorsLength())
    {
        str.append(QString("  global descriptors length(%1) ")
                   .arg(GlobalDescriptorsLength()));
        vector<const unsigned char*> desc =
            MPEGDescriptor::Parse(GlobalDescriptors(),
                                  GlobalDescriptorsLength());
        str.append(QString("count: %1\n").arg(desc.size()));
        for (uint i = 0; i < desc.size(); i++)
        {
            str.append(QString("    %1\n")
                       .arg(MPEGDescriptor(desc[i]).toString()));
        }
    }
    return str;
}
Beispiel #5
0
int QTableManager::GetBTableByPoint(QPointF value, QgraphicsItemTable *obj)
{
    for (int i = 0;i<=TableCount()-1;i++){
            if ((obj!=getTable(i))&&(!getTable(i)->GetInternalRect().contains(value) && getTable(i)->boundingRect().contains(value) )){
                    return i;
                }
        }
    return -1;
}
Beispiel #6
0
void SBRefStrHashCleanup(SBServerList *slist)
{
    if (g_SBRefStrList != NULL && TableCount(g_SBRefStrList) == 0)
    {
        TableFree(g_SBRefStrList);
        g_SBRefStrList = NULL;
    }

    GSI_UNUSED(slist);
}
Beispiel #7
0
/*! \brief Creates a new SparablePartition object. */
SparablePartition::SparablePartition(uint16 number, uint32 start, uint32 length,
	uint16 packetLength, uint8 tableCount, uint32 *tableLocations)
	:
	fNumber(number),
	fStart(start),
	fLength(length),
	fPacketLength(packetLength),
	fTableCount(tableCount),
	fInitStatus(B_NO_INIT)
{
	TRACE(("SparablePartition::SparablePartition: number = %d, start = %"
		B_PRIu32 ",length = %" B_PRIu32 ", packetLength = %d\n", number, start,
		length, packetLength));

	status_t status = (0 < TableCount() && TableCount() <= kMaxSparingTableCount)
		? B_OK : B_BAD_VALUE;
	if (status != B_OK)
		return;

	for (uint8 i = 0; i < TableCount(); i++)
		fTableLocations[i] = tableLocations[i];
	fInitStatus = B_OK;	
}
Beispiel #8
0
QString MasterGuideTable::toString(void) const
{
    QString str;
    str.append(QString("MGT: tables(%1)\n").arg(TableCount()));
    for (uint i = 0; i < TableCount(); i++)
    {
        str.append(QString("Table #%1 ").arg(i, 2, 10));
        str.append(QString("pid(0x%1) ver(%2) ")
                   .arg(TablePID(i), 0, 16).arg(TableVersion(i), 2, 10));
        str.append(QString("size(%1) desc_len(%2) type: %4 %3 \n")
                   .arg(TableDescriptorsBytes(i), 4, 10)
                   .arg(TableDescriptorsLength(i))
                   .arg(TableClassString(i)).arg(TableType(i)));
        if (0 != TableDescriptorsLength(i))
        {
            vector<const unsigned char*> desc =
                MPEGDescriptor::Parse(TableDescriptors(i),
                                      TableDescriptorsLength(i));
            for (uint i = 0; i < desc.size(); i++)
                str.append(QString("  %1\n")
                           .arg(MPEGDescriptor(desc[i]).toString()));
        }
    }
    if (0 != GlobalDescriptorsLength())
    {
        str.append(QString("Global descriptors length: %1\n")
                   .arg(GlobalDescriptorsLength()));
        vector<const unsigned char*> desc =
            MPEGDescriptor::Parse(GlobalDescriptors(),
                                  GlobalDescriptorsLength());
        for (uint i = 0; i < desc.size(); i++)
            str.append(QString(" %1\n")
                       .arg(MPEGDescriptor(desc[i]).toString()));
    }
    return str;
}
Beispiel #9
0
// Returns a player to ping, or NULL if there's noone to ping.
//////////////////////////////////////////////////////////////
static piPlayer * piPickXpingPlayer
(
	PEER peer
)
{
	piPickXpingPlayerData data;
	PEER_CONNECTION;

	// Check for no players.
	////////////////////////
	if(!connection->players || !TableCount(connection->players))
		return NULL;

	// Find someone near the top of the list.
	/////////////////////////////////////////
	data.peer = peer;
	data.player = NULL;
	TableMap(connection->players, piPickXpingPlayerMap, &data);

	return data.player;
}
Beispiel #10
0
static void piKeyCacheRefresh
(
	PEER peer,
	RoomType roomType,
	const char * nick
)
{
	int num;
	piSetupKeysMapData data;
	PEERBool getIP;
	PEERBool getFlags;
	piWatchKey watchKey;

	PEER_CONNECTION;

	assert(IN_ROOM || ENTERING_ROOM);
	if(!IN_ROOM && !ENTERING_ROOM)
		return;

	// Get the IP if we're pinging this room.
	/////////////////////////////////////////
	if(!nick)
		getIP = (connection->pingRoom[roomType] || connection->alwaysRequestPlayerInfo)?PEERTrue:PEERFalse;
	else
		getIP = PEERFalse;

	// Check if we're already getting the IP.
	/////////////////////////////////////////
	if(getIP)
	{
		watchKey.key = "username";
		getIP = (PEERBool)(!TableLookup(connection->roomWatchKeys[roomType], &watchKey));
	}

	// Don't get flags on a player - he just joined, and will set them.
	///////////////////////////////////////////////////////////////////
	getFlags = (PEERBool)(nick == NULL);

	// Check for a b_flags watch key.
	/////////////////////////////////
	if(getFlags)
	{
		watchKey.key = "b_flags";
		getFlags = (PEERBool)(!(TableLookup(connection->globalWatchKeys[roomType], &watchKey) ||
			TableLookup(connection->roomWatchKeys[roomType], &watchKey)));
	}

	data.next = 0;
	num = TableCount(connection->globalWatchKeys[roomType]);
	if(num)
	{
		data.keys = (char **)gsimalloc(sizeof(char *) * num);
		if(!data.keys)
			return;
		TableMap(connection->globalWatchKeys[roomType], piSetupKeysMap, &data);
		assert(data.next == num);
		chatGetGlobalKeysA(connection->chat, nick?nick:ROOM, num, (const char **)data.keys, piGetGlobalKeysCallback, peer, CHATFalse);
		gsifree(data.keys);
	}

	if(!nick)
	{
		data.next = 0;
		num = TableCount(connection->roomWatchKeys[roomType]);
		if(getIP)
			num++;
		if(getFlags)
			num++;
		if(num)
		{
			data.keys = (char **)gsimalloc(sizeof(char *) * num);
			if(!data.keys)
				return;
			TableMap(connection->roomWatchKeys[roomType], piSetupKeysMap, &data);
			if(getIP)
				data.keys[data.next++] = "username";
			if(getFlags)
				data.keys[data.next++] = "b_flags";
			assert(data.next == num);
			chatGetChannelKeysA(connection->chat, ROOM, nick?nick:"*", num, (const char **)data.keys, piGetRoomKeysCallback, peer, CHATFalse);
			gsifree(data.keys);
		}
	}
}