buffer.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _GSTREAMERMM_BUFFER_H
00004 #define _GSTREAMERMM_BUFFER_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00010 
00011 /* gstreamermm - a C++ wrapper for gstreamer
00012  *
00013  * Copyright 2008 The gstreamermm Development Team
00014  *
00015  * This library is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU Library General Public
00017  * License as published by the Free Software Foundation; either
00018  * version 2 of the License, or (at your option) any later version.
00019  *
00020  * This library is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023  * Library General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU Library General Public
00026  * License along with this library; if not, write to the Free
00027  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00028  */
00029 
00030 #include <gst/gstbuffer.h>
00031 #include <gstreamermm/miniobject.h>
00032 #include <gstreamermm/wrap.h>
00033 #include <gstreamermm/caps.h>
00034 
00035 
00036 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00037 typedef struct _GstBuffer GstBuffer;
00038 typedef struct _GstBufferClass GstBufferClass;
00039 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00040 
00041 
00042 namespace Gst
00043 { class Buffer_Class; } // namespace Gst
00044 namespace Gst
00045 {
00046 
00052 enum BufferFlag
00053 {
00054   BUFFER_FLAG_READONLY = GST_MINI_OBJECT_FLAG_READONLY,
00055   BUFFER_FLAG_PREROLL = GST_MINI_OBJECT_FLAG_READONLY << 0,
00056   BUFFER_FLAG_DISCONT = GST_MINI_OBJECT_FLAG_READONLY << 1,
00057   BUFFER_FLAG_IN_CAPS = GST_MINI_OBJECT_FLAG_READONLY << 2,
00058   BUFFER_FLAG_GAP = GST_MINI_OBJECT_FLAG_READONLY << 3,
00059   BUFFER_FLAG_DELTA_UNIT = GST_MINI_OBJECT_FLAG_READONLY << 4,
00060   BUFFER_FLAG_LAST = GST_MINI_OBJECT_FLAG_READONLY << 8
00061 };
00062 
00063 } // namespace Gst
00064 
00065 
00066 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00067 namespace Glib
00068 {
00069 
00070 template <>
00071 class Value<Gst::BufferFlag> : public Glib::Value_Enum<Gst::BufferFlag>
00072 {
00073 public:
00074   static GType value_type() G_GNUC_CONST;
00075 };
00076 
00077 } // namespace Glib
00078 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00079 
00080 
00081 namespace Gst
00082 {
00083 
00095 enum BufferCopyFlags
00096 {
00097   BUFFER_COPY_FLAGS = 1 << 0,
00098   BUFFER_COPY_TIMESTAMPS = 1 << 1,
00099   BUFFER_COPY_CAPS = 1 << 2
00100 };
00101 
00103 inline BufferCopyFlags operator|(BufferCopyFlags lhs, BufferCopyFlags rhs)
00104   { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00105 
00107 inline BufferCopyFlags operator&(BufferCopyFlags lhs, BufferCopyFlags rhs)
00108   { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00109 
00111 inline BufferCopyFlags operator^(BufferCopyFlags lhs, BufferCopyFlags rhs)
00112   { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00113 
00115 inline BufferCopyFlags operator~(BufferCopyFlags flags)
00116   { return static_cast<BufferCopyFlags>(~static_cast<unsigned>(flags)); }
00117 
00119 inline BufferCopyFlags& operator|=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
00120   { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00121 
00123 inline BufferCopyFlags& operator&=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
00124   { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00125 
00127 inline BufferCopyFlags& operator^=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
00128   { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00129 
00130 } // namespace Gst
00131 
00132 
00133 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00134 namespace Glib
00135 {
00136 
00137 template <>
00138 class Value<Gst::BufferCopyFlags> : public Glib::Value_Flags<Gst::BufferCopyFlags>
00139 {
00140 public:
00141   static GType value_type() G_GNUC_CONST;
00142 };
00143 
00144 } // namespace Glib
00145 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00146 
00147 
00148 namespace Gst
00149 {
00150 
00151 
00165 class Buffer : public MiniObject
00166 {
00167 protected:
00168   
00169 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00170 
00171 public:
00172   typedef Buffer CppObjectType;
00173   typedef Buffer_Class CppClassType;
00174   typedef GstBuffer BaseObjectType;
00175   typedef GstBufferClass BaseClassType;
00176 
00177 private:  friend class Buffer_Class;
00178   static CppClassType buffer_class_;
00179 
00180 private:
00181   // noncopyable
00182   Buffer(const Buffer&);
00183   Buffer& operator=(const Buffer&);
00184 
00185 protected:
00186   explicit Buffer(GstBuffer* castitem);
00187 
00188 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00189 
00190 public:
00191   virtual ~Buffer();
00192 
00193 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00194   static GType get_type()      G_GNUC_CONST;
00195   static GType get_base_type() G_GNUC_CONST;
00196 #endif
00197 
00199   GstBuffer*       gobj()       { return reinterpret_cast<GstBuffer*>(gobject_); }
00200 
00202   const GstBuffer* gobj() const { return reinterpret_cast<GstBuffer*>(gobject_); }
00203 
00205   GstBuffer* gobj_copy();
00206 
00207 private:
00208 
00209 
00210 public:
00211   
00217   static Glib::RefPtr<Buffer> create();
00218   
00231   static Glib::RefPtr<Buffer> create(guint size);
00232 
00233   
00234   guint get_flags() const;
00235   
00236   bool is_set_flag(BufferFlag flag) const;
00237   
00238   void set_flag(BufferFlag flag);
00239   
00240   void unset_flag(BufferFlag flag);
00241 
00242   
00243   Glib::RefPtr<Buffer> copy() const;
00244 
00245   
00259   void copy_metadata(const Glib::RefPtr<Buffer>& source_buffer, BufferCopyFlags flags);
00260 
00261   
00267   bool is_metadata_writable() const;
00268 
00269   //This is not const because it sometimes returns the same buffer:
00270   
00271   Glib::RefPtr<Buffer> make_writable();
00272 
00273   //This is const because it always returns a new buffer:
00274   
00284   Glib::RefPtr<Buffer> make_metadata_writable() const;
00285 
00286   
00293   Glib::RefPtr<Caps> get_caps();
00294   
00301   Glib::RefPtr<const Caps > get_caps() const;
00302   
00308   void set_caps(const Glib::RefPtr<Caps>& caps);
00309   
00326   Glib::RefPtr<Buffer> create_sub(const guint& offset, const guint& size);
00327   
00344   Glib::RefPtr<const Buffer > create_sub(const guint& offset, const guint& size) const;
00345   
00355   bool is_span_fast(const Glib::RefPtr<const Buffer>& other_buffer) const;
00356 
00357   //This is const because it always returns a new buffer:
00358   
00377   Glib::RefPtr<Buffer> span(const guint32& offset, const Glib::RefPtr<Buffer>& other_buffer, const guint32& len) const;
00378 
00379   //Hand-code this because the C function unrefs the input parameters? Can it be const?
00380   //I asked in http://bugzilla.gnome.org/show_bug.cgi?id=533856
00381   //Glib::RefPtr<Buffer> join(const Glib::RefPtr<Buffer>& other_buffer);
00382   //__IGNORE(gst_buffer_join)
00383 
00384   //This is const because it always returns a new buffer:
00385   
00394   Glib::RefPtr<Buffer> join(const Glib::RefPtr<Buffer>& other_buffer) const;
00395 
00396   //This is const because it always returns a new buffer:
00397   
00408   Glib::RefPtr<Buffer> merge(const Glib::RefPtr<const Buffer>& other_buffer) const;
00409 
00413    guint8* get_data() const;
00414  
00418    guint get_size() const;
00419  
00425    ClockTime get_timestamp() const;
00426  
00431    ClockTime get_duration() const;
00432  
00436    guint64 get_offset() const;
00437  
00441    guint64 get_offset_end() const;
00442  
00448    guint8* get_malloc_data() const;
00449  
00450   
00451 public:
00452 
00453 public:
00454   //C++ methods used to invoke GTK+ virtual functions:
00455 #ifdef GLIBMM_VFUNCS_ENABLED
00456 #endif //GLIBMM_VFUNCS_ENABLED
00457 
00458 protected:
00459   //GTK+ Virtual Functions (override these to change behaviour):
00460 #ifdef GLIBMM_VFUNCS_ENABLED
00461 #endif //GLIBMM_VFUNCS_ENABLED
00462 
00463   //Default Signal Handlers::
00464 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00465 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00466 
00467 
00468 };
00469 
00470 }//namespace Gst
00471 
00472 
00473 namespace Gst
00474 {
00480   Glib::RefPtr<Gst::Buffer> wrap(GstBuffer* object, bool take_copy = false);
00481 }
00482 
00483 
00484 #endif /* _GSTREAMERMM_BUFFER_H */
00485 

Generated on Sun Jul 27 17:07:20 2008 for gstreamermm by  doxygen 1.5.4