Browse code

Deprecate av_opt_show() in favor of a new function av_opt_show2(), which allows to specify only a subset of all the options to show.

Originally committed as revision 25166 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2010/09/24 09:51:40
Showing 4 changed files
... ...
@@ -3905,11 +3905,11 @@ static void show_help(void)
3905 3905
                       OPT_GRAB,
3906 3906
                       OPT_GRAB);
3907 3907
     printf("\n");
3908
-    av_opt_show(avcodec_opts[0], NULL);
3908
+    av_opt_show2(avcodec_opts[0], NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
3909 3909
     printf("\n");
3910
-    av_opt_show(avformat_opts, NULL);
3910
+    av_opt_show2(avformat_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
3911 3911
     printf("\n");
3912
-    av_opt_show(sws_opts, NULL);
3912
+    av_opt_show2(sws_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
3913 3913
 }
3914 3914
 
3915 3915
 static void opt_target(const char *arg)
... ...
@@ -31,7 +31,7 @@
31 31
 #include "libavutil/cpu.h"
32 32
 
33 33
 #define LIBAVCODEC_VERSION_MAJOR 52
34
-#define LIBAVCODEC_VERSION_MINOR 89
34
+#define LIBAVCODEC_VERSION_MINOR 90
35 35
 #define LIBAVCODEC_VERSION_MICRO  0
36 36
 
37 37
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
... ...
@@ -54,6 +54,9 @@
54 54
 #ifndef FF_API_MM_FLAGS
55 55
 #define FF_API_MM_FLAGS         (LIBAVCODEC_VERSION_MAJOR < 53)
56 56
 #endif
57
+#ifndef FF_API_OPT_SHOW
58
+#define FF_API_OPT_SHOW         (LIBAVCODEC_VERSION_MAJOR < 53)
59
+#endif
57 60
 
58 61
 #define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
59 62
 #define AV_TIME_BASE            1000000
... ...
@@ -319,12 +319,13 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out){
319 319
     return num*intnum/den;
320 320
 }
321 321
 
322
-static void opt_list(void *obj, void *av_log_obj, const char *unit)
322
+static void opt_list(void *obj, void *av_log_obj, const char *unit,
323
+                     int req_flags, int rej_flags)
323 324
 {
324 325
     const AVOption *opt=NULL;
325 326
 
326 327
     while((opt= av_next_option(obj, opt))){
327
-        if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM)))
328
+        if (!(opt->flags & req_flags) || (opt->flags & rej_flags))
328 329
             continue;
329 330
 
330 331
         /* Don't print CONST's on level one.
... ...
@@ -383,22 +384,30 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit)
383 383
             av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
384 384
         av_log(av_log_obj, AV_LOG_INFO, "\n");
385 385
         if (opt->unit && opt->type != FF_OPT_TYPE_CONST) {
386
-            opt_list(obj, av_log_obj, opt->unit);
386
+            opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags);
387 387
         }
388 388
     }
389 389
 }
390 390
 
391
-int av_opt_show(void *obj, void *av_log_obj){
391
+int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
392
+{
392 393
     if(!obj)
393 394
         return -1;
394 395
 
395 396
     av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
396 397
 
397
-    opt_list(obj, av_log_obj, NULL);
398
+    opt_list(obj, av_log_obj, NULL, req_flags, rej_flags);
398 399
 
399 400
     return 0;
400 401
 }
401 402
 
403
+#if FF_API_OPT_SHOW
404
+int av_opt_show(void *obj, void *av_log_obj){
405
+    return av_opt_show2(obj, av_log_obj,
406
+                        AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
407
+}
408
+#endif
409
+
402 410
 /** Set the values of the AVCodecContext or AVFormatContext structure.
403 411
  * They are set to the defaults specified in the according AVOption options
404 412
  * array default_val field.
... ...
@@ -204,7 +204,25 @@ AVRational av_get_q(void *obj, const char *name, const AVOption **o_out);
204 204
 int64_t av_get_int(void *obj, const char *name, const AVOption **o_out);
205 205
 const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len);
206 206
 const AVOption *av_next_option(void *obj, const AVOption *last);
207
-int av_opt_show(void *obj, void *av_log_obj);
207
+
208
+#if FF_API_OPT_SHOW
209
+/**
210
+ * @deprecated Use av_opt_show2() instead.
211
+ */
212
+attribute_deprecated int av_opt_show(void *obj, void *av_log_obj);
213
+#endif
214
+
215
+/**
216
+ * Show the obj options.
217
+ *
218
+ * @param req_flags requested flags for the options to show. Show only the
219
+ * options for which it is opt->flags & req_flags.
220
+ * @param rej_flags rejected flags for the options to show. Show only the
221
+ * options for which it is !(opt->flags & req_flags).
222
+ * @param av_log_obj log context to use for showing the options
223
+ */
224
+int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
225
+
208 226
 void av_opt_set_defaults(void *s);
209 227
 void av_opt_set_defaults2(void *s, int mask, int flags);
210 228