/usr/include/gavl/metadata.h is in libgavl-dev 1.4.0-1.
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 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | /*****************************************************************
* gavl - a general purpose audio/video processing library
*
* Copyright (c) 2001 - 2011 Members of the Gmerlin project
* gmerlin-general@lists.sourceforge.net
* http://gmerlin.sourceforge.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 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 General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *****************************************************************/
#ifndef GAVL_METADATA_H_INCLUDED
#define GAVL_METADATA_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <gavl/gavldefs.h>
/** \defgroup metadata Metadata
* \brief Metadata support
*
* This is a simple dictionary structure, which is
* used my gmerlin applications and libraries to
* associate metadata with a media file or a single
* media stream.
*
* Metadata are defined as all data, which are not directly
* related to the decoding process, but might be of interest
* for the user.
*
* The tag types are completely generic so applications can
* define their own tags. For compatibility it is, however
* recommended to use the tags defined in \ref metatags.h
*
* Since 1.4.0
*
* @{
*/
/** Length of a date string of the format YYYY-MM-DD
*/
#define GAVL_METADATA_DATE_STRING_LEN 11
/** Length of a date/time string of the format YYYY-MM-DD HH:MM:SS
*/
#define GAVL_METADATA_DATE_TIME_STRING_LEN 20
/** \brief Single metadata tag
*/
typedef struct
{
char * key; //!< Key
char * val; //!< Value
} gavl_metadata_tag_t;
/** \brief Single metadata structure
*/
typedef struct
{
gavl_metadata_tag_t * tags; //!< Array of tags
int tags_alloc; //!< Number of allocated tags (never touch this)
int num_tags; //!< Number of valid tags
} gavl_metadata_t;
/** \brief Free all metadata tags
* \arg m A metadata structure
*/
GAVL_PUBLIC void
gavl_metadata_free(gavl_metadata_t * m);
/** \brief Initialize structre
* \arg m A metadata structure
*
* Use this if you define a \ref gavl_metadata_t
* structure in unintialized memory (e.g. on the stack)
* before using it.
*/
GAVL_PUBLIC void
gavl_metadata_init(gavl_metadata_t * m);
/** \brief Set a tag
* \arg m A metadata structure
* \arg key Key
* \arg val Value
*
* Set a metadata tag. The value is copied.
*/
GAVL_PUBLIC void
gavl_metadata_set(gavl_metadata_t * m,
const char * key,
const char * val);
/** \brief Set a tag
* \arg m A metadata structure
* \arg key Key
* \arg val Value
*
* Like \ref gavl_metadata_set except that the
* value is not copied.
*/
GAVL_PUBLIC void
gavl_metadata_set_nocpy(gavl_metadata_t * m,
const char * key,
char * val);
/** \brief Get the value of a tag
* \arg m A metadata structure
* \arg key Key
* \returns Value of the tag or NULL if the tag doesn't exist
*/
GAVL_PUBLIC
const char * gavl_metadata_get(const gavl_metadata_t * m,
const char * key);
/** \brief Set an integer tag
* \arg m A metadata structure
* \arg key Key
* \arg val Value
*/
GAVL_PUBLIC void
gavl_metadata_set_int(gavl_metadata_t * m,
const char * key,
int val);
/** \brief Get an integer tag
* \arg m A metadata structure
* \arg key Key
* \arg ret Returns the value
* \returns 1 if ret contains a valid tag, 0 if the tag doesn't exist or is not numeric
*/
GAVL_PUBLIC
int gavl_metadata_get_int(const gavl_metadata_t * m,
const char * key, int * ret);
/** \brief Set a date tag
* \arg m A metadata structure
* \arg key Key
* \arg year Year
* \arg month Month
* \arg day Day
*/
GAVL_PUBLIC void
gavl_metadata_set_date(gavl_metadata_t * m,
const char * key,
int year,
int month,
int day);
/** \brief Get a date tag
* \arg m A metadata structure
* \arg key Key
* \arg year Returns year
* \arg month Returns month
* \arg day Returns day
* \returns 1 if a valid date was returned, 0 else
*/
GAVL_PUBLIC int
gavl_metadata_get_date(gavl_metadata_t * m,
const char * key,
int * year,
int * month,
int * day);
/** \brief Set a date/time tag
* \arg m A metadata structure
* \arg key Key
* \arg year Year
* \arg month Month
* \arg day Day
* \arg hour Hour
* \arg minute Minute
* \arg second Second
*/
GAVL_PUBLIC void
gavl_metadata_set_date_time(gavl_metadata_t * m,
const char * key,
int year,
int month,
int day,
int hour,
int minute,
int second);
/** \brief Get a date/time tag
* \arg m A metadata structure
* \arg key Key
* \arg year Returns year
* \arg month Returns month
* \arg day Returns day
* \arg hour Returns hour
* \arg minute Returns minute
* \arg second Returns second
* \returns 1 if a valid date/time was returned, 0 else
*/
GAVL_PUBLIC int
gavl_metadata_get_date_time(gavl_metadata_t * m,
const char * key,
int * year,
int * month,
int * day,
int * hour,
int * minute,
int * second);
/** \brief Format a date string
* \arg year Year
* \arg month Month
* \arg day Day
* \arg ret String to be formatted
*
* The string needs to be at least \ref GAVL_METADATA_DATE_STRING_LEN
* bytes long.
*/
GAVL_PUBLIC void
gavl_metadata_date_to_string(int year,
int month,
int day, char * ret);
/** \brief Format a date string
* \arg year Year
* \arg month Month
* \arg day Day
* \arg ret String to be formatted
* \arg hour Hour
* \arg minute Minute
* \arg second Second
*
* The string needs to be at least
* \ref GAVL_METADATA_DATE_TIME_STRING_LEN bytes long.
*/
GAVL_PUBLIC void
gavl_metadata_date_time_to_string(int year,
int month,
int day,
int hour,
int minute,
int second,
char * ret);
/** \brief Merge two metadata structures
* \arg dst Destination
* \arg src1 First source
* \arg src2 Second source
*
* Copy all tags from src1 and src2 to dst. If a tag
* is available in src1 and src2, the one from src1 is
* taken.
*/
GAVL_PUBLIC
void gavl_metadata_merge(gavl_metadata_t * dst,
const gavl_metadata_t * src1,
const gavl_metadata_t * src2);
/** \brief Merge two metadata structures
* \arg dst Destination
* \arg src Source
*
* Copy tags from src to dst, which are not
* already contained in dst.
*/
GAVL_PUBLIC
void gavl_metadata_merge2(gavl_metadata_t * dst,
const gavl_metadata_t * src);
/** \brief Copy metadata structure
* \arg dst Destination
* \arg src Source
*
* Copy all tags from src to dst
*/
GAVL_PUBLIC void
gavl_metadata_copy(gavl_metadata_t * dst,
const gavl_metadata_t * src);
/** \brief Dump metadata structure to stderr
* \arg m Metadata
* \arg indent Spaces to append to each line
*/
GAVL_PUBLIC void
gavl_metadata_dump(const gavl_metadata_t * m, int indent);
/** \brief Check if 2 metadata structures are equal
* \arg m1 Metadata 1
* \arg m2 Metadata 2
* \returns 1 if the 2 metadata structures are identical, 0 else
*/
GAVL_PUBLIC int
gavl_metadata_equal(const gavl_metadata_t * m1,
const gavl_metadata_t * m2);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif // GAVL_METADATA_H_INCLUDED
|