[ create a new paste ] login | about

Link: http://codepad.org/Jb6cL5VX    [ raw code | fork ]

C, pasted on Apr 21:
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);
    void *dst;
    if(o_out)
        *o_out= o;
    if(!o || o->offset<=0)
        return AVERROR(ENOENT);

    if(o->max*den < num*intnum || o->min*den > num*intnum) {
        av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);
        return AVERROR(ERANGE);
    }
#undef please_use_av_log_instead_of_fprintf
    dst= ((uint8_t*)obj) + o->offset;
av_log(obj, AV_LOG_INFO ,"static int  %lx \n" ,o->offset);
 //fprintf(stdout,"static int av_set_number2 \n");
    switch(o->type){
        av_log(obj, AV_LOG_INFO,"X: %i  \n", o->type);
    case FF_OPT_TYPE_FLAGS:
    case FF_OPT_TYPE_INT:   *(int       *)dst= llrint(num/den)*intnum; break;
    case FF_OPT_TYPE_INT64: *(int64_t   *)dst= llrint(num/den)*intnum; av_log(obj, AV_LOG_INFO,"int64_t   *)dst= llrint(num/den)*i %i  \n", o->type); break
;
    case FF_OPT_TYPE_FLOAT: *(float     *)dst= num*intnum/den;         break;
    case FF_OPT_TYPE_DOUBLE:*(double    *)dst= num*intnum/den;         break;
    case FF_OPT_TYPE_RATIONAL:
        if((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den};
        else                *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24);
        break;
    default:
        return AVERROR(EINVAL);
    }
  av_log(obj, AV_LOG_INFO,"static int av_set_number2 done %i \n " , o->type);
    return 0;
}
static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){
    const AVOption *o = NULL;
int ret = av_set_number2(obj, name, num, den, intnum, &o);

 if (o){
av_log(obj, AV_LOG_INFO ,"o_0  %i \n" ,ret);
}

    if (ret < 0){
av_log(obj, AV_LOG_INFO ,"z  %i \n" ,num);
        return 0;
   } else if (o){
av_log(obj, AV_LOG_INFO ,"y  %i \n" ,num);
        return o;
        }
av_log(obj, AV_LOG_INFO ,"r  %i \n" ,num);
return 0;
}


Create a new paste based on this one


Comments: