aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-03-07 02:21:35 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-03-07 02:21:35 +0000
commit20e708cbbeffcc3e55f77cbb0d4ae85a54196d62 (patch)
tree6fc2d6c45ffad94556075ef229c821e805384d2e
parentbc2a1c340a12a452accad5c3807c9e940cf86535 (diff)
downloadffmpeg-20e708cbbeffcc3e55f77cbb0d4ae85a54196d62.tar.gz
add av_opt_set_defaults2() which sets just defaults from AVOptions whos flags match a user specified & mask = flags
Originally committed as revision 8280 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/opt.c8
-rw-r--r--libavcodec/opt.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/opt.c b/libavcodec/opt.c
index bbfc42b2b7..ed7aaa0f86 100644
--- a/libavcodec/opt.c
+++ b/libavcodec/opt.c
@@ -343,10 +343,12 @@ int av_opt_show(void *obj, void *av_log_obj){
*
* @param s AVCodecContext or AVFormatContext for which the defaults will be set
*/
-void av_opt_set_defaults(void *s)
+void av_opt_set_defaults2(void *s, int mask, int flags)
{
const AVOption *opt = NULL;
while ((opt = av_next_option(s, opt)) != NULL) {
+ if((opt->flags & mask) != flags)
+ continue;
switch(opt->type) {
case FF_OPT_TYPE_CONST:
/* Nothing to be done here */
@@ -379,3 +381,7 @@ void av_opt_set_defaults(void *s)
}
}
+void av_opt_set_defaults(void *s){
+ av_opt_set_defaults2(s, 0, 0);
+}
+
diff --git a/libavcodec/opt.h b/libavcodec/opt.h
index 1d750ff296..151dbb788e 100644
--- a/libavcodec/opt.h
+++ b/libavcodec/opt.h
@@ -80,5 +80,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