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
00614
00621 gulong add_buffer_probe(const SlotData& slot);
00622
00623
00630 gulong add_event_probe(const SlotData& slot);
00631
00632
00636 void remove_data_probe(guint handler_id);
00637
00641 void remove_buffer_probe(guint handler_id);
00642
00646 void remove_event_probe(guint handler_id);
00647
00648
00649
00650 FlowReturn alloc_buffer(guint64 offset, int size, const Glib::RefPtr<Caps>& caps, Glib::RefPtr<Buffer>& buf);
00651
00652
00653
00654
00655 FlowReturn alloc_buffer_and_set_caps(guint64 offset, int size, const Glib::RefPtr<Caps>& caps, Glib::RefPtr<Buffer>& buf);
00656
00657
00658
00659
00660 FlowReturn get_range(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer);
00661
00662
00667 bool accept_caps(const Glib::RefPtr<Caps>& caps);
00668
00677 Glib::RefPtr<Caps> proxy_getcaps();
00678
00687 Glib::RefPtr<const Caps > proxy_getcaps() const;
00688
00695 bool proxy_setcaps(const Glib::RefPtr<Caps>& caps);
00696
00701 void fixate_caps(const Glib::RefPtr<Caps>& caps);
00702
00708 bool peer_accept_caps(const Glib::RefPtr<Caps>& caps);
00709
00710
00711 FlowReturn push(const Glib::RefPtr<Buffer>& buffer);
00712
00713
00714
00715 bool push_event(const Glib::RefPtr<Event>& event);
00716
00717
00729 bool check_pull_range() const;
00730
00731 FlowReturn pull_range(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer);
00732
00733
00746 bool activate_pull(bool active = true);
00747
00757 bool activate_push(bool active = true);
00758
00759
00760 bool send_event(const Glib::RefPtr<Event>& event);
00761
00762
00771 bool event_default(const Glib::RefPtr<Event>& event);
00772
00783 bool query(const Glib::RefPtr<Query>& query);
00784
00795 bool peer_query(const Glib::RefPtr<Query>& query);
00796
00805 bool query_default(const Glib::RefPtr<Query>& query);
00806
00813 bool query_position(Format& format, gint64& position) const;
00814
00815 bool query_position(Format& format) const;
00816
00817
00824 bool query_duration(Format& format, gint64& duration) const;
00825
00826 bool query_duration(Format& format) const;
00827
00828
00836 bool query_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
00837
00844 bool query_peer_position(Format& format, gint64& position) const;
00845
00846 bool query_peer_position(Format& format) const;
00847
00848
00855 bool query_peer_duration(Format& format, gint64& duration) const;
00856
00857 bool query_peer_duration(Format& format) const;
00858
00859
00868 bool query_peer_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
00869
00870
00875 Glib::ArrayHandle<QueryType> get_query_types() const;
00876
00882 Glib::ArrayHandle<QueryType> get_query_types_default() const;
00883
00884
00892 Glib::ListHandle< Glib::RefPtr<Pad> > get_internal_links();
00893
00903 Glib::ListHandle< Glib::RefPtr<Pad> > get_internal_links_default();
00904
00905
00906 FlowReturn chain(const Glib::RefPtr<Buffer>& buffer);
00907
00908
00915 bool pause_task() ;
00916
00928 bool stop_task() ;
00929
00945 bool set_active(bool active = true);
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00962 Glib::SignalProxy1< void,const Glib::RefPtr<Pad>& > signal_linked();
00963
00964
00970 Glib::SignalProxy0< void > signal_request_link();
00971
00972
00978 Glib::SignalProxy1< void,const Glib::RefPtr<Pad>& > signal_unlinked();
00979
00980
00981 #ifdef GLIBMM_PROPERTIES_ENABLED
00982
00988 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Caps> > property_caps() const;
00989 #endif //#GLIBMM_PROPERTIES_ENABLED
00990
00991
00992 #ifdef GLIBMM_PROPERTIES_ENABLED
00993
00999 Glib::PropertyProxy_ReadOnly<PadDirection> property_direction() const;
01000 #endif //#GLIBMM_PROPERTIES_ENABLED
01001
01002
01003 #ifdef GLIBMM_PROPERTIES_ENABLED
01004
01010 Glib::PropertyProxy<PadTemplate> property_template() ;
01011 #endif //#GLIBMM_PROPERTIES_ENABLED
01012
01013 #ifdef GLIBMM_PROPERTIES_ENABLED
01014
01020 Glib::PropertyProxy_ReadOnly<PadTemplate> property_template() const;
01021 #endif //#GLIBMM_PROPERTIES_ENABLED
01022
01023
01024 public:
01025
01026 public:
01027
01028 #ifdef GLIBMM_VFUNCS_ENABLED
01029 #endif //GLIBMM_VFUNCS_ENABLED
01030
01031 protected:
01032
01033 #ifdef GLIBMM_VFUNCS_ENABLED
01034 #endif //GLIBMM_VFUNCS_ENABLED
01035
01036
01037 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01038 virtual void on_linked(const Glib::RefPtr<Pad>& peer_pad);
01039 virtual void on_request_link();
01040 virtual void on_unlinked(const Glib::RefPtr<Pad>& peer_pad);
01041 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01042
01043
01044 };
01045
01046 }
01047
01048
01049 namespace Glib
01050 {
01059 Glib::RefPtr<Gst::Pad> wrap(GstPad* object, bool take_copy = false);
01060 }
01061
01062
01063 #endif
01064