~ubuntu-branches/ubuntu/trusty/libav/trusty-proposed

« back to all changes in this revision

Viewing changes to libavutil/opt.h

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2013-10-22 23:24:08 UTC
  • mfrom: (1.3.36 sid)
  • Revision ID: package-import@ubuntu.com-20131022232408-b8tvvn4pyzri9mi3
Tags: 6:9.10-1ubuntu1
* Build all -extra flavors from this source package, as libav got demoted
  from main to universe, cf LP: #1243235
* Simplify debian/rules to follow exactly the code that debian executes
* New upstream (LP: #1180288) fixes lots of security issues (LP: #1242802)
* Merge from unstable, remaining changes:
  - build-depend on libtiff5-dev rather than libtiff4-dev,
    avoids FTBFS caused by imlib
  - follow the regular debian codepaths

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 *
65
65
 * static const AVOption options[] = {
66
66
 *   { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt),
67
 
 *     AV_OPT_TYPE_INT, { -1 }, INT_MIN, INT_MAX },
 
67
 *     AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX },
68
68
 *   { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt),
69
69
 *     AV_OPT_TYPE_STRING },
70
70
 *   { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt),
123
123
 *      } child_struct;
124
124
 *      static const AVOption child_opts[] = {
125
125
 *          { "test_flags", "This is a test option of flags type.",
126
 
 *            offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX },
 
126
 *            offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX },
127
127
 *          { NULL },
128
128
 *      };
129
129
 *      static const AVClass child_class = {
170
170
 *      above, put the following into the child_opts array:
171
171
 *      @code
172
172
 *      { "test_flags", "This is a test option of flags type.",
173
 
 *        offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, "test_unit" },
174
 
 *      { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { 16 }, 0, 0, "test_unit" },
 
173
 *        offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" },
 
174
 *      { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" },
175
175
 *      @endcode
176
176
 *
177
177
 * @section avoptions_use Using AVOptions
225
225
    AV_OPT_TYPE_RATIONAL,
226
226
    AV_OPT_TYPE_BINARY,  ///< offset must point to a pointer immediately followed by an int for the length
227
227
    AV_OPT_TYPE_CONST = 128,
228
 
#if FF_API_OLD_AVOPTIONS
229
 
    FF_OPT_TYPE_FLAGS = 0,
230
 
    FF_OPT_TYPE_INT,
231
 
    FF_OPT_TYPE_INT64,
232
 
    FF_OPT_TYPE_DOUBLE,
233
 
    FF_OPT_TYPE_FLOAT,
234
 
    FF_OPT_TYPE_STRING,
235
 
    FF_OPT_TYPE_RATIONAL,
236
 
    FF_OPT_TYPE_BINARY,  ///< offset must point to a pointer immediately followed by an int for the length
237
 
    FF_OPT_TYPE_CONST=128,
238
 
#endif
239
228
};
240
229
 
241
230
/**
261
250
     * the default value for scalar options
262
251
     */
263
252
    union {
 
253
        int64_t i64;
264
254
        double dbl;
265
255
        const char *str;
266
256
        /* TODO those are unused now */
267
 
        int64_t i64;
268
257
        AVRational q;
269
258
    } default_val;
270
259
    double min;                 ///< minimum valid value for the option
287
276
    const char *unit;
288
277
} AVOption;
289
278
 
290
 
#if FF_API_FIND_OPT
291
 
/**
292
 
 * Look for an option in obj. Look only for the options which
293
 
 * have the flags set as specified in mask and flags (that is,
294
 
 * for which it is the case that opt->flags & mask == flags).
295
 
 *
296
 
 * @param[in] obj a pointer to a struct whose first element is a
297
 
 * pointer to an AVClass
298
 
 * @param[in] name the name of the option to look for
299
 
 * @param[in] unit the unit of the option to look for, or any if NULL
300
 
 * @return a pointer to the option found, or NULL if no option
301
 
 * has been found
302
 
 *
303
 
 * @deprecated use av_opt_find.
304
 
 */
305
 
attribute_deprecated
306
 
const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags);
307
 
#endif
308
 
 
309
 
#if FF_API_OLD_AVOPTIONS
310
 
/**
311
 
 * Set the field of obj with the given name to value.
312
 
 *
313
 
 * @param[in] obj A struct whose first element is a pointer to an
314
 
 * AVClass.
315
 
 * @param[in] name the name of the field to set
316
 
 * @param[in] val The value to set. If the field is not of a string
317
 
 * type, then the given string is parsed.
318
 
 * SI postfixes and some named scalars are supported.
319
 
 * If the field is of a numeric type, it has to be a numeric or named
320
 
 * scalar. Behavior with more than one scalar and +- infix operators
321
 
 * is undefined.
322
 
 * If the field is of a flags type, it has to be a sequence of numeric
323
 
 * scalars or named flags separated by '+' or '-'. Prefixing a flag
324
 
 * with '+' causes it to be set without affecting the other flags;
325
 
 * similarly, '-' unsets a flag.
326
 
 * @param[out] o_out if non-NULL put here a pointer to the AVOption
327
 
 * found
328
 
 * @param alloc this parameter is currently ignored
329
 
 * @return 0 if the value has been set, or an AVERROR code in case of
330
 
 * error:
331
 
 * AVERROR_OPTION_NOT_FOUND if no matching option exists
332
 
 * AVERROR(ERANGE) if the value is out of range
333
 
 * AVERROR(EINVAL) if the value is not valid
334
 
 * @deprecated use av_opt_set()
335
 
 */
336
 
attribute_deprecated
337
 
int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out);
338
 
 
339
 
attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n);
340
 
attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n);
341
 
attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n);
342
 
 
343
 
attribute_deprecated double av_get_double(void *obj, const char *name, const AVOption **o_out);
344
 
attribute_deprecated AVRational av_get_q(void *obj, const char *name, const AVOption **o_out);
345
 
attribute_deprecated int64_t av_get_int(void *obj, const char *name, const AVOption **o_out);
346
 
attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len);
347
 
attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last);
348
 
#endif
349
 
 
350
279
/**
351
280
 * Show the obj options.
352
281
 *
365
294
 */
366
295
void av_opt_set_defaults(void *s);
367
296
 
368
 
#if FF_API_OLD_AVOPTIONS
369
 
attribute_deprecated
370
 
void av_opt_set_defaults2(void *s, int mask, int flags);
371
 
#endif
372
 
 
373
297
/**
374
298
 * Parse the key/value pairs list in opts. For each key/value pair
375
299
 * found, stores the value in the field in ctx that is named like the
560
484
int av_opt_set_int   (void *obj, const char *name, int64_t     val, int search_flags);
561
485
int av_opt_set_double(void *obj, const char *name, double      val, int search_flags);
562
486
int av_opt_set_q     (void *obj, const char *name, AVRational  val, int search_flags);
 
487
int av_opt_set_bin   (void *obj, const char *name, const uint8_t *val, int size, int search_flags);
563
488
/**
564
489
 * @}
565
490
 */