Update contrib.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <mdf/codecapivideoresolverutils.h>
17 #include <mmf/devvideo/devvideoplay.h>
18 #include "codecapiresolverconsts.h"
21 Creates a new CCodecApiVideoOpaqueData object.
23 A reference to the opaque data value.
24 @return A pointer to the newly constructed match data object.
26 EXPORT_C CCodecApiVideoOpaqueData* CCodecApiVideoOpaqueData::NewL(const TDesC8& aOpaqueData)
28 CCodecApiVideoOpaqueData* result = CCodecApiVideoOpaqueData::NewLC(aOpaqueData);
29 CleanupStack::Pop(result);
35 Creates a new CCodecApiOpaqueData object and leaves a pointer to it on the cleanup stack.
37 A reference to the opaque data value.
38 @return A pointer to the newly constructed match data object.
40 EXPORT_C CCodecApiVideoOpaqueData* CCodecApiVideoOpaqueData::NewLC(const TDesC8& aOpaqueData)
42 CCodecApiVideoOpaqueData* result = new (ELeave) CCodecApiVideoOpaqueData(aOpaqueData);
43 CleanupStack::PushL(result);
52 A reference to the opaque data value.
54 CCodecApiVideoOpaqueData::CCodecApiVideoOpaqueData(const TDesC8& aOpaqueData) :
55 CCodecApiOpaqueData(aOpaqueData),
61 Sets up the data inside the class by calling <code>ParseTaggedDataL()</code>.
63 void CCodecApiVideoOpaqueData::ConstructL()
70 Returns the value of the maximun picture size data member.
71 @return The maximum picture size.
73 EXPORT_C const TSize& CCodecApiVideoOpaqueData::MaxPictureSize() const
75 return iMaxPictureSize;
79 Returns the value of the manufacturer name data member.
80 @return Constant reference to the manufactured name.
82 EXPORT_C const TDesC8& CCodecApiVideoOpaqueData::Manufacturer() const
86 return *iManufacturer;
92 Returns the array with values for the picture rate and size.
93 @return Array containing the picture rate and size values.
95 EXPORT_C const RArray<TPictureRateAndSize>& CCodecApiVideoOpaqueData::MaxPictureRates() const
97 return iMaxPictureRates;
102 Sets the values in the TPictureRateAndSize structure.
104 A constant reference to the data containting values for TPictureRateAndSize.
106 void CCodecApiVideoOpaqueData::SetPictureRateAndSizeL(const TDesC8& aData)
108 TPictureRateAndSize pictureRateAndSize;
111 TPtrC8 restOfData = aData;
112 position = aData.MatchF(KComma);
113 if (position == KErrNotFound)
115 User::Leave(KErrCorrupt);
117 TLex8 lex(restOfData.Left(position));
118 User::LeaveIfError(lex.Val(value, EDecimal));
119 pictureRateAndSize.iPictureRate = value;
121 restOfData.Set(aData.Mid(position));
122 position = restOfData.MatchF(KComma);
123 if (position == KErrNotFound)
125 User::Leave(KErrCorrupt);
127 lex = restOfData.Left(position);
128 User::LeaveIfError(lex.Val(value, EDecimal));
129 pictureRateAndSize.iPictureSize.iWidth = value;
131 restOfData.Set(restOfData.Mid(position));
133 User::LeaveIfError(lex.Val(value, EDecimal));
134 pictureRateAndSize.iPictureSize.iHeight = value;
136 iMaxPictureRates.AppendL(pictureRateAndSize);
140 Sets the values in the TPictureRateAndSize structure.
142 A constant reference to the data containting values for TPictureRateAndSize.
144 void CCodecApiVideoOpaqueData::SetMaxPictureSizeL(const TDesC8& aData)
146 TPictureRateAndSize pictureRateAndSize;
148 TPtrC8 restOfData = aData.Mid(position);
149 position = restOfData.MatchF(KComma);
150 if (position == KErrNotFound)
152 User::Leave(KErrCorrupt);
154 iMaxPictureSize.iWidth = ConvertTextToTUintL(restOfData.Left(position));
156 restOfData.Set(aData.Mid(position));
157 iMaxPictureSize.iHeight = ConvertTextToTUintL(restOfData);
161 Sets member data to the value of the given opaque data, based upon the tag value provided.
163 A constant reference to a tag from the opaque data. Can be \<m\>, \<l\>, \<p\>.
165 The data associated with a tag.
167 void CCodecApiVideoOpaqueData::ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData)
169 if (aTag == KManufacturer)
173 iManufacturer = aData.AllocL();
178 User::Leave(KErrCorrupt);
181 if (aTag == KMaxPictureSize)
183 SetMaxPictureSizeL(aData);
186 if (aTag == KListOfPictureRateAndSize)
188 return SetPictureRateAndSizeL(aData);
190 CCodecApiOpaqueData::ProcessTaggedDataL(aTag, aData);
197 CCodecApiVideoOpaqueData::~CCodecApiVideoOpaqueData()
199 delete iManufacturer;
200 iMaxPictureRates.Reset();
201 iMaxPictureRates.Close();