2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef _FMEDIA_INTERNAL_GIF_DECODER_IMPL_H_
19 #define _FMEDIA_INTERNAL_GIF_DECODER_IMPL_H_
21 #include <unique_ptr.h>
22 namespace Tizen { namespace Media
28 : public Tizen::Base::Object
34 _GifDecoderImpl(void);
39 virtual ~_GifDecoderImpl(void);
42 * Initializes a new instance of this class
44 * @return An error code
46 * @param[in] filePath The file path of image.
47 * @param[in] pixelFormat The output pixel format of the decoded image.
49 * @exception E_SUCCESS The method was successful.
50 * @exception E_INVALID_STATE Current state is invalid.
51 * @exception E_INVALID_DATA The input data is invalid.
52 * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
53 * @exception E_INVALID_ARG A specified pixel format is not supported.
54 * @exception E_OUT_OF_MEMORY The memory is insufficient.
55 * @exception E_SYSTEM A system error occurred.
56 * @remarks Supported pixelFormats are MEDIA_PIXEL_FORMAT_RGB565LE, and MEDIA_PIXEL_FORMAT_BGRA8888.
58 result Construct(const Tizen::Base::String& filePath, MediaPixelFormat pixelFormat);
61 * Initializes a new instance of this class
63 * @return An error code
65 * @param[in] srcBuf The source buffer that the image data is stored.
66 * @param[in] pixelFormat The output pixel format of the decoded image.
68 * @exception E_SUCCESS The method was successful.
69 * @exception E_INVALID_STATE Current state is invalid.
70 * @exception E_INVALID_DATA The input data is invalid.
71 * @exception E_INVALID_ARG A specified pixel format is not supported.
72 * @exception E_OUT_OF_MEMORY The memory is insufficient.
73 * @exception E_SYSTEM A system error occurred.
74 * @remarks Supported pixelFormats are MEDIA_PIXEL_FORMAT_RGB565LE, and MEDIA_PIXEL_FORMAT_BGRA8888.
76 result Construct(const Tizen::Base::ByteBuffer& srcBuf, MediaPixelFormat pixelFormat);
79 * Gets the width of the image.
81 * @return The width of image, @n
82 * else @c 0 when an error occurred.
84 * @exception E_SUCCESS The method was successful.
85 * @exception E_INVALID_STATE Current state is invalid.
86 * @remarks The specific error code can be accessed using the GetLastResult() method.
88 int GetWidth(void) const;
91 * Gets the height of the image.
93 * @return The height of the image, @n
94 * else @c 0 when an error occurred.
96 * @exception E_SUCCESS The method was successful.
97 * @exception E_INVALID_STATE Current state is invalid.
98 * @remarks The specific error code can be accessed using the GetLastResult() method.
100 int GetHeight(void) const;
103 * Decodes and gets the next frame in RAW RGB format.
105 * @return The next decoded frame. @n
106 * else @c null when no frame is left or an error occurred.
107 * @param[out] duration The duration of returned frame in miliseconds.
109 * @exception E_SUCCESS The method was successful.
110 * @exception E_INVALID_STATE Current state is invalid.
111 * @exception E_INVALID_DATA The data of the next frame is invalid.
112 * @exception E_OUT_OF_MEMORY The memory is insufficient.
113 * @exception ImplE_SYSTEM A system error occurred.
114 * @remarks The specific error code can be accessed using the GetLastResult() method.
116 Tizen::Base::ByteBuffer* GetNextFrameN(long& duration);
119 * Decodes and gets the next frame in Bitmap format.
121 * @return The next decoded frame. @n
122 * else @c null when no frame is left or an error occurred.
123 * @param[out] duration The duration of returned frame in miliseconds.
124 * @param[in] bufferScaling The buffer scaling type.
126 * @exception E_SUCCESS The method was successful.
127 * @exception E_INVALID_STATE Current state is invalid.
128 * @exception E_INVALID_DATA The data of the next frame is invalid.
129 * @exception E_OUT_OF_MEMORY The memory is insufficient.
130 * @exception E_SYSTEM A system error occurred.
131 * @remarks When autoScale parameter is true auto scaled Bitmap will be returned. @n
132 * The specific error code can be accessed using the GetLastResult() method.
134 Tizen::Graphics::Bitmap* GetNextBitmapN(long& duration, Tizen::Graphics::BufferScaling bufferScaling = Tizen::Graphics::BUFFER_SCALING_AUTO);
137 * Gets the value of given key.
139 * @return An error code
140 * @param[in] key The key of the value.
141 * @param[out] value The output value.
142 * @exception E_SUCCESS The method is successful.
143 * @exception E_INVALID_ARG The input parameter is invalid.
144 * @exception E_UNSUPPORTED_OPERATION This method is unsupported.
146 result GetValue(const Tizen::Base::String& key, Tizen::Base::Object &value);
149 _GifDecoderImpl(const _GifDecoderImpl& rhs);
150 _GifDecoderImpl& operator =(const _GifDecoderImpl& rhs);
151 std::unique_ptr<_GifDecoder> __pGifDecoder;