Re: [libav-devel] [PATCH 08/25] libavfilter changes for the new channel layout API

2017-07-22 Thread Anton Khirnov
Quoting Vittorio Giovara (2017-06-29 00:10:52)
> This patch contains the following commits:
> 
> avtools: Use the new channel layout API in libavfilter

Again, this does not belong here.
The libraries should be converted separately from their users, and FATE
should pass both before and after. That helps ensuring that the compat
layers are correct.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 08/25] libavfilter changes for the new channel layout API

2017-06-29 Thread Vittorio Giovara
On Thu, Jun 29, 2017 at 3:59 AM, Diego Biurrun  wrote:
> On Wed, Jun 28, 2017 at 06:10:52PM -0400, Vittorio Giovara wrote:
>> --- a/libavfilter/af_aformat.c
>> +++ b/libavfilter/af_aformat.c
>> @@ -94,6 +94,13 @@ static int get_sample_rate(const char *samplerate)
>> +static int get_channel_layout(const char *channel_layout)
>> +{
>> +AVChannelLayout ch_layout = {0};
>> --- a/libavfilter/af_channelmap.c
>> +++ b/libavfilter/af_channelmap.c
>> @@ -219,50 +223,59 @@ static av_cold int channelmap_init(AVFilterContext 
>> *ctx)
>>  if (s->channel_layout_str) {
>> -uint64_t fmt;
>> -if ((fmt = av_get_channel_layout(s->channel_layout_str)) == 0) {
>> +int ret;
>> +AVChannelLayout fmt = {0};
>
>> --- a/libavfilter/af_join.c
>> +++ b/libavfilter/af_join.c
>> @@ -285,12 +273,14 @@ static void guess_map_any(AVFilterContext *ctx, 
>> ChannelMap *ch,
>> -if ((inputs[i] & link->channel_layout) != link->channel_layout) {
>> -uint64_t unused = link->channel_layout & ~inputs[i];
>> +if ((inputs[i] & link->ch_layout.u.mask) != link->ch_layout.u.mask) 
>> {
>> +uint64_t unused = link->ch_layout.u.mask & ~inputs[i];
>> +AVChannelLayout layout = {0};
>
> spaces inside {}
>

applied locally

-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 08/25] libavfilter changes for the new channel layout API

2017-06-29 Thread Diego Biurrun
On Wed, Jun 28, 2017 at 06:10:52PM -0400, Vittorio Giovara wrote:
> --- a/libavfilter/af_aformat.c
> +++ b/libavfilter/af_aformat.c
> @@ -94,6 +94,13 @@ static int get_sample_rate(const char *samplerate)
> +static int get_channel_layout(const char *channel_layout)
> +{
> +AVChannelLayout ch_layout = {0};
> --- a/libavfilter/af_channelmap.c
> +++ b/libavfilter/af_channelmap.c
> @@ -219,50 +223,59 @@ static av_cold int channelmap_init(AVFilterContext *ctx)
>  if (s->channel_layout_str) {
> -uint64_t fmt;
> -if ((fmt = av_get_channel_layout(s->channel_layout_str)) == 0) {
> +int ret;
> +AVChannelLayout fmt = {0};

> --- a/libavfilter/af_join.c
> +++ b/libavfilter/af_join.c
> @@ -285,12 +273,14 @@ static void guess_map_any(AVFilterContext *ctx, 
> ChannelMap *ch,
> -if ((inputs[i] & link->channel_layout) != link->channel_layout) {
> -uint64_t unused = link->channel_layout & ~inputs[i];
> +if ((inputs[i] & link->ch_layout.u.mask) != link->ch_layout.u.mask) {
> +uint64_t unused = link->ch_layout.u.mask & ~inputs[i];
> +AVChannelLayout layout = {0};

spaces inside {}

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 08/25] libavfilter changes for the new channel layout API

2017-06-28 Thread Vittorio Giovara
This patch contains the following commits:

avtools: Use the new channel layout API in libavfilter

af_aformat: convert to new channel layout API

Signed-off-by: Vittorio Giovara 

af_amix: convert to new channel layout API

Signed-off-by: Vittorio Giovara 

af_ashowinfo: convert to new channel layout API

Signed-off-by: Vittorio Giovara 

af_asyncts: convert to new channel layout API

Signed-off-by: Vittorio Giovara 

af_atrim: convert to new channel layout API

Signed-off-by: Vittorio Giovara 

af_channelmap: convert to new channel layout API

Signed-off-by: Vittorio Giovara 

af_channelsplit: convert to new channel layout API

Signed-off-by: Vittorio Giovara 

af_compand: convert to new channel layout API

Signed-off-by: Vittorio Giovara 

af_hdcd: convert to new channel layout API

af_join: convert to new channel layout API

af_resample: convert to new channel layout API

af_volume: convert to new channel layout
---
 avtools/avconv.c  |  2 +-
 avtools/avconv_filter.c   |  4 +-
 libavfilter/af_aformat.c  | 10 -
 libavfilter/af_amix.c | 11 --
 libavfilter/af_ashowinfo.c| 12 +++---
 libavfilter/af_asyncts.c  |  6 +--
 libavfilter/af_channelmap.c   | 92 ---
 libavfilter/af_channelsplit.c | 38 +-
 libavfilter/af_compand.c  |  8 ++--
 libavfilter/af_hdcd.c |  2 +-
 libavfilter/af_join.c | 84 ++-
 libavfilter/af_resample.c | 33 +---
 libavfilter/af_volume.c   |  2 +-
 libavfilter/trim.c|  3 +-
 14 files changed, 163 insertions(+), 144 deletions(-)

diff --git a/avtools/avconv.c b/avtools/avconv.c
index 42cbfef592..a1427e0cb4 100644
--- a/avtools/avconv.c
+++ b/avtools/avconv.c
@@ -1998,7 +1998,7 @@ static int init_output_stream_encode(OutputStream *ost)
 case AVMEDIA_TYPE_AUDIO:
 enc_ctx->sample_fmt = ost->filter->filter->inputs[0]->format;
 enc_ctx->sample_rate= ost->filter->filter->inputs[0]->sample_rate;
-enc_ctx->channel_layout = 
ost->filter->filter->inputs[0]->channel_layout;
+enc_ctx->channel_layout = 
ost->filter->filter->inputs[0]->ch_layout.u.mask;
 enc_ctx->channels   = 
av_get_channel_layout_nb_channels(enc_ctx->channel_layout);
 enc_ctx->time_base  = (AVRational){ 1, enc_ctx->sample_rate };
 break;
diff --git a/avtools/avconv_filter.c b/avtools/avconv_filter.c
index e719c06658..7df64c647a 100644
--- a/avtools/avconv_filter.c
+++ b/avtools/avconv_filter.c
@@ -591,7 +591,7 @@ static int configure_input_audio_filter(FilterGraph *fg, 
InputFilter *ifilter,
 par->time_base  = (AVRational){ 1, ifilter->sample_rate };
 par->sample_rate= ifilter->sample_rate;
 par->format = ifilter->format;
-par->channel_layout = ifilter->channel_layout;
+av_channel_layout_from_mask(>ch_layout, ifilter->channel_layout);
 
 ret = av_buffersrc_parameters_set(ifilter->filter, par);
 av_freep();
@@ -758,7 +758,7 @@ int configure_filtergraph(FilterGraph *fg)
 ofilter->height = link->h;
 
 ofilter->sample_rate= link->sample_rate;
-ofilter->channel_layout = link->channel_layout;
+ofilter->channel_layout = link->ch_layout.u.mask;
 }
 
 for (i = 0; i < fg->nb_inputs; i++) {
diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index f0746737dc..c5aa4f7148 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -94,6 +94,13 @@ static int get_sample_rate(const char *samplerate)
 return FFMAX(ret, 0);
 }
 
+static int get_channel_layout(const char *channel_layout)
+{
+AVChannelLayout ch_layout = {0};
+av_channel_layout_from_string(_layout, channel_layout);
+return ch_layout.u.mask;
+}
+
 static av_cold int init(AVFilterContext *ctx)
 {
 AFormatContext *s = ctx->priv;
@@ -103,8 +110,7 @@ static av_cold int init(AVFilterContext *ctx)
 PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format,
   get_sample_rate, 0, "sample rate");
 PARSE_FORMATS(s->channel_layouts_str, uint64_t, s->channel_layouts,
-  ff_add_channel_layout, av_get_channel_layout, 0,
-  "channel layout");
+  ff_add_channel_layout, get_channel_layout, 0, "channel 
layout");
 
 return 0;
 }
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index bfba1504ea..a35e04530f 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -226,7 +226,7 @@ static int config_output(AVFilterLink *outlink)
 AVFilterContext *ctx = outlink->src;
 MixContext *s  = ctx->priv;
 int i;
-char buf[64];
+char *chlstr;
 
 s->planar  =