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_CodecFactory.h
20 * @brief This is the header file for the _CodecFactory.
22 * This header file contains the declarations of the _CodecFactory.
25 #ifndef _FMEDIA_INTERNAL_CODECFACTORY_H_
26 #define _FMEDIA_INTERNAL_CODECFACTORY_H_
28 #include <unique_ptr.h>
30 namespace Tizen { namespace Media
38 typedef _IVideoDecoder* (*_VideoDecoderCreateFunc)(void);
39 typedef _IVideoEncoder* (*_VideoEncoderCreateFunc)(void);
40 typedef _IAudioDecoder* (*_AudioDecoderCreateFunc)(void);
41 typedef _IAudioEncoder* (*_AudioEncoderCreateFunc)(void);
44 * @class __CodecFactory
45 * @brief This class is used to create audio or video codec instance.
47 * This class contains list of __CodecCreator and create codec instance with Codec's request.
51 : public Tizen::Base::Object
55 * Get the global instance of this class.
57 * @return Global instance of this class.
59 static _CodecFactory* GetInstance(void);
62 * Create an instance of Codec with given type.
64 * @return E_SUCCESS on success, an error code on failure
66 * @param[in] codecType The codec type that want to create
67 * @param[Out] pVideoDecoder Reference to the _IVideoDecoder instance
69 * @exception E_SUCCESS This method was successful.
70 * @exception E_INVALID_ARG One of input parameter is invalid
71 * @exception E_SYSTEM A system error occurred.
73 result CreateCodecInstance(CodecType codecType, _IVideoDecoder*& pVideoDecoder);
76 * Create an instance of Codec with given type.
78 * @return E_SUCCESS on success, an error code on failure
80 * @param[in] codecType The codec type that want to create
81 * @param[Out] pVideoEncoder Reference to the _IVideoEncoder instance
83 * @exception E_SUCCESS This method was successful.
84 * @exception E_INVALID_ARG One of input parameter is invalid
85 * @exception E_SYSTEM A system error occurred.
87 result CreateCodecInstance(CodecType codecType, _IVideoEncoder*& pVideoEncoder);
90 * Create an instance of Codec with given type.
92 * @return E_SUCCESS on success, an error code on failure
94 * @param[in] codecType The codec type that want to create
95 * @param[Out] pAudioDecoder Reference to the _IAudioDecoder instance
97 * @exception E_SUCCESS This method was successful.
98 * @exception E_INVALID_ARG One of input parameter is invalid
99 * @exception E_SYSTEM A system error occurred.
101 result CreateCodecInstance(CodecType codecType, _IAudioDecoder*& pAudioDecoder);
104 * Create an instance of Codec with given type.
106 * @return E_SUCCESS on success, an error code on failure
108 * @param[in] codecType The codec type that want to create
109 * @param[Out] pAudioEncoder Reference to the _IAudioEncoder instance
111 * @exception E_SUCCESS This method was successful.
112 * @exception E_INVALID_ARG One of input parameter is invalid
113 * @exception E_SYSTEM A system error occurred.
115 result CreateCodecInstance(CodecType codecType, _IAudioEncoder*& pAudioEncoder);
119 * Registers the _IVideoDecoder CreateInstance function.
121 * @return E_SUCCESS on success, an error code on failure
123 * @param[in] codecType The codec type that want to create
124 * @param[in] createFunc The reference to the video encoder create instance is returned
126 * @exception E_SUCCESS This method was successful.
127 * @exception E_INVALID_ARG One of input parameter is invalid
128 * @exception E_SYSTEM A system error occurred.
130 result RegisterCodecCreateFunc(CodecType codecType, _VideoDecoderCreateFunc createFunc);
134 * Retrieves the _IVideoEncoder CreateInstance function.
136 * @return E_SUCCESS on success, an error code on failure
138 * @param[in] codecType The codec type that want to create
139 * @param[in] createFunc The reference to the video encoder create instance is returned
141 * @exception E_SUCCESS This method was successful.
142 * @exception E_INVALID_ARG One of input parameter is invalid
143 * @exception E_SYSTEM A system error occurred.
145 result RegisterCodecCreateFunc(CodecType codecType, _VideoEncoderCreateFunc createFunc);
148 * Retrieves the _IAudioDecoder CreateInstance function.
150 * @return E_SUCCESS on success, an error code on failure
152 * @param[in] codecType The codec type that want to create
153 * @param[in] createFunc The reference to the audio decoder create instance is returned
155 * @exception E_SUCCESS This method was successful.
156 * @exception E_INVALID_ARG One of input parameter is invalid
157 * @exception E_SYSTEM A system error occurred.
159 result RegisterCodecCreateFunc(CodecType codecType, _AudioDecoderCreateFunc createFunc);
162 * Retrieves the _IAudioEncoder CreateInstance function.
164 * @return E_SUCCESS on success, an error code on failure
166 * @param[in] codecType The codec type that want to create
167 * @param[in] createFunc The reference to the audio encoder create instance is returned
169 * @exception E_SUCCESS This method was successful.
170 * @exception E_INVALID_ARG One of input parameter is invalid
171 * @exception E_SYSTEM A system error occurred.
173 result RegisterCodecCreateFunc(CodecType codecType, _AudioEncoderCreateFunc createFunc);
176 * Registers all availiable codec
178 result RegisterAllCodec(void);
181 * Gets supported audio decoder list
183 Tizen::Base::Collection::IListT<CodecType>* GetSupportedAudioDecoderListN(void);
186 * Gets supported audio encoder list
188 Tizen::Base::Collection::IListT<CodecType>* GetSupportedAudioEncoderListN(void);
191 * Gets supported video decoder list
193 Tizen::Base::Collection::IListT<CodecType>* GetSupportedVideoDecoderListN(void);
196 * Gets supported video encoder list
198 Tizen::Base::Collection::IListT<CodecType>* GetSupportedVideoEncoderListN(void);
201 // This constructs the hash maps.
202 result Construct(void);
206 virtual ~_CodecFactory(void);
208 static void InitSingleton(void);
209 static void DestroySingleton(void);
211 static _CodecFactory* __pTheInstance;
212 friend struct std::default_delete<_CodecFactory>;
213 Tizen::Base::Collection::HashMapT<CodecType, _VideoDecoderCreateFunc> __videoDecoderRegister;
214 Tizen::Base::Collection::HashMapT<CodecType, _VideoEncoderCreateFunc> __videoEncoderRegister;
215 Tizen::Base::Collection::HashMapT<CodecType, _AudioDecoderCreateFunc> __audioDecoderRegister;
216 Tizen::Base::Collection::HashMapT<CodecType, _AudioEncoderCreateFunc> __audioEncoderRegister;
221 #endif // _FMEDIA_INTERNAL_CODECFACTORY_H_