From: Darren S. <ds...@us...> - 2005-12-21 18:43:08
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2880/src Modified Files: player.c Log Message: Fix playback speed display. Cause deprecated functions to output warnings and stop using them. Remove unused variables. Index: player.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/player.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- player.c 20 Dec 2005 02:44:34 -0000 1.58 +++ player.c 21 Dec 2005 18:42:53 -0000 1.59 @@ -163,9 +163,13 @@ xine_set_param (stream, XINE_PARAM_AUDIO_MUTE, mute); } +static inline int calc_speed (int i) +{ + return i ? (1 << (i - 1)) : 0; +} + static void set_speed (int speed) { - speed = speed ? (1 << (speed - 1)) : 0; xine_set_param (stream, XINE_PARAM_SPEED, speed); if (speed == XINE_SPEED_NORMAL) ui_set_status (UI_PLAY); @@ -177,6 +181,13 @@ ui_set_status (UI_PAUSE); } +static int listen_speed (void *se, se_t *se_t, se_o_t *o, se_prop_t *prop, + se_prop_read_t r) +{ + set_speed (calc_speed (r.i)); + return FALSE; +} + static void get_speed (se_prop_t *prop, se_prop_read_t *value) { int speed = xine_get_param (stream, XINE_PARAM_SPEED); @@ -278,8 +289,6 @@ static JSBool set_vo_postproc_chain (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - se_t *se = (se_t *) JS_GetContextPrivate(cx); - se_log_fncall ("vo_postproc.set_chain"); se_argc_check (1, "vo_postproc.set_chain"); se_arg_is_string (0, "vo_postproc.set_chain"); @@ -292,8 +301,6 @@ static JSBool set_ao_postproc_chain (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - se_t *se = (se_t *) JS_GetContextPrivate(cx); - se_log_fncall ("ao_postproc.set_chain"); se_argc_check (1, "ao_postproc.set_chain"); se_arg_is_string (0, "ao_postproc.set_chain"); @@ -322,17 +329,12 @@ #ifdef WITH_DEPRECATED static JSBool js_get_speed (JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) { - - /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */ - int speed; - - se_log_fncall ("get_speed"); - - speed = xine_get_param (stream, XINE_PARAM_SPEED); - - *rval = INT_TO_JSVAL (speed); - + jsval *argv, jsval *rval) +{ + se_prop_read_t speed; + se_log_fncall_deprecated ("get_speed"); + get_speed (NULL, &speed); + *rval = INT_TO_JSVAL (speed.i); return JS_TRUE; } @@ -342,7 +344,7 @@ /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */ int volume; - se_log_fncall ("get_volume"); + se_log_fncall_deprecated ("get_volume"); volume = xine_get_param (stream, XINE_PARAM_AUDIO_VOLUME); @@ -356,7 +358,7 @@ { /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */ int mute; - se_log_fncall ("get_mute"); + se_log_fncall_deprecated ("get_mute"); mute = xine_get_param (stream, XINE_PARAM_AUDIO_MUTE); *rval = BOOLEAN_TO_JSVAL (mute); return JS_TRUE; @@ -368,7 +370,7 @@ /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */ int zoom; - se_log_fncall ("get_zoom"); + se_log_fncall_deprecated ("get_zoom"); zoom = xine_get_param (stream, XINE_PARAM_VO_ZOOM_X); @@ -398,16 +400,16 @@ switch (pause_state) { case 0: /* pause off */ - xine_set_param (stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL); + set_speed (XINE_SPEED_NORMAL); break; case 1: /* pause on */ - xine_set_param (stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE); + set_speed (XINE_SPEED_PAUSE); break; default: /* toggle */ if (xine_get_param (stream, XINE_PARAM_SPEED) != XINE_SPEED_PAUSE) - xine_set_param (stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE); + set_speed (XINE_SPEED_PAUSE); else - xine_set_param (stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL); + set_speed (XINE_SPEED_NORMAL); } pthread_mutex_unlock (&engine_lock); @@ -442,7 +444,7 @@ se_t *se = (se_t *) JS_GetContextPrivate(cx); int speed; - se_log_fncall ("set_speed"); + se_log_fncall_deprecated ("set_speed"); se_argc_check (1, "set_speed"); se_arg_is_int (0, "set_speed"); @@ -454,7 +456,7 @@ if (engine_mutex_trylock (se)) return JS_TRUE; - xine_set_param (stream, XINE_PARAM_SPEED, speed ? (1 << (speed - 1)) : 0); + set_speed (calc_speed (speed)); pthread_mutex_unlock (&engine_lock); return JS_TRUE; } @@ -465,7 +467,7 @@ se_t *se = (se_t *) JS_GetContextPrivate(cx); int volume; - se_log_fncall ("set_volume"); + se_log_fncall_deprecated ("set_volume"); se_argc_check (1, "set_volume"); se_arg_is_int (0, "set_volume"); @@ -491,7 +493,7 @@ se_t *se = (se_t *) JS_GetContextPrivate(cx); JSBool mute; - se_log_fncall ("set_mute"); + se_log_fncall_deprecated ("set_mute"); se_argc_check_max (1, "set_mute"); if (argc == 1) @@ -515,7 +517,7 @@ se_t *se = (se_t *) JS_GetContextPrivate(cx); int zoom; - se_log_fncall ("set_zoom"); + se_log_fncall_deprecated ("set_zoom"); se_argc_check (1, "set_zoom"); se_arg_is_int (0, "set_zoom"); @@ -551,9 +553,8 @@ } static JSBool js_set_video_size (JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) { - - se_t *se = (se_t *) JS_GetContextPrivate(cx); + jsval *argv, jsval *rval) +{ int *zoom = malloc (sizeof (int)); se_log_fncall ("set_video_size"); @@ -576,11 +577,9 @@ static JSBool js_set_fullscreen (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - - se_t *se = (se_t *) JS_GetContextPrivate(cx); int fs; - se_log_fncall ("set_fullscreen"); + se_log_fncall_deprecated ("set_fullscreen"); se_argc_check_max (1, "set_fullscreen"); if (argc==1) { @@ -596,11 +595,9 @@ static JSBool js_set_deinterlace (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - - se_t *se = (se_t *) JS_GetContextPrivate(cx); int di; - se_log_fncall ("set_deinterlace"); + se_log_fncall_deprecated ("set_deinterlace"); se_argc_check_max (1, "set_deinterlace"); if (argc==1) { @@ -620,7 +617,7 @@ se_t *se = (se_t *) JS_GetContextPrivate(cx); int di; - se_log_fncall ("set_postproc_video"); + se_log_fncall_deprecated ("set_postproc_video"); se_argc_check_max (1, "set_postproc_video"); if (argc == 1) @@ -653,7 +650,7 @@ se_t *se = (se_t *) JS_GetContextPrivate(cx); int di; - se_log_fncall ("set_postproc_audio"); + se_log_fncall_deprecated ("set_postproc_audio"); se_argc_check_max (1, "set_postproc_audio"); if (argc == 1) @@ -683,11 +680,9 @@ static JSBool js_set_auto_resize (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - - se_t *se = (se_t *) JS_GetContextPrivate(cx); int ar; - se_log_fncall ("set_auto_resize"); + se_log_fncall_deprecated ("set_auto_resize"); se_argc_check_max (1, "set_auto_resize"); if (argc==1) { @@ -704,10 +699,9 @@ static JSBool js_set_auto_rescale (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - se_t *se = (se_t *) JS_GetContextPrivate(cx); int ar; - se_log_fncall ("set_auto_rescale"); + se_log_fncall_deprecated ("set_auto_rescale"); se_argc_check_max (1, "set_auto_rescale"); if (argc==1) { @@ -724,10 +718,9 @@ static JSBool js_set_aspect (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - se_t *se = (se_t *) JS_GetContextPrivate(cx); int aspect; - se_log_fncall ("set_aspect"); + se_log_fncall_deprecated ("set_aspect"); se_argc_check_max (1, "set_aspect"); if (argc==1) { @@ -936,7 +929,7 @@ } if (xine_get_param (stream, XINE_PARAM_SPEED) != XINE_SPEED_NORMAL) - xine_set_param (stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL); + set_speed (XINE_SPEED_NORMAL); pthread_mutex_unlock (&engine_lock); @@ -947,10 +940,8 @@ * (Useful on some keyboards with CD/DVD control keys.) */ static JSBool controls_play_pause (JSContext *cx, JSObject *obj, uintN argc, - jsval *argv, jsval *rval) { - - se_t *se = (se_t *) JS_GetContextPrivate(cx); - + jsval *argv, jsval *rval) +{ se_log_fncall_checkinit ("play_pause"); se_argc_check_max (1, "play_pause"); @@ -971,8 +962,6 @@ static JSBool js_is_live_stream (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - se_t *se = (se_t *) JS_GetContextPrivate(cx); - *rval = JSVAL_FALSE; se_log_fncall ("is_live_stream"); @@ -1082,7 +1071,7 @@ * VARIABLE[=TYPE] or METHOD([PARAMETER TYPE,...]) * To the right, descriptive text */ - { "av_speed", N_("v=int, min, max; playback speed"), 0, get_speed, set_speed, XINE_SPEED_PAUSE, XINE_SPEED_FAST_4 }, + { "av_speed", N_("v=int, min, max; playback speed"), 0, get_speed, set_speed, XINE_SPEED_PAUSE, XINE_SPEED_FAST_4, FALSE, { listen_speed } }, { "vo_aspect", N_("v=int; aspect ratio"), XINE_PARAM_VO_ASPECT_RATIO, NULL, set_aspect, 0, XINE_VO_ASPECT_NUM_RATIOS - 1, TRUE }, { "vo_subtitle", N_("v=int, min, max; subtitle channel"), XINE_PARAM_SPU_CHANNEL, NULL, set_subtitles, -2, GXINE_MAX_SPU_CHANNEL }, { "vo_zoom", N_("v=int, min, max; video zoom (within window)"), XINE_PARAM_VO_ZOOM_X, NULL, set_zoom, XINE_VO_ZOOM_MIN, XINE_VO_ZOOM_MAX }, |