00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef QGST_BIN_H
00020 #define QGST_BIN_H
00021
00022 #include "element.h"
00023 #include "childproxy.h"
00024
00025 #ifdef Q_CC_MSVC
00026 # pragma warning(push)
00027 # pragma warning(disable:4250) //Bin inherits QGst::Object::ref/unref via dominance
00028 #endif
00029
00030 #if !QGLIB_HAVE_CXX0X
00031 # include <boost/preprocessor.hpp>
00032 #endif
00033
00034 namespace QGst {
00035
00045 class QTGSTREAMER_EXPORT Bin : public Element, public ChildProxy
00046 {
00047 QGST_WRAPPER(Bin)
00048 public:
00050 static BinPtr create(const char *name = NULL);
00051
00053 enum BinFromDescriptionOption {
00054 NoGhost = 0,
00055 Ghost = 1
00056 };
00057
00066 static BinPtr fromDescription(const char *description,
00067 BinFromDescriptionOption ghostUnlinkedPads = Ghost);
00069 static inline BinPtr fromDescription(const QString & description,
00070 BinFromDescriptionOption ghostUnlinkedPads = Ghost);
00071
00078 bool add(const ElementPtr & element);
00079
00080 #if QGLIB_HAVE_CXX0X
00081
00082 # ifndef DOXYGEN_RUN
00083 private:
00084 inline void add() {}
00085 public:
00086 # endif
00087
00095 template <typename First, typename Second, typename... Rest>
00096 inline void add(const First & first, const Second & second, const Rest & ... rest)
00097 {
00098 add(first);
00099 add(second);
00100 add(rest...);
00101 }
00102
00103 #else //QGLIB_HAVE_CXX0X
00104
00105 # ifndef QGST_BIN_ADD_MAX_ARGS
00106 # define QGST_BIN_ADD_MAX_ARGS 10
00107 # endif
00108
00109 # define QGST_BIN_ADD_DECLARATION(z, n, data) \
00110 inline void add(BOOST_PP_ENUM_PARAMS(n, const ElementPtr & e)) \
00111 { \
00112 add(e0); \
00113 add(BOOST_PP_ENUM_SHIFTED_PARAMS(n, e)); \
00114 };
00115
00116 BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_INC(QGST_BIN_ADD_MAX_ARGS), QGST_BIN_ADD_DECLARATION, dummy)
00117
00118 # undef QGST_BIN_ADD_DECLARATION
00119
00120 #endif //QGLIB_HAVE_CXX0X
00121
00127 bool remove(const ElementPtr & element);
00128
00132 enum RecursionType {
00134 RecurseDown,
00138 RecurseUp
00139 };
00140
00147 ElementPtr getElementByName(const char *name, RecursionType recursionType = RecurseDown) const;
00148
00150 ElementPtr getElementByInterface(QGlib::Type interfaceType) const;
00151
00158 template <typename T> QGlib::RefPointer<T> getElementByInterface() const;
00159
00163 PadPtr findUnlinkedPad(PadDirection direction) const;
00164
00165 bool recalculateLatency();
00166 };
00167
00168 inline BinPtr Bin::fromDescription(const QString & description,
00169 BinFromDescriptionOption ghostUnlinkedPads)
00170 {
00171 return fromDescription(description.toUtf8().constData(), ghostUnlinkedPads);
00172 }
00173
00174 template <typename T>
00175 QGlib::RefPointer<T> Bin::getElementByInterface() const
00176 {
00177 ElementPtr p = getElementByInterface(QGlib::GetType<T>());
00178 return p.dynamicCast<T>();
00179 }
00180
00181 }
00182
00183 QGST_REGISTER_TYPE(QGst::Bin)
00184
00185 #ifdef Q_CC_MSVC
00186 # pragma warning(pop)
00187 #endif
00188
00189 #endif