os/mm/devsoundextensions/audiorouting/Output/AudioOutputBase/src/AudioOutput.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsoundextensions/audiorouting/Output/AudioOutputBase/src/AudioOutput.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,238 @@
     1.4 +/*
     1.5 +* Copyright (c) 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:   This is the implementation of the CAudioOutput class.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +
    1.24 +// INCLUDE FILES
    1.25 +#include <mmf/server/sounddevice.h>
    1.26 +#include "AudioOutputProxy.h"
    1.27 +#include "AudioOutputMessageTypes.h"
    1.28 +#include <CustomInterfaceUtility.h>
    1.29 +#include <CustomCommandUtility.h>
    1.30 +#include <mdaaudiotoneplayer.h>
    1.31 +#include <mdaaudiooutputstream.h>
    1.32 +#include <AudioOutput.h>
    1.33 +#include <DrmAudioSamplePlayer.h>
    1.34 +#include <videoplayer.h>
    1.35 +
    1.36 +#ifdef _DEBUG
    1.37 +#define DEBPRN0         RDebug::Printf( "%s", __PRETTY_FUNCTION__);
    1.38 +#define DEBPRN1(str)    RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
    1.39 +#else
    1.40 +#define DEBPRN0
    1.41 +#define DEBPRN1(str)
    1.42 +#endif
    1.43 +
    1.44 +// Two-phased constructor.
    1.45 +EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioPlayerUtility& aUtility)
    1.46 +    {
    1.47 +    DEBPRN0;
    1.48 +    CAudioOutputProxy* audioOutput = NULL;
    1.49 +    CCustomInterfaceUtility* customInterface;
    1.50 +
    1.51 +    customInterface = CCustomInterfaceUtility::NewL(aUtility);
    1.52 +    CleanupStack::PushL( customInterface );
    1.53 +
    1.54 +    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
    1.55 +
    1.56 +	if (audioOutput == NULL)
    1.57 +		{
    1.58 +        DEBPRN1("No Adaptation Support - leaving");
    1.59 +		User::Leave(KErrNotSupported);
    1.60 +		}
    1.61 +
    1.62 +	CleanupStack::Pop(customInterface);
    1.63 +    return audioOutput;
    1.64 +    }
    1.65 +
    1.66 +
    1.67 +// Two-phased constructor.
    1.68 +EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioRecorderUtility& aUtility, TBool aRecordStream)
    1.69 +    {
    1.70 +    DEBPRN0;
    1.71 +    CAudioOutputProxy* audioOutput = NULL;
    1.72 +    CCustomInterfaceUtility* customInterface;
    1.73 +
    1.74 +    customInterface = CCustomInterfaceUtility::NewL(aUtility,aRecordStream);
    1.75 +    CleanupStack::PushL( customInterface );
    1.76 +
    1.77 +    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
    1.78 +
    1.79 +	if (audioOutput == NULL)
    1.80 +		{
    1.81 +        DEBPRN1("No Adaptation Support - leaving");
    1.82 +		User::Leave(KErrNotSupported);
    1.83 +		}
    1.84 +
    1.85 +	CleanupStack::Pop(customInterface);
    1.86 +    return audioOutput;
    1.87 +    }
    1.88 +
    1.89 +
    1.90 +// Two-phased constructor.
    1.91 +EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioOutputStream& aUtility)
    1.92 +    {
    1.93 +    DEBPRN0;
    1.94 +    CAudioOutputProxy* audioOutput = NULL;
    1.95 +    audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
    1.96 +
    1.97 +	if (audioOutput == NULL)
    1.98 +		{
    1.99 +        DEBPRN1("No Adaptation Support - leaving");
   1.100 +		User::Leave(KErrNotSupported);
   1.101 +		}
   1.102 +
   1.103 +    return audioOutput;
   1.104 +    }
   1.105 +
   1.106 +// Two-phased constructor.
   1.107 +EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioToneUtility& aUtility)
   1.108 +    {
   1.109 +    DEBPRN0;
   1.110 +    CAudioOutputProxy* audioOutput = NULL;
   1.111 +    audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
   1.112 +
   1.113 +	if (audioOutput == NULL)
   1.114 +		{
   1.115 +        DEBPRN1("No Adaptation Support - leaving");
   1.116 +		User::Leave(KErrNotSupported);
   1.117 +		}
   1.118 +
   1.119 +    return audioOutput;
   1.120 +    }
   1.121 +
   1.122 +// Two-phased constructor.
   1.123 +EXPORT_C CAudioOutput* CAudioOutput::NewL(CMMFDevSound& aDevSound)
   1.124 +    {
   1.125 +    DEBPRN0;
   1.126 +    CAudioOutputProxy* audioOutput = NULL;
   1.127 +    audioOutput = (CAudioOutputProxy*)aDevSound.CustomInterface(KUidAudioOutput);
   1.128 +
   1.129 +	if (audioOutput == NULL)
   1.130 +		{
   1.131 +        DEBPRN1("No Adaptation Support - leaving");
   1.132 +		User::Leave(KErrNotSupported);
   1.133 +		}
   1.134 +
   1.135 +    return audioOutput;
   1.136 +    }
   1.137 +
   1.138 +// Two-phased constructor.
   1.139 +EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomInterface& aUtility)
   1.140 +    {
   1.141 +    DEBPRN0;
   1.142 +	CAudioOutputProxy* audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
   1.143 +
   1.144 +	if ( !audioOutput )
   1.145 +		{
   1.146 +		DEBPRN1("No Adaptation Support - leaving");
   1.147 +		User::Leave(KErrNotSupported);
   1.148 +		}
   1.149 +
   1.150 +    return audioOutput;
   1.151 +    }
   1.152 +
   1.153 +// Two-phased constructor.
   1.154 +EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomCommand& aUtility)
   1.155 +    {
   1.156 +    DEBPRN0;
   1.157 +    CAudioOutputProxy* audioOutput = NULL;
   1.158 +    CCustomInterfaceUtility* customInterface;
   1.159 +
   1.160 +    customInterface = CCustomInterfaceUtility::NewL(aUtility);
   1.161 +    CleanupStack::PushL( customInterface );
   1.162 +
   1.163 +    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
   1.164 +
   1.165 +	if (audioOutput == NULL)
   1.166 +		{
   1.167 +        DEBPRN1("No Adaptation Support - leaving");
   1.168 +		User::Leave(KErrNotSupported);
   1.169 +		}
   1.170 +
   1.171 +	CleanupStack::Pop(customInterface);
   1.172 +    return audioOutput;
   1.173 +    }
   1.174 +
   1.175 +// Two-phased constructor.
   1.176 +EXPORT_C CAudioOutput* CAudioOutput::NewL(CMidiClientUtility& aUtility)
   1.177 +    {
   1.178 +    DEBPRN0;
   1.179 +    CAudioOutputProxy* audioOutput = NULL;
   1.180 +    CCustomInterfaceUtility* customInterface;
   1.181 +
   1.182 +    customInterface = CCustomInterfaceUtility::NewL(aUtility);
   1.183 +    CleanupStack::PushL( customInterface );
   1.184 +
   1.185 +    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
   1.186 +
   1.187 +	if (audioOutput == NULL)
   1.188 +		{
   1.189 +        DEBPRN1("No Adaptation Support - leaving");
   1.190 +		User::Leave(KErrNotSupported);
   1.191 +		}
   1.192 +
   1.193 +	CleanupStack::Pop(customInterface);
   1.194 +    return audioOutput;
   1.195 +    }
   1.196 +
   1.197 +// Two-phased constructor.
   1.198 +EXPORT_C CAudioOutput* CAudioOutput::NewL(CDrmPlayerUtility& aUtility)
   1.199 +    {
   1.200 +    DEBPRN0;
   1.201 +    CAudioOutputProxy* audioOutput = NULL;
   1.202 +    CCustomInterfaceUtility* customInterface;
   1.203 +
   1.204 +    customInterface = CCustomInterfaceUtility::NewL(aUtility);
   1.205 +    CleanupStack::PushL( customInterface );
   1.206 +
   1.207 +    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
   1.208 +
   1.209 +	if (audioOutput == NULL)
   1.210 +		{
   1.211 +        DEBPRN1("No Adaptation Support - leaving");
   1.212 +		User::Leave(KErrNotSupported);
   1.213 +		}
   1.214 +
   1.215 +	CleanupStack::Pop(customInterface);
   1.216 +    return audioOutput;
   1.217 +    }
   1.218 +
   1.219 +EXPORT_C CAudioOutput* CAudioOutput::NewL(CVideoPlayerUtility& aUtility)
   1.220 +    {
   1.221 +    DEBPRN0;
   1.222 +    CAudioOutputProxy* audioOutput = NULL;
   1.223 +    CCustomInterfaceUtility* customInterface;
   1.224 +
   1.225 +    customInterface = CCustomInterfaceUtility::NewL(aUtility);
   1.226 +    CleanupStack::PushL( customInterface );
   1.227 +
   1.228 +    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
   1.229 +
   1.230 +	if (audioOutput == NULL)
   1.231 +		{
   1.232 +        DEBPRN1("No Adaptation Support - leaving");
   1.233 +		User::Leave(KErrNotSupported);
   1.234 +		}
   1.235 +
   1.236 +	CleanupStack::Pop(customInterface);
   1.237 +    return audioOutput;
   1.238 +    }
   1.239 +
   1.240 +// End of file
   1.241 +