os/mm/devsoundextensions/audiorouting/Output/AudioOutputBase/src/AudioOutput.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:   This is the implementation of the CAudioOutput class.
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
sl@0
    21
// INCLUDE FILES
sl@0
    22
#include <mmf/server/sounddevice.h>
sl@0
    23
#include "AudioOutputProxy.h"
sl@0
    24
#include "AudioOutputMessageTypes.h"
sl@0
    25
#include <CustomInterfaceUtility.h>
sl@0
    26
#include <CustomCommandUtility.h>
sl@0
    27
#include <mdaaudiotoneplayer.h>
sl@0
    28
#include <mdaaudiooutputstream.h>
sl@0
    29
#include <AudioOutput.h>
sl@0
    30
#include <DrmAudioSamplePlayer.h>
sl@0
    31
#include <videoplayer.h>
sl@0
    32
sl@0
    33
#ifdef _DEBUG
sl@0
    34
#define DEBPRN0         RDebug::Printf( "%s", __PRETTY_FUNCTION__);
sl@0
    35
#define DEBPRN1(str)    RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
sl@0
    36
#else
sl@0
    37
#define DEBPRN0
sl@0
    38
#define DEBPRN1(str)
sl@0
    39
#endif
sl@0
    40
sl@0
    41
// Two-phased constructor.
sl@0
    42
EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioPlayerUtility& aUtility)
sl@0
    43
    {
sl@0
    44
    DEBPRN0;
sl@0
    45
    CAudioOutputProxy* audioOutput = NULL;
sl@0
    46
    CCustomInterfaceUtility* customInterface;
sl@0
    47
sl@0
    48
    customInterface = CCustomInterfaceUtility::NewL(aUtility);
sl@0
    49
    CleanupStack::PushL( customInterface );
sl@0
    50
sl@0
    51
    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
sl@0
    52
sl@0
    53
	if (audioOutput == NULL)
sl@0
    54
		{
sl@0
    55
        DEBPRN1("No Adaptation Support - leaving");
sl@0
    56
		User::Leave(KErrNotSupported);
sl@0
    57
		}
sl@0
    58
sl@0
    59
	CleanupStack::Pop(customInterface);
sl@0
    60
    return audioOutput;
sl@0
    61
    }
sl@0
    62
sl@0
    63
sl@0
    64
// Two-phased constructor.
sl@0
    65
EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioRecorderUtility& aUtility, TBool aRecordStream)
sl@0
    66
    {
sl@0
    67
    DEBPRN0;
sl@0
    68
    CAudioOutputProxy* audioOutput = NULL;
sl@0
    69
    CCustomInterfaceUtility* customInterface;
sl@0
    70
sl@0
    71
    customInterface = CCustomInterfaceUtility::NewL(aUtility,aRecordStream);
sl@0
    72
    CleanupStack::PushL( customInterface );
sl@0
    73
sl@0
    74
    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
sl@0
    75
sl@0
    76
	if (audioOutput == NULL)
sl@0
    77
		{
sl@0
    78
        DEBPRN1("No Adaptation Support - leaving");
sl@0
    79
		User::Leave(KErrNotSupported);
sl@0
    80
		}
sl@0
    81
sl@0
    82
	CleanupStack::Pop(customInterface);
sl@0
    83
    return audioOutput;
sl@0
    84
    }
sl@0
    85
sl@0
    86
sl@0
    87
// Two-phased constructor.
sl@0
    88
EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioOutputStream& aUtility)
sl@0
    89
    {
sl@0
    90
    DEBPRN0;
sl@0
    91
    CAudioOutputProxy* audioOutput = NULL;
sl@0
    92
    audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
sl@0
    93
sl@0
    94
	if (audioOutput == NULL)
sl@0
    95
		{
sl@0
    96
        DEBPRN1("No Adaptation Support - leaving");
sl@0
    97
		User::Leave(KErrNotSupported);
sl@0
    98
		}
sl@0
    99
sl@0
   100
    return audioOutput;
sl@0
   101
    }
sl@0
   102
sl@0
   103
// Two-phased constructor.
sl@0
   104
EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioToneUtility& aUtility)
sl@0
   105
    {
sl@0
   106
    DEBPRN0;
sl@0
   107
    CAudioOutputProxy* audioOutput = NULL;
sl@0
   108
    audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
sl@0
   109
sl@0
   110
	if (audioOutput == NULL)
sl@0
   111
		{
sl@0
   112
        DEBPRN1("No Adaptation Support - leaving");
sl@0
   113
		User::Leave(KErrNotSupported);
sl@0
   114
		}
sl@0
   115
sl@0
   116
    return audioOutput;
sl@0
   117
    }
sl@0
   118
sl@0
   119
// Two-phased constructor.
sl@0
   120
EXPORT_C CAudioOutput* CAudioOutput::NewL(CMMFDevSound& aDevSound)
sl@0
   121
    {
sl@0
   122
    DEBPRN0;
sl@0
   123
    CAudioOutputProxy* audioOutput = NULL;
sl@0
   124
    audioOutput = (CAudioOutputProxy*)aDevSound.CustomInterface(KUidAudioOutput);
sl@0
   125
sl@0
   126
	if (audioOutput == NULL)
sl@0
   127
		{
sl@0
   128
        DEBPRN1("No Adaptation Support - leaving");
sl@0
   129
		User::Leave(KErrNotSupported);
sl@0
   130
		}
sl@0
   131
sl@0
   132
    return audioOutput;
sl@0
   133
    }
sl@0
   134
sl@0
   135
// Two-phased constructor.
sl@0
   136
EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomInterface& aUtility)
sl@0
   137
    {
sl@0
   138
    DEBPRN0;
sl@0
   139
	CAudioOutputProxy* audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
sl@0
   140
sl@0
   141
	if ( !audioOutput )
sl@0
   142
		{
sl@0
   143
		DEBPRN1("No Adaptation Support - leaving");
sl@0
   144
		User::Leave(KErrNotSupported);
sl@0
   145
		}
sl@0
   146
sl@0
   147
    return audioOutput;
sl@0
   148
    }
sl@0
   149
sl@0
   150
// Two-phased constructor.
sl@0
   151
EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomCommand& aUtility)
sl@0
   152
    {
sl@0
   153
    DEBPRN0;
sl@0
   154
    CAudioOutputProxy* audioOutput = NULL;
sl@0
   155
    CCustomInterfaceUtility* customInterface;
sl@0
   156
sl@0
   157
    customInterface = CCustomInterfaceUtility::NewL(aUtility);
sl@0
   158
    CleanupStack::PushL( customInterface );
sl@0
   159
sl@0
   160
    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
sl@0
   161
sl@0
   162
	if (audioOutput == NULL)
sl@0
   163
		{
sl@0
   164
        DEBPRN1("No Adaptation Support - leaving");
sl@0
   165
		User::Leave(KErrNotSupported);
sl@0
   166
		}
sl@0
   167
sl@0
   168
	CleanupStack::Pop(customInterface);
sl@0
   169
    return audioOutput;
sl@0
   170
    }
sl@0
   171
sl@0
   172
// Two-phased constructor.
sl@0
   173
EXPORT_C CAudioOutput* CAudioOutput::NewL(CMidiClientUtility& aUtility)
sl@0
   174
    {
sl@0
   175
    DEBPRN0;
sl@0
   176
    CAudioOutputProxy* audioOutput = NULL;
sl@0
   177
    CCustomInterfaceUtility* customInterface;
sl@0
   178
sl@0
   179
    customInterface = CCustomInterfaceUtility::NewL(aUtility);
sl@0
   180
    CleanupStack::PushL( customInterface );
sl@0
   181
sl@0
   182
    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
sl@0
   183
sl@0
   184
	if (audioOutput == NULL)
sl@0
   185
		{
sl@0
   186
        DEBPRN1("No Adaptation Support - leaving");
sl@0
   187
		User::Leave(KErrNotSupported);
sl@0
   188
		}
sl@0
   189
sl@0
   190
	CleanupStack::Pop(customInterface);
sl@0
   191
    return audioOutput;
sl@0
   192
    }
sl@0
   193
sl@0
   194
// Two-phased constructor.
sl@0
   195
EXPORT_C CAudioOutput* CAudioOutput::NewL(CDrmPlayerUtility& aUtility)
sl@0
   196
    {
sl@0
   197
    DEBPRN0;
sl@0
   198
    CAudioOutputProxy* audioOutput = NULL;
sl@0
   199
    CCustomInterfaceUtility* customInterface;
sl@0
   200
sl@0
   201
    customInterface = CCustomInterfaceUtility::NewL(aUtility);
sl@0
   202
    CleanupStack::PushL( customInterface );
sl@0
   203
sl@0
   204
    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
sl@0
   205
sl@0
   206
	if (audioOutput == NULL)
sl@0
   207
		{
sl@0
   208
        DEBPRN1("No Adaptation Support - leaving");
sl@0
   209
		User::Leave(KErrNotSupported);
sl@0
   210
		}
sl@0
   211
sl@0
   212
	CleanupStack::Pop(customInterface);
sl@0
   213
    return audioOutput;
sl@0
   214
    }
sl@0
   215
sl@0
   216
EXPORT_C CAudioOutput* CAudioOutput::NewL(CVideoPlayerUtility& aUtility)
sl@0
   217
    {
sl@0
   218
    DEBPRN0;
sl@0
   219
    CAudioOutputProxy* audioOutput = NULL;
sl@0
   220
    CCustomInterfaceUtility* customInterface;
sl@0
   221
sl@0
   222
    customInterface = CCustomInterfaceUtility::NewL(aUtility);
sl@0
   223
    CleanupStack::PushL( customInterface );
sl@0
   224
sl@0
   225
    audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
sl@0
   226
sl@0
   227
	if (audioOutput == NULL)
sl@0
   228
		{
sl@0
   229
        DEBPRN1("No Adaptation Support - leaving");
sl@0
   230
		User::Leave(KErrNotSupported);
sl@0
   231
		}
sl@0
   232
sl@0
   233
	CleanupStack::Pop(customInterface);
sl@0
   234
    return audioOutput;
sl@0
   235
    }
sl@0
   236
sl@0
   237
// End of file
sl@0
   238