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.
19 * @file FMedia_PngEncoder.h
20 * @brief This is header file for _PngEncoder.
22 #ifndef _FMEDIA_INTERNAL_PNG_ENCODER_H_
23 #define _FMEDIA_INTERNAL_PNG_ENCODER_H_
25 #include "FMedia_IImageEncoder.h"
28 namespace Tizen { namespace Media
32 : public _IImageEncoder
33 , public Tizen::Base::Object
36 static const int MIN_WIDTH = 8;
37 static const int MIN_HEIGHT = 8;
38 static const int MIN_BUF_SIZE = 67;
40 * This is the default constructor for this class.
47 * This is the destructor for this class.
51 virtual ~_PngEncoder(void);
54 * Initialize this instance.
55 * @param[in] dim Encode dimension
56 * @param[in] pixelFormat Encode pixel format
57 * @param[in] quality Encoding quality
59 virtual result Construct(int width, int height,
60 MediaPixelFormat srcPixelFormat,
61 MediaPixelFormat& reqPixelFormat,
65 * Encodes the image data
67 * @return An error code
68 * @param[in] srcBuf Source raw data
69 * @param[in] srcLength Source data length
70 * @param[out] dstBuf Encoded destination buffer
71 * @param[out] dstLength Destination buffer length
73 * @exception E_SUCCESS The method is successful.
74 * @exception E_OUT_OF_MEMORY Memory is insufficient.
75 * @exception E_INVALID_ARG The input parameter is invalid.
77 virtual Tizen::Base::ByteBuffer* EncodeN(const byte* srcBuf, int srcLength);
80 * Set specific key value to the encoder
81 * @return An error code
82 * @param[in] key The key to be set
83 * @param[in] value The value to be set.
85 virtual result SetValue(const Tizen::Base::String& key, Tizen::Base::Object &value);
88 static void PngWriteDataStatic(struct png_struct_def* pngPtr, png_bytep data, png_size_t length);
90 static void PngFlushDataStatic(struct png_struct_def* pngPtr);
96 MediaPixelFormat __pixelFormat;
98 }; // class _PngEncoder