- Main Page
- Modules
- Namespaces
- Classes
- Files

# 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 /* gstreamermm - a C++ wrapper for gstreamer
    00010  *
    00011  * Copyright 2008 The gstreamermm Development Team
    00012  *
    00013  * This library is free software; you can redistribute it and/or
    00014  * modify it under the terms of the GNU Lesser General Public
    00015  * License as published by the Free Software Foundation; either
    00016  * version 2.1 of the License, or (at your option) any later version.
    00017  *
    00018  * This library is distributed in the hope that it will be useful,
    00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00021  * Lesser General Public License for more details.
    00022  *
    00023  * You should have received a copy of the GNU Lesser General Public
    00024  * License along with this library; if not, write to the Free
    00025  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00026  */
    00027
    00028 #include <gst/gstbuffer.h>
    00029 #include <gstreamermm/miniobject.h>
    00030 #include <gstreamermm/wrap.h>
    00031 #include <gstreamermm/caps.h>
    00032
    00033
    00034 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00035 typedef struct _GstBuffer GstBuffer;
    00036 typedef struct _GstBufferClass GstBufferClass;
    00037 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00038
    00039
    00040 namespace Gst
    00041 { class Buffer_Class; } // namespace Gst
    00042 namespace Gst
    00043 {
    00044
    00050 enum BufferFlag
    00051 {
    00052   BUFFER_FLAG_READONLY = GST_MINI_OBJECT_FLAG_READONLY,
    00053   BUFFER_FLAG_PREROLL = GST_MINI_OBJECT_FLAG_READONLY << 0,
    00054   BUFFER_FLAG_DISCONT = GST_MINI_OBJECT_FLAG_READONLY << 1,
    00055   BUFFER_FLAG_IN_CAPS = GST_MINI_OBJECT_FLAG_READONLY << 2,
    00056   BUFFER_FLAG_GAP = GST_MINI_OBJECT_FLAG_READONLY << 3,
    00057   BUFFER_FLAG_DELTA_UNIT = GST_MINI_OBJECT_FLAG_READONLY << 4,
    00058   BUFFER_FLAG_LAST = GST_MINI_OBJECT_FLAG_READONLY << 8
    00059 };
    00060
    00061 } // namespace Gst
    00062
    00063
    00064 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00065 namespace Glib
    00066 {
    00067
    00068 template <>
    00069 class Value<Gst::BufferFlag> : public Glib::Value_Enum<Gst::BufferFlag>
    00070 {
    00071 public:
    00072   static GType value_type() G_GNUC_CONST;
    00073 };
    00074
    00075 } // namespace Glib
    00076 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00077
    00078
    00079 namespace Gst
    00080 {
    00081
    00093 enum BufferCopyFlags
    00094 {
    00095   BUFFER_COPY_FLAGS = 1 << 0,
    00096   BUFFER_COPY_TIMESTAMPS = 1 << 1,
    00097   BUFFER_COPY_CAPS = 1 << 2
    00098 };
    00099
    00101 inline BufferCopyFlags operator|(BufferCopyFlags lhs, BufferCopyFlags rhs)
    00102   { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
    00103
    00105 inline BufferCopyFlags operator&(BufferCopyFlags lhs, BufferCopyFlags rhs)
    00106   { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
    00107
    00109 inline BufferCopyFlags operator^(BufferCopyFlags lhs, BufferCopyFlags rhs)
    00110   { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
    00111
    00113 inline BufferCopyFlags operator~(BufferCopyFlags flags)
    00114   { return static_cast<BufferCopyFlags>(~static_cast<unsigned>(flags)); }
    00115
    00117 inline BufferCopyFlags& operator|=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
    00118   { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
    00119
    00121 inline BufferCopyFlags& operator&=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
    00122   { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
    00123
    00125 inline BufferCopyFlags& operator^=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
    00126   { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
    00127
    00128 } // namespace Gst
    00129
    00130
    00131 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00132 namespace Glib
    00133 {
    00134
    00135 template <>
    00136 class Value<Gst::BufferCopyFlags> : public Glib::Value_Flags<Gst::BufferCopyFlags>
    00137 {
    00138 public:
    00139   static GType value_type() G_GNUC_CONST;
    00140 };
    00141
    00142 } // namespace Glib
    00143 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00144
    00145
    00146 namespace Gst
    00147 {
    00148
    00149
    00163 class Buffer : public MiniObject
    00164 {
    00165 protected:
    00166
    00167 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00168
    00169 public:
    00170   typedef Buffer CppObjectType;
    00171   typedef Buffer_Class CppClassType;
    00172   typedef GstBuffer BaseObjectType;
    00173   typedef GstBufferClass BaseClassType;
    00174
    00175 private:  friend class Buffer_Class;
    00176   static CppClassType buffer_class_;
    00177
    00178 private:
    00179   // noncopyable
    00180   Buffer(const Buffer&);
    00181   Buffer& operator=(const Buffer&);
    00182
    00183 protected:
    00184   explicit Buffer(GstBuffer* castitem);
    00185
    00186 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00187
    00188 public:
    00189   virtual ~Buffer();
    00190
    00191 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00192   static GType get_type()      G_GNUC_CONST;
    00193   static GType get_base_type() G_GNUC_CONST;
    00194 #endif
    00195
    00197   GstBuffer*       gobj()       { return reinterpret_cast<GstBuffer*>(gobject_); }
    00198
    00200   const GstBuffer* gobj() const { return reinterpret_cast<GstBuffer*>(gobject_); }
    00201
    00203   GstBuffer* gobj_copy();
    00204
    00205 private:
    00206
    00207
    00208 public:
    00209
    00215   static Glib::RefPtr<Gst::Buffer> create();
    00216
    00229   static Glib::RefPtr<Gst::Buffer> create(guint size);
    00230
    00235   Glib::RefPtr<Gst::Buffer> copy() const;
    00236
    00237
    00251   void copy_metadata(const Glib::RefPtr<Gst::Buffer>& source_buffer, BufferCopyFlags flags);
    00252
    00258   bool is_metadata_writable() const;
    00259
    00265   Glib::RefPtr<Gst::Buffer> create_writable();
    00266
    00267   //This is const because it always returns a new buffer:
    00268
    00278   Glib::RefPtr<Gst::Buffer> make_metadata_writable() const;
    00279
    00280
    00287   Glib::RefPtr<Gst::Caps> get_caps();
    00288
    00295   Glib::RefPtr<const Gst::Caps> get_caps() const;
    00296
    00302   void set_caps(const Glib::RefPtr<Gst::Caps>& caps);
    00303
    00320   Glib::RefPtr<Gst::Buffer> create_sub(const guint& offset, const guint& size);
    00321
    00338   Glib::RefPtr<const Gst::Buffer> create_sub(const guint& offset, const guint& size) const;
    00339
    00349   bool is_span_fast(const Glib::RefPtr<const Gst::Buffer>& other_buffer) const;
    00350
    00351   //This is const because it always returns a new buffer:
    00352
    00371   Glib::RefPtr<Gst::Buffer> span(const guint32& offset, const Glib::RefPtr<Gst::Buffer>& other_buffer, const guint32& len) const;
    00372
    00373   //We ignore gst_buffer_join() because it is just a C convenience function.
    00374   //It is gst_buffer_merge() with unrefs.
    00375
    00376
    00377   //This is const because it always returns a new buffer:
    00378
    00389   Glib::RefPtr<Gst::Buffer> merge(const Glib::RefPtr<const Gst::Buffer>& other_buffer) const;
    00390
    00394    guint8* get_data() const;
    00395
    00399    guint get_size() const;
    00400
    00406    ClockTime get_timestamp() const;
    00407
    00412    ClockTime get_duration() const;
    00413
    00417    guint64 get_offset() const;
    00418
    00422    guint64 get_offset_end() const;
    00423
    00429    guint8* get_malloc_data() const;
    00430
    00431   //gst_buffer_stamp is depricated so ignore it.
    00432
    00433
    00434 public:
    00435
    00436 public:
    00437   //C++ methods used to invoke GTK+ virtual functions:
    00438 #ifdef GLIBMM_VFUNCS_ENABLED
    00439 #endif //GLIBMM_VFUNCS_ENABLED
    00440
    00441 protected:
    00442   //GTK+ Virtual Functions (override these to change behaviour):
    00443 #ifdef GLIBMM_VFUNCS_ENABLED
    00444 #endif //GLIBMM_VFUNCS_ENABLED
    00445
    00446   //Default Signal Handlers::
    00447 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
    00448 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
    00449
    00450
    00451 };
    00452
    00453 }//namespace Gst
    00454
    00455
    00456 namespace Gst
    00457 {
    00463   Glib::RefPtr<Gst::Buffer> wrap(GstBuffer* object, bool take_copy = false);
    00464 }
    00465
    00466
    00467 #endif /* _GSTREAMERMM_BUFFER_H */
    00468