0
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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 <uri8.h>
|
|
25 |
|
|
26 |
#include "comxil3gpmuxerconfigmanager.h"
|
|
27 |
#include "log.h"
|
|
28 |
|
|
29 |
COmxIL3GPMuxerConfigManager* COmxIL3GPMuxerConfigManager::NewL(
|
|
30 |
const TDesC8& aComponentName,
|
|
31 |
const OMX_VERSIONTYPE& aComponentVersion,
|
|
32 |
const RPointerArray<TDesC8>& aComponentRoleList)
|
|
33 |
{
|
|
34 |
DEBUG_PRINTF(_L8("COmxIL3GPMuxerConfigManager::NewL"));
|
|
35 |
COmxIL3GPMuxerConfigManager* self = new(ELeave) COmxIL3GPMuxerConfigManager();
|
|
36 |
CleanupStack::PushL(self);
|
|
37 |
self->ConstructL(aComponentName, aComponentVersion, aComponentRoleList);
|
|
38 |
CleanupStack::Pop(self);
|
|
39 |
return self;
|
|
40 |
}
|
|
41 |
|
|
42 |
COmxIL3GPMuxerConfigManager::COmxIL3GPMuxerConfigManager()
|
|
43 |
{
|
|
44 |
// nothing to do
|
|
45 |
}
|
|
46 |
|
|
47 |
void COmxIL3GPMuxerConfigManager::ConstructL(const TDesC8& aComponentName,
|
|
48 |
const OMX_VERSIONTYPE& aComponentVersion,
|
|
49 |
const RPointerArray<TDesC8>& aComponentRoleList)
|
|
50 |
{
|
|
51 |
COmxILConfigManager::ConstructL(aComponentName, aComponentVersion, aComponentRoleList);
|
|
52 |
}
|
|
53 |
|
|
54 |
COmxIL3GPMuxerConfigManager::~COmxIL3GPMuxerConfigManager()
|
|
55 |
{
|
|
56 |
DEBUG_PRINTF(_L8("COmxIL3GPMuxerConfigManager::~COmxIL3GPMuxerConfigManager"));
|
|
57 |
delete iUri;
|
|
58 |
delete iFilename;
|
|
59 |
}
|
|
60 |
|
|
61 |
OMX_ERRORTYPE COmxIL3GPMuxerConfigManager::GetParameter(OMX_INDEXTYPE aParamIndex,
|
|
62 |
TAny* apComponentParameterStructure) const
|
|
63 |
{
|
|
64 |
DEBUG_PRINTF2(_L8("COmxIL3GPMuxerConfigManager::GetParameter : aParamIndex[%u]"), aParamIndex);
|
|
65 |
// try the base class first
|
|
66 |
OMX_ERRORTYPE error = COmxILConfigManager::GetParameter(aParamIndex, apComponentParameterStructure);
|
|
67 |
if(error != OMX_ErrorUnsupportedIndex)
|
|
68 |
{
|
|
69 |
return error;
|
|
70 |
}
|
|
71 |
|
|
72 |
if(aParamIndex == OMX_IndexParamContentURI)
|
|
73 |
{
|
|
74 |
if(!iUri)
|
|
75 |
{
|
|
76 |
// content URI has not yet been set
|
|
77 |
return OMX_ErrorUnsupportedSetting; // TODO check return code
|
|
78 |
}
|
|
79 |
OMX_PARAM_CONTENTURITYPE* apContentURI = reinterpret_cast<OMX_PARAM_CONTENTURITYPE*>(apComponentParameterStructure);
|
|
80 |
TPtr8 aDestDes(apContentURI->contentURI, apContentURI->nSize - _FOFF(OMX_PARAM_CONTENTURITYPE, contentURI));
|
|
81 |
// using >= as a byte has to be left for the null terminator
|
|
82 |
if(iUri->Length() >= aDestDes.MaxLength())
|
|
83 |
{
|
|
84 |
// not enough room in supplied struct to copy URI
|
|
85 |
return OMX_ErrorOverflow; // TODO check return code
|
|
86 |
}
|
|
87 |
else
|
|
88 |
{
|
|
89 |
aDestDes = *iUri;
|
|
90 |
aDestDes.Append('\0');
|
|
91 |
return OMX_ErrorNone;
|
|
92 |
}
|
|
93 |
}
|
|
94 |
return OMX_ErrorUnsupportedIndex;
|
|
95 |
}
|
|
96 |
|
|
97 |
OMX_ERRORTYPE COmxIL3GPMuxerConfigManager::SetParameter(OMX_INDEXTYPE aParamIndex,
|
|
98 |
const TAny* aComponentParameterStructure,
|
|
99 |
OMX_BOOL aInitTime)
|
|
100 |
{
|
|
101 |
DEBUG_PRINTF2(_L8("COmxIL3GPMuxerConfigManager::SetParameter : aParamIndex[%u]"), aParamIndex);
|
|
102 |
// try the base class first
|
|
103 |
OMX_ERRORTYPE error = COmxILConfigManager::SetParameter(aParamIndex, aComponentParameterStructure, aInitTime);
|
|
104 |
if(error != OMX_ErrorUnsupportedIndex)
|
|
105 |
{
|
|
106 |
return error;
|
|
107 |
}
|
|
108 |
|
|
109 |
if(aParamIndex == OMX_IndexParamContentURI)
|
|
110 |
{
|
|
111 |
const OMX_PARAM_CONTENTURITYPE* contentUri = reinterpret_cast<const OMX_PARAM_CONTENTURITYPE*>(aComponentParameterStructure);
|
|
112 |
TPtrC8 aUriDes(contentUri->contentURI);
|
|
113 |
|
|
114 |
// validate URI by converting to filename
|
|
115 |
TUriParser8 parser;
|
|
116 |
if(parser.Parse(aUriDes) != KErrNone)
|
|
117 |
{
|
|
118 |
return OMX_ErrorBadParameter;
|
|
119 |
}
|
|
120 |
|
|
121 |
HBufC* newFilename = NULL;
|
|
122 |
TInt error;
|
|
123 |
TRAP(error, newFilename = parser.GetFileNameL());
|
|
124 |
if(error != KErrNone)
|
|
125 |
{
|
|
126 |
return OMX_ErrorBadParameter;
|
|
127 |
}
|
|
128 |
|
|
129 |
// retain a copy of the original URI for GetParameter
|
|
130 |
HBufC8* newUri = HBufC8::New(aUriDes.Length());
|
|
131 |
if(!newUri)
|
|
132 |
{
|
|
133 |
delete newFilename;
|
|
134 |
return OMX_ErrorInsufficientResources;
|
|
135 |
}
|
|
136 |
*newUri = aUriDes;
|
|
137 |
|
|
138 |
delete iUri;
|
|
139 |
iUri = newUri;
|
|
140 |
delete iFilename;
|
|
141 |
iFilename = newFilename;
|
|
142 |
|
|
143 |
return OMX_ErrorNone;
|
|
144 |
}
|
|
145 |
|
|
146 |
return OMX_ErrorUnsupportedIndex;
|
|
147 |
}
|
|
148 |
|
|
149 |
const HBufC* COmxIL3GPMuxerConfigManager::Filename() const
|
|
150 |
{
|
|
151 |
return iFilename;
|
|
152 |
}
|