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
00029
00030 #include <gst/gstpad.h>
00031 #include <gstreamermm/object.h>
00032 #include <gstreamermm/miniobject.h>
00033 #include <gstreamermm/format.h>
00034 #include <gstreamermm/query.h>
00035
00036
00037 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00038 typedef struct _GstPad GstPad;
00039 typedef struct _GstPadClass GstPadClass;
00040 #endif
00041
00042
00043 namespace Gst
00044 { class Pad_Class; }
00045 namespace Gst
00046 {
00047
00048 class Buffer;
00049 class Caps;
00050 class Element;
00051 class Event;
00052 class PadTemplate;
00053 class Query;
00054
00060 enum PadDirection
00061 {
00062 PAD_UNKNOWN,
00063 PAD_SRC,
00064 PAD_SINK
00065 };
00066
00067 }
00068
00069
00070 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00071 namespace Glib
00072 {
00073
00074 template <>
00075 class Value<Gst::PadDirection> : public Glib::Value_Enum<Gst::PadDirection>
00076 {
00077 public:
00078 static GType value_type() G_GNUC_CONST;
00079 };
00080
00081 }
00082 #endif
00083
00084
00085 namespace Gst
00086 {
00087
00091 enum PadFlags
00092 {
00093 PAD_BLOCKED = GST_OBJECT_FLAG_LAST << 0,
00094 PAD_FLUSHING = GST_OBJECT_FLAG_LAST << 1,
00095 PAD_IN_GETCAPS = GST_OBJECT_FLAG_LAST << 2,
00096 PAD_IN_SETCAPS = GST_OBJECT_FLAG_LAST << 3,
00097 PAD_BLOCKING = GST_OBJECT_FLAG_LAST << 4,
00098 PAD_FLAG_LAST = GST_OBJECT_FLAG_LAST << 8
00099 };
00100
00101 }
00102
00103
00104 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00105 namespace Glib
00106 {
00107
00108 template <>
00109 class Value<Gst::PadFlags> : public Glib::Value_Enum<Gst::PadFlags>
00110 {
00111 public:
00112 static GType value_type() G_GNUC_CONST;
00113 };
00114
00115 }
00116 #endif
00117
00118
00119 namespace Gst
00120 {
00121
00125 enum PadLinkReturn
00126 {
00127 PAD_LINK_OK = 0,
00128 PAD_LINK_WRONG_HIERARCHY = -1,
00129 PAD_LINK_WAS_LINKED = -2,
00130 PAD_LINK_WRONG_DIRECTION = -3,
00131 PAD_LINK_NOFORMAT = -4,
00132 PAD_LINK_NOSCHED = -5,
00133 PAD_LINK_REFUSED = -6
00134 };
00135
00136 }
00137
00138
00139 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00140 namespace Glib
00141 {
00142
00143 template <>
00144 class Value<Gst::PadLinkReturn> : public Glib::Value_Enum<Gst::PadLinkReturn>
00145 {
00146 public:
00147 static GType value_type() G_GNUC_CONST;
00148 };
00149
00150 }
00151 #endif
00152
00153
00154 namespace Gst
00155 {
00156
00160 enum FlowReturn
00161 {
00162 FLOW_CUSTOM_SUCCESS = 100,
00163 FLOW_RESEND = 1,
00164 FLOW_OK = 0,
00165 FLOW_NOT_LINKED = -1,
00166 FLOW_WRONG_STATE = -2,
00167 FLOW_UNEXPECTED = -3,
00168 FLOW_NOT_NEGOTIATED = -4,
00169 FLOW_ERROR = -5,
00170 FLOW_NOT_SUPPORTED = -6,
00171 FLOW_CUSTOM_ERROR = -100
00172 };
00173
00174 }
00175
00176
00177 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00178 namespace Glib
00179 {
00180
00181 template <>
00182 class Value<Gst::FlowReturn> : public Glib::Value_Enum<Gst::FlowReturn>
00183 {
00184 public:
00185 static GType value_type() G_GNUC_CONST;
00186 };
00187
00188 }
00189 #endif
00190
00191
00192 namespace Gst
00193 {
00194
00198 enum ActivateMode
00199 {
00200 ACTIVATE_NONE,
00201 ACTIVATE_PUSH,
00202 ACTIVATE_PULL
00203 };
00204
00205 }
00206
00207
00208 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00209 namespace Glib
00210 {
00211
00212 template <>
00213 class Value<Gst::ActivateMode> : public Glib::Value_Enum<Gst::ActivateMode>
00214 {
00215 public:
00216 static GType value_type() G_GNUC_CONST;
00217 };
00218
00219 }
00220 #endif
00221
00222
00223 namespace Gst
00224 {
00225
00226
00258 class Pad : public Object
00259 {
00260
00261 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00262
00263 public:
00264 typedef Pad CppObjectType;
00265 typedef Pad_Class CppClassType;
00266 typedef GstPad BaseObjectType;
00267 typedef GstPadClass BaseClassType;
00268
00269 private: friend class Pad_Class;
00270 static CppClassType pad_class_;
00271
00272 private:
00273
00274 Pad(const Pad&);
00275 Pad& operator=(const Pad&);
00276
00277 protected:
00278 explicit Pad(const Glib::ConstructParams& construct_params);
00279 explicit Pad(GstPad* castitem);
00280
00281 #endif
00282
00283 public:
00284 virtual ~Pad();
00285
00286 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00287 static GType get_type() G_GNUC_CONST;
00288 static GType get_base_type() G_GNUC_CONST;
00289 #endif
00290
00292 GstPad* gobj() { return reinterpret_cast<GstPad*>(gobject_); }
00293
00295 const GstPad* gobj() const { return reinterpret_cast<GstPad*>(gobject_); }
00296
00298 GstPad* gobj_copy();
00299
00300 private:
00301
00302
00303 protected:
00304 explicit Pad(const Glib::ustring& name, PadDirection direction);
00305 Pad(PadDirection dir);
00306 Pad(const Glib::RefPtr<Gst::PadTemplate>& templ, const Glib::ustring& name);
00307 Pad(const Glib::RefPtr<Gst::PadTemplate>& templ);
00308
00309 public:
00313 typedef sigc::slot<void, const Glib::RefPtr<Gst::Pad>&, bool> SlotBlock;
00314
00321 typedef sigc::slot< bool, const Glib::RefPtr<Gst::Pad>&, const Glib::RefPtr<Gst::MiniObject>& > SlotData;
00322
00330 static Glib::RefPtr<Pad> create(const Glib::ustring& name, PadDirection dir);
00331
00332
00340 static Glib::RefPtr<Pad> create(PadDirection dir);
00341
00342
00350 static Glib::RefPtr<Pad> create(const Glib::RefPtr<Gst::PadTemplate>& pad_template);
00351
00352
00360 static Glib::RefPtr<Pad> create(const Glib::RefPtr<Gst::PadTemplate>& pad_template, const Glib::ustring& name);
00361
00362
00370 PadDirection get_direction() const;
00371
00379 Glib::RefPtr<Gst::Element> get_parent_element();
00380
00388 Glib::RefPtr<const Gst::Element> get_parent_element() const;
00389
00396 Glib::RefPtr<Gst::PadTemplate> get_pad_template() const;
00397
00405 PadLinkReturn link(const Glib::RefPtr<Gst::Pad>& sink_pad);
00406
00415 bool unlink(const Glib::RefPtr<Gst::Pad>& sink_pad);
00416
00422 bool is_linked() const;
00423
00429 bool can_link(const Glib::RefPtr<Gst::Pad>& other_pad);
00430
00441 Glib::RefPtr<Gst::Caps> get_caps();
00442
00453 Glib::RefPtr<const Gst::Caps> get_caps() const;
00454
00466 Glib::RefPtr<Gst::Caps> get_allowed_caps();
00467
00479 Glib::RefPtr<const Gst::Caps> get_allowed_caps() const;
00480
00493 Glib::RefPtr<Gst::Caps> get_negotiated_caps();
00494
00507 Glib::RefPtr<const Gst::Caps> get_negotiated_caps() const;
00508
00509
00514 Glib::RefPtr<const Gst::Caps> get_pad_template_caps() const;
00515
00516
00528 bool set_caps (const Glib::RefPtr<Gst::Caps>& caps);
00529
00536 Glib::RefPtr<Gst::Pad> get_peer();
00537
00544 Glib::RefPtr<const Gst::Pad> get_peer() const;
00545
00551 Glib::RefPtr<Gst::Caps> peer_get_caps();
00552
00558 Glib::RefPtr<const Gst::Caps> peer_get_caps() const;
00559
00568 void use_fixed_caps();
00569
00575 bool is_active() const;
00576
00586 bool set_blocked(bool blocked = true);
00587
00603 bool set_blocked_async(const SlotBlock& slot, bool blocked = true);
00604
00605
00613 bool is_blocked() const;
00614
00623 bool is_blocking() const;
00624
00647 gulong add_data_probe(const SlotData& slot);
00648
00649
00656 gulong add_buffer_probe(const SlotData& slot);
00657
00658
00665 gulong add_event_probe(const SlotData& slot);
00666
00667
00671 void remove_data_probe(guint handler_id);
00672
00676 void remove_buffer_probe(guint handler_id);
00677
00681 void remove_event_probe(guint handler_id);
00682
00683
00684
00701 FlowReturn alloc_buffer(guint64 offset, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buf);
00702
00703
00704
00705
00719 FlowReturn alloc_buffer_and_set_caps(guint64 offset, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buf);
00720
00721
00722
00723
00724 FlowReturn get_range(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer);
00725
00726
00731 bool accept_caps(const Glib::RefPtr<Gst::Caps>& caps);
00732
00741 Glib::RefPtr<Gst::Caps> proxy_getcaps();
00742
00751 Glib::RefPtr<const Gst::Caps > proxy_getcaps() const;
00752
00759 bool proxy_setcaps(const Glib::RefPtr<Gst::Caps>& caps);
00760
00765 void fixate_caps(const Glib::RefPtr<Gst::Caps>& caps);
00766
00772 bool peer_accept_caps(const Glib::RefPtr<Gst::Caps>& caps);
00773
00774
00794 FlowReturn push(const Glib::RefPtr<Gst::Buffer>& buffer);
00795
00796
00797
00804 bool push_event(const Glib::RefPtr<Gst::Event>& event);
00805
00806
00818 bool check_pull_range() const;
00819
00820 FlowReturn pull_range(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer);
00821
00822
00835 bool activate_pull(bool active = true);
00836
00846 bool activate_push(bool active = true);
00847
00848
00871 bool send_event(const Glib::RefPtr<Gst::Event>& event);
00872
00873
00882 bool event_default(const Glib::RefPtr<Gst::Event>& event);
00883
00894 bool query(const Glib::RefPtr<Gst::Query>& query);
00895
00906 bool peer_query(const Glib::RefPtr<Gst::Query>& query);
00907
00916 bool query_default(const Glib::RefPtr<Gst::Query>& query);
00917
00924 bool query_position(Format& format, gint64& position) const;
00925
00931 bool query_position(Format& format) const;
00932
00933
00940 bool query_duration(Format& format, gint64& duration) const;
00941
00947 bool query_duration(Format& format) const;
00948
00949
00957 bool query_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
00958
00965 bool query_peer_position(Format& format, gint64& position) const;
00966
00973 bool query_peer_position(Format& format) const;
00974
00975
00982 bool query_peer_duration(Format& format, gint64& duration) const;
00983
00989 bool query_peer_duration(Format& format) const;
00990
00991
01000 bool query_peer_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
01001
01002
01007 Glib::ArrayHandle<QueryType> get_query_types() const;
01008
01014 Glib::ArrayHandle<QueryType> get_query_types_default() const;
01015
01016
01030 Glib::ListHandle< Glib::RefPtr<Gst::Pad> > get_internal_links();
01031
01048 Glib::ListHandle< Glib::RefPtr<Gst::Pad> > get_internal_links_default();
01049
01050
01051 FlowReturn chain(const Glib::RefPtr<Gst::Buffer>& buffer);
01052
01053
01060 bool pause_task() ;
01061
01073 bool stop_task() ;
01074
01090 bool set_active(bool active = true);
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01108 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Pad>& > signal_linked();
01109
01110
01117 Glib::SignalProxy0< void > signal_request_link();
01118
01119
01126 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Pad>& > signal_unlinked();
01127
01128
01129 #ifdef GLIBMM_PROPERTIES_ENABLED
01130
01136 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Caps> > property_caps() const;
01137 #endif //#GLIBMM_PROPERTIES_ENABLED
01138
01139
01140 #ifdef GLIBMM_PROPERTIES_ENABLED
01141
01147 Glib::PropertyProxy_ReadOnly<PadDirection> property_direction() const;
01148 #endif //#GLIBMM_PROPERTIES_ENABLED
01149
01150
01151 #ifdef GLIBMM_PROPERTIES_ENABLED
01152
01158 Glib::PropertyProxy<PadTemplate> property_template() ;
01159 #endif //#GLIBMM_PROPERTIES_ENABLED
01160
01161 #ifdef GLIBMM_PROPERTIES_ENABLED
01162
01168 Glib::PropertyProxy_ReadOnly<PadTemplate> property_template() const;
01169 #endif //#GLIBMM_PROPERTIES_ENABLED
01170
01171
01172 public:
01173
01174 public:
01175
01176 #ifdef GLIBMM_VFUNCS_ENABLED
01177 #endif //GLIBMM_VFUNCS_ENABLED
01178
01179 protected:
01180
01181 #ifdef GLIBMM_VFUNCS_ENABLED
01182 #endif //GLIBMM_VFUNCS_ENABLED
01183
01184
01185 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01186 virtual void on_linked(const Glib::RefPtr<Gst::Pad>& peer_pad);
01187 virtual void on_request_link();
01188 virtual void on_unlinked(const Glib::RefPtr<Gst::Pad>& peer_pad);
01189 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01190
01191
01192 };
01193
01194 }
01195
01196
01197 namespace Glib
01198 {
01207 Glib::RefPtr<Gst::Pad> wrap(GstPad* object, bool take_copy = false);
01208 }
01209
01210
01211 #endif
01212