]> git.sesse.net Git - casparcg/blob - server/producers/targascroll/TargaScrollProducer.h
- Reconfiguration of code
[casparcg] / server / producers / targascroll / TargaScrollProducer.h
1 /*\r
2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
3 *\r
4 *  This file is part of CasparCG.\r
5 *\r
6 *    CasparCG is free software: you can redistribute it and/or modify\r
7 *    it under the terms of the GNU General Public License as published by\r
8 *    the Free Software Foundation, either version 3 of the License, or\r
9 *    (at your option) any later version.\r
10 *\r
11 *    CasparCG is distributed in the hope that it will be useful,\r
12 *    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 *    GNU General Public License for more details.\r
15 \r
16 *    You should have received a copy of the GNU General Public License\r
17 *    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
18 *\r
19 */\r
20  \r
21 #ifndef TARGASCROLLMediaProducer_H\r
22 #define TARGASCROLLMediaProducer_H\r
23 \r
24 #include "..\..\MediaProducer.h"\r
25 #include "..\..\utils\Thread.h"\r
26 #include "..\..\utils\Lockable.h"\r
27 #include "..\..\frame\Framemediacontroller.h"\r
28 #include "..\..\frame\buffers\MotionFrameBuffer.h"\r
29 \r
30 namespace caspar {\r
31 namespace utils {\r
32         class PixmapData;\r
33         typedef std::tr1::shared_ptr<PixmapData> PixmapDataPtr;\r
34 }\r
35 \r
36 class TargaScrollMediaProducer : public MediaProducer, public FrameMediaController, public utils::IRunnable, utils::LockableObject\r
37 {\r
38         static int DEFAULT_SPEED;\r
39 public:\r
40         explicit TargaScrollMediaProducer();\r
41         TargaScrollMediaProducer(const TargaScrollMediaProducer&);\r
42         virtual ~TargaScrollMediaProducer();\r
43 \r
44         bool Load(const tstring& filename);\r
45 \r
46         virtual IMediaController* QueryController(const tstring& id);\r
47         virtual bool Initialize(FrameManagerPtr pFrameManager);\r
48         virtual FrameBuffer& GetFrameBuffer() {\r
49                 return frameBuffer;\r
50         }\r
51 \r
52         virtual void Run(HANDLE stopEvent);\r
53         virtual bool OnUnhandledException(const std::exception& ex) throw();\r
54 \r
55 private:\r
56         void PadImageToFrameFormat();\r
57         FramePtr FillVideoFrame(FramePtr pFrame);\r
58 \r
59         struct DirectionFlag\r
60         {\r
61                 enum DirectionFlagEnum\r
62                 {\r
63                         ScrollUp = 1,\r
64                         ScrollDown,\r
65                         ScrollLeft,\r
66                         ScrollRight\r
67                 };\r
68         };\r
69 \r
70         int offset;\r
71         short speed;\r
72 \r
73         utils::Thread workerThread;\r
74         utils::PixmapDataPtr pImage;\r
75 \r
76         MotionFrameBuffer frameBuffer;\r
77         DirectionFlag::DirectionFlagEnum direction;\r
78 \r
79         utils::Event initializeEvent_;\r
80         FrameManagerPtr pFrameManager_;\r
81         FrameManagerPtr pTempFrameManager_;\r
82 };\r
83 \r
84 }\r
85 \r
86 #endif