]> git.sesse.net Git - casparcg/blob - modules/bluefish/util/memory.h
[scene] More documentation with auto completion for example values/expressions.
[casparcg] / modules / bluefish / util / memory.h
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Robert Nagy, ronag89@gmail.com
20 */
21
22 #pragma once
23
24 #include <Windows.h>
25
26 #include <BlueVelvet4.h>
27
28 #include <common/os/page_locked_allocator.h>
29
30 #include <vector>
31
32 namespace caspar { namespace bluefish {
33         
34 static const size_t MAX_HANC_BUFFER_SIZE = 256*1024;
35 static const size_t MAX_VBI_BUFFER_SIZE = 36*1920*4;
36
37 struct blue_dma_buffer
38 {
39 public:
40         blue_dma_buffer(int image_size, int id) 
41                 : id_(id)
42                 , image_size_(image_size)
43                 , hanc_size_(MAX_HANC_BUFFER_SIZE)
44                 , image_buffer_(image_size_)
45                 , hanc_buffer_(hanc_size_){}
46                         
47         int id() const {return id_;}
48
49         PBYTE image_data() { return image_buffer_.data(); }
50         PBYTE hanc_data() { return hanc_buffer_.data(); }
51
52         size_t image_size() const { return image_size_; }
53         size_t hanc_size() const { return hanc_size_; }
54
55 private:        
56         int id_;
57         size_t image_size_;
58         size_t hanc_size_;
59         std::vector<BYTE, page_locked_allocator<BYTE>> image_buffer_;   
60         std::vector<BYTE, page_locked_allocator<BYTE>> hanc_buffer_;
61 };
62 typedef std::shared_ptr<blue_dma_buffer> blue_dma_buffer_ptr;
63
64 }}