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_JpegTurboEncoder.h
20 * @brief This is header file for _JpegTurboEnecoder.
23 #ifndef _FMEDIA_INTERNAL_JPEG_TURBO_ENCODER_H_
24 #define _FMEDIA_INTERNAL_JPEG_TURBO_ENCODER_H_
26 #include <turbojpeg.h>
27 #include "FMedia_IImageEncoder.h"
28 namespace Tizen { namespace Media
31 class _JpegTurboEncoder
32 : public _IImageEncoder
33 , public Tizen::Base::Object
36 static const int MIN_WIDTH = 16;
37 static const int MIN_HEIGHT = 16;
38 static const int MAX_WIDTH = 5000;
39 static const int MAX_HEIGHT = 5000;
42 * This is the default constructor for this class.
46 _JpegTurboEncoder(void);
49 * This is the destructor for this class.
53 virtual ~_JpegTurboEncoder(void);
56 * Initialize this instance.
57 * @param[in] dim Encode dimension
58 * @param[in] pixelFormat Encode pixel format
59 * @param[in] quality Encoding quality
61 virtual result Construct(int width, int height,
62 MediaPixelFormat srcPixelFormat,
63 MediaPixelFormat& reqPixelFormat,
67 * Encodes the image data
69 * @return An error code
70 * @param[in] srcBuf Source raw data
71 * @param[in] srcLength Source data length
72 * @param[out] dstBuf Encoded destination buffer
73 * @param[out] dstLength Destination buffer length
75 * @exception E_SUCCESS The method is successful.
76 * @exception E_OUT_OF_MEMORY Memory is insufficient.
77 * @exception E_INVALID_ARG The input parameter is invalid.
79 virtual Tizen::Base::ByteBuffer* EncodeN(const byte* srcBuf, int srcLength);
82 * Set specific key value to the encoder
83 * @return An error code
84 * @param[in] key The key to be set
85 * @param[in] value The value to be set.
87 virtual result SetValue(const Tizen::Base::String& key, Tizen::Base::Object &value);
89 TJPF ToTurboJpegPixelFormat(MediaPixelFormat mediaPixelFmt);
97 MediaPixelFormat __pixelFormat;
98 tjhandle __tjEncodingHandle;
100 }; // class _JpegTurboEncoder