sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <mdf/codecapivideoresolverutils.h>
|
sl@0
|
17 |
#include <mmf/devvideo/devvideoplay.h>
|
sl@0
|
18 |
#include "codecapiresolverconsts.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
Creates a new CCodecApiVideoOpaqueData object.
|
sl@0
|
22 |
@param aOpaqueData
|
sl@0
|
23 |
A reference to the opaque data value.
|
sl@0
|
24 |
@return A pointer to the newly constructed match data object.
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
EXPORT_C CCodecApiVideoOpaqueData* CCodecApiVideoOpaqueData::NewL(const TDesC8& aOpaqueData)
|
sl@0
|
27 |
{
|
sl@0
|
28 |
CCodecApiVideoOpaqueData* result = CCodecApiVideoOpaqueData::NewLC(aOpaqueData);
|
sl@0
|
29 |
CleanupStack::Pop(result);
|
sl@0
|
30 |
return result;
|
sl@0
|
31 |
}
|
sl@0
|
32 |
|
sl@0
|
33 |
|
sl@0
|
34 |
/**
|
sl@0
|
35 |
Creates a new CCodecApiOpaqueData object and leaves a pointer to it on the cleanup stack.
|
sl@0
|
36 |
@param aOpaqueData
|
sl@0
|
37 |
A reference to the opaque data value.
|
sl@0
|
38 |
@return A pointer to the newly constructed match data object.
|
sl@0
|
39 |
*/
|
sl@0
|
40 |
EXPORT_C CCodecApiVideoOpaqueData* CCodecApiVideoOpaqueData::NewLC(const TDesC8& aOpaqueData)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
CCodecApiVideoOpaqueData* result = new (ELeave) CCodecApiVideoOpaqueData(aOpaqueData);
|
sl@0
|
43 |
CleanupStack::PushL(result);
|
sl@0
|
44 |
result->ConstructL();
|
sl@0
|
45 |
return result;
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
|
sl@0
|
49 |
/**
|
sl@0
|
50 |
Constructor
|
sl@0
|
51 |
@param aOpaqueData
|
sl@0
|
52 |
A reference to the opaque data value.
|
sl@0
|
53 |
*/
|
sl@0
|
54 |
CCodecApiVideoOpaqueData::CCodecApiVideoOpaqueData(const TDesC8& aOpaqueData) :
|
sl@0
|
55 |
CCodecApiOpaqueData(aOpaqueData),
|
sl@0
|
56 |
iManufacturer(NULL)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
Sets up the data inside the class by calling <code>ParseTaggedDataL()</code>.
|
sl@0
|
62 |
*/
|
sl@0
|
63 |
void CCodecApiVideoOpaqueData::ConstructL()
|
sl@0
|
64 |
{
|
sl@0
|
65 |
ParseTaggedDataL();
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
|
sl@0
|
69 |
/**
|
sl@0
|
70 |
Returns the value of the maximun picture size data member.
|
sl@0
|
71 |
@return The maximum picture size.
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
EXPORT_C const TSize& CCodecApiVideoOpaqueData::MaxPictureSize() const
|
sl@0
|
74 |
{
|
sl@0
|
75 |
return iMaxPictureSize;
|
sl@0
|
76 |
}
|
sl@0
|
77 |
|
sl@0
|
78 |
/**
|
sl@0
|
79 |
Returns the value of the manufacturer name data member.
|
sl@0
|
80 |
@return Constant reference to the manufactured name.
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
EXPORT_C const TDesC8& CCodecApiVideoOpaqueData::Manufacturer() const
|
sl@0
|
83 |
{
|
sl@0
|
84 |
if (iManufacturer)
|
sl@0
|
85 |
{
|
sl@0
|
86 |
return *iManufacturer;
|
sl@0
|
87 |
}
|
sl@0
|
88 |
return KNullDesC8;
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
/**
|
sl@0
|
92 |
Returns the array with values for the picture rate and size.
|
sl@0
|
93 |
@return Array containing the picture rate and size values.
|
sl@0
|
94 |
*/
|
sl@0
|
95 |
EXPORT_C const RArray<TPictureRateAndSize>& CCodecApiVideoOpaqueData::MaxPictureRates() const
|
sl@0
|
96 |
{
|
sl@0
|
97 |
return iMaxPictureRates;
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
|
sl@0
|
101 |
/**
|
sl@0
|
102 |
Sets the values in the TPictureRateAndSize structure.
|
sl@0
|
103 |
@param aData
|
sl@0
|
104 |
A constant reference to the data containting values for TPictureRateAndSize.
|
sl@0
|
105 |
*/
|
sl@0
|
106 |
void CCodecApiVideoOpaqueData::SetPictureRateAndSizeL(const TDesC8& aData)
|
sl@0
|
107 |
{
|
sl@0
|
108 |
TPictureRateAndSize pictureRateAndSize;
|
sl@0
|
109 |
TInt position = 0;
|
sl@0
|
110 |
TUint32 value = 0;
|
sl@0
|
111 |
TPtrC8 restOfData = aData;
|
sl@0
|
112 |
position = aData.MatchF(KComma);
|
sl@0
|
113 |
if (position == KErrNotFound)
|
sl@0
|
114 |
{
|
sl@0
|
115 |
User::Leave(KErrCorrupt);
|
sl@0
|
116 |
}
|
sl@0
|
117 |
TLex8 lex(restOfData.Left(position));
|
sl@0
|
118 |
User::LeaveIfError(lex.Val(value, EDecimal));
|
sl@0
|
119 |
pictureRateAndSize.iPictureRate = value;
|
sl@0
|
120 |
position++;
|
sl@0
|
121 |
restOfData.Set(aData.Mid(position));
|
sl@0
|
122 |
position = restOfData.MatchF(KComma);
|
sl@0
|
123 |
if (position == KErrNotFound)
|
sl@0
|
124 |
{
|
sl@0
|
125 |
User::Leave(KErrCorrupt);
|
sl@0
|
126 |
}
|
sl@0
|
127 |
lex = restOfData.Left(position);
|
sl@0
|
128 |
User::LeaveIfError(lex.Val(value, EDecimal));
|
sl@0
|
129 |
pictureRateAndSize.iPictureSize.iWidth = value;
|
sl@0
|
130 |
position++;
|
sl@0
|
131 |
restOfData.Set(restOfData.Mid(position));
|
sl@0
|
132 |
lex = restOfData;
|
sl@0
|
133 |
User::LeaveIfError(lex.Val(value, EDecimal));
|
sl@0
|
134 |
pictureRateAndSize.iPictureSize.iHeight = value;
|
sl@0
|
135 |
|
sl@0
|
136 |
iMaxPictureRates.AppendL(pictureRateAndSize);
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
/**
|
sl@0
|
140 |
Sets the values in the TPictureRateAndSize structure.
|
sl@0
|
141 |
@param aData
|
sl@0
|
142 |
A constant reference to the data containting values for TPictureRateAndSize.
|
sl@0
|
143 |
*/
|
sl@0
|
144 |
void CCodecApiVideoOpaqueData::SetMaxPictureSizeL(const TDesC8& aData)
|
sl@0
|
145 |
{
|
sl@0
|
146 |
TPictureRateAndSize pictureRateAndSize;
|
sl@0
|
147 |
TInt position = 0;
|
sl@0
|
148 |
TPtrC8 restOfData = aData.Mid(position);
|
sl@0
|
149 |
position = restOfData.MatchF(KComma);
|
sl@0
|
150 |
if (position == KErrNotFound)
|
sl@0
|
151 |
{
|
sl@0
|
152 |
User::Leave(KErrCorrupt);
|
sl@0
|
153 |
}
|
sl@0
|
154 |
iMaxPictureSize.iWidth = ConvertTextToTUintL(restOfData.Left(position));
|
sl@0
|
155 |
position++;
|
sl@0
|
156 |
restOfData.Set(aData.Mid(position));
|
sl@0
|
157 |
iMaxPictureSize.iHeight = ConvertTextToTUintL(restOfData);
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
/**
|
sl@0
|
161 |
Sets member data to the value of the given opaque data, based upon the tag value provided.
|
sl@0
|
162 |
@param aTag
|
sl@0
|
163 |
A constant reference to a tag from the opaque data. Can be \<m\>, \<l\>, \<p\>.
|
sl@0
|
164 |
@param aData
|
sl@0
|
165 |
The data associated with a tag.
|
sl@0
|
166 |
*/
|
sl@0
|
167 |
void CCodecApiVideoOpaqueData::ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
if (aTag == KManufacturer)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
if(!iManufacturer)
|
sl@0
|
172 |
{
|
sl@0
|
173 |
iManufacturer = aData.AllocL();
|
sl@0
|
174 |
return;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
else
|
sl@0
|
177 |
{
|
sl@0
|
178 |
User::Leave(KErrCorrupt);
|
sl@0
|
179 |
}
|
sl@0
|
180 |
}
|
sl@0
|
181 |
if (aTag == KMaxPictureSize)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
SetMaxPictureSizeL(aData);
|
sl@0
|
184 |
return;
|
sl@0
|
185 |
}
|
sl@0
|
186 |
if (aTag == KListOfPictureRateAndSize)
|
sl@0
|
187 |
{
|
sl@0
|
188 |
return SetPictureRateAndSizeL(aData);
|
sl@0
|
189 |
}
|
sl@0
|
190 |
CCodecApiOpaqueData::ProcessTaggedDataL(aTag, aData);
|
sl@0
|
191 |
}
|
sl@0
|
192 |
|
sl@0
|
193 |
|
sl@0
|
194 |
/**
|
sl@0
|
195 |
Destructor
|
sl@0
|
196 |
*/
|
sl@0
|
197 |
CCodecApiVideoOpaqueData::~CCodecApiVideoOpaqueData()
|
sl@0
|
198 |
{
|
sl@0
|
199 |
delete iManufacturer;
|
sl@0
|
200 |
iMaxPictureRates.Reset();
|
sl@0
|
201 |
iMaxPictureRates.Close();
|
sl@0
|
202 |
}
|
sl@0
|
203 |
|