1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/audiorouting/Input/AudioInputBase/src/AudioInput.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,144 @@
1.4 +/*
1.5 +* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: Audio input base implementation
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +// INCLUDE FILES
1.24 +#include <AudioInput.h>
1.25 +#include <mmf/server/sounddevice.h>
1.26 +#include "AudioInputProxy.h"
1.27 +#include "AudioInputMessageTypes.h"
1.28 +#include <CustomInterfaceUtility.h>
1.29 +#include <CustomCommandUtility.h>
1.30 +#include <mdaaudioinputstream.h>
1.31 +#include <videorecorder.h>
1.32 +
1.33 +#ifdef _DEBUG
1.34 +#define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__);
1.35 +#define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
1.36 +#else
1.37 +#define DEBPRN0
1.38 +#define DEBPRN1(str)
1.39 +#endif
1.40 +
1.41 +// Two-phased constructor.
1.42 +EXPORT_C CAudioInput* CAudioInput::NewL(CMdaAudioRecorderUtility& aUtility)
1.43 + {
1.44 + DEBPRN0;
1.45 + CAudioInputProxy* audioInput;
1.46 + CCustomInterfaceUtility* customInterface;
1.47 +
1.48 + //customInterface = CCustomInterfaceUtility::NewL(aUtility,ECCRecording);
1.49 + customInterface = CCustomInterfaceUtility::NewL(aUtility,ETrue);
1.50 + CleanupStack::PushL(customInterface);
1.51 +
1.52 + // The ownership of customInterface is taken by the audioInput
1.53 + audioInput = (CAudioInputProxy*)customInterface->CustomInterface(KUidAudioInput);
1.54 +
1.55 + if (audioInput == NULL)
1.56 + {
1.57 + DEBPRN1("No Adaptation Support - leaving");
1.58 + User::Leave(KErrNotSupported);
1.59 + }
1.60 + CleanupStack::Pop(customInterface);
1.61 + return audioInput;
1.62 + }
1.63 +
1.64 +EXPORT_C CAudioInput* CAudioInput::NewL(CMMFDevSound& aDevSound)
1.65 + {
1.66 + DEBPRN0;
1.67 + CAudioInputProxy* audioInput = NULL;
1.68 + audioInput = (CAudioInputProxy*)aDevSound.CustomInterface(KUidAudioInput);
1.69 + if (audioInput == NULL)
1.70 + {
1.71 + DEBPRN1("No Adaptation Support - leaving");
1.72 + User::Leave(KErrNotSupported);
1.73 + }
1.74 + return audioInput;
1.75 + }
1.76 +
1.77 +// Two-phased constructor.
1.78 +EXPORT_C CAudioInput* CAudioInput::NewL(MCustomCommand& aUtility)
1.79 + {
1.80 + DEBPRN0;
1.81 + CAudioInputProxy* audioInput;
1.82 + CCustomInterfaceUtility* customInterface;
1.83 +
1.84 + customInterface = CCustomInterfaceUtility::NewL(aUtility);
1.85 + CleanupStack::PushL(customInterface);
1.86 +
1.87 + audioInput = (CAudioInputProxy*)customInterface->CustomInterface(KUidAudioInput);
1.88 + if (audioInput == NULL)
1.89 + {
1.90 + DEBPRN1("No Adaptation Support - leaving");
1.91 + User::Leave(KErrNotSupported);
1.92 + }
1.93 +
1.94 + CleanupStack::Pop(customInterface);
1.95 + return audioInput;
1.96 + }
1.97 +
1.98 +// Two-phased constructor.
1.99 +EXPORT_C CAudioInput* CAudioInput::NewL(MCustomInterface& aUtility)
1.100 + {
1.101 + DEBPRN0;
1.102 + CAudioInput* audioInput = (CAudioInputProxy*)aUtility.CustomInterface(KUidAudioInput);
1.103 +
1.104 + if ( !audioInput )
1.105 + {
1.106 + DEBPRN1("No Adaptation Support - leaving");
1.107 + User::Leave(KErrNotSupported);
1.108 + }
1.109 +
1.110 + return audioInput;
1.111 + }
1.112 +
1.113 +EXPORT_C CAudioInput* CAudioInput::NewL(CMdaAudioInputStream& aUtility)
1.114 + {
1.115 + DEBPRN0;
1.116 + CAudioInputProxy* audioInput = NULL;
1.117 + audioInput = (CAudioInputProxy*)aUtility.CustomInterface(KUidAudioInput);
1.118 + if (audioInput == NULL)
1.119 + {
1.120 + DEBPRN1("No Adaptation Support - leaving");
1.121 + User::Leave(KErrNotSupported);
1.122 + }
1.123 + return audioInput;
1.124 + }
1.125 +
1.126 +EXPORT_C CAudioInput* CAudioInput::NewL(CVideoRecorderUtility& aUtility)
1.127 + {
1.128 + DEBPRN0;
1.129 + CAudioInputProxy* audioInput;
1.130 + CCustomInterfaceUtility* customInterface;
1.131 +
1.132 + customInterface = CCustomInterfaceUtility::NewL(aUtility);
1.133 + CleanupStack::PushL(customInterface);
1.134 +
1.135 + // The ownership of customInterface is taken by the audioInput
1.136 + audioInput = (CAudioInputProxy*)customInterface->CustomInterface(KUidAudioInput);
1.137 + if (audioInput == NULL)
1.138 + {
1.139 + DEBPRN1("No Adaptation Support - leaving");
1.140 + User::Leave(KErrNotSupported);
1.141 + }
1.142 +
1.143 + CleanupStack::Pop(customInterface);
1.144 + return audioInput;
1.145 + }
1.146 +
1.147 +// End of File