2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\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
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
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
21 #ifndef _CASPAR_BLUEFISHVIDEOFRAMEFACTORY_H__
\r
22 #define _CASPAR_BLUEFISHVIDEOFRAMEFACTORY_H__
\r
26 #include "..\..\frame\system_frame.h"
\r
27 #include "..\..\frame\frame_format.h"
\r
30 #include "BluefishException.h"
\r
32 #include <tbb\mutex.h>
\r
37 namespace bluefish {
\r
39 typedef std::tr1::shared_ptr<CBlueVelvet4> BlueVelvetPtr;
\r
41 class VideoFrameInfo
\r
45 virtual ~VideoFrameInfo() {}
\r
47 virtual unsigned char* GetPtr() const = 0;
\r
48 virtual int GetBufferID() const = 0;
\r
49 virtual int size() const = 0;
\r
51 typedef std::tr1::shared_ptr<VideoFrameInfo> VideoFrameInfoPtr;
\r
53 class CardFrameInfo : public VideoFrameInfo
\r
56 CardFrameInfo(BlueVelvetPtr pSDK, int dataSize, int bufferID);
\r
59 unsigned char* GetPtr() const {
\r
62 int GetBufferID() const {
\r
70 BlueVelvetPtr pSDK_;
\r
71 unsigned char* pData_;
\r
76 class SystemFrameInfo : public VideoFrameInfo
\r
79 SystemFrameInfo(int dataSize, int bufferID);
\r
82 unsigned char* GetPtr() const {
\r
85 int GetBufferID() const {
\r
93 unsigned char* pData_;
\r
98 class BluefishFrameManager
\r
100 friend class BluefishVideoFrame;
\r
101 typedef std::list<VideoFrameInfoPtr> FrameInfoList;
\r
103 BluefishFrameManager(const BluefishFrameManager&);
\r
104 const BluefishFrameManager& operator=(const BluefishFrameManager&);
\r
107 BluefishFrameManager(BlueVelvetPtr pSDK, frame_format fmt, unsigned long optimalLength);
\r
108 virtual ~BluefishFrameManager();
\r
110 virtual std::shared_ptr<BluefishVideoFrame> CreateFrame();
\r
111 virtual const frame_format_desc& get_frame_format_desc() const;
\r
114 VideoFrameInfoPtr GetBuffer();
\r
115 void ReturnBuffer(VideoFrameInfoPtr);
\r
117 BlueVelvetPtr pSDK_;
\r
118 frame_format format_;
\r
119 FrameInfoList frameBuffers_;
\r
122 typedef std::tr1::shared_ptr<BluefishFrameManager> BluefishFrameManagerPtr;
\r
125 class BluefishVideoFrame : public frame
\r
128 explicit BluefishVideoFrame(BluefishFrameManager* pFrameManager);
\r
130 virtual ~BluefishVideoFrame();
\r
132 unsigned char* data() { return data_; }
\r
134 unsigned int size() const { return size_; }
\r
136 long meta_data() const { return buffer_id_; }
\r
140 return pFrameManager_;
\r
143 unsigned char* data_;
\r
146 VideoFrameInfoPtr pInfo_;
\r
147 BluefishFrameManager* pFrameManager_;
\r
151 } //namespace bluefish
\r
152 } //namespace caspar
\r
154 #endif //_CASPAR_BLUEFISHVIDEOFRAMEFACTORY_H__