merge commits of 2.2.1 to public
[platform/framework/native/image.git] / src / FMedia_ImageUriDataFactory.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_ImageUriDataFactory.h
20  * @brief  This file contains the declaration of _ImageUriDataFactory class,
21  *               required internally by Image::DecodeUrl.
22  */
23
24 #ifndef FMEDIA_INTERNAL_IMAGEURIDATAFACTORY_H_
25 #define FMEDIA_INTERNAL_IMAGEURIDATAFACTORY_H_
26
27 #include <unique_ptr.h>
28
29 namespace Tizen{ namespace Media{
30
31 static const int _TIMEOUT_INFINITE = 0;
32
33 class _ImageUriDataFactory
34         : public Tizen::Base::Object
35         , Tizen::Base::Runtime::IEventListener
36 {
37 public:
38         static _ImageUriDataFactory* GetInstance(void);
39
40         result Construct(void);
41
42         result
43         DecodeUrl(const Tizen::Base::Utility::Uri& srcImageUrl,
44           Tizen::Graphics::BitmapPixelFormat colorFormat,
45           int destWidth, int destHeight, RequestId &reqId,
46           const Tizen::Base::Runtime::IEventListener& listener, long timeout);
47
48         int GetHolderCount(void);
49         int GetWorkerCount(void);
50         void Remove(RequestId reqId);
51
52         void OnMediaSessionEnded(RequestId requestId);
53
54 private:
55         _ImageUriDataFactory(void);
56         virtual ~_ImageUriDataFactory(void);
57         _ImageUriDataFactory(const _ImageUriDataFactory& value);
58         _ImageUriDataFactory& operator =(const _ImageUriDataFactory& value);
59
60         int AddImageUriData(const Tizen::Base::Utility::Uri& srcImageUrl,
61           Tizen::Graphics::BitmapPixelFormat colorFormat,
62           int destWidth, int destHeight, RequestId &reqId,
63           const Tizen::Base::Runtime::IEventListener& listener, long timeout);
64         result StartDecode(void);
65         void Watchout(void);
66
67         static void InitSingleton(void);
68         static void DestroySingleton(void);
69
70         RequestId __requestId;
71         static _ImageUriDataFactory* __pTheInstance;
72         friend struct std::default_delete<_ImageUriDataFactory>;
73         std::unique_ptr<Tizen::Base::Collection::Queue> __pImageUriDataHolderQueue;
74         std::unique_ptr<Tizen::Base::Collection::LinkedList> __pImageUriDataWorkingList;
75 };
76
77
78 }} // Tizen::Media
79
80 #endif // FMEDIA_INTERNAL_IMAGEURIDATAFACTORY_H_