00001
00002
00003 #ifndef _GSTREAMERMM_PAD_H
00004 #define _GSTREAMERMM_PAD_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/gstpad.h>
00029 #include <gstreamermm/object.h>
00030 #include <gstreamermm/miniobject.h>
00031 #include <gstreamermm/format.h>
00032 #include <gstreamermm/query.h>
00033
00034
00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00036 typedef struct _GstPad GstPad;
00037 typedef struct _GstPadClass GstPadClass;
00038 #endif
00039
00040
00041 namespace Gst
00042 { class Pad_Class; }
00043 namespace Gst
00044 {
00045
00046 class Buffer;
00047 class Caps;
00048 class Element;
00049 class Event;
00050 class PadTemplate;
00051 class Query;
00052
00053
00054 template <class CppType>
00055 class Iterator;
00056
00062 enum PadDirection
00063 {
00064 PAD_UNKNOWN,
00065 PAD_SRC,
00066 PAD_SINK
00067 };
00068
00069 }
00070
00071
00072 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00073 namespace Glib
00074 {
00075
00076 template <>
00077 class Value<Gst::PadDirection> : public Glib::Value_Enum<Gst::PadDirection>
00078 {
00079 public:
00080 static GType value_type() G_GNUC_CONST;
00081 };
00082
00083 }
00084 #endif
00085
00086
00087 namespace Gst
00088 {
00089
00093 enum PadFlags
00094 {
00095 PAD_BLOCKED = GST_OBJECT_FLAG_LAST << 0,
00096 PAD_FLUSHING = GST_OBJECT_FLAG_LAST << 1,
00097 PAD_IN_GETCAPS = GST_OBJECT_FLAG_LAST << 2,
00098 PAD_IN_SETCAPS = GST_OBJECT_FLAG_LAST << 3,
00099 PAD_BLOCKING = GST_OBJECT_FLAG_LAST << 4,
00100 PAD_FLAG_LAST = GST_OBJECT_FLAG_LAST << 8
00101 };
00102
00103 }
00104
00105
00106 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00107 namespace Glib
00108 {
00109
00110 template <>
00111 class Value<Gst::PadFlags> : public Glib::Value_Enum<Gst::PadFlags>
00112 {
00113 public:
00114 static GType value_type() G_GNUC_CONST;
00115 };
00116
00117 }
00118 #endif
00119
00120
00121 namespace Gst
00122 {
00123
00127 enum PadLinkReturn
00128 {
00129 PAD_LINK_OK = 0,
00130 PAD_LINK_WRONG_HIERARCHY = -1,
00131 PAD_LINK_WAS_LINKED = -2,
00132 PAD_LINK_WRONG_DIRECTION = -3,
00133 PAD_LINK_NOFORMAT = -4,
00134 PAD_LINK_NOSCHED = -5,
00135 PAD_LINK_REFUSED = -6
00136 };
00137
00138 }
00139
00140
00141 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00142 namespace Glib
00143 {
00144
00145 template <>
00146 class Value<Gst::PadLinkReturn> : public Glib::Value_Enum<Gst::PadLinkReturn>
00147 {
00148 public:
00149 static GType value_type() G_GNUC_CONST;
00150 };
00151
00152 }
00153 #endif
00154
00155
00156 namespace Gst
00157 {
00158
00162 enum FlowReturn
00163 {
00164 FLOW_CUSTOM_SUCCESS = 100,
00165 FLOW_RESEND = 1,
00166 FLOW_OK = 0,
00167 FLOW_NOT_LINKED = -1,
00168 FLOW_WRONG_STATE = -2,
00169 FLOW_UNEXPECTED = -3,
00170 FLOW_NOT_NEGOTIATED = -4,
00171 FLOW_ERROR = -5,
00172 FLOW_NOT_SUPPORTED = -6,
00173 FLOW_CUSTOM_ERROR = -100
00174 };
00175
00176 }
00177
00178
00179 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00180 namespace Glib
00181 {
00182
00183 template <>
00184 class Value<Gst::FlowReturn> : public Glib::Value_Enum<Gst::FlowReturn>
00185 {
00186 public:
00187 static GType value_type() G_GNUC_CONST;
00188 };
00189
00190 }
00191 #endif
00192
00193
00194 namespace Gst
00195 {
00196
00200 enum ActivateMode
00201 {
00202 ACTIVATE_NONE,
00203 ACTIVATE_PUSH,
00204 ACTIVATE_PULL
00205 };
00206
00207 }
00208
00209
00210 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00211 namespace Glib
00212 {
00213
00214 template <>
00215 class Value<Gst::ActivateMode> : public Glib::Value_Enum<Gst::ActivateMode>
00216 {
00217 public:
00218 static GType value_type() G_GNUC_CONST;
00219 };
00220
00221 }
00222 #endif
00223
00224
00225 namespace Gst
00226 {
00227
00228
00260 class Pad : public Object
00261 {
00262
00263 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00264
00265 public:
00266 typedef Pad CppObjectType;
00267 typedef Pad_Class CppClassType;
00268 typedef GstPad BaseObjectType;
00269 typedef GstPadClass BaseClassType;
00270
00271 private: friend class Pad_Class;
00272 static CppClassType pad_class_;
00273
00274 private:
00275
00276 Pad(const Pad&);
00277 Pad& operator=(const Pad&);
00278
00279 protected:
00280 explicit Pad(const Glib::ConstructParams& construct_params);
00281 explicit Pad(GstPad* castitem);
00282
00283 #endif
00284
00285 public:
00286 virtual ~Pad();
00287
00288 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00289 static GType get_type() G_GNUC_CONST;
00290
00291
00292 static GType get_base_type() G_GNUC_CONST;
00293 #endif
00294
00296 GstPad* gobj() { return reinterpret_cast<GstPad*>(gobject_); }
00297
00299 const GstPad* gobj() const { return reinterpret_cast<GstPad*>(gobject_); }
00300
00302 GstPad* gobj_copy();
00303
00304 private:
00305
00306
00307 protected:
00308 explicit Pad(const Glib::ustring& name, PadDirection direction);
00309 Pad(PadDirection dir);
00310 Pad(const Glib::RefPtr<const Gst::PadTemplate>& templ, const Glib::ustring& name);
00311 Pad(const Glib::RefPtr<const Gst::PadTemplate>& templ);
00312
00313 public:
00317 typedef sigc::slot<void, const Glib::RefPtr<Gst::Pad>&, bool> SlotBlock;
00318
00325 typedef sigc::slot< bool, const Glib::RefPtr<Gst::Pad>&, const Glib::RefPtr<Gst::MiniObject>& > SlotData;
00326
00334 static Glib::RefPtr<Pad> create(const Glib::ustring& name, PadDirection dir);
00335
00336
00344 static Glib::RefPtr<Pad> create(PadDirection dir);
00345
00346
00354 static Glib::RefPtr<Pad> create(const Glib::RefPtr<const Gst::PadTemplate>& pad_template);
00355
00356
00364 static Glib::RefPtr<Pad> create(const Glib::RefPtr<const Gst::PadTemplate>& pad_template, const Glib::ustring& name);
00365
00366
00374 PadDirection get_direction() const;
00375
00383 Glib::RefPtr<Gst::Element> get_parent_element();
00384
00392 Glib::RefPtr<const Gst::Element> get_parent_element() const;
00393
00400 Glib::RefPtr<Gst::PadTemplate> get_pad_template();
00401
00408 Glib::RefPtr<const Gst::PadTemplate> get_pad_template() const;
00409
00417 PadLinkReturn link(const Glib::RefPtr<Gst::Pad>& sink_pad);
00418
00427 bool unlink(const Glib::RefPtr<Gst::Pad>& sink_pad);
00428
00434 bool is_linked() const;
00435
00441 bool can_link(const Glib::RefPtr<const Gst::Pad>& other_pad) const;
00442
00453 Glib::RefPtr<Gst::Caps> get_caps();
00454
00465 Glib::RefPtr<const Gst::Caps> get_caps() const;
00466
00478 Glib::RefPtr<Gst::Caps> get_allowed_caps();
00479
00491 Glib::RefPtr<const Gst::Caps> get_allowed_caps() const;
00492
00505 Glib::RefPtr<Gst::Caps> get_negotiated_caps();
00506
00519 Glib::RefPtr<const Gst::Caps> get_negotiated_caps() const;
00520
00521
00526 Glib::RefPtr<const Gst::Caps> get_pad_template_caps() const;
00527
00528
00540 bool set_caps(const Glib::RefPtr<Gst::Caps>& caps);
00541
00548 Glib::RefPtr<Gst::Pad> get_peer();
00549
00556 Glib::RefPtr<const Gst::Pad> get_peer() const;
00557
00563 Glib::RefPtr<Gst::Caps> peer_get_caps();
00564
00570 Glib::RefPtr<const Gst::Caps> peer_get_caps() const;
00571
00580 void use_fixed_caps();
00581
00587 bool is_active() const;
00588
00598 bool set_blocked(bool blocked = true);
00599
00615 bool set_blocked_async(const SlotBlock& slot, bool blocked = true);
00616
00617
00625 bool is_blocked() const;
00626
00635 bool is_blocking() const;
00636
00659 gulong add_data_probe(const SlotData& slot);
00660
00661
00668 gulong add_buffer_probe(const SlotData& slot);
00669
00670
00677 gulong add_event_probe(const SlotData& slot);
00678
00679
00683 void remove_data_probe(guint handler_id);
00684
00688 void remove_buffer_probe(guint handler_id);
00689
00693 void remove_event_probe(guint handler_id);
00694
00695
00696
00714 FlowReturn alloc_buffer(guint64 offset, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buf);
00715
00716
00717
00718
00733 FlowReturn alloc_buffer_and_set_caps(guint64 offset, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buf);
00734
00735
00736
00737
00752 FlowReturn get_range(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer);
00753
00754
00759 bool accept_caps(const Glib::RefPtr<const Gst::Caps>& caps) const;
00760
00769 Glib::RefPtr<Gst::Caps> proxy_getcaps();
00770
00779 Glib::RefPtr<const Gst::Caps> proxy_getcaps() const;
00780
00787 bool proxy_setcaps(const Glib::RefPtr<Gst::Caps>& caps);
00788
00793 void fixate_caps(const Glib::RefPtr<Gst::Caps>& caps);
00794
00800 bool peer_accept_caps(const Glib::RefPtr<const Gst::Caps>& caps) const;
00801
00802
00822 FlowReturn push(const Glib::RefPtr<Gst::Buffer>& buffer);
00823
00824
00825
00832 bool push_event(const Glib::RefPtr<Gst::Event>& event);
00833
00834
00846 bool check_pull_range() const;
00847
00868 FlowReturn pull_range(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer);
00869
00870
00883 bool activate_pull(bool active = true);
00884
00894 bool activate_push(bool active = true);
00895
00896
00919 bool send_event(const Glib::RefPtr<Gst::Event>& event);
00920
00921
00930 bool event_default(const Glib::RefPtr<Gst::Event>& event);
00931
00942 bool query(const Glib::RefPtr<Gst::Query>& query) const;
00943
00954 bool peer_query(const Glib::RefPtr<Gst::Query>& query) const;
00955
00964 bool query_default(const Glib::RefPtr<Gst::Query>& query) const;
00965
00972 bool query_position(Format& format, gint64& position) const;
00973
00979 bool query_position(Format& format) const;
00980
00981
00988 bool query_duration(Format& format, gint64& duration) const;
00989
00995 bool query_duration(Format& format) const;
00996
00997
01005 bool query_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
01006
01013 bool query_peer_position(Format& format, gint64& position) const;
01014
01021 bool query_peer_position(Format& format) const;
01022
01023
01030 bool query_peer_duration(Format& format, gint64& duration) const;
01031
01037 bool query_peer_duration(Format& format) const;
01038
01039
01048 bool query_peer_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
01049
01050
01055 Glib::ArrayHandle<QueryType> get_query_types() const;
01056
01062 Glib::ArrayHandle<QueryType> get_query_types_default() const;
01063
01064
01075 Gst::Iterator<Gst::Pad> iterate_internal_links();
01076
01087 Gst::Iterator<const Gst::Pad> iterate_internal_links() const;
01088
01100 Gst::Iterator<Gst::Pad> iterate_internal_links_default();
01101
01113 Gst::Iterator<const Gst::Pad> iterate_internal_links_default() const;
01114
01115
01129 Glib::ListHandle< Glib::RefPtr<Gst::Pad> > get_internal_links();
01130
01131
01145 Glib::ListHandle< Glib::RefPtr<const Gst::Pad> > get_internal_links() const;
01146
01147
01164 Glib::ListHandle< Glib::RefPtr<Gst::Pad> > get_internal_links_default();
01165
01182 Glib::ListHandle< Glib::RefPtr<const Gst::Pad> > get_internal_links_default() const;
01183
01184
01185 FlowReturn chain(const Glib::RefPtr<Gst::Buffer>& buffer);
01186
01187
01194 bool pause_task() ;
01195
01207 bool stop_task() ;
01208
01224 bool set_active(bool active = true);
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01242 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Pad>& > signal_linked();
01243
01244
01251 Glib::SignalProxy0< void > signal_request_link();
01252
01253
01260 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Pad>& > signal_unlinked();
01261
01262
01263 #ifdef GLIBMM_PROPERTIES_ENABLED
01264
01270 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Caps> > property_caps() const;
01271 #endif //#GLIBMM_PROPERTIES_ENABLED
01272
01273
01274 #ifdef GLIBMM_PROPERTIES_ENABLED
01275
01281 Glib::PropertyProxy_ReadOnly<PadDirection> property_direction() const;
01282 #endif //#GLIBMM_PROPERTIES_ENABLED
01283
01284
01285 #ifdef GLIBMM_PROPERTIES_ENABLED
01286
01292 Glib::PropertyProxy<PadTemplate> property_template() ;
01293 #endif //#GLIBMM_PROPERTIES_ENABLED
01294
01295 #ifdef GLIBMM_PROPERTIES_ENABLED
01296
01302 Glib::PropertyProxy_ReadOnly<PadTemplate> property_template() const;
01303 #endif //#GLIBMM_PROPERTIES_ENABLED
01304
01305
01306 public:
01307
01308 public:
01309
01310 #ifdef GLIBMM_VFUNCS_ENABLED
01311 #endif //GLIBMM_VFUNCS_ENABLED
01312
01313 protected:
01314
01315 #ifdef GLIBMM_VFUNCS_ENABLED
01316 #endif //GLIBMM_VFUNCS_ENABLED
01317
01318
01319 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01320 virtual void on_linked(const Glib::RefPtr<Gst::Pad>& peer_pad);
01321 virtual void on_request_link();
01322 virtual void on_unlinked(const Glib::RefPtr<Gst::Pad>& peer_pad);
01323 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01324
01325
01326 };
01327
01328 }
01329
01330
01331 namespace Glib
01332 {
01341 Glib::RefPtr<Gst::Pad> wrap(GstPad* object, bool take_copy = false);
01342 }
01343
01344
01345 #endif
01346