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
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
00040
00041
00042 namespace Gst
00043 { class Buffer_Class; }
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 }
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 }
00078 #endif
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 }
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 }
00145 #endif
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
00182 Buffer(const Buffer&);
00183 Buffer& operator=(const Buffer&);
00184
00185 protected:
00186 explicit Buffer(GstBuffer* castitem);
00187
00188 #endif
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
00270
00271 Glib::RefPtr<Buffer> make_writable();
00272
00273
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
00358
00377 Glib::RefPtr<Buffer> span(const guint32& offset, const Glib::RefPtr<Buffer>& other_buffer, const guint32& len) const;
00378
00379
00380
00381
00382
00383
00384
00385
00394 Glib::RefPtr<Buffer> join(const Glib::RefPtr<Buffer>& other_buffer) const;
00395
00396
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
00455 #ifdef GLIBMM_VFUNCS_ENABLED
00456 #endif //GLIBMM_VFUNCS_ENABLED
00457
00458 protected:
00459
00460 #ifdef GLIBMM_VFUNCS_ENABLED
00461 #endif //GLIBMM_VFUNCS_ENABLED
00462
00463
00464 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00465 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00466
00467
00468 };
00469
00470 }
00471
00472
00473 namespace Gst
00474 {
00480 Glib::RefPtr<Gst::Buffer> wrap(GstBuffer* object, bool take_copy = false);
00481 }
00482
00483
00484 #endif
00485