1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2024-12-29 19:02:21 +00:00

Cosmetics: apply misc style fixes.

Originally committed as revision 25219 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Stefano Sabatini 2010-09-27 10:01:44 +00:00
parent e2983d6eac
commit 8f1afd3b37

View File

@ -30,7 +30,8 @@
#include "libavutil/eval.h" #include "libavutil/eval.h"
//FIXME order them and do a bin search //FIXME order them and do a bin search
const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags){ const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags)
{
AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass
const AVOption *o= c->option; const AVOption *o= c->option;
@ -41,13 +42,15 @@ const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mas
return NULL; return NULL;
} }
const AVOption *av_next_option(void *obj, const AVOption *last){ const AVOption *av_next_option(void *obj, const AVOption *last)
{
if (last && last[1].name) return ++last; if (last && last[1].name) return ++last;
else if (last) return NULL; else if (last) return NULL;
else return (*(AVClass**)obj)->option; else return (*(AVClass**)obj)->option;
} }
static int av_set_number2(void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out){ static int av_set_number2(void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out)
{
const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
void *dst; void *dst;
if (o_out) if (o_out)
@ -78,7 +81,8 @@ static int av_set_number2(void *obj, const char *name, double num, int den, int6
return 0; return 0;
} }
static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){ static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum)
{
const AVOption *o = NULL; const AVOption *o = NULL;
if (av_set_number2(obj, name, num, den, intnum, &o) < 0) if (av_set_number2(obj, name, num, den, intnum, &o) < 0)
return NULL; return NULL;
@ -107,7 +111,8 @@ static int hexchar2int(char c) {
return -1; return -1;
} }
int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out){ int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)
{
int ret; int ret;
const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
if (o_out) if (o_out)
@ -199,15 +204,18 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
return 0; return 0;
} }
const AVOption *av_set_double(void *obj, const char *name, double n){ const AVOption *av_set_double(void *obj, const char *name, double n)
{
return av_set_number(obj, name, n, 1, 1); return av_set_number(obj, name, n, 1, 1);
} }
const AVOption *av_set_q(void *obj, const char *name, AVRational n){ const AVOption *av_set_q(void *obj, const char *name, AVRational n)
{
return av_set_number(obj, name, n.num, n.den, 1); return av_set_number(obj, name, n.num, n.den, 1);
} }
const AVOption *av_set_int(void *obj, const char *name, int64_t n){ const AVOption *av_set_int(void *obj, const char *name, int64_t n)
{
return av_set_number(obj, name, 1, 1, n); return av_set_number(obj, name, 1, 1, n);
} }
@ -216,7 +224,8 @@ const AVOption *av_set_int(void *obj, const char *name, int64_t n){
* @param buf a buffer which is used for returning non string values as strings, can be NULL * @param buf a buffer which is used for returning non string values as strings, can be NULL
* @param buf_len allocated length in bytes of buf * @param buf_len allocated length in bytes of buf
*/ */
const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len){ const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len)
{
const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
void *dst; void *dst;
uint8_t *bin; uint8_t *bin;
@ -248,7 +257,8 @@ const char *av_get_string(void *obj, const char *name, const AVOption **o_out, c
return buf; return buf;
} }
static int av_get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum){ static int av_get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum)
{
const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
void *dst; void *dst;
if (!o || o->offset<=0) if (!o || o->offset<=0)
@ -273,7 +283,8 @@ error:
return -1; return -1;
} }
double av_get_double(void *obj, const char *name, const AVOption **o_out){ double av_get_double(void *obj, const char *name, const AVOption **o_out)
{
int64_t intnum=1; int64_t intnum=1;
double num=1; double num=1;
int den=1; int den=1;
@ -282,7 +293,8 @@ double av_get_double(void *obj, const char *name, const AVOption **o_out){
return num*intnum/den; return num*intnum/den;
} }
AVRational av_get_q(void *obj, const char *name, const AVOption **o_out){ AVRational av_get_q(void *obj, const char *name, const AVOption **o_out)
{
int64_t intnum=1; int64_t intnum=1;
double num=1; double num=1;
int den=1; int den=1;
@ -294,7 +306,8 @@ AVRational av_get_q(void *obj, const char *name, const AVOption **o_out){
return av_d2q(num*intnum/den, 1<<24); return av_d2q(num*intnum/den, 1<<24);
} }
int64_t av_get_int(void *obj, const char *name, const AVOption **o_out){ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out)
{
int64_t intnum=1; int64_t intnum=1;
double num=1; double num=1;
int den=1; int den=1;
@ -327,8 +340,7 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
else else
av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name); av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
switch( opt->type ) switch (opt->type) {
{
case FF_OPT_TYPE_FLAGS: case FF_OPT_TYPE_FLAGS:
av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>"); av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>");
break; break;
@ -435,7 +447,8 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
} }
} }
void av_opt_set_defaults(void *s){ void av_opt_set_defaults(void *s)
{
av_opt_set_defaults2(s, 0, 0); av_opt_set_defaults2(s, 0, 0);
} }