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 static GType get_base_type() G_GNUC_CONST;
00291 #endif
00292
00294 GstPad* gobj() { return reinterpret_cast<GstPad*>(gobject_); }
00295
00297 const GstPad* gobj() const { return reinterpret_cast<GstPad*>(gobject_); }
00298
00300 GstPad* gobj_copy();
00301
00302 private:
00303
00304
00305 protected:
00306 explicit Pad(const Glib::ustring& name, PadDirection direction);
00307 Pad(PadDirection dir);
00308 Pad(const Glib::RefPtr<const Gst::PadTemplate>& templ, const Glib::ustring& name);
00309 Pad(const Glib::RefPtr<const Gst::PadTemplate>& templ);
00310
00311 public:
00315 typedef sigc::slot<void, const Glib::RefPtr<Gst::Pad>&, bool> SlotBlock;
00316
00323 typedef sigc::slot< bool, const Glib::RefPtr<Gst::Pad>&, const Glib::RefPtr<Gst::MiniObject>& > SlotData;
00324
00332 static Glib::RefPtr<Pad> create(const Glib::ustring& name, PadDirection dir);
00333
00334
00342 static Glib::RefPtr<Pad> create(PadDirection dir);
00343
00344
00352 static Glib::RefPtr<Pad> create(const Glib::RefPtr<const Gst::PadTemplate>& pad_template);
00353
00354
00362 static Glib::RefPtr<Pad> create(const Glib::RefPtr<const Gst::PadTemplate>& pad_template, const Glib::ustring& name);
00363
00364
00372 PadDirection get_direction() const;
00373
00381 Glib::RefPtr<Gst::Element> get_parent_element();
00382
00390 Glib::RefPtr<const Gst::Element> get_parent_element() const;
00391
00398 Glib::RefPtr<Gst::PadTemplate> get_pad_template();
00399
00406 Glib::RefPtr<const Gst::PadTemplate> get_pad_template() const;
00407
00415 PadLinkReturn link(const Glib::RefPtr<Gst::Pad>& sink_pad);
00416
00425 bool unlink(const Glib::RefPtr<Gst::Pad>& sink_pad);
00426
00432 bool is_linked() const;
00433
00439 bool can_link(const Glib::RefPtr<const Gst::Pad>& other_pad) const;
00440
00451 Glib::RefPtr<Gst::Caps> get_caps();
00452
00463 Glib::RefPtr<const Gst::Caps> get_caps() const;
00464
00476 Glib::RefPtr<Gst::Caps> get_allowed_caps();
00477
00489 Glib::RefPtr<const Gst::Caps> get_allowed_caps() const;
00490
00503 Glib::RefPtr<Gst::Caps> get_negotiated_caps();
00504
00517 Glib::RefPtr<const Gst::Caps> get_negotiated_caps() const;
00518
00519
00524 Glib::RefPtr<const Gst::Caps> get_pad_template_caps() const;
00525
00526
00538 bool set_caps(const Glib::RefPtr<Gst::Caps>& caps);
00539
00546 Glib::RefPtr<Gst::Pad> get_peer();
00547
00554 Glib::RefPtr<const Gst::Pad> get_peer() const;
00555
00561 Glib::RefPtr<Gst::Caps> peer_get_caps();
00562
00568 Glib::RefPtr<const Gst::Caps> peer_get_caps() const;
00569
00578 void use_fixed_caps();
00579
00585 bool is_active() const;
00586
00596 bool set_blocked(bool blocked = true);
00597
00613 bool set_blocked_async(const SlotBlock& slot, bool blocked = true);
00614
00615
00623 bool is_blocked() const;
00624
00633 bool is_blocking() const;
00634
00657 gulong add_data_probe(const SlotData& slot);
00658
00659
00666 gulong add_buffer_probe(const SlotData& slot);
00667
00668
00675 gulong add_event_probe(const SlotData& slot);
00676
00677
00681 void remove_data_probe(guint handler_id);
00682
00686 void remove_buffer_probe(guint handler_id);
00687
00691 void remove_event_probe(guint handler_id);
00692
00693
00694
00712 FlowReturn alloc_buffer(guint64 offset, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buf);
00713
00714
00715
00716
00731 FlowReturn alloc_buffer_and_set_caps(guint64 offset, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buf);
00732
00733
00734
00735
00750 FlowReturn get_range(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer);
00751
00752
00757 bool accept_caps(const Glib::RefPtr<const Gst::Caps>& caps) const;
00758
00767 Glib::RefPtr<Gst::Caps> proxy_getcaps();
00768
00777 Glib::RefPtr<const Gst::Caps> proxy_getcaps() const;
00778
00785 bool proxy_setcaps(const Glib::RefPtr<Gst::Caps>& caps);
00786
00791 void fixate_caps(const Glib::RefPtr<Gst::Caps>& caps);
00792
00798 bool peer_accept_caps(const Glib::RefPtr<const Gst::Caps>& caps) const;
00799
00800
00820 FlowReturn push(const Glib::RefPtr<Gst::Buffer>& buffer);
00821
00822
00823
00830 bool push_event(const Glib::RefPtr<Gst::Event>& event);
00831
00832
00844 bool check_pull_range() const;
00845
00866 FlowReturn pull_range(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer);
00867
00868
00881 bool activate_pull(bool active = true);
00882
00892 bool activate_push(bool active = true);
00893
00894
00917 bool send_event(const Glib::RefPtr<Gst::Event>& event);
00918
00919
00928 bool event_default(const Glib::RefPtr<Gst::Event>& event);
00929
00940 bool query(const Glib::RefPtr<Gst::Query>& query) const;
00941
00952 bool peer_query(const Glib::RefPtr<Gst::Query>& query) const;
00953
00962 bool query_default(const Glib::RefPtr<Gst::Query>& query) const;
00963
00970 bool query_position(Format& format, gint64& position) const;
00971
00977 bool query_position(Format& format) const;
00978
00979
00986 bool query_duration(Format& format, gint64& duration) const;
00987
00993 bool query_duration(Format& format) const;
00994
00995
01003 bool query_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
01004
01011 bool query_peer_position(Format& format, gint64& position) const;
01012
01019 bool query_peer_position(Format& format) const;
01020
01021
01028 bool query_peer_duration(Format& format, gint64& duration) const;
01029
01035 bool query_peer_duration(Format& format) const;
01036
01037
01046 bool query_peer_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
01047
01048
01053 Glib::ArrayHandle<QueryType> get_query_types() const;
01054
01060 Glib::ArrayHandle<QueryType> get_query_types_default() const;
01061
01062
01073 Gst::Iterator<Gst::Pad> iterate_internal_links();
01074
01085 Gst::Iterator<const Gst::Pad> iterate_internal_links() const;
01086
01098 Gst::Iterator<Gst::Pad> iterate_internal_links_default();
01099
01111 Gst::Iterator<const Gst::Pad> iterate_internal_links_default() const;
01112
01113
01127 Glib::ListHandle< Glib::RefPtr<Gst::Pad> > get_internal_links();
01128
01129
01143 Glib::ListHandle< Glib::RefPtr<const Gst::Pad> > get_internal_links() const;
01144
01145
01162 Glib::ListHandle< Glib::RefPtr<Gst::Pad> > get_internal_links_default();
01163
01180 Glib::ListHandle< Glib::RefPtr<const Gst::Pad> > get_internal_links_default() const;
01181
01182
01183 FlowReturn chain(const Glib::RefPtr<Gst::Buffer>& buffer);
01184
01185
01192 bool pause_task() ;
01193
01205 bool stop_task() ;
01206
01222 bool set_active(bool active = true);
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01240 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Pad>& > signal_linked();
01241
01242
01249 Glib::SignalProxy0< void > signal_request_link();
01250
01251
01258 Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Pad>& > signal_unlinked();
01259
01260
01261 #ifdef GLIBMM_PROPERTIES_ENABLED
01262
01268 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Caps> > property_caps() const;
01269 #endif //#GLIBMM_PROPERTIES_ENABLED
01270
01271
01272 #ifdef GLIBMM_PROPERTIES_ENABLED
01273
01279 Glib::PropertyProxy_ReadOnly<PadDirection> property_direction() const;
01280 #endif //#GLIBMM_PROPERTIES_ENABLED
01281
01282
01283 #ifdef GLIBMM_PROPERTIES_ENABLED
01284
01290 Glib::PropertyProxy<PadTemplate> property_template() ;
01291 #endif //#GLIBMM_PROPERTIES_ENABLED
01292
01293 #ifdef GLIBMM_PROPERTIES_ENABLED
01294
01300 Glib::PropertyProxy_ReadOnly<PadTemplate> property_template() const;
01301 #endif //#GLIBMM_PROPERTIES_ENABLED
01302
01303
01304 public:
01305
01306 public:
01307
01308 #ifdef GLIBMM_VFUNCS_ENABLED
01309 #endif //GLIBMM_VFUNCS_ENABLED
01310
01311 protected:
01312
01313 #ifdef GLIBMM_VFUNCS_ENABLED
01314 #endif //GLIBMM_VFUNCS_ENABLED
01315
01316
01317 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01318 virtual void on_linked(const Glib::RefPtr<Gst::Pad>& peer_pad);
01319 virtual void on_request_link();
01320 virtual void on_unlinked(const Glib::RefPtr<Gst::Pad>& peer_pad);
01321 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01322
01323
01324 };
01325
01326 }
01327
01328
01329 namespace Glib
01330 {
01339 Glib::RefPtr<Gst::Pad> wrap(GstPad* object, bool take_copy = false);
01340 }
01341
01342
01343 #endif
01344