/usr/include/QtGStreamer/QGst/bin.h is in libqtgstreamer-dev 0.10.1-2ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | /*
Copyright (C) 2009-2010 George Kiagiadakis <kiagiadakis.george@gmail.com>
Copyright (C) 2011 Collabora Ltd.
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QGST_BIN_H
#define QGST_BIN_H
#include "element.h"
#include "childproxy.h"
#ifdef Q_CC_MSVC
# pragma warning(push)
# pragma warning(disable:4250) //Bin inherits QGst::Object::ref/unref via dominance
#endif
#if !QGLIB_HAVE_CXX0X
# include <boost/preprocessor.hpp>
#endif
namespace QGst {
/*! \headerfile bin.h <QGst/Bin>
* \brief Wrapper class for GstBin
*
* Bin is an element that can contain other Elements, allowing them to be managed as a group.
* Pads from the child elements can be ghosted to the bin, see GhostPad. This makes the bin
* look like any other elements and enables creation of higher-level abstraction elements.
*
* For more information refer to GStreamer's C API documentation.
*/
class QTGSTREAMER_EXPORT Bin : public Element, public ChildProxy
{
QGST_WRAPPER(Bin)
public:
/*! Creates a new Bin with the specified \a name */
static BinPtr create(const char *name = NULL);
/*! \see fromDescription() */
enum BinFromDescriptionOption { //codegen: skip=true
NoGhost = 0, ///< Do not create ghost pads
Ghost = 1 ///< Create ghost pads
};
/*! Creates a new Bin from a bin description. The description's syntax is the same as the one
* used in the gst-launch tool. If \a ghostUnlinkedPads is set to Ghost, Ghost pads on the bin
* for unlinked source or sink pads within the bin can automatically be created (but only a
* maximum of one ghost pad for each direction will be created; if you expect multiple unlinked
* source pads or multiple unlinked sink pads and want them all ghosted, you will have to
* create the ghost pads yourself)
* \throws QGlib::Error when there was a problem creating the pipeline
*/
static BinPtr fromDescription(const char *description,
BinFromDescriptionOption ghostUnlinkedPads = Ghost);
/*! \overload */
static inline BinPtr fromDescription(const QString & description,
BinFromDescriptionOption ghostUnlinkedPads = Ghost);
/*! Adds the given element to the bin. Sets the element's parent, and thus takes
* ownership of the element. An element can only be added to one bin.
*
* If the element's pads are linked to other pads, the pads will be unlinked before
* the element is added to the bin.
*/
bool add(const ElementPtr & element);
#if QGLIB_HAVE_CXX0X
# ifndef DOXYGEN_RUN
private:
inline void add() {} //terminate condition for the variadic template recursion
public:
# endif
/*! Adds two or more elements to the bin. This function is equivalent to calling
* add() for each of the elements. The return value of each add() is ignored.
* \note This function makes use of C++0x features. If your compiler doesn't support
* this, a different version will be compiled. That version supports up to
* QGST_BIN_ADD_MAX_ARGS arguments, which defaults to 10. If you need more, define
* this to a greater value before including any QtGStreamer headers.
*/
template <typename First, typename Second, typename... Rest>
inline void add(const First & first, const Second & second, const Rest & ... rest)
{
add(first);
add(second);
add(rest...);
}
#else //QGLIB_HAVE_CXX0X
# ifndef QGST_BIN_ADD_MAX_ARGS
# define QGST_BIN_ADD_MAX_ARGS 10
# endif
# define QGST_BIN_ADD_DECLARATION(z, n, data) \
inline void add(BOOST_PP_ENUM_PARAMS(n, const ElementPtr & e)) \
{ \
add(e0); \
add(BOOST_PP_ENUM_SHIFTED_PARAMS(n, e)); \
};
BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_INC(QGST_BIN_ADD_MAX_ARGS), QGST_BIN_ADD_DECLARATION, dummy)
# undef QGST_BIN_ADD_DECLARATION
#endif //QGLIB_HAVE_CXX0X
/*! Removes the element from the bin, unparenting it as well.
*
* If the element's pads are linked to other pads, the pads will be
* unlinked before the element is removed from the bin.
*/
bool remove(const ElementPtr & element);
/*! This enum is used with getElementByName() to specify where to look for
* elements if an element is not found as a direct child of this Bin.
*/
enum RecursionType { //codegen: skip=true
/*! Recurse down into child bins (if any) */
RecurseDown,
/*! Recurse down to child bins and if the element is not found there as well,
* recurse up the hierarchy to the parent bins (if any) and their children.
*/
RecurseUp
};
/*! Gets the element with the given name from a bin.
* Returns a null ElementPtr if the element is not found.
*
* By default, this function also recurses into child bins. If \a recursionType
* is set to RecurseUp, it will also search parent bins (if any) and their children.
*/
ElementPtr getElementByName(const char *name, RecursionType recursionType = RecurseDown) const;
/*! Returns an element inside the bin that implements the given interface type. */
ElementPtr getElementByInterface(QGlib::Type interfaceType) const;
/*! Looks for an element inside the bin that implements the given interface
* and returns it casted to the interface type. Example:
* \code
* QGst::XOverlayPtr xoverlay = bin->getElementByInterface<QGst::XOverlay>();
* \endcode
*/
template <typename T> QGlib::RefPointer<T> getElementByInterface() const;
/*! Recursively looks for elements with an unlinked pad of the given direction within the
* specified bin and returns an unlinked pad if one is found, or a null PadPtr otherwise.
*/
PadPtr findUnlinkedPad(PadDirection direction) const;
bool recalculateLatency();
};
inline BinPtr Bin::fromDescription(const QString & description,
BinFromDescriptionOption ghostUnlinkedPads)
{
return fromDescription(description.toUtf8().constData(), ghostUnlinkedPads);
}
template <typename T>
QGlib::RefPointer<T> Bin::getElementByInterface() const
{
ElementPtr p = getElementByInterface(QGlib::GetType<T>());
return p.dynamicCast<T>();
}
} //namespace QGst
QGST_REGISTER_TYPE(QGst::Bin)
#ifdef Q_CC_MSVC
# pragma warning(pop)
#endif
#endif
|