| 1 | /* |
| 2 | * check.h |
| 3 | * |
| 4 | * Created on: 3 sie 2013 |
| 5 | * Author: loganek |
| 6 | */ |
| 7 | |
| 8 | #ifndef _GSTREAMERMM_CHECK_H |
| 9 | #define _GSTREAMERMM_CHECK_H |
| 10 | |
| 11 | #include <glibmm/threads.h> |
| 12 | #include <glibmm/ustring.h> |
| 13 | #include <gstreamermm/element.h> |
| 14 | #include <gstreamermm/pad.h> |
| 15 | #include <gstreamermm/caps.h> |
| 16 | #include <gstreamermm/buffer.h> |
| 17 | #include <stdexcept> |
| 18 | |
| 19 | #define THROW_IF(condition, message) \ |
| 20 | if (condition) \ |
| 21 | throw Exception(message); |
| 22 | |
| 23 | namespace Gst |
| 24 | { |
| 25 | class Exception : std::runtime_error |
| 26 | { |
| 27 | public: |
| 28 | Exception(const std::string& message) |
| 29 | : std::runtime_error(message) |
| 30 | {} |
| 31 | }; |
| 32 | |
| 33 | class Check |
| 34 | { |
| 35 | class _Check |
| 36 | { |
| 37 | public: |
| 38 | /** |
| 39 | * Setup an element. |
| 40 | * |
| 41 | * @param factory Factory. |
| 42 | * @return a new element. |
| 43 | * @throw Gst::Exception if creating element fails. |
| 44 | */ |
| 45 | Glib::RefPtr<Gst::Element> setup_element (const Glib::ustring& factory); |
| 46 | |
| 47 | /** |
| 48 | * Compare two caps with. |
| 49 | * |
| 50 | * @param caps1 First caps to compare. |
| 51 | * @param caps2: Second caps to compare. |
| 52 | * @throw Gst::Exception if caps are not equal. |
| 53 | */ |
| 54 | void caps_equal (Glib::RefPtr<Gst::Caps> caps1, Glib::RefPtr<Gst::Caps> caps2); |
| 55 | }; |
| 56 | |
| 57 | Check(); |
| 58 | Check(const Check&); |
| 59 | Check& operator=(const Check&); |
| 60 | |
| 61 | virtual ~Check(){} |
| 62 | public: |
| 63 | static _Check& Instance() |
| 64 | { |
| 65 | static _Check instance; |
| 66 | |
| 67 | return instance; |
| 68 | } |
| 69 | }; |
| 70 | |
| 71 | } |
| 72 | |
| 73 | #endif |