Commit 0ad654d4 authored by Stefano Sabatini's avatar Stefano Sabatini

lavu/opt: perform misc cosmetical fixes

parent 642a60f1
...@@ -826,14 +826,14 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit, ...@@ -826,14 +826,14 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.'); av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.');
av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.'); av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
if(av_opt_query_ranges(&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 0) { if (av_opt_query_ranges(&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 0) {
switch (opt->type) { switch (opt->type) {
case AV_OPT_TYPE_INT: case AV_OPT_TYPE_INT:
case AV_OPT_TYPE_INT64: case AV_OPT_TYPE_INT64:
case AV_OPT_TYPE_DOUBLE: case AV_OPT_TYPE_DOUBLE:
case AV_OPT_TYPE_FLOAT: case AV_OPT_TYPE_FLOAT:
case AV_OPT_TYPE_RATIONAL: case AV_OPT_TYPE_RATIONAL:
for (i=0; i<r->nb_ranges; i++) { for (i = 0; i <r->nb_ranges; i++) {
av_log(av_log_obj, AV_LOG_INFO, "["); av_log(av_log_obj, AV_LOG_INFO, "[");
log_value(av_log_obj, AV_LOG_INFO, r->range[i]->value_min); log_value(av_log_obj, AV_LOG_INFO, r->range[i]->value_min);
av_log(av_log_obj, AV_LOG_INFO, ", "); av_log(av_log_obj, AV_LOG_INFO, ", ");
...@@ -1208,20 +1208,22 @@ void *av_opt_ptr(const AVClass *class, void *obj, const char *name) ...@@ -1208,20 +1208,22 @@ void *av_opt_ptr(const AVClass *class, void *obj, const char *name)
return (uint8_t*)obj + opt->offset; return (uint8_t*)obj + opt->offset;
} }
int av_opt_query_ranges(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags) { int av_opt_query_ranges(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
{
const AVClass *c = *(AVClass**)obj; const AVClass *c = *(AVClass**)obj;
int (*callback)(AVOptionRanges **, void *obj, const char *key, int flags) = NULL; int (*callback)(AVOptionRanges **, void *obj, const char *key, int flags) = NULL;
if(c->version > (52 << 16 | 11 << 8)) if (c->version > (52 << 16 | 11 << 8))
callback = c->query_ranges; callback = c->query_ranges;
if(!callback) if (!callback)
callback = av_opt_query_ranges_default; callback = av_opt_query_ranges_default;
return callback(ranges_arg, obj, key, flags); return callback(ranges_arg, obj, key, flags);
} }
int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags) { int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
{
AVOptionRanges *ranges = av_mallocz(sizeof(*ranges)); AVOptionRanges *ranges = av_mallocz(sizeof(*ranges));
AVOptionRange **range_array = av_mallocz(sizeof(void*)); AVOptionRange **range_array = av_mallocz(sizeof(void*));
AVOptionRange *range = av_mallocz(sizeof(*range)); AVOptionRange *range = av_mallocz(sizeof(*range));
...@@ -1229,7 +1231,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch ...@@ -1229,7 +1231,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
*ranges_arg = NULL; *ranges_arg = NULL;
if(!ranges || !range || !range_array || !field) if (!ranges || !range || !range_array || !field)
goto fail; goto fail;
ranges->range = range_array; ranges->range = range_array;
...@@ -1239,7 +1241,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch ...@@ -1239,7 +1241,7 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
range->value_min = field->min; range->value_min = field->min;
range->value_max = field->max; range->value_max = field->max;
switch(field->type){ switch (field->type) {
case AV_OPT_TYPE_INT: case AV_OPT_TYPE_INT:
case AV_OPT_TYPE_INT64: case AV_OPT_TYPE_INT64:
case AV_OPT_TYPE_PIXEL_FMT: case AV_OPT_TYPE_PIXEL_FMT:
...@@ -1275,11 +1277,12 @@ fail: ...@@ -1275,11 +1277,12 @@ fail:
return -1; return -1;
} }
void av_opt_freep_ranges(AVOptionRanges **rangesp) { void av_opt_freep_ranges(AVOptionRanges **rangesp)
{
int i; int i;
AVOptionRanges *ranges = *rangesp; AVOptionRanges *ranges = *rangesp;
for(i=0; i<ranges->nb_ranges; i++){ for (i = 0; i < ranges->nb_ranges; i++) {
AVOptionRange *range = ranges->range[i]; AVOptionRange *range = ranges->range[i];
av_freep(&range->str); av_freep(&range->str);
av_freep(&ranges->range[i]); av_freep(&ranges->range[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment