Merge "seek expection handling bug" into tizen_2.2
[platform/framework/native/media.git] / src / FMedia_CameraBuffer.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                        FMedia_CameraImpl.h
20  * @brief                       This header file contains the declarations of the %_CameraImpl class.
21  *
22  */
23
24 #ifndef _FMEDIA_INTERNAL_CAMERA_BUFFER_H_
25 #define _FMEDIA_INTERNAL_CAMERA_BUFFER_H_
26
27 #include <FBaseByteBuffer.h>
28 #include <FMediaTypes.h>
29
30 namespace Tizen { namespace Media
31 {
32
33 /**
34  * @enum _CameraBufferType
35  * Defines the buffer type of the camera.
36  */
37 enum _CameraBufferType
38 {
39         _CAMERA_BUFFER_NONE,
40         _CAMERA_BUFFER_PREVIEW,
41         _CAMERA_BUFFER_CAPTURE,
42 };
43
44 /**
45  * @class       _CameraBuffer
46  * @brief       This class implements the APIs of %_CameraBuffer class.
47  */
48 class _CameraBuffer
49         : public Tizen::Base::ByteBuffer
50 {
51 public:
52         /**
53          * This is the default constructor for this class.
54          *
55          * @remarks             After creating an instance of this class, the Construct() method must be called explicitly to
56          * initialize this instance.
57          * @see                 Construct()
58          */
59         _CameraBuffer(void);
60
61         /**
62          * This is the destructor for this class. @n
63          * All allocated resources are deallocated by this method. This method should be called in the same thread
64          * where the Construct() method is called.
65          *
66          * @see                 Construct()
67          */
68         virtual ~_CameraBuffer(void);
69
70         /**
71         * Initializes this instance of camera buffer with the specified parameters. @n
72         * This method creates an instance of camera buffer in the subsystem. Only one instance is created at a given time.
73         *
74         * @return               An error code
75         * @param[in]    capacity                                The capacity of the buffer
76         * @param[in]    bufferType                              The buffer type
77         * @param[in]    pixelFormat                             The pixel format
78         * @param[in]    width                                   The width of the buffer data
79         * @param[in]    height                                  The height of the buffer data
80         * @exception    E_SUCCESS                               The method is successful.
81         * @exception    E_SYSTEM                                A system error has occurred.
82         * @exception    E_INVALID_ARG                   A specified input parameter is invalid.
83         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
84         */
85         result Construct(int capacity, _CameraBufferType bufferType, MediaPixelFormat pixelFormat, int width, int height);
86
87         /**
88         * Initializes this instance of camera buffer with the specified parameters. @n
89         * This method creates an instance of camera buffer in the subsystem. Only one instance is created at a given time.
90         *
91         * @return               An error code
92         * @param[in]    capacity                                The capacity of the buffer
93         * @param[in]    bufferType                              The buffer type
94         * @param[in]    codec                                   The encoded type of the buffer
95         * @param[in]    hasHeader                               The flag determining the buffer has header
96         * @param[in]    width                                   The width of the buffer data
97         * @param[in]    height                                  The height of the buffer data
98         * @exception    E_SUCCESS                               The method is successful.
99         * @exception    E_SYSTEM                                A system error has occurred.
100         * @exception    E_INVALID_ARG                   A specified input parameter is invalid.
101         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
102         */
103         result Construct(int capacity, _CameraBufferType bufferType, CodecType codec, bool hasHeader, int width, int height);
104
105         /**
106          * Initializes this instance of %_CameraBuffer which is a view of the specified _CameraBuffer. @n
107          * This is the copy constructor for the %_CameraBuffer class.
108          *
109          * @param[in]   cameraBuffer          The %_CameraBuffer instance used to initialize new object
110          * @exception   E_SUCCESS               The method is successful.
111          * @exception   E_INVALID_ARG     A specified input parameter is invalid.
112          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
113          */
114         result Construct(const _CameraBuffer& cameraBuffer);
115
116         /**
117         * Gets the pixel format of the buffer.
118         *
119         * @return               The buffer's pixel format
120         */
121         MediaPixelFormat GetPixelFormat(void) const;
122
123         /**
124         * Gets the type of the buffer.
125         *
126         * @return               The buffer type
127         */
128         _CameraBufferType GetBufferType(void) const;
129
130         /**
131         * Gets the width of the buffer.
132         *
133         * @return               The width
134         */
135         int GetWidth(void) const;
136
137         /**
138         * Gets the height of the buffer.
139         *
140         * @return               The height
141         */
142         int GetHeight(void) const;
143
144         /**
145         * Gets the encoded codec type of the buffer.
146         *
147         * @return               The buffer's encoded codec type
148         */
149         CodecType GetCodecType(void) const;
150
151 private:
152         _CameraBuffer(const _CameraBuffer& cameraBuffer);
153         _CameraBuffer& operator =(const _CameraBuffer& cameraBuffer);
154
155         _CameraBufferType __bufferType;
156         MediaPixelFormat __pixelFormat;
157         int __width;
158         int __height;
159         CodecType __codec;
160         bool __hasHeader;
161 };
162
163 }}// Tizen::Media
164
165 #endif