|
1 /* |
|
2 * Copyright (c) 2005 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: This class is capture://radio protocol |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.microedition.media.protocol.capture.radio; |
|
19 |
|
20 import com.nokia.microedition.media.Locator; |
|
21 import com.nokia.microedition.media.InternalPlayer; |
|
22 import com.nokia.microedition.media.PlayerImpl; |
|
23 import javax.microedition.media.MediaException; |
|
24 import com.nokia.mj.impl.rt.legacy.NativeError; |
|
25 import com.nokia.microedition.media.ManagerImpl; |
|
26 import com.nokia.amms.control.tuner.TunerControlImpl; |
|
27 |
|
28 /** |
|
29 * This class is capture://radio protocol. |
|
30 */ |
|
31 public class Protocol |
|
32 implements com.nokia.microedition.media.protocol.Protocol |
|
33 { |
|
34 // Constants |
|
35 private static final String TUNER_CONTROL_NAME = |
|
36 "javax.microedition.amms.control.tuner.TunerControl"; |
|
37 |
|
38 /** |
|
39 * Default constructor. |
|
40 */ |
|
41 public Protocol() |
|
42 { |
|
43 } |
|
44 |
|
45 /** |
|
46 * From Protocol |
|
47 */ |
|
48 public InternalPlayer createPlayer(Locator aLocator) |
|
49 throws java.io.IOException, |
|
50 MediaException, |
|
51 java.lang.SecurityException |
|
52 { |
|
53 // JDEBUG( "AMMS Tuner Protocol createPlayer" ); |
|
54 |
|
55 String locatorParameters = aLocator.getParameters(); |
|
56 |
|
57 // Create native tuner player. The native tuner player |
|
58 // creates a native tuner control and adds it to its list. |
|
59 // Handle for the native player are returned. |
|
60 int playerHandle = 0; |
|
61 playerHandle = _createNativeTunerPlayer( |
|
62 ManagerImpl.getEventSource(), |
|
63 locatorParameters); |
|
64 |
|
65 // JDEBUG( "AMMS Tuner Protocol createPlayer playerHandle = " + playerHandle ); |
|
66 |
|
67 NativeError.check(playerHandle); |
|
68 |
|
69 PlayerImpl tunerPlayer = new PlayerImpl(playerHandle); |
|
70 |
|
71 return tunerPlayer; |
|
72 } |
|
73 |
|
74 /** |
|
75 * Creates native tuner player. |
|
76 * Native tuner player creates and adds native tuner control. |
|
77 * |
|
78 * @param aEventSourceHandle Handle to event source. |
|
79 * @param aLocatorParameters |
|
80 * @return Error code. |
|
81 */ |
|
82 private native int _createNativeTunerPlayer(int aEventSourceHandle, |
|
83 String aLocatorParameters); |
|
84 } |