/usr/include/mediascanner-1.0/mediascanner/mediautils.h is in libmediascanner-dev 0.3.93+14.04.20131024.1-0ubuntu1.
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 | /*
* This file is part of the Ubuntu TV Media Scanner
* Copyright (C) 2012-2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* 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 Lesser 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/>.
*
* Contact: Jim Hodapp <jim.hodapp@canonical.com>
* Authored by: Mathias Hasselmann <mathias@openismus.com>
*/
#ifndef MEDIASCANNER_MEDIAUTILS_H
#define MEDIASCANNER_MEDIAUTILS_H
// C++ Standard Library
#include <string>
#include <vector>
// Media Scanner Library
#include "mediascanner/property.h"
typedef struct _GList GList;
typedef struct _GrlMedia GrlMedia;
namespace mediascanner {
class MimeType {
public:
static const MimeType kApplicationOgg;
static const MimeType kAudioPrefix;
static const MimeType kImagePrefix;
static const MimeType kVideoPrefix;
explicit MimeType(const std::string &str)
: str_(str.begin(), str.end()) {
}
explicit MimeType(const std::wstring &str)
: str_(str) {
}
const std::wstring& str() const {
return str_;
}
bool is_audio() const;
bool is_image() const;
bool is_video() const;
GrlMedia* make_media() const;
private:
std::wstring str_;
};
class MediaInfo {
private:
typedef std::vector<Property::ValueMap> PropertyVector;
public:
typedef PropertyVector::const_iterator const_iterator;
typedef PropertyVector::value_type value_type;
MediaInfo();
void add_related(const Property::ValueMap &properties);
void add_single(const Property::BoundValue &value);
Property::Value first(Property key) const;
size_t count(Property key) const;
template<typename PropertyType, typename ValueType>
ValueType first(const GenericProperty<PropertyType, ValueType> &key) const;
std::wstring first(StringProperty key) const {
return first<StringProperty, std::wstring>(key);
}
std::wstring first(TextProperty key) const {
return first<TextProperty, std::wstring>(key);
}
GrlMedia* make_media(GList *const requested_keys) const;
GrlMedia* make_media(GList *const requested_keys,
const std::string &url) const;
void copy_to_media(GList *const requested_keys,
GrlMedia *const media) const;
bool fill_from_media(GrlMedia *media, const GList *const requested_keys,
GList **failed_keys, std::string *error_message);
const_iterator begin() const {
return related_properties_.begin();
}
const_iterator end() const {
return related_properties_.end();
}
bool empty() const;
bool operator==(const MediaInfo &other) const {
return related_properties_ == other.related_properties_;
}
bool operator!=(const MediaInfo &other) const {
return not operator==(other);
}
private:
std::vector<Property::ValueMap> related_properties_;
};
template<typename P, typename V>
inline V MediaInfo::first(const GenericProperty<P, V> &key) const {
const Property::Value value = first(static_cast<Property>(key));
return value.which() ? boost::get<V>(value) : V();
}
} // namespace mediascanner
#endif // MEDIASCANNER_MEDIAUTILS_H
|