QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
sample.cpp
1 /*
2  Copyright (C) 2013 Diane Trout
3  @author Diane Trout <diane@ghic.org>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published
7  by the Free Software Foundation; either version 2.1 of the License, or
8  (at your option) any later version.
9 
10  This program 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
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "buffer.h"
19 #include "caps.h"
20 #include "sample.h"
21 #include "structure.h"
22 #include "segment.h"
23 #include <QtCore/QDebug>
24 #include <gst/gst.h>
25 
26 namespace QGst {
27 
28 SamplePtr Sample::create(const BufferPtr & buffer, const CapsPtr & caps,
29  const Segment & segment, const Structure & info)
30 {
31  GstStructure *cinfo = NULL;
32  if (info.isValid())
33  cinfo = gst_structure_copy(info);
34 
35  return SamplePtr::wrap(gst_sample_new(buffer, caps, segment, cinfo), false);
36 }
37 
38 BufferPtr Sample::buffer() const
39 {
40  return BufferPtr::wrap(gst_sample_get_buffer(object<GstSample>()));
41 }
42 
43 CapsPtr Sample::caps() const
44 {
45  return CapsPtr::wrap(gst_sample_get_caps(object<GstSample>()));
46 }
47 
48 Structure Sample::info() const
49 {
50  return Structure(gst_sample_get_info(object<GstSample>()));
51 }
52 
53 Segment Sample::segment() const
54 {
55  return Segment(gst_sample_get_segment(object<GstSample>()));
56 }
57 
58 } //namespace QGst
static RefPointer< T > wrap(typename T::CType *nativePtr, bool increaseRef=true)
Definition: refpointer.h:326