00001
00002
00003 #ifndef _GSTREAMERMM_BUFFER_H
00004 #define _GSTREAMERMM_BUFFER_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00038
00039
00040 namespace Gst
00041 { class Buffer_Class; }
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_LAST << 0,
00054 BUFFER_FLAG_DISCONT = GST_MINI_OBJECT_FLAG_LAST << 1,
00055 BUFFER_FLAG_IN_CAPS = GST_MINI_OBJECT_FLAG_LAST << 2,
00056 BUFFER_FLAG_GAP = GST_MINI_OBJECT_FLAG_LAST << 3,
00057 BUFFER_FLAG_DELTA_UNIT = GST_MINI_OBJECT_FLAG_LAST << 4,
00058 BUFFER_FLAG_MEDIA1 = GST_MINI_OBJECT_FLAG_LAST << 5,
00059 BUFFER_FLAG_MEDIA2 = GST_MINI_OBJECT_FLAG_LAST << 6,
00060 BUFFER_FLAG_MEDIA3 = GST_MINI_OBJECT_FLAG_LAST << 7,
00061 BUFFER_FLAG_LAST = GST_MINI_OBJECT_FLAG_LAST << 8
00062 };
00063
00064 }
00065
00066
00067 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00068 namespace Glib
00069 {
00070
00071 template <>
00072 class Value<Gst::BufferFlag> : public Glib::Value_Enum<Gst::BufferFlag>
00073 {
00074 public:
00075 static GType value_type() G_GNUC_CONST;
00076 };
00077
00078 }
00079 #endif
00080
00081
00082 namespace Gst
00083 {
00084
00096 enum BufferCopyFlags
00097 {
00098 BUFFER_COPY_FLAGS = 1 << 0,
00099 BUFFER_COPY_TIMESTAMPS = 1 << 1,
00100 BUFFER_COPY_CAPS = 1 << 2
00101 };
00102
00104 inline BufferCopyFlags operator|(BufferCopyFlags lhs, BufferCopyFlags rhs)
00105 { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00106
00108 inline BufferCopyFlags operator&(BufferCopyFlags lhs, BufferCopyFlags rhs)
00109 { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00110
00112 inline BufferCopyFlags operator^(BufferCopyFlags lhs, BufferCopyFlags rhs)
00113 { return static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00114
00116 inline BufferCopyFlags operator~(BufferCopyFlags flags)
00117 { return static_cast<BufferCopyFlags>(~static_cast<unsigned>(flags)); }
00118
00120 inline BufferCopyFlags& operator|=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
00121 { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00122
00124 inline BufferCopyFlags& operator&=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
00125 { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00126
00128 inline BufferCopyFlags& operator^=(BufferCopyFlags& lhs, BufferCopyFlags rhs)
00129 { return (lhs = static_cast<BufferCopyFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00130
00131 }
00132
00133
00134 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00135 namespace Glib
00136 {
00137
00138 template <>
00139 class Value<Gst::BufferCopyFlags> : public Glib::Value_Flags<Gst::BufferCopyFlags>
00140 {
00141 public:
00142 static GType value_type() G_GNUC_CONST;
00143 };
00144
00145 }
00146 #endif
00147
00148
00149 namespace Gst
00150 {
00151
00152
00166 class Buffer : public MiniObject
00167 {
00168 protected:
00169
00170 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00171
00172 public:
00173 typedef Buffer CppObjectType;
00174 typedef Buffer_Class CppClassType;
00175 typedef GstBuffer BaseObjectType;
00176 typedef GstBufferClass BaseClassType;
00177
00178 private: friend class Buffer_Class;
00179 static CppClassType buffer_class_;
00180
00181 private:
00182
00183 Buffer(const Buffer&);
00184 Buffer& operator=(const Buffer&);
00185
00186 protected:
00187 explicit Buffer(GstBuffer* castitem);
00188
00189 #endif
00190
00191 public:
00192 virtual ~Buffer();
00193
00194 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00195 static GType get_type() G_GNUC_CONST;
00196 static GType get_base_type() G_GNUC_CONST;
00197 #endif
00198
00200 GstBuffer* gobj() { return reinterpret_cast<GstBuffer*>(gobject_); }
00201
00203 const GstBuffer* gobj() const { return reinterpret_cast<GstBuffer*>(gobject_); }
00204
00206 GstBuffer* gobj_copy();
00207
00208 private:
00209
00210
00211 public:
00212
00218 static Glib::RefPtr<Gst::Buffer> create();
00219
00232 static Glib::RefPtr<Gst::Buffer> create(guint size);
00233
00238 Glib::RefPtr<Gst::Buffer> copy() const;
00239
00240
00254 void copy_metadata(const Glib::RefPtr<Gst::Buffer>& source_buffer, BufferCopyFlags flags);
00255
00261 bool is_metadata_writable() const;
00262
00268 Glib::RefPtr<Gst::Buffer> create_writable();
00269
00270
00271
00281 Glib::RefPtr<Gst::Buffer> make_metadata_writable() const;
00282
00283
00290 Glib::RefPtr<Gst::Caps> get_caps();
00291
00298 Glib::RefPtr<const Gst::Caps> get_caps() const;
00299
00305 void set_caps(const Glib::RefPtr<Gst::Caps>& caps);
00306
00323 Glib::RefPtr<Gst::Buffer> create_sub(const guint& offset, const guint& size);
00324
00341 Glib::RefPtr<const Gst::Buffer> create_sub(const guint& offset, const guint& size) const;
00342
00352 bool is_span_fast(const Glib::RefPtr<const Gst::Buffer>& other_buffer) const;
00353
00354
00355
00374 Glib::RefPtr<Gst::Buffer> span(const guint32& offset, const Glib::RefPtr<Gst::Buffer>& other_buffer, const guint32& len) const;
00375
00376
00377
00378
00379
00380
00381
00392 Glib::RefPtr<Gst::Buffer> merge(const Glib::RefPtr<const Gst::Buffer>& other_buffer) const;
00393
00397 guint8* get_data() const;
00398
00402 guint get_size() const;
00403
00409 ClockTime get_timestamp() const;
00410
00415 ClockTime get_duration() const;
00416
00420 guint64 get_offset() const;
00421
00425 guint64 get_offset_end() const;
00426
00432 guint8* get_malloc_data() const;
00433
00434
00435
00436
00437 public:
00438
00439 public:
00440
00441 #ifdef GLIBMM_VFUNCS_ENABLED
00442 #endif //GLIBMM_VFUNCS_ENABLED
00443
00444 protected:
00445
00446 #ifdef GLIBMM_VFUNCS_ENABLED
00447 #endif //GLIBMM_VFUNCS_ENABLED
00448
00449
00450 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00451 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00452
00453
00454 };
00455
00456 }
00457
00458
00459 namespace Gst
00460 {
00466 Glib::RefPtr<Gst::Buffer> wrap(GstBuffer* object, bool take_copy = false);
00467 }
00468
00469
00470 #endif
00471