void cDvbDevice::SetAudioTrackDevice(eTrackType Type)
{
  const tTrackId *TrackId = GetTrack(Type);
  if (TrackId && TrackId->id) {
     SetAudioBypass(false);
     if (IS_AUDIO_TRACK(Type) || (IS_DOLBY_TRACK(Type) && SetAudioBypass(true))) {
        if (pidHandles[ptAudio].pid && pidHandles[ptAudio].pid != TrackId->id) {
           DetachAll(pidHandles[ptAudio].pid);
           if (ciHandler)
              ciHandler->SetPid(pidHandles[ptAudio].pid, false);
           pidHandles[ptAudio].pid = TrackId->id;
           SetPid(&pidHandles[ptAudio], ptAudio, true);
           if (ciHandler) {
              ciHandler->SetPid(pidHandles[ptAudio].pid, true);
              ciHandler->StartDecrypting();
              }
           }
        }
     else if (IS_DOLBY_TRACK(Type)) {
        if (setTransferModeForDolbyDigital == 0)
           return;
        // Currently this works only in Transfer Mode
        ForceTransferMode();
        }
     }
}
Exemple #2
0
void cDvbHdFfDevice::SetAudioTrackDevice(eTrackType Type)
{
    //printf("SetAudioTrackDevice %d\n", Type);
    const tTrackId *TrackId = GetTrack(Type);
    if (TrackId && TrackId->id) {
        int streamType = 0;
        cChannel * channel = Channels.GetByNumber(CurrentChannel());
        if (channel) {
            if (IS_AUDIO_TRACK(Type))
                streamType = channel->Atype(Type - ttAudioFirst);
            else if (IS_DOLBY_TRACK(Type))
                streamType = channel->Dtype(Type - ttDolbyFirst);
        }
        //printf("SetAudioTrackDevice new %d %d, current %d\n", TrackId->id, streamType, pidHandles[ptAudio].pid);
        if (pidHandles[ptAudio].pid && pidHandles[ptAudio].pid != TrackId->id) {
            DetachAll(pidHandles[ptAudio].pid);
            if (CamSlot())
                CamSlot()->SetPid(pidHandles[ptAudio].pid, false);
            pidHandles[ptAudio].pid = TrackId->id;
            pidHandles[ptAudio].streamType = streamType;
            SetPid(&pidHandles[ptAudio], ptAudio, true);
            if (CamSlot()) {
                CamSlot()->SetPid(pidHandles[ptAudio].pid, true);
                CamSlot()->StartDecrypting();
            }
        }
    }
}
Exemple #3
0
bool clConsoleBase::StartProcess(const wxString& command)
{
    wxProcess* callback = nullptr;
    if(m_callback) {
        // user provided callback
        callback = m_callback;
    } else if(m_sink) {
        // using events. This object will get deleted when the process exits
        callback = new ConsoleProcess(m_sink, m_callbackUID);
    }

    SetPid(::wxExecute(command, wxEXEC_ASYNC | wxEXEC_MAKE_GROUP_LEADER | GetExecExtraFlags(), callback));
    // reset the m_callback (it will auto-delete itself)
    m_callback = nullptr;
    m_sink = nullptr;
    m_callbackUID.clear();
    return (GetPid() > 0);
}
Exemple #4
0
void SysParseOptions( char c, char **cmd )
{
    char buff[2];

    switch( c ) {
    case 'r':
        SetTimerRate( cmd );
        break;
    case 'p':
        SetPid( cmd );
        break;
    default:
        Output( MsgArray[MSG_INVALID_OPTION - ERR_FIRST_MESSAGE] );
        buff[0] = c;
        buff[1] = '\0';
        Output( buff );
        Output( "\n" );
        fatal();
        break;
    }
}
void CIkev2Acquire::ConstructL(const TPfkeyMessage& aReq, const TInetAddr& aLocalAddr, 
                          TUint16 aDHGroup, TBool aImplicitSa, 
                          const TIpsecSaSpec* aSaSpec, const CIpsecSARekeyData* aRekeyData)
{
    SetIpsecProtocol(aReq.iBase.iMsg->sadb_msg_satype); 
    SetPid(aReq.iBase.iMsg->sadb_msg_pid);
    SetSeq(aReq.iBase.iMsg->sadb_msg_seq);
    iSrcSpecific = !(aReq.iSrcAddr.iAddr->IsUnspecified());

    if (!aRekeyData)
        {
        // SADB_ACQUIRE was received
        if ( aReq.iProposal.iComb->sadb_comb_flags & SADB_SAFLAGS_PFS )
            {
            iDHGroup = (TUint32)aDHGroup;
            }
    
        if ( aReq.iProposal.iComb->sadb_comb_flags & SADB_SAFLAGS_TUNNEL )
            {
            iTransport = EFalse;        
            }
        else 
            {
            iTransport = ETrue;
            }

        iHard.iAllocations = aReq.iProposal.iComb->sadb_comb_hard_allocations;
        iHard.iBytes = aReq.iProposal.iComb->sadb_comb_hard_bytes;
        iHard.iAddtime = aReq.iProposal.iComb->sadb_comb_hard_addtime;
        iHard.iUsetime = aReq.iProposal.iComb->sadb_comb_hard_usetime;
    
        iSoft.iAllocations = aReq.iProposal.iComb->sadb_comb_soft_allocations;
        iSoft.iBytes = aReq.iProposal.iComb->sadb_comb_soft_bytes;
        iSoft.iAddtime = aReq.iProposal.iComb->sadb_comb_soft_addtime;
        iSoft.iUsetime = aReq.iProposal.iComb->sadb_comb_soft_usetime;

        SetReplayWindow(aReq.iProposal.iExt->sadb_prop_replay);

        //
        //  Build SA payload (including Proposal and Transform payload)
        //  using parameters in TPfkeyMessage
        //
        if ( aImplicitSa )
            {
            aDHGroup = 0; // No D-H group used with ipmplicit SA although PFS defined   
            }
        iSA = IpsecProposal::BuildIpsecSaRequestL(aReq, aDHGroup);
    
        //
        //  Build Traffic selectors using parameters in TPfkeyMessage.
        //  For some reason the selectors are build using identity 
        //  fields.
        //  
        IpsecSelectors::BuildTrafficSelectorsL(this, aLocalAddr,
                                               aReq.iSrcIdent, aReq.iDstIdent,
                                               aReq.iDstAddr.iExt->sadb_address_proto);
        //
        //  Store identity information from TPfkeyMessage to Acquire
        //
        if ( aReq.iSrcIdent.iExt )
            {            
            iLocalId = HBufC8::NewL(aReq.iSrcIdent.iData.Length());
            iLocalId->Des().Copy(aReq.iSrcIdent.iData);
            }
        else
            {
            iLocalId = KZeroDesc().AllocL();
            }

        if ( aReq.iDstIdent.iExt )
            {            
            iRemoteId = HBufC8::NewL(aReq.iDstIdent.iData.Length());
            iRemoteId->Des().Copy(aReq.iDstIdent.iData);
            }
        else
            {
            iRemoteId = KZeroDesc().AllocL();
            }
        }
    else
        {
        // SADB_EXPIRE was received due to soft lifetime expiration
        TUint16 flags = (TUint16)(aReq.iSa.iExt->sadb_sa_flags | (aSaSpec->iTransportMode ? 0 : SADB_SAFLAGS_TUNNEL));
        if ( flags & SADB_SAFLAGS_PFS )
            {
            iDHGroup = (TUint32)aDHGroup;
            }
    
        if ( flags & SADB_SAFLAGS_TUNNEL )
            {
            iTransport = EFalse;        
            }
        else 
            {
            iTransport = ETrue;
            }
                    
        if ( aImplicitSa )
            {
            aDHGroup = 0; // No D-H group used with ipmplicit SA although PFS defined   
            } 
        
        iSA = IpsecProposal::BuildIpsecSaRequestL(iProtocol, 
                                                  aSaSpec->iEalg, aSaSpec->iEalgLen, aSaSpec->iAalg, 
                                                  flags, aDHGroup);
                                                    
        iReplayWindow = aRekeyData->ReplayWindow();
        iHard = aRekeyData->HardLifetime();
        iSoft = aRekeyData->SoftLifetime();
        
        iTS_i = aRekeyData->TsIL();
        iTS_r = aRekeyData->TsRL();

        
        iLocalId = aRekeyData->LocalId().AllocL();
        iRemoteId = aRekeyData->RemoteId().AllocL();

        iResponse = EFalse;
        }
}
CBaseScteParser::CBaseScteParser(void)
  : m_clvctParser(PID_SCTE_BASE_PID), m_tlvctParser(PID_SCTE_BASE_PID)
{
  SetPid(PID_SCTE_BASE_PID);
}
void CPmtGrabber::OnNewSection(CSection& section)
{
	try
	{
    // if only service ID given, lookup from PAT
    if (GetPid() == 0) // PID 0 is the PAT, so look for matching PMT
    {
      int PMTPid=m_patgrab.PATRequest(section, m_iServiceId);
      if (PMTPid>0)
      {
         SetPmtPid(PMTPid,m_iServiceId);
         SetPid(PMTPid);
      } 
      else
      {
        LogDebug("PMT Pid wasn't found on the PAT. Channel may have moved, try a new channel scan.");
      }
    }

    if (section.table_id!=2) return;

    CEnterCriticalSection enter(m_section);

		if (section.section_length<0 || section.section_length>=MAX_SECTION_LENGTH) return;

		long serviceId = section.table_id_extension;
    if (m_iPmtVersion<0)
		  LogDebug("pmtgrabber: got pmt %x sid:%x",GetPid(), serviceId);

		if (serviceId != m_iServiceId) 
		{	
			LogDebug("pmtgrabber: serviceid mismatch %x != %x",serviceId,m_iServiceId);
			return;
		}

		m_iPmtLength=section.section_length;

    // copy pmt data for passing it to tvserver
		memcpy(m_pmtData,section.Data,m_iPmtLength);

    // compare the current section data with the previous one
    if (memcmp(section.Data, m_pmtPrevSection.Data, m_iPmtLength)!=0)
		{
      bool pidsChanged = false;
      CPmtParser prevPmtParser;
      CPmtParser currPmtParser;
      
      prevPmtParser.SetPid(GetPid());
      prevPmtParser.DecodePmtPidTable(m_pmtPrevSection);
      currPmtParser.SetPid(GetPid());

	  // Check if failed - if corrupted it can crash tv service after the callback
      if(!currPmtParser.DecodePmtPidTable(section))
      {
         LogDebug("CPmtGrabber::OnNewSection() - Error decoding PMT from new section, bad signal?");
         return;
      }

      if (!(prevPmtParser.GetPidInfo() == currPmtParser.GetPidInfo()))
      {
        LogDebug("pmtgrabber: PMT pids changed from:");
        prevPmtParser.GetPidInfo().LogPIDs();
        LogDebug("pmtgrabber: PMT pids changed to:");
        currPmtParser.GetPidInfo().LogPIDs();
        pidsChanged = true;
      }
      m_pmtPrevSection=section;

      // do a callback each time the version number changes. this also allows switching for "regional channels"
			if (m_pCallback!=NULL && m_iPmtVersion != section.version_number)
			{
        LogDebug("pmtgrabber: got new pmt version:%x %x, service_id:%x", section.version_number, m_iPmtVersion, serviceId);
        // if the pids are different, then a callback is required.
        if (pidsChanged)
        {
				  LogDebug("pmtgrabber: do callback pid %x",GetPid());
          m_pCallback->OnPMTReceived(GetPid());
        }
        // otherwise no need to callback, i.e. if _only_ version number changes regulary...
        else 
        {
				  LogDebug("pmtgrabber: NO callback done because a/v pids still the same.");
        }
			}
		}
 		m_iPmtVersion=section.version_number;
	}
	catch(...)
	{
		LogDebug("CPmtGrabber::OnNewSection exception");
	}
}