* [FFmpeg-devel] [PATCH] avcodec/opusdec: stop setting deprecated swr options
@ 2022-09-23 19:51 James Almer
2022-09-23 19:55 ` Andreas Rheinhardt
0 siblings, 1 reply; 4+ messages in thread
From: James Almer @ 2022-09-23 19:51 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/opusdec.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
index c04aa598b8..8b10bd1a25 100644
--- a/libavcodec/opusdec.c
+++ b/libavcodec/opusdec.c
@@ -640,7 +640,7 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
for (i = 0; i < c->nb_streams; i++) {
OpusStreamContext *s = &c->streams[i];
- uint64_t layout;
+ AVChannelLayout layout;
s->output_channels = (i < c->nb_stereo_streams) ? 2 : 1;
@@ -658,14 +658,17 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
if (!s->swr)
return AVERROR(ENOMEM);
- layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
+ layout = (s->output_channels == 1) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO :
+ (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
av_opt_set_int(s->swr, "in_sample_fmt", avctx->sample_fmt, 0);
av_opt_set_int(s->swr, "out_sample_fmt", avctx->sample_fmt, 0);
- av_opt_set_int(s->swr, "in_channel_layout", layout, 0);
- av_opt_set_int(s->swr, "out_channel_layout", layout, 0);
+ av_opt_set_chlayout(s->swr, "in_chlayout", &layout, 0);
+ av_opt_set_chlayout(s->swr, "out_chlayout", &layout, 0);
av_opt_set_int(s->swr, "out_sample_rate", avctx->sample_rate, 0);
av_opt_set_int(s->swr, "filter_size", 16, 0);
+ av_channel_layout_uninit(&layout);
+
ret = ff_silk_init(avctx, &s->silk, s->output_channels);
if (ret < 0)
return ret;
--
2.37.3
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/opusdec: stop setting deprecated swr options
2022-09-23 19:51 [FFmpeg-devel] [PATCH] avcodec/opusdec: stop setting deprecated swr options James Almer
@ 2022-09-23 19:55 ` Andreas Rheinhardt
2022-09-23 20:02 ` James Almer
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Rheinhardt @ 2022-09-23 19:55 UTC (permalink / raw)
To: ffmpeg-devel
James Almer:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavcodec/opusdec.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
> index c04aa598b8..8b10bd1a25 100644
> --- a/libavcodec/opusdec.c
> +++ b/libavcodec/opusdec.c
> @@ -640,7 +640,7 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
>
> for (i = 0; i < c->nb_streams; i++) {
> OpusStreamContext *s = &c->streams[i];
> - uint64_t layout;
> + AVChannelLayout layout;
>
> s->output_channels = (i < c->nb_stereo_streams) ? 2 : 1;
>
> @@ -658,14 +658,17 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
> if (!s->swr)
> return AVERROR(ENOMEM);
>
> - layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
> + layout = (s->output_channels == 1) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO :
> + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
> av_opt_set_int(s->swr, "in_sample_fmt", avctx->sample_fmt, 0);
> av_opt_set_int(s->swr, "out_sample_fmt", avctx->sample_fmt, 0);
> - av_opt_set_int(s->swr, "in_channel_layout", layout, 0);
> - av_opt_set_int(s->swr, "out_channel_layout", layout, 0);
> + av_opt_set_chlayout(s->swr, "in_chlayout", &layout, 0);
> + av_opt_set_chlayout(s->swr, "out_chlayout", &layout, 0);
> av_opt_set_int(s->swr, "out_sample_rate", avctx->sample_rate, 0);
> av_opt_set_int(s->swr, "filter_size", 16, 0);
>
> + av_channel_layout_uninit(&layout);
Unnecessary. You are not even using any of the av_channel_layout*
function to init layout.
> +
> ret = ff_silk_init(avctx, &s->silk, s->output_channels);
> if (ret < 0)
> return ret;
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/opusdec: stop setting deprecated swr options
2022-09-23 19:55 ` Andreas Rheinhardt
@ 2022-09-23 20:02 ` James Almer
2022-09-23 20:04 ` Andreas Rheinhardt
0 siblings, 1 reply; 4+ messages in thread
From: James Almer @ 2022-09-23 20:02 UTC (permalink / raw)
To: ffmpeg-devel
On 9/23/2022 4:55 PM, Andreas Rheinhardt wrote:
> James Almer:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> libavcodec/opusdec.c | 11 +++++++----
>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
>> index c04aa598b8..8b10bd1a25 100644
>> --- a/libavcodec/opusdec.c
>> +++ b/libavcodec/opusdec.c
>> @@ -640,7 +640,7 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
>>
>> for (i = 0; i < c->nb_streams; i++) {
>> OpusStreamContext *s = &c->streams[i];
>> - uint64_t layout;
>> + AVChannelLayout layout;
>>
>> s->output_channels = (i < c->nb_stereo_streams) ? 2 : 1;
>>
>> @@ -658,14 +658,17 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
>> if (!s->swr)
>> return AVERROR(ENOMEM);
>>
>> - layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
>> + layout = (s->output_channels == 1) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO :
>> + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
>> av_opt_set_int(s->swr, "in_sample_fmt", avctx->sample_fmt, 0);
>> av_opt_set_int(s->swr, "out_sample_fmt", avctx->sample_fmt, 0);
>> - av_opt_set_int(s->swr, "in_channel_layout", layout, 0);
>> - av_opt_set_int(s->swr, "out_channel_layout", layout, 0);
>> + av_opt_set_chlayout(s->swr, "in_chlayout", &layout, 0);
>> + av_opt_set_chlayout(s->swr, "out_chlayout", &layout, 0);
>> av_opt_set_int(s->swr, "out_sample_rate", avctx->sample_rate, 0);
>> av_opt_set_int(s->swr, "filter_size", 16, 0);
>>
>> + av_channel_layout_uninit(&layout);
>
> Unnecessary. You are not even using any of the av_channel_layout*
> function to init layout.
I know it's unnecessary, but it's to promote the good habit of
uninitializing layouts when you're done with them.
>
>> +
>> ret = ff_silk_init(avctx, &s->silk, s->output_channels);
>> if (ret < 0)
>> return ret;
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/opusdec: stop setting deprecated swr options
2022-09-23 20:02 ` James Almer
@ 2022-09-23 20:04 ` Andreas Rheinhardt
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Rheinhardt @ 2022-09-23 20:04 UTC (permalink / raw)
To: ffmpeg-devel
James Almer:
> On 9/23/2022 4:55 PM, Andreas Rheinhardt wrote:
>> James Almer:
>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>> ---
>>> libavcodec/opusdec.c | 11 +++++++----
>>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
>>> index c04aa598b8..8b10bd1a25 100644
>>> --- a/libavcodec/opusdec.c
>>> +++ b/libavcodec/opusdec.c
>>> @@ -640,7 +640,7 @@ static av_cold int
>>> opus_decode_init(AVCodecContext *avctx)
>>> for (i = 0; i < c->nb_streams; i++) {
>>> OpusStreamContext *s = &c->streams[i];
>>> - uint64_t layout;
>>> + AVChannelLayout layout;
>>> s->output_channels = (i < c->nb_stereo_streams) ? 2 : 1;
>>> @@ -658,14 +658,17 @@ static av_cold int
>>> opus_decode_init(AVCodecContext *avctx)
>>> if (!s->swr)
>>> return AVERROR(ENOMEM);
>>> - layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO :
>>> AV_CH_LAYOUT_STEREO;
>>> + layout = (s->output_channels == 1) ?
>>> (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO :
>>> +
>>> (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
>>> av_opt_set_int(s->swr, "in_sample_fmt",
>>> avctx->sample_fmt, 0);
>>> av_opt_set_int(s->swr, "out_sample_fmt",
>>> avctx->sample_fmt, 0);
>>> - av_opt_set_int(s->swr, "in_channel_layout",
>>> layout, 0);
>>> - av_opt_set_int(s->swr, "out_channel_layout",
>>> layout, 0);
>>> + av_opt_set_chlayout(s->swr, "in_chlayout",
>>> &layout, 0);
>>> + av_opt_set_chlayout(s->swr, "out_chlayout",
>>> &layout, 0);
>>> av_opt_set_int(s->swr, "out_sample_rate",
>>> avctx->sample_rate, 0);
>>> av_opt_set_int(s->swr, "filter_size",
>>> 16, 0);
>>> + av_channel_layout_uninit(&layout);
>>
>> Unnecessary. You are not even using any of the av_channel_layout*
>> function to init layout.
>
> I know it's unnecessary, but it's to promote the good habit of
> uninitializing layouts when you're done with them.
>
A habit of unnecessary calls is not good.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-23 20:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 19:51 [FFmpeg-devel] [PATCH] avcodec/opusdec: stop setting deprecated swr options James Almer
2022-09-23 19:55 ` Andreas Rheinhardt
2022-09-23 20:02 ` James Almer
2022-09-23 20:04 ` Andreas Rheinhardt
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git