1/* gstreamermm - a C++ wrapper for gstreamer 2 * 3 * Copyright 2008 The gstreamermm Development Team 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free 17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20#include <gst/gst.h> 21#include <glibmm/arrayhandle.h> 22 23_DEFS(gstreamermm,gst) 24 25namespace Gst 26{ 27 28//Gst::IteratorBasic<> forward declaration. 29template <class CppType> 30class IteratorBasic; 31 32_WRAP_ENUM(Format, GstFormat) 33 34/** A class to store the details of a Gst::Format retrieved by 35 * Gst::get_format_details(). 36 */ 37class FormatDefinition 38{ 39 _CLASS_GENERIC(FormatDefinition, GstFormatDefinition) 40 41public: 42 /// Default constructor. 43 FormatDefinition(); 44 45 /** Constructs a Gst::FormatDefinition from a C GstFormatDefinition type. 46 * The @a castitem is left unaffected; its contents are simply copied. 47 * @param castitem The GstFormatDefinition to copy contents from. 48 */ 49 explicit FormatDefinition(const GstFormatDefinition* castitem); 50 51 /// The unique id of this format. 52 Gst::Format value; 53 54 /// A short nick of the format. 55 Glib::ustring nick; 56 57 /// A longer description of the format. 58 Glib::ustring description; 59 60 /// A quark for the nick. 61 Glib::QueryQuark quark; 62}; 63 64namespace Enums 65{ 66 67/** Gets a printable name for the given format. Do not modify or free. 68 * 69 * @param format A Gst::Format. 70 * @return The name of the format or an empty string if the format is unknown. 71 */ 72Glib::ustring get_name(Format format); 73 74/** Gets the unique quark for the given format. 75 * 76 * @param format A Gst::Format. 77 * @return The quark associated with the format or 0 if the format is unknown. 78 */ 79Glib::QueryQuark get_quark(Format format); 80 81} //namespace Enums 82 83/** Creates a new Gst::Format based on the nick or return an already 84 * registered format with that nick. 85 * 86 * @param nick The nick of the new format. 87 * @param description The description of the new format. 88 * @return A new Gst::Format or an already registered format with the same 89 * nick. MT safe. 90 */ 91Format register_format(const Glib::ustring& nick, const Glib::ustring& 92description); 93 94/** Returns the format registered with the given nick. 95 * 96 * @param nick The nick of the format. 97 * @return The format with nick or Gst::FORMAT_UNDEFINED if the format was not 98 * registered. 99 */ 100Format get_format(const Glib::ustring& nick); 101 102/** Sees if the given format is inside the array of formats. 103 * 104 * @param formats The array of formats to search. 105 * @param format The format to find. 106 * @return true If the format is found inside the array. 107 */ 108bool formats_contain(const Glib::ArrayHandle<Format>& formats, Format format); 109 110/** Gets details about the given format. 111 * 112 * @param format The format to get details of. 113 * @param def The Gst::FormatDefinition in which to store the details of 114 * the format. 115 * @return true if successful, false otherwise. MT safe. 116 */ 117bool get_format_details(Format format, FormatDefinition& def); 118 119/** Iterates all the registered formats. The format definitions are read 120 * only. 121 * @return a Gst::IteratorBasic of Gst::FormatDefinition. 122 */ 123IteratorBasic<const FormatDefinition> iterate_format_definitions(); 124 125} //namespace Gst 126