QtGStreamer  1.2.0
allocator.h
1 /*
2  Copyright (C) 2014 Diane Trout <diane@ghic.org>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as published
6  by the Free Software Foundation; either version 2.1 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef QGST_ALLOCATOR_H
19 #define QGST_ALLOCATOR_H
20 
21 #include "global.h"
22 #include "object.h"
23 #include "memory.h"
24 
25 namespace QGst {
26 
30 class QTGSTREAMER_EXPORT AllocationParams
31 {
32 public:
34  AllocationParams(const AllocationParams & other);
35  virtual ~AllocationParams();
36 
37  AllocationParams & operator=(const AllocationParams & other);
38 
39  MemoryFlags flags() const;
40  void setFlags(MemoryFlags flags);
41 
42  size_t align() const;
43  void setAlign(size_t align);
44 
45  size_t prefix() const;
46  void setPrefix(size_t align);
47 
48  size_t padding() const;
49  void setPadding(size_t padding);
50 
51  operator GstAllocationParams*();
52  operator const GstAllocationParams*() const;
53 
54 private:
55  friend class Allocator;
56  GstAllocationParams *d;
57 };
58 
62 class QTGSTREAMER_EXPORT Allocator : public Object
63 {
64  QGST_WRAPPER(Allocator)
65 public:
67  static AllocatorPtr find(const char *name);
68 
70  static AllocatorPtr getDefault();
72  static AllocatorPtr getSystemMemory();
73 
75  MemoryPtr alloc(size_t size, const AllocationParams &params = AllocationParams());
79  void free(MemoryPtr & memory);
80 };
81 
82 } //namespace QGst
83 
84 QGST_REGISTER_TYPE(QGst::Allocator)
85 
86 #endif /* QGST_ALLOCATOR_H */
Smart pointer class for working with wrapper classes that support reference counting.
Definition: refpointer.h:91
Wrapper class for GstAllocationParams.
Definition: allocator.h:31
Wrapper class for GstAllocator.
Definition: allocator.h:63
Wrapper class for GstObject.
Definition: object.h:29
Wrappers for GStreamer classes.