Debian Codegraph @

gstreamer/src/videoinfo.ccg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2015 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 namespace Gst
21 {
22 VideoInfo::VideoInfo()
23 : take_ownership(true)
24 {
25 gobject_ = gst_video_info_new();
26 }
27
28 VideoInfo::VideoInfo(const VideoInfo& other)
29 {
30 gobject_ = gst_video_info_copy(other.gobject_);
31 take_ownership = true;
32 }
33
34 VideoInfo& VideoInfo::operator=(const VideoInfo& other)
35 {
36 if (take_ownership)
37 gst_video_info_free(gobject_);
38
39 take_ownership = true;
40 gobject_ = gst_video_info_copy(other.gobject_);
41
42 return *this;
43 }
44
45 VideoInfo::VideoInfo(GstVideoInfo* castitem, bool take_ownership)
46 : gobject_(castitem),
47 take_ownership(take_ownership)
48 {
49 }
50
51 VideoInfo::~VideoInfo()
52 {
53 if (take_ownership)
54 gst_video_info_free(gobject_);
55 }
56 }