Mercurial > libavcore.hg
comparison parseutils.c @ 5:ae41a485a089 libavcore
Avoid the use of an intermediary variable in
av_parse_video_rate(). Simplify.
| author | stefano |
|---|---|
| date | Mon, 26 Jul 2010 23:12:48 +0000 |
| parents | a821459410ee |
| children |
comparison
equal
deleted
inserted
replaced
| 4:a821459410ee | 5:ae41a485a089 |
|---|---|
| 137 rate->den = strtol(cp+1, &cpp, 10); | 137 rate->den = strtol(cp+1, &cpp, 10); |
| 138 else | 138 else |
| 139 rate->num = 0; | 139 rate->num = 0; |
| 140 } else { | 140 } else { |
| 141 /* Finally we give up and parse it as double */ | 141 /* Finally we give up and parse it as double */ |
| 142 AVRational time_base = av_d2q(strtod(arg, 0), 1001000); | 142 *rate = av_d2q(strtod(arg, 0), 1001000); |
| 143 rate->den = time_base.den; | |
| 144 rate->num = time_base.num; | |
| 145 } | 143 } |
| 146 if (rate->num <= 0 || rate->den <= 0) | 144 if (rate->num <= 0 || rate->den <= 0) |
| 147 return AVERROR(EINVAL); | 145 return AVERROR(EINVAL); |
| 148 return 0; | 146 return 0; |
| 149 } | 147 } |
