sl@0: /* sl@0: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: This is the implementation of the CAudioOutput class. sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: #include sl@0: #include "AudioOutputProxy.h" sl@0: #include "AudioOutputMessageTypes.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifdef _DEBUG sl@0: #define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__); sl@0: #define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str ); sl@0: #else sl@0: #define DEBPRN0 sl@0: #define DEBPRN1(str) sl@0: #endif sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioPlayerUtility& aUtility) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: CCustomInterfaceUtility* customInterface; sl@0: sl@0: customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL( customInterface ); sl@0: sl@0: audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: return audioOutput; sl@0: } sl@0: sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioRecorderUtility& aUtility, TBool aRecordStream) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: CCustomInterfaceUtility* customInterface; sl@0: sl@0: customInterface = CCustomInterfaceUtility::NewL(aUtility,aRecordStream); sl@0: CleanupStack::PushL( customInterface ); sl@0: sl@0: audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: return audioOutput; sl@0: } sl@0: sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioOutputStream& aUtility) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return audioOutput; sl@0: } sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioToneUtility& aUtility) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return audioOutput; sl@0: } sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(CMMFDevSound& aDevSound) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: audioOutput = (CAudioOutputProxy*)aDevSound.CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return audioOutput; sl@0: } sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomInterface& aUtility) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput); sl@0: sl@0: if ( !audioOutput ) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: return audioOutput; sl@0: } sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomCommand& aUtility) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: CCustomInterfaceUtility* customInterface; sl@0: sl@0: customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL( customInterface ); sl@0: sl@0: audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: return audioOutput; sl@0: } sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(CMidiClientUtility& aUtility) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: CCustomInterfaceUtility* customInterface; sl@0: sl@0: customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL( customInterface ); sl@0: sl@0: audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: return audioOutput; sl@0: } sl@0: sl@0: // Two-phased constructor. sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(CDrmPlayerUtility& aUtility) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: CCustomInterfaceUtility* customInterface; sl@0: sl@0: customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL( customInterface ); sl@0: sl@0: audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: return audioOutput; sl@0: } sl@0: sl@0: EXPORT_C CAudioOutput* CAudioOutput::NewL(CVideoPlayerUtility& aUtility) sl@0: { sl@0: DEBPRN0; sl@0: CAudioOutputProxy* audioOutput = NULL; sl@0: CCustomInterfaceUtility* customInterface; sl@0: sl@0: customInterface = CCustomInterfaceUtility::NewL(aUtility); sl@0: CleanupStack::PushL( customInterface ); sl@0: sl@0: audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); sl@0: sl@0: if (audioOutput == NULL) sl@0: { sl@0: DEBPRN1("No Adaptation Support - leaving"); sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: CleanupStack::Pop(customInterface); sl@0: return audioOutput; sl@0: } sl@0: sl@0: // End of file sl@0: