[MPlayer-dev-eng] [PATCH] Fractional part of time stamp in OSD

Diego Biurrun diego at biurrun.de
Sat Jan 29 23:28:16 CET 2011


On Sat, Jan 29, 2011 at 07:22:46AM +0100, Christian wrote:
> 
> Attached, you'll find the revised version of the patch.
> 
> --- DOCS/man/en/mplayer.1	(Revision 32825)
> +++ DOCS/man/en/mplayer.1	(Arbeitskopie)
> @@ -2426,6 +2426,23 @@
>  .
>  .TP
> +.B \-osd\-fractions <0\-2>
> +Set how fractions of seconds of the current timestamp are printed on the OSD:
> +.PD 0
> +.RSs
> +.IPs 0
> +do not display fractions (default)
> +.IPs 1
> +show the first two decimals
> +.IPs 2
> +show approximated frame count within current second.

Capitalize these sentences and end in a period.

> --- DOCS/man/de/mplayer.1	(Revision 32825)
> +++ DOCS/man/de/mplayer.1	(Arbeitskopie)

same

> --- mplayer.c	(Revision 32825)
> +++ mplayer.c	(Arbeitskopie)
> @@ -1579,15 +1582,37 @@
>              else
>                  percentage_text[0] = 0;
>  
> +            if (osd_fractions==1) {
> +                //print fractions as sub-second timestamp
> +                snprintf(fractions_text, sizeof(fractions_text), ".%02d", 
> +		      (int)( (mpctx->sh_video->pts - pts)* 100 + 0.5) % 100);
> +            } else if (osd_fractions==2) {
> +                //print fractions by estimating the frame count within the
> +	        //second
> +
> +                //rounding or cutting off numbers after the decimal point
> +	        //causes problems because of float's precision and movies,
> +	        //whose first frame is not exactly at timestamp 0. Therefore,
> +	        //we add 0.2 and cut off at the decimal point, which proved
> +	        //as good heuristic
> +                snprintf(fractions_text, sizeof(fractions_text), ".%02d", 
> +			 (int) ( ( mpctx->sh_video->pts - pts ) * 
> +				 mpctx->sh_video->fps + 0.2 ) );
> +            } else {
> +                //do not print fractions
> +                fractions_text[0] = 0;
> +            }
> +

tabs and trailing whitespace

Diego


More information about the MPlayer-dev-eng mailing list