[Libav-user] problem while using swresample library

Rafi Fisher rafi.fisher at wywy.com
Mon Dec 3 16:52:57 CET 2012


hello

  i'm using *swresample lib*. my code is used to convert mp2 or mp4 into
wav file.
  the code fragment :
    .......

    SwrContext *swr = swr_alloc();
    ret = av_opt_set_int(swr, "in_channel_layout",  AV_CH_LAYOUT_STEREO, 0);
    ret = av_opt_set_int(swr, "out_channel_layout",  AV_CH_LAYOUT_MONO,
 0);
    ret = av_opt_set_int(swr, "in_sample_rate",     IN_SAMPLE_RATE,      0);
    ret = av_opt_set_int(swr, "out_sample_rate",   OUT_SAMPLE_RATE,     0);
    ret = av_opt_set_int(swr, "in_sample_fmt",      AV_SAMPLE_FMT_S16,   0);
    ret = av_opt_set_int(swr, "out_sample_fmt",     AV_SAMPLE_FMT_S16,   0);
    ret = swr_init(swr);

    .......

    out_samples = swr_convert(swr, output, out_samples,(const uint8_t **)
(inframe->data), in_samples);
    if out_channel_layout = AV_CH_LAYOUT_ STEREO resampling works fine

    if out_channel_layout = AV_CH_LAYOUT_MONO  & other set options remain
same it fails that is:

    the swr_convert fails that is somwhere inside the code of this function
there is a call to* exit*
    which is  problematic by itself (exit a program from av. library)
instead of returning some error code.

        help will be appreciated thanks rafi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121203/dac2672f/attachment.html>


More information about the Libav-user mailing list