On Sat, Jul 22, 2017 at 10:40 AM, Anton Khirnov <an...@khirnov.net> wrote:
> Quoting Vittorio Giovara (2017-06-29 00:10:50) > > diff --git a/libavresample/utils.c b/libavresample/utils.c > > index bab2153b4b..15c827efbe 100644 > > --- a/libavresample/utils.c > > +++ b/libavresample/utils.c > > @@ -18,6 +18,7 @@ > > * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > 02110-1301 USA > > */ > > > > +#include "libavutil/channel_layout.h" > > #include "libavutil/common.h" > > #include "libavutil/dict.h" > > #include "libavutil/error.h" > > @@ -35,6 +36,7 @@ > > > > int avresample_open(AVAudioResampleContext *avr) > > { > > + int in_ch, out_ch; > > int ret; > > > > if (avresample_is_open(avr)) { > > @@ -42,24 +44,67 @@ int avresample_open(AVAudioResampleContext *avr) > > return AVERROR(EINVAL); > > } > > > > + if ( avr->in_ch_layout.order == AV_CHANNEL_ORDER_CUSTOM || > > + avr->out_ch_layout.order == AV_CHANNEL_ORDER_CUSTOM) { > > + av_log(avr, AV_LOG_ERROR, > > + "Resampling a custom channel layout order is not > supported.\n"); > > + return AVERROR(ENOSYS); > > Why? I don't remember if I tested it properly back then, but IIRC the > matrix building code should work custom orders just fine. > > > + } > > + > > + if (avr->in_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) { > > + if (avr->in_ch_layout.nb_channels > 63) { > > + av_log(avr, AV_LOG_ERROR, > > + "Unspecified channel layout order is supported only > for up " > > + "to 63 channels (got %d).\n", > avr->in_ch_layout.nb_channels); > > + return AVERROR(ENOSYS); > > + } > > + av_channel_layout_default(&avr->in_ch_layout, > avr->in_ch_layout.nb_channels); > > + } > > + if (avr->out_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) { > > + if (avr->out_ch_layout.nb_channels > 63) { > > + av_log(avr, AV_LOG_ERROR, > > + "Unspecified channel layout order is supported only > for up " > > + "to 63 channels (got %d).\n", avr->out_ch_layout.nb_ > channels); > > + return AVERROR(ENOSYS); > > + } > > + av_channel_layout_default(&avr->out_ch_layout, > avr->out_ch_layout.nb_channels); > > + } > > Why are those needed? Seems they are redundant given the other checks > right below. > You are right on both points, the code is fine (and simpler) without these checks. -- Vittorio _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel