[MPlayer-dev-eng] [PATCH 4/7] af_scale*: scaletempo_auto
Robert Juliano
juliano.1 at osu.edu
Mon Jun 11 06:51:07 CEST 2007
scaletempo_auto
Automagically installs scaletempo into filter chain upon speed
change. No need for command line argument. I've included
this as a separate patch because it changes the default
behavior. The next patch enables a method to revert to the
old behavior.
Files:
help/help_mp-en.h
libaf/af.c
Index: mplayer-HEAD/help/help_mp-en.h
===================================================================
--- mplayer-HEAD.orig/help/help_mp-en.h 2007-05-30 21:54:53.000000000 -0400
+++ mplayer-HEAD/help/help_mp-en.h 2007-06-10 14:29:54.000000000 -0400
@@ -1250,6 +1250,8 @@
// libaf
+#define MSGTR_AF_AutoScaleTempoFailed "[af] Unkown error: Unable to maintain pitch.\n"
+
// af_ladspa.c
#define MSGTR_AF_LADSPA_AvailableLabels "available labels in"
Index: mplayer-HEAD/libaf/af.c
===================================================================
--- mplayer-HEAD.orig/libaf/af.c 2007-06-10 12:30:02.000000000 -0400
+++ mplayer-HEAD/libaf/af.c 2007-06-10 14:39:22.000000000 -0400
@@ -7,6 +7,7 @@
#endif
#include "af.h"
+#include "help_mp.h"
// Static list of filters
extern af_info_t af_info_dummy;
@@ -654,8 +655,14 @@
int af_playback_speed_change(af_stream_t* s, float speed, int base_srate)
{
if(!af_control_any_rev(s, AF_CONTROL_PLAYBACK_SPEED | AF_CONTROL_SET, &speed)) {
- // revert to old behavior
- s->input.rate = base_srate * speed;
+ // automagically insert scaletempo
+ af_instance_t* af_st = af_add(s, "scaletempo");
+ if(!(af_st &&
+ (af_st->control(af_st, AF_CONTROL_PLAYBACK_SPEED | AF_CONTROL_SET, &speed) != AF_ERROR))) {
+ // revert to old behavior
+ af_msg(AF_MSG_ERROR, MSGTR_AF_AutoScaleTempoFailed);
+ s->input.rate = base_srate * speed;
+ }
}
return !af_init(s); // make 0 failure
}
More information about the MPlayer-dev-eng
mailing list