You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	AVOptions: add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find().
It allows to search for options only with AVClass, without allocating the corresponding context.
This commit is contained in:
		| @@ -13,6 +13,9 @@ libavutil:   2011-04-18 | |||||||
|  |  | ||||||
| API changes, most recent first: | API changes, most recent first: | ||||||
|  |  | ||||||
|  | 2011-08-xx - xxxxxxx - lavu 51.10.0 | ||||||
|  |   Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function. | ||||||
|  |  | ||||||
| 2011-08-xx - xxxxxx - lavu 51.9.0 | 2011-08-xx - xxxxxx - lavu 51.9.0 | ||||||
|   Add av_fifo_peek2(), deprecate av_fifo_peek(). |   Add av_fifo_peek2(), deprecate av_fifo_peek(). | ||||||
|  |  | ||||||
|   | |||||||
| @@ -44,7 +44,7 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit, i | |||||||
|     AVCodecContext *s = obj; |     AVCodecContext *s = obj; | ||||||
|     AVCodec        *c = NULL; |     AVCodec        *c = NULL; | ||||||
|  |  | ||||||
|     if (s->priv_data) { |     if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ) && s->priv_data) { | ||||||
|         if (s->codec->priv_class) |         if (s->codec->priv_class) | ||||||
|             return av_opt_find(s->priv_data, name, unit, opt_flags, search_flags); |             return av_opt_find(s->priv_data, name, unit, opt_flags, search_flags); | ||||||
|         return NULL; |         return NULL; | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit, i | |||||||
|     AVFormatContext   *s = obj; |     AVFormatContext   *s = obj; | ||||||
|     AVInputFormat  *ifmt = NULL; |     AVInputFormat  *ifmt = NULL; | ||||||
|     AVOutputFormat *ofmt = NULL; |     AVOutputFormat *ofmt = NULL; | ||||||
|     if (s->priv_data) { |     if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ) && s->priv_data) { | ||||||
|         if ((s->iformat && !s->iformat->priv_class) || |         if ((s->iformat && !s->iformat->priv_class) || | ||||||
|             (s->oformat && !s->oformat->priv_class)) |             (s->oformat && !s->oformat->priv_class)) | ||||||
|             return NULL; |             return NULL; | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ | |||||||
| #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) | #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) | ||||||
|  |  | ||||||
| #define LIBAVUTIL_VERSION_MAJOR 51 | #define LIBAVUTIL_VERSION_MAJOR 51 | ||||||
| #define LIBAVUTIL_VERSION_MINOR  9 | #define LIBAVUTIL_VERSION_MINOR 10 | ||||||
| #define LIBAVUTIL_VERSION_MICRO  0 | #define LIBAVUTIL_VERSION_MICRO  0 | ||||||
|  |  | ||||||
| #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | ||||||
|   | |||||||
| @@ -215,6 +215,13 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); | |||||||
|  |  | ||||||
| #define AV_OPT_SEARCH_CHILDREN   0x0001 /**< Search in possible children of the | #define AV_OPT_SEARCH_CHILDREN   0x0001 /**< Search in possible children of the | ||||||
|                                              given object first. */ |                                              given object first. */ | ||||||
|  | /** | ||||||
|  |  *  The obj passed to av_opt_find() is fake -- only a double pointer to AVClass | ||||||
|  |  *  instead of a required pointer to a struct containing AVClass. This is | ||||||
|  |  *  useful for searching for options without needing to allocate the corresponding | ||||||
|  |  *  object. | ||||||
|  |  */ | ||||||
|  | #define AV_OPT_SEARCH_FAKE_OBJ   0x0002 | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Look for an option in an object. Consider only options which |  * Look for an option in an object. Consider only options which | ||||||
| @@ -222,6 +229,8 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); | |||||||
|  * |  * | ||||||
|  * @param[in] obj A pointer to a struct whose first element is a |  * @param[in] obj A pointer to a struct whose first element is a | ||||||
|  *                pointer to an AVClass. |  *                pointer to an AVClass. | ||||||
|  |  *                Alternatively a double pointer to an AVClass, if | ||||||
|  |  *                AV_OPT_SEARCH_FAKE_OBJ search flag is set. | ||||||
|  * @param[in] name The name of the option to look for. |  * @param[in] name The name of the option to look for. | ||||||
|  * @param[in] unit When searching for named constants, name of the unit |  * @param[in] unit When searching for named constants, name of the unit | ||||||
|  *                 it belongs to. |  *                 it belongs to. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user