|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Creates CAMMSPriorityControl and adds it to the player. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //#include <jutils.h> |
|
20 #include <logger.h> |
|
21 |
|
22 #include "com_nokia_amms_AMMSPlugin.h" |
|
23 #include <mmafunctionserver.h> |
|
24 #include <cmmaplayer.h> |
|
25 #include "cammsprioritycontrol.h" |
|
26 #include "cammsaudiooutputcontrol.h" |
|
27 |
|
28 /** |
|
29 * Creates CAMMSPriorityControl and adds it to the player. |
|
30 * Returns the created control through the given parameter. |
|
31 */ |
|
32 static void CreatePriorityControlL(CMMAPlayer* aPlayer, |
|
33 CAMMSPriorityControl** aControl) |
|
34 { |
|
35 LOG( EJavaAMMS, EInfo, "CreatePriorityControlL +"); |
|
36 |
|
37 CAMMSPriorityControl* control = CAMMSPriorityControl::NewLC(aPlayer); |
|
38 |
|
39 aPlayer->AddControlL(control); |
|
40 |
|
41 CleanupStack::Pop(control); |
|
42 |
|
43 *aControl = control; |
|
44 |
|
45 LOG( EJavaAMMS, EInfo, "CreatePriorityControlL -"); |
|
46 } |
|
47 |
|
48 /** |
|
49 * Creates CAMMSAudioOutputControl and adds it to the player. |
|
50 * Returns the created control through the given parameter. |
|
51 */ |
|
52 static void CreateAudioOutputControlL(CMMAPlayer* aPlayer, |
|
53 CAMMSAudioOutputControl** aControl) |
|
54 { |
|
55 LOG( EJavaAMMS, EInfo, "CreatePriorityControlL +"); |
|
56 |
|
57 CAMMSAudioOutputControl* control = CAMMSAudioOutputControl::NewLC(aPlayer); |
|
58 |
|
59 aPlayer->AddControlL(control); |
|
60 |
|
61 CleanupStack::Pop(control); |
|
62 |
|
63 *aControl = control; |
|
64 |
|
65 LOG( EJavaAMMS, EInfo, "CAMMSAudioOutputControl -"); |
|
66 } |
|
67 /* |
|
68 * Class: com_nokia_amms_AMMSPlugin |
|
69 * Method: _createNativePriorityControl |
|
70 * |
|
71 */ |
|
72 JNIEXPORT jint JNICALL Java_com_nokia_amms_AMMSPlugin__1createNativePriorityControl( |
|
73 JNIEnv*, |
|
74 jclass, |
|
75 jint aEventSource, |
|
76 jint aPlayer) |
|
77 { |
|
78 LOG( EJavaAMMS, EInfo, "AMMS: Java_com_nokia_amms_AMMSPlugin__1createNativePriorityControl + "); |
|
79 |
|
80 MMAFunctionServer* eventSource = |
|
81 reinterpret_cast< MMAFunctionServer* >(aEventSource); |
|
82 |
|
83 CMMAPlayer* player = reinterpret_cast< CMMAPlayer* >(aPlayer); |
|
84 |
|
85 |
|
86 // Create control and add it to the player. |
|
87 CAMMSPriorityControl* control = NULL; |
|
88 |
|
89 TInt handle = |
|
90 eventSource->ExecuteTrap(&CreatePriorityControlL, player, &control); |
|
91 |
|
92 __ASSERT_DEBUG(control, User::Invariant()); |
|
93 |
|
94 if (handle == KErrNone) |
|
95 { |
|
96 handle = reinterpret_cast<TInt>(control); |
|
97 } |
|
98 |
|
99 LOG( EJavaAMMS, EInfo, "AMMS: Java_com_nokia_amms_AMMSPlugin__1createNativePriorityControl - "); |
|
100 |
|
101 return handle; |
|
102 } |
|
103 |
|
104 /* |
|
105 * Class: com_nokia_amms_AMMSPlugin |
|
106 * Method: _createNativeAudioOutputControl |
|
107 * |
|
108 */ |
|
109 |
|
110 JNIEXPORT jint JNICALL Java_com_nokia_amms_AMMSPlugin__1createNativeAudioOutputControl( |
|
111 JNIEnv*, |
|
112 jclass, |
|
113 jint aEventSource, |
|
114 jint aPlayer) |
|
115 { |
|
116 LOG( EJavaAMMS, EInfo, "AMMS: Java_com_nokia_amms_AMMSPlugin__1createNativeAudioOutputControl + "); |
|
117 |
|
118 MMAFunctionServer* eventSource = |
|
119 reinterpret_cast< MMAFunctionServer* >(aEventSource); |
|
120 |
|
121 CMMAPlayer* player = reinterpret_cast< CMMAPlayer* >(aPlayer); |
|
122 |
|
123 |
|
124 // Create control and add it to the player. |
|
125 CAMMSAudioOutputControl* control = NULL; |
|
126 |
|
127 TInt handle = |
|
128 eventSource->ExecuteTrap(&CreateAudioOutputControlL, player, &control); |
|
129 |
|
130 __ASSERT_DEBUG(control, User::Invariant()); |
|
131 |
|
132 if (handle == KErrNone) |
|
133 { |
|
134 handle = reinterpret_cast<TInt>(control); |
|
135 } |
|
136 |
|
137 LOG( EJavaAMMS, EInfo, "AMMS: Java_com_nokia_amms_AMMSPlugin__1createNativeAudioOutputControl - "); |
|
138 |
|
139 return handle; |
|
140 } |
|
141 // End of File |