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(const Glib::RefPtr<PadTemplate>& templ, const Glib::ustring& name);
00306
00307 public:
00311 typedef sigc::slot<void, const Glib::RefPtr<Pad>&, bool> SlotBlock;
00312
00319 typedef sigc::slot< bool, const Glib::RefPtr<Pad>&, const Glib::RefPtr<MiniObject>& > SlotData;
00320
00321
00322 static Glib::RefPtr<Pad> create(const Glib::ustring& name, PadDirection dir);
00323
00324
00325 static Glib::RefPtr<Pad> create(const Glib::RefPtr<PadTemplate>& pad_template, const Glib::ustring& name);
00326
00327
00335 PadDirection get_direction() const;
00336
00344 Glib::RefPtr<Element> get_parent_element();
00345
00353 Glib::RefPtr<const Element> get_parent_element() const;
00354
00361 Glib::RefPtr<PadTemplate> get_pad_template() const;
00362
00370 PadLinkReturn link(const Glib::RefPtr<Pad>& sink_pad);
00371
00380 bool unlink(const Glib::RefPtr<Pad>& sink_pad);
00381
00387 bool is_linked() const;
00388
00394 bool can_link(const Glib::RefPtr<Pad>& other_pad);
00395
00406 Glib::RefPtr<Caps> get_caps();
00407
00418 Glib::RefPtr<const Caps> get_caps() const;
00419
00431 Glib::RefPtr<Caps> get_allowed_caps();
00432
00444 Glib::RefPtr<const Caps> get_allowed_caps() const;
00445
00458 Glib::RefPtr<Caps> get_negotiated_caps();
00459
00472 Glib::RefPtr<const Caps> get_negotiated_caps() const;
00473
00474
00479 Glib::RefPtr<const Caps> get_pad_template_caps() const;
00480
00481
00493 bool set_caps (const Glib::RefPtr<Caps>& caps);
00494
00501 Glib::RefPtr<Pad> get_peer();
00502
00509 Glib::RefPtr<const Pad> get_peer() const;
00510
00516 Glib::RefPtr<Caps> peer_get_caps();
00517
00523 Glib::RefPtr<const Caps> peer_get_caps() const;
00524
00533 void use_fixed_caps();
00534
00540 bool is_active() const;
00541
00551 bool set_blocked(bool blocked = true);
00552
00568 bool set_blocked_async(const SlotBlock& slot, bool blocked = true);
00569
00570
00578 bool is_blocked() const;
00579
00588 bool is_blocking() const;
00589
00612 gulong add_data_probe(const SlotData& slot);
00613
00620 gulong add_buffer_probe(const SlotData& slot);
00621
00628 gulong add_event_probe(const SlotData& slot);
00629
00630
00634 void remove_data_probe(guint handler_id);
00635
00639 void remove_buffer_probe(guint handler_id);
00640
00644 void remove_event_probe(guint handler_id);
00645
00646 FlowReturn alloc_buffer(guint64 offset, int size, const Glib::RefPtr<Caps>& caps, Glib::RefPtr<Buffer>& buf);
00647 FlowReturn alloc_buffer_and_set_caps(guint64 offset, int size, const Glib::RefPtr<Caps>& caps, Glib::RefPtr<Buffer>& buf);
00648
00649 FlowReturn get_range(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer);
00650
00651
00656 bool accept_caps(const Glib::RefPtr<Caps>& caps);
00657
00658
00667 Glib::RefPtr<Caps> proxy_getcaps();
00668
00677 Glib::RefPtr<const Caps > proxy_getcaps() const;
00678
00679
00686 bool proxy_setcaps(const Glib::RefPtr<Caps>& caps);
00687
00688
00693 void fixate_caps(const Glib::RefPtr<Caps>& caps);
00694
00695
00701 bool peer_accept_caps(const Glib::RefPtr<Caps>& caps);
00702
00703
00704 FlowReturn push(const Glib::RefPtr<Buffer>& buffer);
00705
00706
00707 bool push_event(const Glib::RefPtr<Event>& event);
00708
00709
00721 bool check_pull_range() const;
00722 FlowReturn pull_range(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer);
00723
00736 bool activate_pull(bool active = true);
00737
00747 bool activate_push(bool active = true);
00748
00749
00750 bool send_event(const Glib::RefPtr<Event>& event);
00751
00760 bool event_default(const Glib::RefPtr<Event>& event);
00761
00772 bool query(const Glib::RefPtr<Query>& query);
00773
00784 bool peer_query(const Glib::RefPtr<Query>& query);
00785
00794 bool query_default(const Glib::RefPtr<Query>& query);
00795 bool query_position(Format& format) const;
00796
00803 bool query_position(Format& format, gint64& position) const;
00804 bool query_duration(Format& format) const;
00805
00812 bool query_duration(Format& format, gint64& duration) const;
00813 bool query_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
00814 bool query_peer_position(Format& format) const;
00815
00822 bool query_peer_position(Format& format, gint64& position) const;
00823 bool query_peer_duration(Format& format) const;
00824
00831 bool query_peer_duration(Format& format, gint64& duration) const;
00832
00841 bool query_peer_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
00842
00843
00848 Glib::ArrayHandle<QueryType> get_query_types() const;
00849
00855 Glib::ArrayHandle<QueryType> get_query_types_default() const;
00856
00857
00865 Glib::ListHandle< Glib::RefPtr<Pad> > get_internal_links();
00866
00876 Glib::ListHandle< Glib::RefPtr<Pad> > get_internal_links_default();
00877
00878
00879 FlowReturn chain(const Glib::RefPtr<Buffer>& buffer);
00880
00881
00888 bool pause_task() ;
00889
00901 bool stop_task() ;
00902
00918 bool set_active(bool active = true);
00919
00920
00926 Glib::SignalProxy1< void,const Glib::RefPtr<Pad>& > signal_linked();
00927
00928
00934 Glib::SignalProxy0< void > signal_request_link();
00935
00936
00942 Glib::SignalProxy1< void,const Glib::RefPtr<Pad>& > signal_unlinked();
00943
00944
00945 #ifdef GLIBMM_PROPERTIES_ENABLED
00946
00952 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Caps> > property_caps() const;
00953 #endif //#GLIBMM_PROPERTIES_ENABLED
00954
00955
00956 #ifdef GLIBMM_PROPERTIES_ENABLED
00957
00963 Glib::PropertyProxy_ReadOnly<PadDirection> property_direction() const;
00964 #endif //#GLIBMM_PROPERTIES_ENABLED
00965
00966
00967 #ifdef GLIBMM_PROPERTIES_ENABLED
00968
00974 Glib::PropertyProxy<PadTemplate> property_template() ;
00975 #endif //#GLIBMM_PROPERTIES_ENABLED
00976
00977 #ifdef GLIBMM_PROPERTIES_ENABLED
00978
00984 Glib::PropertyProxy_ReadOnly<PadTemplate> property_template() const;
00985 #endif //#GLIBMM_PROPERTIES_ENABLED
00986
00987
00988 public:
00989
00990 public:
00991
00992 #ifdef GLIBMM_VFUNCS_ENABLED
00993 #endif //GLIBMM_VFUNCS_ENABLED
00994
00995 protected:
00996
00997 #ifdef GLIBMM_VFUNCS_ENABLED
00998 #endif //GLIBMM_VFUNCS_ENABLED
00999
01000
01001 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01002 virtual void on_linked(const Glib::RefPtr<Pad>& peer_pad);
01003 virtual void on_request_link();
01004 virtual void on_unlinked(const Glib::RefPtr<Pad>& peer_pad);
01005 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01006
01007
01008 };
01009
01010 }
01011
01012
01013 namespace Glib
01014 {
01023 Glib::RefPtr<Gst::Pad> wrap(GstPad* object, bool take_copy = false);
01024 }
01025
01026
01027 #endif
01028