]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/opt.h
Use full internal pathname in doxygen @file directives.
[ffmpeg] / libavcodec / opt.h
index ff65456d8530c4bfb6d0bc070f481c5891e23000..50d483ef156d28d19fffb11410e16ca90eeeb43a 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVOPT_H
-#define AVOPT_H
+#ifndef AVCODEC_OPT_H
+#define AVCODEC_OPT_H
 
 /**
- * @file opt.h
+ * @file libavcodec/opt.h
  * AVOptions
  */
 
+#include "libavutil/rational.h"
+#include "avcodec.h"
+
 enum AVOptionType{
     FF_OPT_TYPE_FLAGS,
     FF_OPT_TYPE_INT,
@@ -35,26 +38,35 @@ enum AVOptionType{
     FF_OPT_TYPE_FLOAT,
     FF_OPT_TYPE_STRING,
     FF_OPT_TYPE_RATIONAL,
+    FF_OPT_TYPE_BINARY,  ///< offset must point to a pointer immediately followed by an int for the length
     FF_OPT_TYPE_CONST=128,
 };
 
 /**
- * AVOption.
+ * AVOption
  */
 typedef struct AVOption {
     const char *name;
 
     /**
-     * short English text help.
-     * @fixme what about other languages
+     * short English help text
+     * @todo What about other languages?
      */
     const char *help;
-    int offset;             ///< offset to context structure where the parsed value should be stored
+
+    /**
+     * The offset relative to the context structure where the option
+     * value is stored. It should be 0 for named constants.
+     */
+    int offset;
     enum AVOptionType type;
 
+    /**
+     * the default value for scalar options
+     */
     double default_val;
-    double min;
-    double max;
+    double min;                 ///< minimum valid value for the option
+    double max;                 ///< maximum valid value for the option
 
     int flags;
 #define AV_OPT_FLAG_ENCODING_PARAM  1   ///< a generic parameter which can be set by the user for muxing or encoding
@@ -64,11 +76,71 @@ typedef struct AVOption {
 #define AV_OPT_FLAG_VIDEO_PARAM     16
 #define AV_OPT_FLAG_SUBTITLE_PARAM  32
 //FIXME think about enc-audio, ... style flags
+
+    /**
+     * The logical unit to which the option belongs. Non-constant
+     * options and corresponding named constants share the same
+     * unit. May be NULL.
+     */
     const char *unit;
 } AVOption;
 
 
-const AVOption *av_set_string(void *obj, const char *name, const char *val);
+/**
+ * Looks for an option in \p obj. Looks only for the options which
+ * have the flags set as specified in \p mask and \p flags (that is,
+ * for which it is the case that opt->flags & mask == flags).
+ *
+ * @param[in] obj a pointer to a struct whose first element is a
+ * pointer to an AVClass
+ * @param[in] name the name of the option to look for
+ * @param[in] unit the unit of the option to look for, or any if NULL
+ * @return a pointer to the option found, or NULL if no option
+ * has been found
+ */
+const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags);
+
+#if LIBAVCODEC_VERSION_MAJOR < 53
+/**
+ * @see av_set_string2()
+ */
+attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val);
+
+/**
+ * @return a pointer to the AVOption corresponding to the field set or
+ * NULL if no matching AVOption exists, or if the value \p val is not
+ * valid
+ * @see av_set_string3()
+ */
+attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc);
+#endif
+
+/**
+ * Sets the field of obj with the given name to value.
+ *
+ * @param[in] obj A struct whose first element is a pointer to an
+ * AVClass.
+ * @param[in] name the name of the field to set
+ * @param[in] val The value to set. If the field is not of a string
+ * type, then the given string is parsed.
+ * SI postfixes and some named scalars are supported.
+ * If the field is of a numeric type, it has to be a numeric or named
+ * scalar. Behavior with more than one scalar and +- infix operators
+ * is undefined.
+ * If the field is of a flags type, it has to be a sequence of numeric
+ * scalars or named flags separated by '+' or '-'. Prefixing a flag
+ * with '+' causes it to be set without affecting the other flags;
+ * similarly, '-' unsets a flag.
+ * @param[out] o_out if non-NULL put here a pointer to the AVOption
+ * found
+ * @param alloc when 1 then the old value will be av_freed() and the
+ *                     new av_strduped()
+ *              when 0 then no av_free() nor av_strdup() will be used
+ * @return 0 if the value has been set, an AVERROR* error code if no
+ * matching option exists, or if the value \p val is not valid
+ */
+int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out);
+
 const AVOption *av_set_double(void *obj, const char *name, double n);
 const AVOption *av_set_q(void *obj, const char *name, AVRational n);
 const AVOption *av_set_int(void *obj, const char *name, int64_t n);
@@ -79,5 +151,6 @@ const char *av_get_string(void *obj, const char *name, const AVOption **o_out, c
 const AVOption *av_next_option(void *obj, const AVOption *last);
 int av_opt_show(void *obj, void *av_log_obj);
 void av_opt_set_defaults(void *s);
+void av_opt_set_defaults2(void *s, int mask, int flags);
 
-#endif
+#endif /* AVCODEC_OPT_H */