Commit 637b5326 authored by Michael Niedermayer's avatar Michael Niedermayer

convert some options in ffmpeg.c to AVOptions

Originally committed as revision 4586 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent a1689e2f
This diff is collapsed.
......@@ -35,12 +35,12 @@ static double av_parse_num(const char *name, char **tail){
}
//FIXME order them and do a bin search
static AVOption *find_opt(void *v, const char *name){
static AVOption *find_opt(void *v, const char *name, const char *unit){
AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass
AVOption *o= c->option;
for(;o && o->name; o++){
if(!strcmp(o->name, name))
if(!strcmp(o->name, name) && (!unit || !strcmp(o->unit, unit)) )
return o;
}
return NULL;
......@@ -53,7 +53,7 @@ AVOption *av_next_option(void *obj, AVOption *last){
}
static AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){
AVOption *o= find_opt(obj, name);
AVOption *o= find_opt(obj, name, NULL);
void *dst;
if(!o || o->offset<=0)
return NULL;
......@@ -78,9 +78,30 @@ static AVOption *av_set_number(void *obj, const char *name, double num, int den,
return o;
}
static AVOption *set_all_opt(void *v, const char *unit, double d){
AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass
AVOption *o= c->option;
AVOption *ret=NULL;
for(;o && o->name; o++){
if(o->type != FF_OPT_TYPE_CONST && o->unit && !strcmp(o->unit, unit)){
double tmp= d;
if(o->type == FF_OPT_TYPE_FLAGS)
tmp= av_get_int(v, o->name, NULL) | (int64_t)d;
av_set_number(v, o->name, tmp, 1, 1);
ret= o;
}
}
return ret;
}
//FIXME use eval.c maybe?
AVOption *av_set_string(void *obj, const char *name, const char *val){
AVOption *o= find_opt(obj, name);
AVOption *o= find_opt(obj, name, NULL);
if(o && o->offset==0 && o->type == FF_OPT_TYPE_CONST && o->unit){
return set_all_opt(obj, o->unit, o->default_val);
}
if(!o || !val || o->offset<=0)
return NULL;
if(o->type != FF_OPT_TYPE_STRING){
......@@ -100,8 +121,8 @@ AVOption *av_set_string(void *obj, const char *name, const char *val){
d= av_parse_num(buf, &tail);
if(tail <= buf){
AVOption *o_named= find_opt(obj, buf);
if(o_named && o_named->type == FF_OPT_TYPE_CONST && !strcmp(o_named->unit, o->unit))
AVOption *o_named= find_opt(obj, buf, o->unit);
if(o_named && o_named->type == FF_OPT_TYPE_CONST)
d= o_named->default_val;
else if(!strcmp(buf, "default")) d= o->default_val;
else if(!strcmp(buf, "max" )) d= o->max;
......@@ -143,7 +164,7 @@ AVOption *av_set_int(void *obj, const char *name, int64_t n){
* @param buf_len allocated length in bytes of buf
*/
const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *buf, int buf_len){
AVOption *o= find_opt(obj, name);
AVOption *o= find_opt(obj, name, NULL);
void *dst;
if(!o || o->offset<=0)
return NULL;
......@@ -169,7 +190,7 @@ const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *b
}
static int av_get_number(void *obj, const char *name, AVOption **o_out, double *num, int *den, int64_t *intnum){
AVOption *o= find_opt(obj, name);
AVOption *o= find_opt(obj, name, NULL);
void *dst;
if(!o || o->offset<=0)
goto error;
......
This diff is collapsed.
......@@ -16,7 +16,7 @@ c9050b51f6d6636cdda3160d43463bc3 *./data/b-libav.ts
57a8dfc7926802bb337a9d8918de94a8 *./data/b-libav.swf
41816 ./data/b-libav.swf
./data/b-libav.swf CRC=2b273fea
c85c98bb1c9a5fe833eed5d23fbf8499 *./data/b-libav.ffm
8f908b4651a7e5915f0f6e505bafb0b1 *./data/b-libav.ffm
389120 ./data/b-libav.ffm
./data/b-libav.ffm CRC=688bd1eb
794934a02582f8dfc85d1856514cf37c *./data/b-libav.flv
......
......@@ -107,8 +107,8 @@ do_ffmpeg()
{
f="$1"
shift
echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $*
$ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
echo $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE $*
$ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
rm -f /tmp/ffmpeg$$
do_md5sum $f >> $logfile
......@@ -127,8 +127,8 @@ do_ffmpeg_crc()
{
f="$1"
shift
echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
$ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
echo $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE $* -f crc $datadir/ffmpeg.crc
$ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true
rm -f /tmp/ffmpeg$$
echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
......@@ -138,8 +138,8 @@ do_ffmpeg_nocheck()
{
f="$1"
shift
echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $*
$ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
echo $ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE $*
$ffmpeg -y -flags +BITEXACT -dct FASTINT -idct SIMPLE -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
rm -f /tmp/ffmpeg$$
expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
......@@ -175,14 +175,14 @@ do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
# mpeg2 encoding
file=${outfile}mpeg2.mpg
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct_algo 1 -dct_algo 2 -f mpeg1video $file
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct INT -dct INT -f mpeg1video $file
# mpeg2 decoding
do_ffmpeg $raw_dst -y -idct_algo 1 -i $file -f rawvideo $raw_dst
do_ffmpeg $raw_dst -y -idct INT -i $file -f rawvideo $raw_dst
# mpeg2 encoding interlaced
file=${outfile}mpeg2i.mpg
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -ildct -ilme $file
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags +ILDCT+ILME $file
# mpeg2 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -192,14 +192,14 @@ fi
if [ -n "$do_mpeg2thread" ] ; then
# mpeg2 encoding interlaced
file=${outfile}mpeg2thread.mpg
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -ildct -ilme -threads 2 $file
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ILDCT+ILME -threads 2 $file
# mpeg2 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
# mpeg2 encoding interlaced
file=${outfile}mpeg2reuse.mpg
do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -ildct -ilme -threads 4 $file
do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ILDCT+ILME -threads 4 $file
# mpeg2 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -269,7 +269,7 @@ fi
if [ -n "$do_h263p" ] ; then
# h263p encoding
file=${outfile}h263p.avi
do_ffmpeg $file -y -qscale 2 -umv -aiv -aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
do_ffmpeg $file -y -qscale 2 -flags +UMV+AIV+AIC -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
# h263p decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -279,7 +279,7 @@ fi
if [ -n "$do_mpeg4" ] ; then
# mpeg4
file=${outfile}odivx.mp4
do_ffmpeg $file -y -4mv -hq -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
do_ffmpeg $file -y -flags +MV4 -hq -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
# mpeg4 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -309,7 +309,7 @@ fi
if [ -n "$do_mpeg4adv" ] ; then
# mpeg4
file=${outfile}mpeg4-adv.avi
do_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -aic -trell -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
do_ffmpeg $file -y -qscale 9 -flags +MV4+PART+AIC+TRELL -hq -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
# mpeg4 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -319,7 +319,7 @@ fi
if [ -n "$do_mpeg4thread" ] ; then
# mpeg4
file=${outfile}mpeg4-thread.avi
do_ffmpeg $file -y -b 500 -4mv -hq -part -ps 200 -aic -trell -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file
do_ffmpeg $file -y -b 500 -flags +MV4+PART+AIC+TRELL -hq -ps 200 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file
# mpeg4 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -329,7 +329,7 @@ fi
if [ -n "$do_mpeg4adv" ] ; then
# mpeg4
file=${outfile}mpeg4-Q.avi
do_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -qpel -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
do_ffmpeg $file -y -qscale 7 -flags +MV4+QPEL -mbd 2 -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
# mpeg4 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -339,7 +339,7 @@ fi
if [ -n "$do_error" ] ; then
# damaged mpeg4
file=${outfile}error-mpeg4-adv.avi
do_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -part -ps 250 -error 10 -aic -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
do_ffmpeg $file -y -qscale 7 -flags +MV4+PART+AIC -mbd 2 -ps 250 -error 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
# damaged mpeg4 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -349,7 +349,7 @@ fi
if [ -n "$do_mpeg4nr" ] ; then
# noise reduction
file=${outfile}mpeg4-nr.avi
do_ffmpeg $file -y -qscale 8 -4mv -mbd 2 -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
do_ffmpeg $file -y -qscale 8 -flags +MV4 -mbd 2 -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
# mpeg4 decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -456,7 +456,7 @@ do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
# snow encoding
file=${outfile}snow53.avi
do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -qpel -4mv $file
do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -flags +MV4+QPEL $file
# snow decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
......@@ -466,7 +466,7 @@ fi
if [ -n "$do_dv" ] ; then
# dv encoding
file=${outfile}dv.dv
do_ffmpeg $file -dct_algo 2 -y -f pgmyuv -i $raw_src -s pal -an $file
do_ffmpeg $file -dct INT -y -f pgmyuv -i $raw_src -s pal -an $file
# dv decoding
do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif $raw_dst
......@@ -651,7 +651,7 @@ do_ffmpeg_crc $file -i $file
# jpeg (we do not do md5 on image files yet)
file=${outfile}libav%d.jpg
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -bitexact -dct_algo 1 -idct_algo 2 -pix_fmt yuvj420p -f image2 $file
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -flags +BITEXACT -dct FASTINT -idct SIMPLE -pix_fmt yuvj420p -f image2 $file
do_ffmpeg_crc $file -f image2 -i $file
####################
......
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