<div dir="ltr">hello<div><br></div><div> i'm using <b>swresample lib</b>. my code is used to convert mp2 or mp4 into wav file. </div><div> the code fragment :</div><div> .......</div><div><br></div><div> SwrContext *swr = swr_alloc();</div>
<div>
ret = av_opt_set_int(swr, "in_channel_layout", AV_CH_LAYOUT_STEREO, 0);</div><div> ret = av_opt_set_int(swr, "out_channel_layout", AV_CH_LAYOUT_MONO, 0);</div><div> ret = av_opt_set_int(swr, "in_sample_rate", IN_SAMPLE_RATE, 0);</div>
<div> ret = av_opt_set_int(swr, "out_sample_rate", OUT_SAMPLE_RATE, 0);</div><div> ret = av_opt_set_int(swr, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0);</div><div> ret = av_opt_set_int(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);</div>
<div> ret = swr_init(swr);</div><div><br></div><div> .......</div><div><br></div><div> out_samples = swr_convert(swr, output, out_samples,(const uint8_t **) (inframe->data), in_samples);</div><div> if out_channel_layout = AV_CH_LAYOUT_ STEREO resampling works fine</div>
<div>
<br></div><div> if out_channel_layout = AV_CH_LAYOUT_MONO & other set options remain same it fails that is:</div><div><br></div><div> the swr_convert fails that is somwhere inside the code of this function there is a call to<b> exit</b></div>
<div> which is problematic by itself (exit a program from av. library) instead of returning some error code.</div><div><br></div><div> help will be appreciated thanks rafi</div><div> </div></div>