* [FFmpeg-devel] [PATCH 2/5] avcodec/dfpwmdec: Remove always-false check
2022-09-16 1:10 [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts Andreas Rheinhardt
@ 2022-09-16 1:11 ` Andreas Rheinhardt
2022-09-16 1:11 ` [FFmpeg-devel] [PATCH 3/5] avformat/dfpwmdec: Inline raw_codec_id Andreas Rheinhardt
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-09-16 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
This decoder does not have the AV_CODEC_CAP_CHANNEL_CONF set,
so that number of channels has to be set by the user before
avcodec_open2().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/dfpwmdec.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/libavcodec/dfpwmdec.c b/libavcodec/dfpwmdec.c
index 532a955b4c..4ddb806561 100644
--- a/libavcodec/dfpwmdec.c
+++ b/libavcodec/dfpwmdec.c
@@ -85,11 +85,6 @@ static av_cold int dfpwm_dec_init(struct AVCodecContext *ctx)
{
DFPWMState *state = ctx->priv_data;
- if (ctx->ch_layout.nb_channels <= 0) {
- av_log(ctx, AV_LOG_ERROR, "Invalid number of channels\n");
- return AVERROR(EINVAL);
- }
-
state->fq = 0;
state->q = 0;
state->s = 0;
--
2.34.1
_______________________________________________
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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 3/5] avformat/dfpwmdec: Inline raw_codec_id
2022-09-16 1:10 [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts Andreas Rheinhardt
2022-09-16 1:11 ` [FFmpeg-devel] [PATCH 2/5] avcodec/dfpwmdec: Remove always-false check Andreas Rheinhardt
@ 2022-09-16 1:11 ` Andreas Rheinhardt
2022-09-16 1:11 ` [FFmpeg-devel] [PATCH 4/5] avformat/dfpwmdec: Remove unnecessary headers Andreas Rheinhardt
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-09-16 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/dfpwmdec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c
index 685b95148c..98fb4102e3 100644
--- a/libavformat/dfpwmdec.c
+++ b/libavformat/dfpwmdec.c
@@ -50,7 +50,7 @@ static int dfpwm_read_header(AVFormatContext *s)
par = st->codecpar;
par->codec_type = AVMEDIA_TYPE_AUDIO;
- par->codec_id = s->iformat->raw_codec_id;
+ par->codec_id = AV_CODEC_ID_DFPWM;
par->sample_rate = s1->sample_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
if (s1->ch_layout.nb_channels) {
@@ -95,6 +95,5 @@ const AVInputFormat ff_dfpwm_demuxer = {
.read_seek = ff_pcm_read_seek,
.flags = AVFMT_GENERIC_INDEX,
.extensions = "dfpwm",
- .raw_codec_id = AV_CODEC_ID_DFPWM,
.priv_class = &dfpwm_demuxer_class,
};
--
2.34.1
_______________________________________________
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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 4/5] avformat/dfpwmdec: Remove unnecessary headers
2022-09-16 1:10 [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts Andreas Rheinhardt
2022-09-16 1:11 ` [FFmpeg-devel] [PATCH 2/5] avcodec/dfpwmdec: Remove always-false check Andreas Rheinhardt
2022-09-16 1:11 ` [FFmpeg-devel] [PATCH 3/5] avformat/dfpwmdec: Inline raw_codec_id Andreas Rheinhardt
@ 2022-09-16 1:11 ` Andreas Rheinhardt
2022-09-16 1:11 ` [FFmpeg-devel] [PATCH 5/5] fate/lavf-audio: Add dfpwm test Andreas Rheinhardt
2022-09-16 1:16 ` [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts James Almer
4 siblings, 0 replies; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-09-16 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/dfpwmdec.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c
index 98fb4102e3..2244aa99fe 100644
--- a/libavformat/dfpwmdec.c
+++ b/libavformat/dfpwmdec.c
@@ -20,13 +20,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
#include "pcm.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
-#include "libavutil/avassert.h"
typedef struct DFPWMAudioDemuxerContext {
AVClass *class;
--
2.34.1
_______________________________________________
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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 5/5] fate/lavf-audio: Add dfpwm test
2022-09-16 1:10 [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts Andreas Rheinhardt
` (2 preceding siblings ...)
2022-09-16 1:11 ` [FFmpeg-devel] [PATCH 4/5] avformat/dfpwmdec: Remove unnecessary headers Andreas Rheinhardt
@ 2022-09-16 1:11 ` Andreas Rheinhardt
2022-09-16 1:16 ` [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts James Almer
4 siblings, 0 replies; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-09-16 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
tests/fate/lavf-audio.mak | 2 ++
tests/ref/lavf/dfpwm | 3 +++
2 files changed, 5 insertions(+)
create mode 100644 tests/ref/lavf/dfpwm
diff --git a/tests/fate/lavf-audio.mak b/tests/fate/lavf-audio.mak
index 68fca35298..d557d43c08 100644
--- a/tests/fate/lavf-audio.mak
+++ b/tests/fate/lavf-audio.mak
@@ -14,6 +14,7 @@ FATE_LAVF_AUDIO-$(call ENCDEC, PCM_S16LE, W64) += w64
FATE_LAVF_AUDIO-$(call ENCDEC, TTA, TTA) += tta
FATE_LAVF_AUDIO-$(call ENCMUX, TTA, MATROSKA_AUDIO) += mka
FATE_LAVF_AUDIO_RESAMPLE-$(call ENCDEC, PCM_S16BE_PLANAR, AST) += ast
+FATE_LAVF_AUDIO_RESAMPLE-$(call ENCDEC, PCM_S16BE_PLANAR, AST) += dfpwm
FATE_LAVF_AUDIO_RESAMPLE-$(call ENCDEC, PCM_U8, RSO) += rso
FATE_LAVF_AUDIO_RESAMPLE-$(call ENCDEC, PCM_S16LE, SOX) += sox
FATE_LAVF_AUDIO_RESAMPLE-$(call ENCDEC, PCM_U8, VOC) += voc
@@ -28,6 +29,7 @@ $(FATE_LAVF_AUDIO): REF = $(SRC_PATH)/tests/ref/lavf/$(@:fate-lavf-%=%)
$(FATE_LAVF_AUDIO): $(AREF)
fate-lavf-al fate-lavf-ul: CMD = lavf_audio "" "" "-ar 44100"
+fate-lavf-dfpwm: CMD = lavf_audio "" "" "-sample_rate 44100"
fate-lavf-ogg: CMD = lavf_audio "" "-c:a flac"
fate-lavf-s16.voc: CMD = lavf_audio "-ac 2" "-c:a pcm_s16le"
fate-lavf-ast: CMD = lavf_audio "-ac 2" "-loopstart 1 -loopend 10"
diff --git a/tests/ref/lavf/dfpwm b/tests/ref/lavf/dfpwm
new file mode 100644
index 0000000000..b9423bc1c1
--- /dev/null
+++ b/tests/ref/lavf/dfpwm
@@ -0,0 +1,3 @@
+c216a2b5576f3e7f31516854bbb41eb8 *tests/data/lavf/lavf.dfpwm
+5513 tests/data/lavf/lavf.dfpwm
+tests/data/lavf/lavf.dfpwm CRC=0x226be6b3
--
2.34.1
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts
2022-09-16 1:10 [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts Andreas Rheinhardt
` (3 preceding siblings ...)
2022-09-16 1:11 ` [FFmpeg-devel] [PATCH 5/5] fate/lavf-audio: Add dfpwm test Andreas Rheinhardt
@ 2022-09-16 1:16 ` James Almer
2022-09-16 15:02 ` James Almer
4 siblings, 1 reply; 7+ messages in thread
From: James Almer @ 2022-09-16 1:16 UTC (permalink / raw)
To: ffmpeg-devel
On 9/15/2022 10:10 PM, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> Maybe use av_channel_layout_check?
>
> libavcodec/decode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 2961705c9d..e24005cc44 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1595,7 +1595,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
> FF_ENABLE_DEPRECATION_WARNINGS
> #endif
>
> - if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && avctx->ch_layout.nb_channels == 0 &&
> + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && avctx->ch_layout.nb_channels <= 0 &&
> !(avctx->codec->capabilities & AV_CODEC_CAP_CHANNEL_CONF)) {
> av_log(avctx, AV_LOG_ERROR, "Decoder requires channel count but channels not set\n");
> return AVERROR(EINVAL);
This is a AV_CODEC_CAP_CHANNEL_CONF specific check to see if a channel
count is set. A general sanity check like < 0 should be in
avcodec_open2() before the ff_decode_preinit() call, next to (or as part
of) the similar FF_SANE_NB_CHANNELS check, IMO.
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts
2022-09-16 1:16 ` [FFmpeg-devel] [PATCH 1/5] avcodec/decode: Check for more invalid channel counts James Almer
@ 2022-09-16 15:02 ` James Almer
0 siblings, 0 replies; 7+ messages in thread
From: James Almer @ 2022-09-16 15:02 UTC (permalink / raw)
To: ffmpeg-devel
On 9/15/2022 10:16 PM, James Almer wrote:
> On 9/15/2022 10:10 PM, Andreas Rheinhardt wrote:
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>> Maybe use av_channel_layout_check?
>>
>> libavcodec/decode.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>> index 2961705c9d..e24005cc44 100644
>> --- a/libavcodec/decode.c
>> +++ b/libavcodec/decode.c
>> @@ -1595,7 +1595,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
>> FF_ENABLE_DEPRECATION_WARNINGS
>> #endif
>> - if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
>> avctx->ch_layout.nb_channels == 0 &&
>> + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
>> avctx->ch_layout.nb_channels <= 0 &&
>> !(avctx->codec->capabilities & AV_CODEC_CAP_CHANNEL_CONF)) {
>> av_log(avctx, AV_LOG_ERROR, "Decoder requires channel count
>> but channels not set\n");
>> return AVERROR(EINVAL);
>
> This is a AV_CODEC_CAP_CHANNEL_CONF specific check to see if a channel
> count is set. A general sanity check like < 0 should be in
> avcodec_open2() before the ff_decode_preinit() call, next to (or as part
> of) the similar FF_SANE_NB_CHANNELS check, IMO.
On second thought, maybe the early FF_SANE_NB_CHANNELS check should be
removed from avcodec_open2() and av_channel_layout_check() used here for
non AV_CODEC_CAP_CHANNEL_CONF decoders like you suggested above.
For the rest, whatever value is set is going to be ignored, overwritten,
and then verified after the decoder was initialized.
_______________________________________________
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] 7+ messages in thread