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 <omxinputport.h>
|
|
22 |
#include <mdf/mdfpuconfig.h>
|
|
23 |
|
|
24 |
#include "vorbisencoderinputport.h"
|
|
25 |
#include "vorbisencoderprocessingunit.h"
|
|
26 |
|
|
27 |
#include <e32debug.h>
|
|
28 |
|
|
29 |
// #define VORBISENCODERINPUTPORT_DEBUG 1
|
|
30 |
#if defined(VORBISENCODERINPUTPORT_DEBUG)
|
|
31 |
#define DEBUG_PRINT RDebug::Print
|
|
32 |
#else
|
|
33 |
#define DEBUG_PRINT
|
|
34 |
#endif
|
|
35 |
|
|
36 |
const TUint KSampleRate = 44100;
|
|
37 |
const TUint KMonoChannel = 1;
|
|
38 |
const TUint KStereoChannel = 2;
|
|
39 |
|
|
40 |
CVorbisEncoderInputPort* CVorbisEncoderInputPort::NewL(TInt aIndex, CVorbisEncoderProcessingUnit* aParent)
|
|
41 |
{
|
|
42 |
CVorbisEncoderInputPort* self = new (ELeave) CVorbisEncoderInputPort;
|
|
43 |
CleanupStack::PushL(self);
|
|
44 |
self->ConstructL(aIndex, aParent);
|
|
45 |
CleanupStack::Pop();
|
|
46 |
return self;
|
|
47 |
}
|
|
48 |
|
|
49 |
CVorbisEncoderInputPort::CVorbisEncoderInputPort() :
|
|
50 |
iSampleRate(KSampleRate),
|
|
51 |
iChannels(KStereoChannel),
|
|
52 |
iInterleaved(EFalse)
|
|
53 |
{
|
|
54 |
}
|
|
55 |
|
|
56 |
|
|
57 |
TInt CVorbisEncoderInputPort::MipConfigure(const TPuConfig& aConfig)
|
|
58 |
{
|
|
59 |
if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig))
|
|
60 |
{
|
|
61 |
const TTaskConfig* config = TPuTaskConfig::GetStructure(aConfig);
|
|
62 |
|
|
63 |
iSampleRate = config->iRate;
|
|
64 |
iChannels = (config->iStereoMode & ETaskMono)? KMonoChannel : KStereoChannel;
|
|
65 |
iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse;
|
|
66 |
|
|
67 |
return KErrNone;
|
|
68 |
}
|
|
69 |
else
|
|
70 |
{
|
|
71 |
return KErrNotSupported;
|
|
72 |
}
|
|
73 |
}
|
|
74 |
|
|
75 |
void CVorbisEncoderInputPort::MipInitialize()
|
|
76 |
{
|
|
77 |
COmxInputPort::MipInitialize();
|
|
78 |
OMX_VERSIONTYPE ver =
|
|
79 |
{
|
|
80 |
1,0
|
|
81 |
};
|
|
82 |
|
|
83 |
// Set Input Port (PCM16)
|
|
84 |
OMX_AUDIO_PARAM_PCMMODETYPE pcm;
|
|
85 |
pcm.nVersion = ver;
|
|
86 |
pcm.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
|
|
87 |
pcm.nPortIndex = 0;
|
|
88 |
pcm.nSamplingRate = iSampleRate;
|
|
89 |
pcm.ePCMMode = OMX_AUDIO_PCMModeLinear;
|
|
90 |
pcm.eNumData = OMX_NumericalDataSigned;
|
|
91 |
pcm.nBitPerSample = 16;
|
|
92 |
pcm.nChannels = iChannels;
|
|
93 |
pcm.bInterleaved = (OMX_BOOL)iInterleaved;
|
|
94 |
|
|
95 |
Component()->OmxSetParameter(OMX_IndexParamAudioPcm, &pcm);
|
|
96 |
}
|
|
97 |
|
|
98 |
|
|
99 |
// end
|
|
100 |
|