QtGStreamer 0.10.1
|
00001 /* 00002 Copyright (C) 2010 Collabora Multimedia. 00003 @author Mauricio Piacentini <mauricio.piacentini@collabora.co.uk> 00004 00005 This library is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU Lesser General Public License as published 00007 by the Free Software Foundation; either version 2.1 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 #include "buffer.h" 00019 #include "caps.h" 00020 #include <QtCore/QDebug> 00021 #include <gst/gst.h> 00022 00023 namespace QGst { 00024 00025 BufferPtr Buffer::create(uint size) 00026 { 00027 return BufferPtr::wrap(gst_buffer_try_new_and_alloc(size), false); 00028 } 00029 00030 quint8 * Buffer::data() const 00031 { 00032 return GST_BUFFER_DATA(object<GstBuffer>()); 00033 } 00034 00035 quint32 Buffer::size() const 00036 { 00037 return GST_BUFFER_SIZE(object<GstBuffer>()); 00038 } 00039 00040 ClockTime Buffer::timeStamp() const 00041 { 00042 return GST_BUFFER_TIMESTAMP(object<GstBuffer>()); 00043 } 00044 00045 ClockTime Buffer::duration() const 00046 { 00047 return GST_BUFFER_DURATION(object<GstBuffer>()); 00048 } 00049 00050 CapsPtr Buffer::caps() const 00051 { 00052 //wrap increasing the refcount 00053 return QGst::CapsPtr::wrap(GST_BUFFER_CAPS(object<GstBuffer>())); 00054 } 00055 00056 void Buffer::setCaps(const CapsPtr & caps) 00057 { 00058 gst_buffer_set_caps(object<GstBuffer>(), caps); 00059 } 00060 00061 quint64 Buffer::offset() const 00062 { 00063 return GST_BUFFER_OFFSET(object<GstBuffer>()); 00064 } 00065 00066 quint64 Buffer::offsetEnd() const 00067 { 00068 return GST_BUFFER_OFFSET_END(object<GstBuffer>()); 00069 } 00070 00071 BufferFlags Buffer::flags() const 00072 { 00073 return BufferFlags(GST_BUFFER_FLAGS(object<GstBuffer>())); 00074 } 00075 00076 void Buffer::setFlags(const BufferFlags flags) 00077 { 00078 GST_BUFFER_FLAGS(object<GstBuffer>()) = flags; 00079 } 00080 00081 BufferPtr Buffer::copy() const 00082 { 00083 return BufferPtr::wrap(gst_buffer_copy(object<GstBuffer>()), false); 00084 } 00085 00086 } //namespace QGst