void CPodcastModel::ResetDB()
	{
	DP("CPodcastModel::ResetDB BEGIN");
	
	DropDB();
	
	TFileName dbFileName;
	dbFileName.Copy(iSettingsEngine->PrivatePath());
	dbFileName.Append(KDBFileName);

	// remove the old DB file
	if (BaflUtils::FileExists(iFsSession, dbFileName))
		{
		BaflUtils::DeleteFile(iFsSession, dbFileName);
		}

	// copy template to new DB
	TFileName dbTemplate;
	TFileName temp;
	dbTemplate.Copy(_L("z:"));
	temp.Copy(iSettingsEngine->PrivatePath());
	dbTemplate.Append(temp);
	dbTemplate.Append(KDBTemplateFileName);
	
	DP1("Copy template DB from: %S", &dbTemplate);
	DP1("Copy template DB to: %S", &dbFileName);
	
	BaflUtils::CopyFile(iFsSession, dbTemplate,dbFileName);
	iIsFirstStartup = ETrue;
	DP("CPodcastModel::ResetDB END");
	}
EXPORT_C void CPodcastModel::UpdateSNAPListL()
{
	DP("CPodcastModel::UpdateSNAPListL BEGIN");
	iSNAPNameArray->Reset();
	iSNAPIdArray.Reset();
	
	RCmDestination destination;
	TPodcastIAPItem IAPItem;
	
	RArray<TUint32> destArray;
	CleanupClosePushL(destArray);
	iCmManager.AllDestinationsL(destArray);
	
	TInt cnt = destArray.Count();
	DP1("destArray.Count==%d", cnt);
	for(TInt loop = 0;loop<cnt;loop++)
		{
		destination = iCmManager.DestinationL (destArray[loop]);
		CleanupClosePushL(destination);
		if(!destination.IsHidden())
			{
			IAPItem.iIapId = destArray[loop];
			HBufC* name = destination.NameLC();
			DP1(" destination.NameLC==%S", name);
			iSNAPNameArray->AppendL(*name);
			CleanupStack::PopAndDestroy(name);
			iSNAPIdArray.Append(IAPItem);
			}
		CleanupStack::PopAndDestroy();//close destination
		}
	CleanupStack::PopAndDestroy();// close destArray

	DP("CPodcastModel::UpdateSNAPListL END");
}
// -----------------------------------------------------------------------------
// CAdvancedAudioEncoder::Stop
// Stops encoding process.
// -----------------------------------------------------------------------------
//
EXPORT_C void CAdvancedAudioEncoder::Stop()
	{
	DP1(_L("CAdvancedAudioEncoder::Stop start iNextBuffer[%d]"), iNextBuffer);

    // There are 2 situations in which this function is called.
    // First when Devsound has already given a buffer to Encoder to be handled.
    // In which case, one needs to finish handling it by calling HandleEmptyBufferL().
    // Secondly, in a situation where the current shared buffer is being filled (partially full)
    // in which case, the buffer needs to be flushed
	if (iBufferToEmpty && (iState == EEncoding))
		{
	    DP1(_L("CAdvancedAudioEncoder::Stop setting last buffer[%d]"), iBufferToEmpty);
		iBufferToEmpty->SetLastBuffer(ETrue);
		TRAPD(err, HandleEmptyBufferL());
		if ( err )
			{
			DP1(_L("CAdvancedAudioEncoder::Stop err[%d]"), err);
			iState = EIdle;
			iObserver->SendEvent(TMMFEvent(KMMFEventCategoryPlaybackComplete, err));
			}		
        }
	else if (iNextBuffer)
	    { // a record controller may call stop before buffers are initialized
        if (iNextBuffer->Status() == EBeingFilled)
            {
            DP1(_L("CAdvancedAudioEncoder::Stop setting buffer[%d] to EFull"), iNextBuffer);
            iNextBuffer->SetStatus(EFull);
            DP1(_L("CAdvancedAudioEncoder::Stop emptying buffer[%d]"), iNextBuffer);
            iObserver->EmptyBuffer(iNextBuffer);
            }
	    }
		
	iState = EIdle;
    DP0(_L("CAdvancedAudioEncoder::Stop end"));
	}
QString S60MediaPlayerAudioEndpointSelector::defaultEndpoint() const
{
    DP0("S60MediaPlayerAudioEndpointSelector::defaultEndpoint");

    if (m_control->session()) {
        DP1("S60MediaPlayerAudioEndpointSelector::defaultEndpoint - ",
                m_control->session()->defaultEndpoint());
        return m_control->session()->defaultEndpoint();
    }
    else {
        DP1("S60MediaPlayerAudioEndpointSelector::defaultEndpoint - ",
                m_control->mediaControlSettings().audioEndpoint());
        return m_control->mediaControlSettings().audioEndpoint();
    }
}
void S60VideoPlayerSession::setActiveEndpoint(const QString& name)
{
    DP0("S60VideoPlayerSession::setActiveEndpoint +++");

    DP1("S60VideoPlayerSession::setActiveEndpoint - ", name);

#ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
    CAudioOutput::TAudioOutputPreference output = CAudioOutput::ENoPreference;
    if (name == DefaultAudioEndpoint)
        output = CAudioOutput::ENoPreference;
    else if (name == QString("All"))
        output = CAudioOutput::EAll;
    else if (name == QString("None"))
        output = CAudioOutput::ENoOutput;
    else if (name == QString("Earphone"))
        output = CAudioOutput::EPrivate;
    else if (name == QString("Speaker"))
        output = CAudioOutput::EPublic;
    if (m_audioOutput) {
        TRAPD(err, m_audioOutput->SetAudioOutputL(output));
        setError(err);
    }
#endif

    DP0("S60VideoPlayerSession::setActiveEndpoint ---");
}
void S60VideoPlayerSession::doSetAudioEndpoint(const QString& audioEndpoint)
{
    DP0("S60VideoPlayerSession::doSetAudioEndpoint +++");

    DP1("S60VideoPlayerSession::doSetAudioEndpoint - ", audioEndpoint);

    m_audioEndpoint = audioEndpoint;

    DP0("S60VideoPlayerSession::doSetAudioEndpoint ---");
}
void S60VideoPlayerSession::doSetVolumeL(int volume)
{
    DP0("S60VideoPlayerSession::doSetVolumeL +++");

    DP1("S60VideoPlayerSession::doSetVolumeL - ", volume);

    m_player->SetVolumeL(volume * m_player->MaxVolume() / 100);

    DP0("S60VideoPlayerSession::doSetVolumeL ---");
}
// -----------------------------------------------------------------------------
// CAdvancedAudioPlayController::MacSetSinkFormatL
// -----------------------------------------------------------------------------
//
EXPORT_C void CAdvancedAudioPlayController::MacSetSinkFormatL(
	TUid aFormatUid)
    {
    DP1(_L("CAdvancedAudioPlayController::MacSetSinkFormatL[%x]"), aFormatUid);

    if (aFormatUid != TUid::Uid(KMmfUidFormatRAWWrite))
        {
        User::Leave(KErrNotSupported);
        }
    }
// -----------------------------------------------------------------------------
// CAMRAudioPlayControllerDecoder::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CAMRAudioPlayControllerDecoder::ConstructL()
    {
    DP1(_L("CAMRAudioPlayControllerDecoder::ConstructL"), this);
    iFrameTable = CFrameTable::NewL();
    
	RenderEnable();
	UnMarkPlayEnd();
	Enable();

    CActiveScheduler::Add(this);
    }
// -----------------------------------------------------------------------------
// CAdvancedAudioPlayController::MacGetSourceBitRateL
// Returns the bit rate obtained from the source.
// -----------------------------------------------------------------------------
//
EXPORT_C void CAdvancedAudioPlayController::MacGetSourceBitRateL(
	TUint& aRate)
    {
    if (!iDataSource)
		{
        User::Leave(KErrNotReady);
		}
		
	// bit rate might be changed implicitly within a Controller's Utility
//    UpdateBitRate();
    aRate = iBitRate;
	DP1(_L("CAdvancedAudioPlayController::MacGetSourceBitRateL[%d]"), iBitRate);
    }
void S60VideoPlayerSession::MvpuoPlayComplete(TInt aError)
{
    DP0("S60VideoPlayerSession::MvpuoPlayComplete +++");

    DP1("S60VideoPlayerSession::MvpuoPlayComplete - aError", aError);

    if (m_stream)
        m_networkAccessControl->resetIndex();

    endOfMedia();
    setError(aError);

    DP0("S60VideoPlayerSession::MvpuoPlayComplete ---");
}
示例#12
0
void cGameCell::AddObject( cGameEnt* pObj )
{
	/**
	 * Make sure we don't have the object yet.
	 */
	assert( 0 == count(
		m_objectsInCell.begin(),
		m_objectsInCell.end(),
		pObj ) );

	m_objectsInCell.push_back( pObj );

	DP1("[cGameCell::AddObject]: Adding object %x\n", pObj );
}
// -----------------------------------------------------------------------------
// CAdvancedAudioPlayController::MapdSetVolumeL
// Sets the volume in audion output.
// -----------------------------------------------------------------------------
//
EXPORT_C void CAdvancedAudioPlayController::MapdSetVolumeL(
	TInt aVolume)
    {
    DP1(_L("CAdvancedAudioPlayController::MapdSetVolumeL[%d]"), aVolume);

    if (!iDataSink)
    	{
        User::Leave(KErrNotReady);
		}

    if (0 <= aVolume && aVolume <= iAudioOutput->MaxVolumeL())
        {
        iAudioOutput->SetVolumeL(aVolume);
        }
    }
void S60VideoPlayerSession::MvpuoOpenComplete(TInt aError)
{
    DP0("S60VideoPlayerSession::MvpuoOpenComplete +++");

    DP1("S60VideoPlayerSession::MvpuoOpenComplete - aError:", aError);

    setError(aError);
    if (KErrNone == aError)
        m_player->Prepare();

    const TMMFMessageDestinationPckg dest( KUidInterfaceMMFROPController );
    TRAP_IGNORE(m_player->CustomCommandSync(dest, KMMFROPControllerEnablePausedLoadingStatus, KNullDesC8, KNullDesC8));

    DP0("S60VideoPlayerSession::MvpuoOpenComplete ---");
}
QString S60VideoPlayerSession::activeEndpoint() const
{
    DP0("S60VideoPlayerSession::activeEndpoint +++");

    QString outputName = m_audioEndpoint;
#ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
    if (m_audioOutput) {
        CAudioOutput::TAudioOutputPreference output = m_audioOutput->AudioOutput();
        outputName = qStringFromTAudioOutputPreference(output);
    }
#endif

    DP1("S60VideoPlayerSession::activeEndpoint- outputName:", outputName);
    DP0("S60VideoPlayerSession::activeEndpoint ---");
    return outputName;
}
void CPodcastModel::ConstructL()
{
	DP("CPodcastModel::ConstructL BEGIN");
	User::LeaveIfError(iFsSession.Connect());
	iCommDB = CCommsDatabase::NewL (EDatabaseTypeUnspecified);
	iIapNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu);
	iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu);

	iImageHandler = CImageHandler::NewL(FsSession(), *this);
	iDocHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process());

	TRAPD(err,iCmManager.OpenL());
	DP1("iCmManager.OpenL(),err=%d;", err);
	
	if (err == KErrNone)
		{
		UpdateIAPListL();
		UpdateSNAPListL();
		}
	
	iSettingsEngine = CSettingsEngine::NewL(*this);
	iConnectionEngine = CConnectionEngine::NewL(*this);	
	
	TRAP(err, OpenDBL());
	
	if (err != KErrNone)
		{
		ResetDB();
		
		TRAP(err, OpenDBL());
		
		if (err != KErrNone)
			{
			Panic(EPodcatcherPanicDB);
			}
		
		}
	
	iFeedEngine = CFeedEngine::NewL(*this);
	iShowEngine = CShowEngine::NewL(*this);

	DP("CPodcastModel::ConstructL END");
}
示例#17
0
void parseProgramHeader(FILE *elf, programHeader_t *programHeader){
  int numBytesRead;

  READ_ELF32_WORD(&programHeader->p_type, elf)
  READ_ELF32_WORD(&programHeader->p_offset, elf)
  READ_ELF32_WORD(&programHeader->p_vaddr, elf)
  READ_ELF32_WORD(&programHeader->p_paddr, elf)
  READ_ELF32_WORD(&programHeader->p_filesz, elf)
  READ_ELF32_WORD(&programHeader->p_memsz, elf)
  READ_ELF32_WORD(&programHeader->p_flags, elf)
  READ_ELF32_WORD(&programHeader->p_align, elf)

  DP1("Program Header Type: %d\n",programHeader->p_type);
  DP1("Program Segment Offset: %d\n",programHeader->p_offset);
  DP1("Program Virtual Address: 0x%x\n",programHeader->p_vaddr);
  DP1("Program Physical Address: 0x%x\n",programHeader->p_paddr);
  DP1("Program Segment File Image Size: %d\n",programHeader->p_filesz);
  DP1("Program Segment Memory Image Size: %d\n",programHeader->p_memsz);
  DP1("Program Header Flags: 0x%x\n",programHeader->p_flags);
  DP1("Program Header Alignment: 0x%x\n",programHeader->p_align);
}
void S60VideoPlayerSession::MvpuoPrepareComplete(TInt aError)
{
    DP0("S60VideoPlayerSession::MvpuoPrepareComplete +++");

    DP1("S60VideoPlayerSession::MvpuoPrepareComplete - aError:", aError);

    if (KErrNone == aError && m_stream) {
        emit accessPointChanged(m_accessPointId);
    }
    if (KErrCouldNotConnect == aError && !(m_networkAccessControl->isLastAccessPoint())) {
        load(m_UrlPath);
        return;
    }
    TInt error = aError;
    if (KErrNone == error || KErrMMPartialPlayback == error) {
        TSize originalSize;
        TRAP(error, m_player->VideoFrameSizeL(originalSize));
        if (KErrNone == error) {
            m_nativeSize = QSize(originalSize.iWidth, originalSize.iHeight);
            emit nativeSizeChanged(m_nativeSize);
            m_pendingChanges |= ScaleFactors;
#ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
            Q_ASSERT(!m_audioOutput);
            TRAP(error, m_audioOutput = CAudioOutput::NewL(*m_player));
            if (KErrNone == error) {
                TRAP(error, m_audioOutput->RegisterObserverL(*this));
                if (KErrNone == error)
                    setActiveEndpoint(m_audioEndpoint);
            }
#endif
        }
        if (KErrNone == error) {
            applyPendingChanges(true); // force apply even though state is not Loaded
            if (KErrNone == this->error()) // applyPendingChanges() can call setError()
                loaded();
        }
    } else {
        setError(error);
    }

    DP0("S60VideoPlayerSession::MvpuoPrepareComplete ---");
}
void S60MediaPlayerAudioEndpointSelector::setActiveEndpoint(const QString& name)
{
    DP0("S60MediaPlayerAudioEndpointSelector::setActiveEndpoin +++");

    DP1("S60MediaPlayerAudioEndpointSelector::setActiveEndpoint - ", name);

    QString oldEndpoint = m_control->mediaControlSettings().audioEndpoint();

    if (name != oldEndpoint && (name == QString("Default") || name == QString("All") ||
        name == QString("None") || name == QString("Earphone") || name == QString("Speaker"))) {

        if (m_control->session()) {
            m_control->session()->setActiveEndpoint(name);
            emit activeEndpointChanged(name);
        }
        m_control->setAudioEndpoint(name);
    }

    DP0("S60MediaPlayerAudioEndpointSelector::setActiveEndpoin ---");
}
// -----------------------------------------------------------------------------
// CAdvancedAudioPlayController::MscEnableEvents
// -----------------------------------------------------------------------------
//
EXPORT_C TInt CAdvancedAudioPlayController::MscEnableEvents(TBool aEnable)
    {
    iEventsEnabled = aEnable;
        
    // bit rate might be changed implicitly within a Controller's Utility, that would have effect on the duration event
    if (iAudioUtility)
        {
        TInt err = KErrNone;
            
        if (iEventsEnabled)
            {
            // callback on every 1000 millisecond (1 second) if bitrate changes
            TRAP(err, iAudioUtility->EnableBitRateChangedEventL(1000));
            }
        else
            {
            TRAP(err, iAudioUtility->EnableBitRateChangedEventL(-1));
            }

		DP1(_L("CAdvancedAudioPlayController::MscEnableEvents, EnableBitRateChangedEventL err[%d]"), err);
        }
    return KErrNone;
    }
void S60VideoPlayerSession::setPlaybackRate(qreal rate)
{
    DP0("S60VideoPlayerSession::setPlaybackRate +++");

    DP1("S60VideoPlayerSession::setPlaybackRate - ", rate);

    /*
     * setPlaybackRate is not supported in S60 3.1 and 3.2
     * This flag will be defined for 3.1 and 3.2
    */
#ifndef PLAY_RATE_NOT_SUPPORTED
    //setPlayVelocity requires rate in the form of
    //50 = 0.5x ;100 = 1.x ; 200 = 2.x ; 300 = 3.x
    //so multiplying rate with 100
    TRAPD(err, m_player->SetPlayVelocityL((TInt)(rate*100)));
    if (KErrNone == err)
        emit playbackRateChanged(rate);
    else
        setError(err);
#endif

    DP0("S60VideoPlayerSession::setPlaybackRate ---");
}
示例#22
0
void parseElfHeader(FILE *elf, elfHeader_t *elfHeader){
  int numBytesRead;

  numBytesRead = fread(elfHeader->e_ident, 1, EI_NIDENT, elf);
  READ_ELF32_HALF(&elfHeader->e_type, elf)
  READ_ELF32_HALF(&elfHeader->e_machine, elf)
  READ_ELF32_WORD(&elfHeader->e_version, elf)
  READ_ELF32_WORD(&elfHeader->e_entry, elf)
  READ_ELF32_WORD(&elfHeader->e_phoff, elf)
  READ_ELF32_WORD(&elfHeader->e_shoff, elf)
  READ_ELF32_WORD(&elfHeader->e_flags, elf)
  READ_ELF32_HALF(&elfHeader->e_ehsize, elf)
  READ_ELF32_HALF(&elfHeader->e_phentsize, elf)
  READ_ELF32_HALF(&elfHeader->e_phnum, elf)
  READ_ELF32_HALF(&elfHeader->e_shentsize, elf)
  READ_ELF32_HALF(&elfHeader->e_shnum, elf)
  READ_ELF32_HALF(&elfHeader->e_shstrndx, elf)

  DP1("Elf Header Identification: %s\n",elfHeader->e_ident);
  DP1("ELF Type: %d\n",elfHeader->e_type);
  DP1("ELF Machine: %d\n",elfHeader->e_machine);
  DP1("ELF Version: %d\n",elfHeader->e_version);
  DP1("ELF Entry: %d\n",elfHeader->e_entry);
  DP1("ELF Program Header Offset: 0x%x\n",elfHeader->e_phoff);
  DP1("ELF Section Header Offset: 0x%x\n",elfHeader->e_shoff);
  DP1("ELF Flags: 0x%x\n",elfHeader->e_flags);
  DP1("ELF Header Size: %d\n",elfHeader->e_ehsize);
  DP1("ELF Program Header Ent Size: %d\n",elfHeader->e_phentsize);
  DP1("ELF Program Header Num: %d\n",elfHeader->e_phnum);
  DP1("ELF Section Header Ent Size: %d\n",elfHeader->e_shentsize);
  DP1("ELF Section Header Num: %d\n",elfHeader->e_shnum);
  DP1("ELF Section Header Str Index: %d\n",elfHeader->e_shstrndx);
}