0
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file
|
|
18 |
@internalComponent
|
|
19 |
*/
|
|
20 |
|
|
21 |
#include <mdf/mdfpuconfig.h>
|
|
22 |
#include <omxoutputport.h>
|
|
23 |
|
|
24 |
#include "vorbisdecoderoutputport.h"
|
|
25 |
#include "vorbisdecoderprocessingunit.h"
|
|
26 |
|
|
27 |
#include <e32debug.h>
|
|
28 |
|
|
29 |
const TInt KPcm16BitsPerSample = 16;
|
|
30 |
|
|
31 |
// #define VORBISDECODEROUTPUTPORT_DEBUG 1
|
|
32 |
#if defined(VORBISDECODEROUTPUTPORT_DEBUG)
|
|
33 |
#define DEBUG_PRINT RDebug::Print
|
|
34 |
#else
|
|
35 |
#define DEBUG_PRINT
|
|
36 |
#endif
|
|
37 |
|
|
38 |
const TUint KSampleRate = 44100;
|
|
39 |
const TUint KMonoChannel = 1;
|
|
40 |
const TUint KStereoChannel = 2;
|
|
41 |
|
|
42 |
CVorbisDecoderOutputPort* CVorbisDecoderOutputPort::NewL(TInt aIndex, CVorbisDecoderProcessingUnit* aComponent)
|
|
43 |
{
|
|
44 |
CVorbisDecoderOutputPort* self = new (ELeave) CVorbisDecoderOutputPort;
|
|
45 |
CleanupStack::PushL (self);
|
|
46 |
self->ConstructL(aIndex, aComponent);
|
|
47 |
CleanupStack::Pop();
|
|
48 |
return self;
|
|
49 |
}
|
|
50 |
|
|
51 |
CVorbisDecoderOutputPort::CVorbisDecoderOutputPort() :
|
|
52 |
iSampleRate(KSampleRate),
|
|
53 |
iChannels(KStereoChannel),
|
|
54 |
iInterleaved(EFalse)
|
|
55 |
{
|
|
56 |
}
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
TInt CVorbisDecoderOutputPort::MopConfigure(const TPuConfig& aConfig)
|
|
61 |
{
|
|
62 |
if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig))
|
|
63 |
{
|
|
64 |
const TTaskConfig* config = TPuTaskConfig::GetStructure(aConfig);
|
|
65 |
|
|
66 |
iSampleRate = config->iRate;
|
|
67 |
iChannels = (config->iStereoMode & ETaskMono)? KMonoChannel : KStereoChannel;
|
|
68 |
iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse;
|
|
69 |
return KErrNone;
|
|
70 |
}
|
|
71 |
return KErrNotSupported;
|
|
72 |
}
|
|
73 |
|
|
74 |
void CVorbisDecoderOutputPort::MopInitialize()
|
|
75 |
{
|
|
76 |
COmxOutputPort::MopInitialize();
|
|
77 |
|
|
78 |
OMX_VERSIONTYPE ver =
|
|
79 |
{
|
|
80 |
1,0
|
|
81 |
};
|
|
82 |
|
|
83 |
// Set Output Port (PCM16)
|
|
84 |
OMX_AUDIO_PARAM_PCMMODETYPE pcm;
|
|
85 |
pcm.nVersion = ver;
|
|
86 |
pcm.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
|
|
87 |
pcm.nPortIndex = KVorbisDecoderOutputPortIndex;
|
|
88 |
pcm.nSamplingRate = iSampleRate;
|
|
89 |
pcm.ePCMMode = OMX_AUDIO_PCMModeLinear;
|
|
90 |
pcm.eNumData = OMX_NumericalDataSigned;
|
|
91 |
pcm.nBitPerSample = KPcm16BitsPerSample;
|
|
92 |
pcm.nChannels = iChannels;
|
|
93 |
pcm.bInterleaved = (OMX_BOOL)iInterleaved;
|
|
94 |
|
|
95 |
Component()->OmxSetParameter(OMX_IndexParamAudioPcm, &pcm);
|
|
96 |
}
|
|
97 |
|
|
98 |
// end
|