[FFmpeg-devel] [PATCH] convert to S16 when resampling is requested

Michael Niedermayer michaelni
Sat Jan 31 12:07:57 CET 2009


On Fri, Jan 30, 2009 at 09:59:25PM -0800, Baptiste Coudurier wrote:
> Baptiste Coudurier wrote:
> > Baptiste Coudurier wrote:
> >> Michael Niedermayer wrote:
> >>> On Fri, Jan 30, 2009 at 02:51:01PM -0800, Baptiste Coudurier wrote:
> >>>> Michael Niedermayer wrote:
> >>>>> On Fri, Jan 30, 2009 at 12:17:02PM -0800, Baptiste Coudurier wrote:
> >>>>>> Hi Michael,
> >>>>>>
> >>>>>> Michael Niedermayer wrote:
> >>>>>>> On Sat, Dec 13, 2008 at 03:53:15PM -0800, Baptiste Coudurier wrote:
> >>>>>>>> Hi Michael,
> >>>>>>>>
> >>>>>>>> Michael Niedermayer wrote:
> >>>>>>>>> On Fri, Dec 12, 2008 at 12:03:17PM -0800, Baptiste Coudurier
> >>>>>>>>> wrote:
> >>>>>>>>>> Hi,
> >>>>>>>>>>
> >>>>>>>>>> $subject.
> >>>>>>>>> I think the audio resampler should support all input & output
> >>>>>>>>> sample formats instead. This would be similar to swscale and
> >>>>>>>>> would be much easier to use for applications than having these
> >>>>>>>>> steps seperated
> >>>>>>>> Well, yes, however you suggested that 3 months ago and nobody
> >>>>>>>> jumped in to work on it. In the mean time, there is still a big
> >>>>>>>> regression in FFmpeg, and I don't see anything fixed in the near
> >>>>>>>> future, so this workaround is IMHO acceptable until the most
> >>>>>>>> elegant solution is implemented.
> >>>>>>> what about moving your solution into the resampler?
> >>>>>>>
> >>>>>>> I mean, so that one can later replace the X->S16->Y code by something
> >>>>>>>  better without having to change the API/ABI
> >>>>>> I just looked at it and API does not provide a way to specify input
> >>>>>> sample format, so we cannot do this without changing it.
> >>>>> Indeed
> >>>> So what do you want to do ? Can we still apply the patch on ffmpeg.c ?
> >>> if it cant be done without changing API, well
> >>> extend it :)
> >>>
> >>> its just adding a foobar2(samplefmt in / out, ...)
> >>> or am i missing something?
> >> All right, here it is.
> > 
> > Humm, old patch sliped in. Here is the good one.
> 
> When I screw up, this is serious shit. Last attached patch contained 3
> diffs :/
> 
> 3rd try.
[...]
> @@ -126,8 +132,10 @@
>      }
>  }
>  
> -ReSampleContext *audio_resample_init(int output_channels, int input_channels,
> -                                      int output_rate, int input_rate)
> +ReSampleContext *audio_resample_init2(int output_channels, int input_channels,

this needs a ff or av prefix
also there should be a way for the user to set/pass the other params
to the resampler namely 
int filter_size, int phase_shift, int linear, double cutoff
when we already change the API ...

[...]
> +            av_log(NULL, AV_LOG_ERROR,
> +                   "Cannot convert %s sample format to s16 sample format\n",
> +                   avcodec_get_sample_fmt_name(s->sample_fmt[0]));

av_log() should have some context different from NULL otherwise
it may become hard in some cases to tell from where a message came

[...]

> @@ -2443,6 +2443,10 @@
>  
>  ReSampleContext *audio_resample_init(int output_channels, int input_channels,
>                                       int output_rate, int input_rate);

should be derpecated and under #if VERSION < blah

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090131/4bc6a519/attachment.pgp>



More information about the ffmpeg-devel mailing list