Esempio n. 1
0
void arm(int power, int time){
	timeConvert(time);
	motor[leftTopArm] = power;
	motor[leftBottomArm] = power;
	motor[rightTopArm] = power;
	motor[rightBottomArm] = power;
	wait1Msec(timeMS);
}
Esempio n. 2
0
void turnRight(int power, int time){
	timeConvert(time);
	motor[rightFrontMotor] = power;
	motor[rightBackMotor] = power;
	motor[leftFrontMotor] = power;
	motor[leftBackMotor] = power;
	wait1Msec(timeMS);
}
Esempio n. 3
0
/**
    \fn getPacket
*/
bool      ADM_tsAccess::getPacket(uint8_t *buffer, uint32_t *size, uint32_t maxSize,uint64_t *dts)
{
uint64_t p,d,start;
    // If it is adts, ask ffmpeg to unwrap it...
    switch(muxing)
    {
        case ADM_TS_MUX_ADTS:
            {
                    bool r=false;
                    int outsize=0;
                    *size=0;
                    bool gotPacket=false;
                    int insize=0;
                    uint8_t *ptr=NULL;
                    while(1)
                    {
                        // Manage several packet in packet
                        if(ADM_adts2aac::ADTS_OK==adts.convert2(insize,ptr,&outsize,buffer))
                        {
                            *size=outsize;
                            if(gotPacket)
                                *dts=timeConvert(packet->pts);
                            else
                                *dts=ADM_NO_PTS;
                            return true;
                        }
                        if(false==demuxer.getNextPES(packet)) return false;
                        int avail=packet->payloadSize-packet->offset;
                        if(avail>maxSize) ADM_assert(0);
                        insize=avail;
                        ptr=packet->payload+packet->offset;
                        gotPacket=true;
                    }
                    break;
            }
        case ADM_TS_MUX_NONE:
            {
                if(false==demuxer.getNextPES(packet)) return false;
                int avail=packet->payloadSize-packet->offset;
                if(avail>maxSize) ADM_assert(0);
                *size=avail;
                memcpy(buffer,packet->payload+packet->offset,avail);
                *dts=timeConvert(packet->pts);
                break;
            }
        case ADM_TS_MUX_LATM:
            {
                // Try to get one...
                int retries=10;
                again:
                if(latm.empty()==true) // fetch next LOAS frame, it will contain several frames
                {
                    if(!retries)
                    {
                        ADM_error("Cannot get AAC packet from LATM\n");
                        return false;
                    }
                    if(false==demuxer.getNextPES(packet)) return false;
                    int avail=packet->payloadSize-packet->offset;
                    if(avail>maxSize) ADM_assert(0);
                    latm.pushData(avail,packet->payload+packet->offset,packet->pts);
                    retries--;
                    goto again;
                 }
                 uint64_t myPts;
                 latm.getData(&myPts,size,buffer,maxSize);
                 *dts=timeConvert(myPts);
                 break;
            }
        default:
            ADM_assert(0);
     }
    if(*dts!=ADM_NO_PTS) 
    {
        aprintf("[psAudio] getPacket dts = %" PRIu32" ms\n",(uint32_t)*dts/1000);
    }
    return true;
}