From 46d9c88dcf104d96bb20504a88954ff6f2e6db59 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 18 Mar 2012 22:56:43 +0000 Subject: start of update for ffmpeg7 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2839 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/lib/ffmpeg/opt.pas | 218 +++++++++++++++++++++++++++---------------------- 1 file changed, 119 insertions(+), 99 deletions(-) (limited to 'src/lib/ffmpeg/opt.pas') diff --git a/src/lib/ffmpeg/opt.pas b/src/lib/ffmpeg/opt.pas index 8669eaf6..a779056e 100644 --- a/src/lib/ffmpeg/opt.pas +++ b/src/lib/ffmpeg/opt.pas @@ -22,8 +22,8 @@ * in the source codes. * - Changes and updates by the UltraStar Deluxe Team * - * Conversion of libavcodec/opt.h - * Max. avcodec version: 52.86.1, 24882, Wed Aug 23 07:00:00 2010 CET + * Conversion of libavutil/opt.h + * avutil version 50.43.0 * *) @@ -41,6 +41,7 @@ interface uses ctypes, + dict, rational, UConfig; @@ -89,7 +90,14 @@ type (** * the default value for scalar options *) - default_val: cdouble; + default_val: record + case cint of + 0: (dbl: cdouble); + 1: (str: PAnsiChar); + (* TODO those are unused now *) + 2: (i64: cint64); + 3: (q: TAVRational); + end; min: cdouble; ///< minimum valid value for the option max: cdouble; ///< maximum valid value for the option @@ -104,54 +112,7 @@ type unit_: {const} PAnsiChar; end; -{$IF LIBAVCODEC_VERSION >= 52042000} // >= 52.42.0 -(** - * AVOption2. - * THIS IS NOT PART OF THE API/ABI YET! - * This is identical to AVOption except that default_val was replaced by - * an union, it should be compatible with AVOption on normal platforms. - *) -type - PAVOption2 = ^TAVOption2; - TAVOption2 = record - name : {const} PAnsiChar; - - (** - * short English help text - * @todo What about other languages? - *) - help : {const} PAnsiChar; - - (** - * The offset relative to the context structure where the option - * value is stored. It should be 0 for named constants. - *) - offset : cint; - type_ : TAVOptionType; - - (** - * the default value for scalar options - *) - default_val : record - case cint of - 0 : (dbl: cdouble); - 1 : (str: PAnsiChar); - end; - min : cdouble; - max : cdouble; - flags : cint; -//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. - *) - unit_: {const} PAnsiChar; - end; -{$IFEND} - -{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 +{$IFDEF FF_API_FIND_OPT} (** * Look for an option in obj. Look only for the options which * have the flags set as specified in mask and flags (that is, @@ -165,31 +126,9 @@ type * has been found *) function av_find_opt(obj: Pointer; {const} name: {const} PAnsiChar; {const} unit_: PAnsiChar; mask: cint; flags: cint): {const} PAVOption; - cdecl; external av__codec; -{$IFEND} - -{$IF LIBAVCODEC_VERSION_MAJOR < 53} - -(** - * @see av_set_string2() - *) -function av_set_string(obj: pointer; name: {const} PAnsiChar; val: {const} PAnsiChar): {const} PAVOption; - cdecl; external av__codec; deprecated; - -{$IF LIBAVCODEC_VERSION >= 51059000} // 51.59.0 -(** - * @return a pointer to the AVOption corresponding to the field set or - * NULL if no matching AVOption exists, or if the value val is not - * valid - * @see av_set_string3() - *) -function av_set_string2(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint): {const} PAVOption; - cdecl; external av__codec; deprecated; -{$IFEND} - -{$IFEND} + cdecl; external av__util; deprecated; +{$ENDIF} -{$IF LIBAVCODEC_VERSION >= 52007000} // 52.7.0 (** * Set the field of obj with the given name to value. * @@ -218,43 +157,124 @@ function av_set_string2(obj: Pointer; name: {const} PAnsiChar; val: {const} PAns * AVERROR(EINVAL) if the value is not valid *) function av_set_string3(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint; out o_out: {const} PAVOption): cint; - cdecl; external av__codec; -{$IFEND} + cdecl; external av__util; function av_set_double(obj: pointer; name: {const} PAnsiChar; n: cdouble): PAVOption; - cdecl; external av__codec; - + cdecl; external av__util; function av_set_q(obj: pointer; name: {const} PAnsiChar; n: TAVRational): PAVOption; - cdecl; external av__codec; - + cdecl; external av__util; function av_set_int(obj: pointer; name: {const} PAnsiChar; n: cint64): PAVOption; - cdecl; external av__codec; - + cdecl; external av__util; function av_get_double(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): cdouble; - cdecl; external av__codec; - + cdecl; external av__util; function av_get_q(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): TAVRational; - cdecl; external av__codec; - + cdecl; external av__util; function av_get_int(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption): cint64; - cdecl; external av__codec; - + cdecl; external av__util; function av_get_string(obj: pointer; name: {const} PAnsiChar; var o_out: {const} PAVOption; buf: PAnsiChar; buf_len: cint): PAnsiChar; - cdecl; external av__codec; - + cdecl; external av__util; function av_next_option(obj: pointer; last: {const} PAVOption): PAVOption; - cdecl; external av__codec; + cdecl; external av__util; -function av_opt_show(obj: pointer; av_log_obj: pointer): cint; - cdecl; external av__codec; +(** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + *) +function av_opt_show2(obj: pointer; av_log_obj: pointer; req_flags: cint; rej_flags: cint): cint; + cdecl; external av__util; procedure av_opt_set_defaults(s: pointer); - cdecl; external av__codec; - -{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 + cdecl; external av__util; procedure av_opt_set_defaults2(s: Pointer; mask: cint; flags: cint); - cdecl; external av__codec; -{$IFEND} + cdecl; external av__util; + +(** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param opts options string to parse, may be NULL + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set +*) +function av_set_options_string(ctx: pointer; opts: {const} PAnsiChar; + key_val_sep: {const} PAnsiChar; pairs_sep: {const} PAnsiChar): cint; + cdecl; external av__util; + +(** + * Free all string and binary options in obj. + *) +procedure av_opt_free(obj: pointer); + cdecl; external av__util; + +(** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + *) +function av_opt_flag_is_set(obj: pointer; field_name: {const} PAnsiChar; flag_name: {const} PAnsiChar): cint; + cdecl; external av__util; + +(** + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + *) +function av_opt_set_dict(obj: pointer; var options: PAVDictionary): cint; + cdecl; external av__util; + +const + AV_OPT_SEARCH_CHILDREN = 0001; (**< Search in possible children of the + given object first.*) + +(** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @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 When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return A pointer to the option found, or NULL if no option + * was found. + * + * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable + * directly with av_set_string3(). Use special calls which take an options + * AVDictionary (e.g. avformat_open_input()) to set options found with this + * flag. + *) +function av_opt_find(obj: pointer; name: {const} PAnsiChar; unit_: {const} PAnsiChar; + opt_flags: cint; search_flags: cint): PAVOption; + cdecl; external av__util; implementation -- cgit v1.2.3