]> git.sesse.net Git - casparcg/blob - modules/bluefish/util/memory.h
Merge commit 'fcda9226c39ea7752abb74d40f9e20fa79e88848' into 2.1.0
[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 <common/os/page_locked_allocator.h>
27
28 #include <vector>
29
30 namespace caspar { namespace bluefish {
31         
32 static const size_t MAX_HANC_BUFFER_SIZE = 256*1024;
33 static const size_t MAX_VBI_BUFFER_SIZE = 36*1920*4;
34
35 struct blue_dma_buffer
36 {
37 public:
38         blue_dma_buffer(int image_size, int id) 
39                 : id_(id)
40                 , image_size_(image_size)
41                 , hanc_size_(MAX_HANC_BUFFER_SIZE)
42                 , image_buffer_(image_size_)
43                 , hanc_buffer_(hanc_size_){}
44                         
45         int id() const {return id_;}
46
47         PBYTE image_data() { return image_buffer_.data(); }
48         PBYTE hanc_data() { return hanc_buffer_.data(); }
49
50         size_t image_size() const { return image_size_; }
51         size_t hanc_size() const { return hanc_size_; }
52
53 private:        
54         int id_;
55         size_t image_size_;
56         size_t hanc_size_;
57         std::vector<BYTE, page_locked_allocator<BYTE>> image_buffer_;   
58         std::vector<BYTE, page_locked_allocator<BYTE>> hanc_buffer_;
59 };
60 typedef std::shared_ptr<blue_dma_buffer> blue_dma_buffer_ptr;
61
62 }}