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

Stefano Sabatini stefasab at gmail.com
Mon Nov 7 14:57:57 CET 2011


On date Sunday 2011-11-06 21:45:39 +0100, Michael Niedermayer encoded:
> On Sun, Nov 06, 2011 at 07:52:54PM +0100, Stefano Sabatini wrote:
> > 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.
> 
> Iam happy with any approach you like.

Pushed this variant.
-- 
FFmpeg = Fostering and F***ing Most Puristic Elected Goblin


More information about the ffmpeg-devel mailing list