--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_uvc.h Mon Oct 18 19:39:25 2010 +0900
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 2010 ISB.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description: UVC FOrmat Header
+*
+*/
+
+
+#include <comm.h>
+
+
+#ifndef WEBCAMERA_UVC_H_
+#define WEBCAMERA_UVC_H_
+
+
+#define KWebcameraEoh (TUint8)(0x80)
+#define KWebcameraErr (TUint8)(0x40)
+#define KWebcameraSti (TUint8)(0x20)
+#define KWebcameraRes (TUint8)(0x10)
+#define KWebcameraScr (TUint8)(0x08)
+#define KWebcameraPts (TUint8)(0x04)
+#define KWebcameraEof (TUint8)(0x02)
+#define KWebcameraFid (TUint8)(0x01)
+#define KWebcameraTokenCounter (TUint16)(0x1fff)
+
+
+/* UVC DescriptorType */
+#define KWebcameraSCUndefined (TUint8)(0x00)
+#define KWebcameraSCVideoControl (TUint8)(0x01)
+#define KWebcameraSCVideoStreaming (TUint8)(0x02)
+#define KWebcameraSCVideoInterfaceCollection (TUint8)(0x03)
+
+/* VideoStreaming DescriptorSubType */
+#define KWebcameraVSUndefined (TUint8)(0x00)
+#define KWebcameraVSInputHeader (TUint8)(0x01)
+#define KWebcameraVSOutputHeader (TUint8)(0x02)
+#define KWebcameraVSStillImageFrame (TUint8)(0x03)
+#define KWebcameraVSFormatUnconmpressed (TUint8)(0x04)
+#define KWebcameraVSFrameUncompressed (TUint8)(0x05)
+#define KWebcameraVSFormatJPEG (TUint8)(0x06)
+#define KWebcameraVSFrameJPEG (TUint8)(0x07)
+#define KWebcameraVSFormatMPEG2TS (TUint8)(0x0a)
+#define KWebcameraVSFormatDV (TUint8)(0x0c)
+#define KWebcameraVSColorFormat (TUint8)(0x0d)
+#define KWebcameraVSFormatFrameBased (TUint8)(0x10)
+#define KWebcameraVSFrameFrameBased (TUint8)(0x11)
+#define KWebcameraVSFormatStreamBased (TUint8)(0x12)
+
+/* VideoFormat(GUID) */
+#define KWebcameraYuy2 (TUint32)(0x32595559)
+#define KWebcameraVideoStream (TUint32)(0x73646976)
+
+class TWebcameraGuid
+ {
+public:
+ TUint32 iData1;
+ TUint16 iData2;
+ TUint16 iData3;
+ TUint8 iData4[8];
+ };
+
+class TWebcameraDataFortmat
+ {
+public:
+ TUint32 iFormatSize;
+ TUint32 iFlags;
+ TUint32 iSampleSize;
+ TUint32 iReserved;
+ TWebcameraGuid iMajorFormat;
+ TWebcameraGuid iSubFormat;
+ TWebcameraGuid iSpecifier;
+ };
+
+class TWebcameraRect
+ {
+public:
+ TInt32 iLeft;
+ TInt32 iTop;
+ TInt32 iRight;
+ TInt32 iBottom;
+ };
+
+class TWebcameraBitmapInfoHeader
+ {
+public:
+ TUint32 iSize;
+ TInt32 iWidth;
+ TInt32 iHeight;
+ TUint16 iPlanes;
+ TUint16 iBitCount;
+ TUint32 iCompression;
+ TUint32 iSizeImage;
+ TInt32 iXPelsPerMeter;
+ TInt32 iYPelsPerMeter;
+ TUint32 iClrUsed;
+ TUint32 iClrImportant;
+ };
+
+class TWebcameraVideoInfoHeader
+ {
+public:
+ TWebcameraRect iRcSource;
+ TWebcameraRect iRcTarget;
+ TUint32 iDwBitRate;
+ TUint32 iDwBitErrorRate;
+ Int64 iAvgTimePerFrame;
+ TWebcameraBitmapInfoHeader iBmiHeader;
+ };
+
+class TWebcameraDataInfo
+ {
+public:
+ TWebcameraDataFortmat iDataFortmat;
+ TWebcameraVideoInfoHeader iVideoInfoHeader;
+ };
+
+class TWebcameraUVCSourceClockReference
+ {
+public:
+ TUint16 iTokenCounter;
+ TUint32 iSourceTimeClock;
+ };
+
+class TWebcameraUVCHeaderFormat
+ {
+ /**
+ Variables that configure UVC Header.
+ */
+public:
+ TUint8 iHeaderLength;
+ TUint8 iHeaderInfo;
+ TUint32 iPresentationTime;
+ TWebcameraUVCSourceClockReference iSourceClockReference;
+ };
+
+class TWebcameraUVCFormatDescriptor
+ {
+public:
+ TUint8 iLength;
+ TUint8 iDescriptorType;
+ TUint8 iDescriptorSubType;
+ TUint8 iFormatIndex;
+ TUint8 iNumFrameDescriptor;
+ TWebcameraGuid iGuid;
+ TUint8 iBitsPerPixel;
+ TUint8 iDefaultFrameIndex;
+ TUint8 iAspectRatioX;
+ TUint8 iAspectRatioY;
+ TUint8 iInterlaceFlags;
+ TUint8 iCopyProtect;
+ TUint8 iDataoffset;
+ TUint8 iPacketLength1;
+ TUint32 iPacketLength2;
+ TUint8 iStrideLength;
+ TWebcameraGuid iGuidStrideFormat;
+ TUint8 iFlags;
+ TUint8 iVariableSize;
+ TUint32 iMaxVideoFrameBufferSize;
+ TUint8 iFormatType;
+ };
+
+class TWebcameraUVCFrameInterval
+ {
+public:
+ TUint32 iFrameInterval1;
+ TUint32 iFrameInterval2;
+ TUint32 iFrameInterval3;
+ };
+
+class TWebcameraUVCFrameDescriptor
+ {
+public:
+ TUint8 iLength;
+ TUint8 iDescriptorType;
+ TUint8 iDescriptorSubType;
+ TUint8 iFrameIndex;
+ TUint8 iCapabilities;
+ TUint16 iWidth;
+ TUint16 iHeight;
+ TUint32 iMinBitRate;
+ TUint32 iMaxBitRate;
+ TUint32 iMaxVideoFrameBufferSize;
+ TUint32 iDefaultFrameInterval;
+ TUint8 iFrameIntervalType;
+ TWebcameraUVCFrameInterval iFrameInterval;
+ TUint32 iBytesPerLine;
+ };
+
+class TWebcameraUVCDescriptor
+ {
+public:
+ TWebcameraUVCFormatDescriptor iFormatDescriptor;
+ TWebcameraUVCFrameDescriptor iFrameDescriptor;
+ };
+
+class TWebcameraUVC
+ {
+public:
+ TWebcameraUVCHeaderFormat iUVCHeader;
+ TWebcameraUVCDescriptor iUVCDescriptor;
+ };
+
+/**
+Describe UVC base class.
+*/
+class DWebCameraUVCDescriptor : public DBase// : public DWebCameraUVCBase
+ {
+public://function
+ /**
+ Constructor.
+ */
+ DWebCameraUVCDescriptor();
+
+ /**
+ Destructor.
+ */
+ ~DWebCameraUVCDescriptor();
+ /**
+
+ Describe UVC Format Descriptor and Frame Descriptor.
+
+ @param aDataInfo [in] Information of data from lower layer.
+ bDescriptor.
+ */
+ virtual TWebcameraUVCDescriptor DescribeDescriptor(const TWebcameraDataInfo aDataInfo);
+ };
+
+/**
+Describe descriptor of YUY2 format included in UVC.
+*/
+class DWebCameraUVCDescribeDescriptorYUY2 : public DWebCameraUVCDescriptor
+ {
+public://function
+ /**
+ Constructor.
+ */
+ DWebCameraUVCDescribeDescriptorYUY2();
+
+ /**
+ Destructor.
+ */
+ ~DWebCameraUVCDescribeDescriptorYUY2();
+
+ /**
+ Describe UVC Descriptor of YUY2 Format.
+
+ @param aDataInfo [in] Information of data from lower layer.
+ @return bDescriptor.
+ */
+ TWebcameraUVCDescriptor DescribeDescriptor(const TWebcameraDataInfo aDataInfo);
+ };
+
+/**
+Describe UVC header class.
+ */
+class DWebCameraUVCHeader
+ {
+public://function
+ /**
+ Constructor.
+ */
+ DWebCameraUVCHeader();
+
+ /**
+ Destructor.
+ */
+ ~DWebCameraUVCHeader();
+
+public://function
+ /**
+ Describe UVC Header.
+ @param aDataInfo [in] Information of data from lower layer.
+ @return bHeader.
+ */
+ TWebcameraUVCHeaderFormat DescribeHeader(const TWebcameraDataInfo aDataInfo);
+
+private://function
+ /**
+ Describe HeaderInfo to be included UVC Header.
+ @param aDataInfo [in] Information of data form lower layer.
+ @return bHeaderInfo.
+ */
+ TUint8 DescribeHeaderInfo(TWebcameraDataInfo aDataInfo);
+
+ /**
+ Describe HeaderLength to be included UVC Header.
+ @param aDataInfo [in] Information of data from lower layer.
+ @return bHeaderLength.
+ */
+ TUint8 DescribeHeaderLength(TWebcameraDataInfo aDataInfo, TUint8 aHeaderInfo);
+
+ /**
+ Describe PresentationTime to be included UVC Header.
+ @param aDataInfo [in] Information of data from lower layer.
+ @return bPresentationTime.
+ */
+ TUint32 DescribePresentationTime(TWebcameraDataInfo aDataInfo);
+
+ /**
+ Describe SourceClockReference to be included UVC Header.
+ @param aDataInfo [in] Information of data from lower layer.
+ @return bSourceClockReference.
+ */
+ TWebcameraUVCSourceClockReference DescribeSourceClockReference(TWebcameraDataInfo aDataInfo);
+
+private://variable.
+ TUint8 iFID;
+ };
+
+/**
+Describe class.
+*/
+class DWebCameraDescribe : public DBase
+ {
+public://function.
+ /**
+ Constructor.
+ */
+ DWebCameraDescribe();
+
+ /**
+ Destructor.
+ */
+ ~DWebCameraDescribe();
+
+public://function
+ /**
+ Parse iDataInfo from lower layer and describe UVC Header and Descriptor.
+ @param aDataInfo [in] Information of data from lower layer.
+ aDescriptror [out] Header and Descriptor format of YUY2 format.
+ @return KErrNone.
+ */
+ TWebcameraUVC ParseDataInfo(const TWebcameraDataInfo aDataInfo);
+
+private://val.
+ DWebCameraUVCDescriptor* iDescribe;
+ };
+
+#endif /* WEBCAMERA_UVC_H_ */