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 dir);
00305 explicit Pad(const Glib::RefPtr<PadTemplate>& pad_template, 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
00475
00476
00477 Glib::RefPtr<Caps> get_pad_template_caps();
00478
00479
00491 bool set_caps (const Glib::RefPtr<Caps>& caps);
00492
00499 Glib::RefPtr<Pad> get_peer();
00500
00507 Glib::RefPtr<const Pad> get_peer() const;
00508
00514 Glib::RefPtr<Caps> peer_get_caps();
00515
00521 Glib::RefPtr<const Caps> peer_get_caps() const;
00522
00531 void use_fixed_caps();
00532
00538 bool is_active() const;
00539
00549 bool set_blocked(bool blocked = true);
00550
00566 bool set_blocked_async(const SlotBlock& slot, bool blocked = true);
00567
00568
00576 bool is_blocked() const;
00577
00586 bool is_blocking() const;
00587
00610 gulong add_data_probe(const SlotData& slot);
00611
00618 gulong add_buffer_probe(const SlotData& slot);
00619
00626 gulong add_event_probe(const SlotData& slot);
00627
00628
00632 void remove_data_probe(guint handler_id);
00633
00637 void remove_buffer_probe(guint handler_id);
00638
00642 void remove_event_probe(guint handler_id);
00643
00644 FlowReturn alloc_buffer(guint64 offset, int size, const Glib::RefPtr<Caps>& caps, Glib::RefPtr<Buffer>& buf);
00645 FlowReturn alloc_buffer_and_set_caps(guint64 offset, int size, const Glib::RefPtr<Caps>& caps, Glib::RefPtr<Buffer>& buf);
00646
00647 FlowReturn get_range(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer);
00648
00649
00654 bool accept_caps(const Glib::RefPtr<Caps>& caps);
00655
00656
00665 Glib::RefPtr<Caps> proxy_getcaps();
00666
00675 Glib::RefPtr<Caps const> proxy_getcaps() const;
00676
00677
00684 bool proxy_setcaps(const Glib::RefPtr<Caps>& caps);
00685
00686
00691 void fixate_caps(const Glib::RefPtr<Caps>& caps);
00692
00693
00699 bool peer_accept_caps(const Glib::RefPtr<Caps>& caps);
00700
00701
00702 FlowReturn push(const Glib::RefPtr<Buffer>& buffer);
00703
00704
00705 bool push_event(const Glib::RefPtr<Event>& event);
00706
00707
00719 bool check_pull_range() const;
00720 FlowReturn pull_range(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer);
00721
00734 bool activate_pull(bool active = true);
00735
00745 bool activate_push(bool active = true);
00746
00747
00748 bool send_event(const Glib::RefPtr<Event>& event);
00749
00758 bool event_default(const Glib::RefPtr<Event>& event);
00759
00770 bool query(const Glib::RefPtr<Query>& query);
00771
00782 bool peer_query(const Glib::RefPtr<Query>& query);
00783
00792 bool query_default(const Glib::RefPtr<Query>& query);
00793 bool query_position(Format& format) const;
00794
00801 bool query_position(Format& format, gint64& position) const;
00802 bool query_duration(Format& format) const;
00803
00810 bool query_duration(Format& format, gint64& duration) const;
00811 bool query_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
00812 bool query_peer_position(Format& format) const;
00813
00820 bool query_peer_position(Format& format, gint64& position) const;
00821 bool query_peer_duration(Format& format) const;
00822
00829 bool query_peer_duration(Format& format, gint64& duration) const;
00830
00839 bool query_peer_convert(Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const;
00840
00841
00846 Glib::ArrayHandle<QueryType> get_query_types() const;
00847
00853 Glib::ArrayHandle<QueryType> get_query_types_default() const;
00854
00855
00863 Glib::ListHandle< Glib::RefPtr<Pad> > get_internal_links();
00864
00874 Glib::ListHandle< Glib::RefPtr<Pad> > get_internal_links_default();
00875
00876
00877 FlowReturn chain(const Glib::RefPtr<Buffer>& buffer);
00878
00879
00886 bool pause_task() ;
00887
00899 bool stop_task() ;
00900
00916 bool set_active(bool active = true);
00917
00918
00924 Glib::SignalProxy1< void,const Glib::RefPtr<Pad>& > signal_linked();
00925
00926
00932 Glib::SignalProxy0< void > signal_request_link();
00933
00934
00940 Glib::SignalProxy1< void,const Glib::RefPtr<Pad>& > signal_unlinked();
00941
00942
00943 #ifdef GLIBMM_PROPERTIES_ENABLED
00944
00950 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Caps> > property_caps() const;
00951 #endif //#GLIBMM_PROPERTIES_ENABLED
00952
00953
00954 #ifdef GLIBMM_PROPERTIES_ENABLED
00955
00961 Glib::PropertyProxy_ReadOnly<PadDirection> property_direction() const;
00962 #endif //#GLIBMM_PROPERTIES_ENABLED
00963
00964
00965 #ifdef GLIBMM_PROPERTIES_ENABLED
00966
00972 Glib::PropertyProxy<PadTemplate> property_template() ;
00973 #endif //#GLIBMM_PROPERTIES_ENABLED
00974
00975 #ifdef GLIBMM_PROPERTIES_ENABLED
00976
00982 Glib::PropertyProxy_ReadOnly<PadTemplate> property_template() const;
00983 #endif //#GLIBMM_PROPERTIES_ENABLED
00984
00985
00986 public:
00987
00988 public:
00989
00990 #ifdef GLIBMM_VFUNCS_ENABLED
00991 #endif //GLIBMM_VFUNCS_ENABLED
00992
00993 protected:
00994
00995 #ifdef GLIBMM_VFUNCS_ENABLED
00996 #endif //GLIBMM_VFUNCS_ENABLED
00997
00998
00999 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01000 virtual void on_linked(const Glib::RefPtr<Pad>& peer_pad);
01001 virtual void on_request_link();
01002 virtual void on_unlinked(const Glib::RefPtr<Pad>& peer_pad);
01003 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
01004
01005
01006 };
01007
01008 }
01009
01010
01011 namespace Glib
01012 {
01021 Glib::RefPtr<Gst::Pad> wrap(GstPad* object, bool take_copy = false);
01022 }
01023
01024
01025 #endif
01026