Dont you think Inclusion of stdio.h ,math.h ,assert.h etc is redundant???????AFAIK vlc_common.h takes care of all<br><br><div class="gmail_quote">On Fri, Mar 26, 2010 at 5:31 AM, Casian Andrei <span dir="ltr"><<a href="mailto:skeletk13@gmail.com">skeletk13@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello,<br><br>Done the modfications. Set the editor to highlight trailing whitespaces, so no more of those.<br><br>Regards,<br>
Casian<br><br><div class="gmail_quote">On Thu, Mar 25, 2010 at 10:41 PM, Laurent Aimar <span dir="ltr"><<a href="mailto:fenrir@via.ecp.fr" target="_blank">fenrir@via.ecp.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">Hi,<br>
<div><br>
On Wed, Mar 24, 2010, Casian Andrei wrote:<br>
> +static void DisplayRate( input_thread_t *p_input, float f_rate )<br>
> +{<br>
> + char psz_msg[14 + 1];<br>
> +<br>
</div>> + if( p_input == NULL ) return;<br>
Useless test, DisplayRate cannot be called with a NULL input.<br>
> +<br>
> + snprintf( psz_msg, sizeof(psz_msg), _("Speed: %.2fx"), f_rate );<br>
> + vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, "%s", psz_msg );<br>
In fact you can merge them both (and remove psz_msg):<br>
vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, _("Speed: %.2fx"), f_rate );<br>
<br>
> diff --git a/src/input/var.c b/src/input/var.c<br>
> index 781ce7c..3975bb9 100644<br>
> --- a/src/input/var.c<br>
> +++ b/src/input/var.c<br>
> @@ -29,6 +29,8 @@<br>
> #endif<br>
><br>
> #include <vlc_common.h><br>
> +#include <assert.h><br>
<div>> +#include <math.h><br>
> #include <stdio.h><br>
> #include <stdlib.h><br>
><br>
</div>> @@ -565,23 +567,68 @@ static int RateCallback( vlc_object_t *p_this, char const *psz_cmd,<br>
<div>> {<br>
> input_thread_t *p_input = (input_thread_t*)p_this;<br>
> VLC_UNUSED(oldval); VLC_UNUSED(p_data);<br>
> +<br>
> + static const int ppi_factor[][2] = {<br>
> + {1,64}, {1,32}, {1,16}, {1,8}, {1,4}, {1,3}, {1,2}, {2,3},<br>
> + {1,1},<br>
> + {3,2}, {2,1}, {3,1}, {4,1}, {8,1}, {16,1}, {32,1}, {64,1},<br>
> + {0,0}<br>
> + };<br>
> +<br>
> + int i;<br>
> + int i_idx;<br>
> + float f_rate = var_GetFloat( p_input, "rate" );<br>
</div>> + float f_sign = f_rate >= 0 ? +1. : -1.;<br>
<div>> + float f_error;<br>
> +<br>
> + /* Determine the factor closest to the current rate */<br>
> + f_error = 1E20;<br>
> + i_idx = -1;<br>
> + for( i = 0; ppi_factor[i][0] != 0; i++ )<br>
> + {<br>
</div>> + const float f_test_r = (float)ppi_factor[i][0] / ppi_factor[i][1];<br>
<div>> + const float f_test_e = fabs( fabs( f_rate ) - f_test_r );<br>
> + if( f_test_e < f_error )<br>
> + {<br>
> + i_idx = i;<br>
> + f_error = f_test_e;<br>
> + }<br>
> + }<br>
><br>
> - /* Problem with this way: the "rate" variable is updated after the<br>
> - * input thread did the change */<br>
> -<br>
</div>> + assert( i_idx >= 0 && ppi_factor[i_idx][0] != 0 );<br>
> +<br>
> + float f_new_rate;<br>
<div>> + const float f_rate_min = (float)INPUT_RATE_DEFAULT / INPUT_RATE_MAX;<br>
> + const float f_rate_max = (float)INPUT_RATE_DEFAULT / INPUT_RATE_MIN;<br>
> +<br>
> if( !strcmp( psz_cmd, "rate-slower" ) )<br>
> {<br>
> - input_ControlPush( p_input, INPUT_CONTROL_SET_RATE_SLOWER, NULL );<br>
> + if( ppi_factor[i_idx+1][0] > 0 )<br>
</div> You forgot to fix the test (i_idx > 0).<br>
> + f_new_rate = (float)ppi_factor[i_idx-1][0] / ppi_factor[i_idx-1][1];<br>
> + else<br>
> + f_new_rate = f_rate_min;<br>
> + f_new_rate *= f_sign;<br>
> +<br>
<br>
Also there is a lot of trailings whitespaces that should be removed from<br>
your patch.<br>
<div><div></div><div><br>
Regards,<br>
<br>
--<br>
fenrir<br>
_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="http://mailman.videolan.org/listinfo/vlc-devel" target="_blank">http://mailman.videolan.org/listinfo/vlc-devel</a><br>
</div></div></blockquote></div><br>
<br>_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="http://mailman.videolan.org/listinfo/vlc-devel" target="_blank">http://mailman.videolan.org/listinfo/vlc-devel</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Pankaj Yadav<br>Integrated Dual Degree Pt-III<br>Deptt. of Mining Engg.<br>Institute of Technology<br>Banaras Hindu University,Varanasi,India<br>Admin-MAHASERVER<br>Personal: <a href="mailto:pankajdnapster@gmail.com">pankajdnapster@gmail.com</a><br>
Academic : <a href="mailto:pankaj.yadav.min07@itbhu.ac.in">pankaj.yadav.min07@itbhu.ac.in</a><br>Professional : <a href="mailto:admin@mahaserver.com">admin@mahaserver.com</a><br>