コード例 #1
0
bool CetonStreamHandler::TuneProgram(uint program)
{
    LOG(VB_RECORD, LOG_INFO, LOC + QString("TuneProgram(%1)").arg(program));

    QStringList program_list = GetProgramList();
    if (!program_list.contains(QString::number(program)))
    {
        LOG(VB_RECORD, LOG_ERR, LOC + 
        QString("TuneProgram(%1) - Requested program not in the program list").arg(program));
        return false;
    };


    _last_program = program;

    QUrl params;
    params.addQueryItem("instance_id", QString::number(_tuner));
    params.addQueryItem("program", QString::number(program));

    QString response;
    uint status;
    bool result = HttpRequest(
        "POST", "/program_request.cgi", params, response, status);

    if (!result)
    {
        LOG(VB_RECORD, LOG_ERR, LOC +
            QString("TuneProgram() - HTTP status = %1 - response = %2")
            .arg(status).arg(response));
    }

    return result;
}
コード例 #2
0
/*************************************************************************
 * Function Name : GetSectionPat
 * Description   : get one PAT section from a byte array
 * Parameters    :
 * Returns       :
 **************************************************************************/
static SECTION_PAT *GetSectionPat(unsigned char *pucBuffer)
{
	SECTION_PAT *pstSectionPat = (SECTION_PAT *)malloc(sizeof(SECTION_PAT));
	pstSectionPat->table_id = pucBuffer[0];
	pstSectionPat->section_syntax_indicator = (pucBuffer[1] >> 7) & 0x01;
	pstSectionPat->reserved_future_use = (pucBuffer[1] >> 6) & 0x1;
	pstSectionPat->reserved1 = (pucBuffer[1] >> 4) & 0x3;
	pstSectionPat->section_length = ((pucBuffer[1] & 0x0F) << 8) | pucBuffer[2];
	pstSectionPat->transport_stream_id = (pucBuffer[3] << 8) | pucBuffer[4];
	pstSectionPat->reserved2 = (pucBuffer[5] >> 6) & 0x03;
	pstSectionPat->version_number = (pucBuffer[5] >> 1) & 0x1F;
	pstSectionPat->current_next_indicator = pucBuffer[5] & 0x01;
	pstSectionPat->section_number = pucBuffer[6];
	pstSectionPat->last_section_number = pucBuffer[7];
	pstSectionPat->pstPrograms = GetProgramList(pucBuffer + 8, pstSectionPat->section_length - 5 - 4);
	pstSectionPat->pstNext = NULL;
	return pstSectionPat;
}