diff options
author | uau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-01 06:52:19 +0000 |
---|---|---|
committer | uau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-01 06:52:19 +0000 |
commit | 1844e1dd0c15c18ea4781475fd1f1d62c0098ebc (patch) | |
tree | c2e851fccc75aa0bac60aefba6d9bb36f727a95b /libaf | |
parent | a6d6f182167dbb2fe16ef12faf36a6668eaaa9af (diff) |
Change decode_audio() interface
Rewrite decode_audio to better deal with filters that handle input in
large blocks. It now always places output in sh_audio->a_out_buffer
(which was always given as a parameter before) and reallocates the
buffer if needed. After the changes filters can return arbitrarily
large blocks of data without some of it being lost. The new version
also allows simplifying some code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24920 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf')
-rw-r--r-- | libaf/af.c | 23 | ||||
-rw-r--r-- | libaf/af.h | 20 |
2 files changed, 7 insertions, 36 deletions
diff --git a/libaf/af.c b/libaf/af.c index 5eda4ff5b1..b86bfe3d14 100644 --- a/libaf/af.c +++ b/libaf/af.c @@ -526,19 +526,9 @@ int af_lencalc(double mul, af_data_t* d) return d->len * mul + t + 1; } -/* Calculate how long the input IN to the filters should be to produce - a certain output length OUT but with the following three constraints: - 1. IN <= max_insize, where max_insize is the maximum possible input - block length - 2. OUT <= max_outsize, where max_outsize is the maximum possible - output block length - 3. If possible OUT >= len. - Return -1 in case of error */ -int af_calc_insize_constrained(af_stream_t* s, int len, - int max_outsize,int max_insize) +// Calculate average ratio of filter output size to input size +double af_calc_filter_multiplier(af_stream_t* s) { - int t = s->input.bps*s->input.nch; - int in = 0; af_instance_t* af=s->first; double mul = 1; // Iterate through all filters and calculate total multiplication factor @@ -547,14 +537,7 @@ int af_calc_insize_constrained(af_stream_t* s, int len, af=af->next; }while(af); - if (len > max_outsize) - len = max_outsize; - - in = len / t / mul * t; - - if(in>max_insize) in=t*(max_insize/t); - - return in; + return mul; } /* Calculate the total delay [ms] caused by the filters */ diff --git a/libaf/af.h b/libaf/af.h index 428f53ff6e..4c983cb6e4 100644 --- a/libaf/af.h +++ b/libaf/af.h @@ -189,22 +189,10 @@ af_data_t* af_play(af_stream_t* s, af_data_t* data); af_instance_t *af_control_any_rev (af_stream_t* s, int cmd, void* arg); /** - * \brief calculate required input length for desired output size - * \param len desired minimum output length - * \param max_outsize maximum output length - * \param max_insize maximum input length - * \return input length or -1 on error - * - Calculate how long the input IN to the filters should be to produce - a certain output length OUT but with the following three constraints: - 1. IN <= max_insize, where max_insize is the maximum possible input - block length - 2. OUT <= max_outsize, where max_outsize is the maximum possible - output block length - 3. If possible OUT >= len. - */ -int af_calc_insize_constrained(af_stream_t* s, int len, - int max_outsize,int max_insize); + * \brief calculate average ratio of filter output lenth to input length + * \return the ratio + */ +double af_calc_filter_multiplier(af_stream_t* s); /** * \brief Calculate the total delay caused by the filters |