changeset 32561:17bb5a38ae2e

build_afilter_chain is not safe to use directly, thus make it static and instead use reinit_audio_chain which should have better error handling. Fixes a crash with -af hrtf and changing speed, audio will still stop playing though.
author reimar
date Fri, 26 Nov 2010 20:52:35 +0000
parents 1dd48bfb04a2
children 1c0bea2aaa2f
files command.c mp_core.h mplayer.c
diffstat 3 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Thu Nov 25 10:04:07 2010 +0000
+++ b/command.c	Fri Nov 26 20:52:35 2010 +0000
@@ -257,14 +257,14 @@
             return M_PROPERTY_ERROR;
         M_PROPERTY_CLAMP(prop, *(float *) arg);
         playback_speed = *(float *) arg;
-        build_afilter_chain(mpctx->sh_audio, &ao_data);
+        reinit_audio_chain();
         return M_PROPERTY_OK;
     case M_PROPERTY_STEP_UP:
     case M_PROPERTY_STEP_DOWN:
         playback_speed += (arg ? *(float *) arg : 0.1) *
             (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
         M_PROPERTY_CLAMP(prop, playback_speed);
-        build_afilter_chain(mpctx->sh_audio, &ao_data);
+        reinit_audio_chain();
         return M_PROPERTY_OK;
     }
     return m_property_float_range(prop, action, arg, &playback_speed);
@@ -2746,7 +2746,7 @@
         case MP_CMD_SPEED_INCR:{
                 float v = cmd->args[0].v.f;
                 playback_speed += v;
-                build_afilter_chain(sh_audio, &ao_data);
+                reinit_audio_chain();
                 set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
                             playback_speed);
             } break;
@@ -2754,7 +2754,7 @@
         case MP_CMD_SPEED_MULT:{
                 float v = cmd->args[0].v.f;
                 playback_speed *= v;
-                build_afilter_chain(sh_audio, &ao_data);
+                reinit_audio_chain();
                 set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
                             playback_speed);
             } break;
@@ -2762,7 +2762,7 @@
         case MP_CMD_SPEED_SET:{
                 float v = cmd->args[0].v.f;
                 playback_speed = v;
-                build_afilter_chain(sh_audio, &ao_data);
+                reinit_audio_chain();
                 set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
                             playback_speed);
             } break;
@@ -3467,7 +3467,7 @@
                 else
                     af_add(mpctx->mixer.afilter, af_command);
             }
-            build_afilter_chain(sh_audio, &ao_data);
+            reinit_audio_chain();
             free(af_args);
         }
         break;
@@ -3476,7 +3476,7 @@
             break;
         af_uninit(mpctx->mixer.afilter);
         af_init(mpctx->mixer.afilter);
-        build_afilter_chain(sh_audio, &ao_data);
+        reinit_audio_chain();
         break;
     case MP_CMD_AF_CMDLINE:
         if (sh_audio) {
--- a/mp_core.h	Thu Nov 25 10:04:07 2010 +0000
+++ b/mp_core.h	Fri Nov 26 20:52:35 2010 +0000
@@ -150,7 +150,6 @@
 extern int forced_subs_only;
 
 
-int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data);
 void uninit_player(unsigned int mask);
 void reinit_audio_chain(void);
 void init_vo_spudec(void);
--- a/mplayer.c	Thu Nov 25 10:04:07 2010 +0000
+++ b/mplayer.c	Fri Nov 26 20:52:35 2010 +0000
@@ -1334,7 +1334,7 @@
  * \param sh_audio describes the requested input format of the chain.
  * \param ao_data describes the requested output format of the chain.
  */
-int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data)
+static int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data)
 {
   int new_srate;
   int result;