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
22 #include "../../../common/concurrency/thread.h"
\r
23 #include "BluefishException.h"
\r
24 #include "BluefishFrameManager.h"
\r
25 #include "../../consumer/frame_consumer.h"
\r
26 #include "../../renderer/render_device.h"
\r
27 #include <tbb/concurrent_queue.h>
\r
28 #include <boost/thread.hpp>
\r
30 #define TIMEOUT 1000
\r
36 namespace bluefish {
\r
38 typedef std::tr1::shared_ptr<CBlueVelvet4> BlueVelvetPtr;
\r
40 class BlueFishVideoConsumer : public frame_consumer
\r
42 friend class BluefishPlaybackStrategy;
\r
44 BlueFishVideoConsumer(const frame_format_desc& format_desc);
\r
45 BlueFishVideoConsumer(const BlueFishVideoConsumer&);
\r
46 const BlueFishVideoConsumer& operator=(const BlueFishVideoConsumer&);
\r
49 virtual ~BlueFishVideoConsumer();
\r
51 static int EnumerateDevices();
\r
52 static frame_consumer_ptr Create(const frame_format_desc& format_desc, unsigned int deviceIndex);
\r
54 void display(const gpu_frame_ptr&);
\r
56 const frame_format_desc& get_frame_format_desc() const { return format_desc_; }
\r
62 void EnableVideoOutput();
\r
63 void DisableVideoOutput();
\r
64 bool SetupDevice(unsigned int deviceIndex);
\r
65 bool ReleaseDevice();
\r
67 bool DoSetupDevice(unsigned int deviceIndex);
\r
69 BlueVelvetPtr pSDK_;
\r
70 std::shared_ptr<BluefishPlaybackStrategy> pPlayback_;
\r
71 BluefishFrameManagerPtr pFrameManager_;
\r
72 unsigned long m_bufferCount;
\r
73 unsigned long m_length;
\r
74 unsigned long m_actual;
\r
75 unsigned long m_golden;
\r
77 unsigned long VidFmtFromFrameFormat(frame_format fmt);
\r
79 frame_format currentFormat_;
\r
80 unsigned int _deviceIndex;
\r
81 bool hasEmbeddedAudio_;
\r
82 frame_format_desc format_desc_;
\r
84 std::exception_ptr pException_;
\r
85 boost::thread thread_;
\r
86 tbb::concurrent_bounded_queue<gpu_frame_ptr> frameBuffer_;
\r
88 typedef std::tr1::shared_ptr<BlueFishVideoConsumer> BlueFishFrameConsumerPtr;
\r