[FFmpeg-devel] [PATCH] ffprobe: print non-time values like integer if they have no decimal part

Stefano Sabatini stefasab at gmail.com
Sun Nov 6 19:52:54 CET 2011


On date Sunday 2011-11-06 16:49:39 +0100, Michael Niedermayer encoded:
> On Sun, Nov 06, 2011 at 03:51:34PM +0100, Stefano Sabatini wrote:
[...]
> > In practice the passed value is *always* convertible to an int (indeed
> > it is a size, or a bitrate, casted to double and casted back to int
> > here), and we have already other double-to-int casts in the same
> > function, so I'd rather avoid pointless checks.  In case of a non-int
> > int64_t value, this may need to be changed though.
> > 
> > Alternatively I could create a value_string_int() accepting int but
> > this looks overkill and unnecessary as far as it goes.
> 
> i dont think i fully understand you
> 
> if its always a integer value, then it could be printed as such
> if not something like %.99g could be used to omit the fractional
> part without undefined behavior
> if you want to test if something is a integer, theres modf() and fmod()

Different approach, in this case (int)d is done *only* if val was an
int in the first place.
-- 
FFmpeg = Fantastic Faithless Multimedia Pacific Erroneous Gorilla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-ffprobe-refactor-value_string-to-accept-an-unit_valu.patch
Type: text/x-diff
Size: 4844 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111106/4013d4a1/attachment.bin>


More information about the ffmpeg-devel mailing list