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

Michael Niedermayer michaelni at gmx.at
Sun Nov 6 21:45:39 CET 2011


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.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111106/b2a5f814/attachment.asc>


More information about the ffmpeg-devel mailing list