|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #include <openmax/il/common/omxilspecversion.h> |
|
25 #include <openmax/il/loader/omxilcomponentif.h> |
|
26 #include <openmax/il/loader/omxilsymbiancomponentif.h> |
|
27 |
|
28 #include "omxiltestmd5sink.h" |
|
29 #include "omxiltestmd5sinkport.h" |
|
30 #include "omxiltestmd5sinkprocessingfunction.h" |
|
31 #include "omxiltestmd5sinkconfigmanager.h" |
|
32 #include "omxiltestmd5sink.hrh" |
|
33 #include "omxiltestmd5sinkconst.h" |
|
34 |
|
35 #ifdef DOMAIN_OTHER |
|
36 _LIT8(KOmxILComponentName, "OMX.NOKIA.TEST.OTHER.MD5SINK"); |
|
37 #endif |
|
38 |
|
39 _LIT8(KOmxILRole, "????"); |
|
40 |
|
41 #ifdef DOMAIN_OTHER |
|
42 OMXIL_COMPONENT_ECOM_ENTRYPOINT(KUidSymbianOmxILTestOtherMD5Sink); |
|
43 #endif |
|
44 |
|
45 // Component Entry Point |
|
46 OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE aComponent) |
|
47 { |
|
48 TInt err = COmxILTestMD5Sink::CreateComponent(aComponent); |
|
49 if (err == KErrNone) |
|
50 { |
|
51 return OMX_ErrorNone; |
|
52 } |
|
53 else |
|
54 { |
|
55 // TODO translate Symbian error code into OMX_ERRORTYPE |
|
56 return OMX_ErrorInsufficientResources; |
|
57 } |
|
58 } |
|
59 |
|
60 TInt COmxILTestMD5Sink::CreateComponent(OMX_HANDLETYPE hComponent) |
|
61 { |
|
62 COmxILTestMD5Sink* self = new COmxILTestMD5Sink(); |
|
63 |
|
64 if (!self) |
|
65 { |
|
66 return KErrNoMemory; |
|
67 } |
|
68 |
|
69 TRAPD(err, self->ConstructL(hComponent)); |
|
70 return err; |
|
71 } |
|
72 |
|
73 COmxILTestMD5Sink::COmxILTestMD5Sink() |
|
74 { |
|
75 // nothing to do |
|
76 } |
|
77 |
|
78 void COmxILTestMD5Sink::ConstructL(OMX_HANDLETYPE hComponent) |
|
79 { |
|
80 // STEP 1: Initialize the data received from the IL Core |
|
81 COmxILComponent::ConstructL(hComponent); |
|
82 |
|
83 // STEP 2: Create the call backs holder... |
|
84 MOmxILCallbackNotificationIf* callbackNotificationIf=CreateCallbackManagerL(COmxILComponent::EOutofContext); |
|
85 |
|
86 // STEP 3: Create the MD5 sink-specific Processing Function... |
|
87 COmxILTestMD5SinkProcessingFunction* pProcessingFunction = COmxILTestMD5SinkProcessingFunction::NewL(*callbackNotificationIf); |
|
88 RegisterProcessingFunction(pProcessingFunction); |
|
89 |
|
90 // STEP 4: Create Port manager... |
|
91 CreatePortManagerL(COmxILComponent::ENonBufferSharingPortManager, |
|
92 TOmxILSpecVersion(), // OMX Version |
|
93 0, // The number of audio ports in this component |
|
94 0, // The starting audio port index |
|
95 0, // The number of image ports in this component |
|
96 0, // The starting image port index |
|
97 0, // The number of video ports in this component |
|
98 0, // The starting video port index |
|
99 #ifdef DOMAIN_OTHER |
|
100 1, // The number of other ports in this component |
|
101 #else |
|
102 0, // The number of other ports in this component |
|
103 #endif |
|
104 KMD5SINK_OPB0PORT_INDEX // The starting other port index |
|
105 ); |
|
106 |
|
107 // STEP 5: Create the non-port related configuration manager... |
|
108 RPointerArray<TDesC8> roleList; |
|
109 CleanupClosePushL(roleList); |
|
110 roleList.AppendL(&KOmxILRole); |
|
111 COmxILTestMD5SinkConfigManager* apSinkConfigManager = COmxILTestMD5SinkConfigManager::NewL(KOmxILComponentName, TOmxILSpecVersion(), roleList); |
|
112 RegisterConfigurationManager(apSinkConfigManager); |
|
113 CleanupStack::PopAndDestroy(&roleList); |
|
114 |
|
115 static_cast<COmxILTestMD5SinkProcessingFunction*>(GetProcessingFunction())->SetConfigManager(apSinkConfigManager); |
|
116 |
|
117 // create the input port |
|
118 ConstructSinkPortL(); |
|
119 CleanupStack::PushL(ipSinkPort); |
|
120 // .. and add it to the port manager... |
|
121 User::LeaveIfError(AddPort(ipSinkPort, OMX_DirInput)); |
|
122 CleanupStack::Pop(); |
|
123 |
|
124 // And finally, let's get everything started |
|
125 InitComponentL(); |
|
126 } |
|
127 |
|
128 COmxILTestMD5Sink::~COmxILTestMD5Sink() |
|
129 { |
|
130 } |
|
131 |
|
132 void COmxILTestMD5Sink::ConstructSinkPortL() |
|
133 { |
|
134 TOmxILCommonPortData aPortData( |
|
135 TOmxILSpecVersion(), |
|
136 KMD5SINK_OPB0PORT_INDEX, |
|
137 OMX_DirInput, |
|
138 KMinBuffers, |
|
139 KMinBufferSize, |
|
140 #ifdef DOMAIN_OTHER |
|
141 OMX_PortDomainOther, |
|
142 #endif |
|
143 OMX_FALSE, |
|
144 0, |
|
145 OMX_BufferSupplyInput, |
|
146 COmxILPort::KBufferMarkPropagationPortNotNeeded); |
|
147 |
|
148 ipSinkPort = COmxILTestMD5SinkPort::NewL(aPortData); |
|
149 } |