diff mbox series

[FFmpeg-devel,v1,1/1] avformat/amr: Return PATCHWELCOME on stereo files

Message ID TYCPR01MB59827312A79D5E772DE0D6AAC1DC9@TYCPR01MB5982.jpnprd01.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,v1,1/1] avformat/amr: Return PATCHWELCOME on stereo files
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Sun Zhenliang Sept. 16, 2021, 3:24 a.m. UTC
Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
---
 libavformat/amr.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

Comments

Sun Zhenliang Sept. 17, 2021, 2:14 a.m. UTC | #1
Ping.

Anyone could review this patch?

Thx.
在 2021年9月16日 +0800 11:24,sunzhenliang <hisunzhenliang@outlook.com>,写道:
> Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> ---
> libavformat/amr.c | 22 ++++++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/amr.c b/libavformat/amr.c
> index 836b276fd5..2762010ebe 100644
> --- a/libavformat/amr.c
> +++ b/libavformat/amr.c
> @@ -36,8 +36,10 @@ typedef struct {
> uint64_t block_count;
> } AMRContext;
>
> -static const char AMR_header[] = "#!AMR\n";
> -static const char AMRWB_header[] = "#!AMR-WB\n";
> +static const char AMR_header[] = "#!AMR\n";
> +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> +static const char AMRWB_header[] = "#!AMR-WB\n";
> +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
>
> static const uint8_t amrnb_packed_size[16] = {
> 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> {
> AVIOContext *pb = s->pb;
> AVStream *st;
> - uint8_t header[9];
> + uint8_t header[15];
>
> if (avio_read(pb, header, 6) != 6)
> return AVERROR_INVALIDDATA;
> @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> if (avio_read(pb, header + 6, 3) != 3)
> return AVERROR_INVALIDDATA;
> if (memcmp(header, AMRWB_header, 9)) {
> - return -1;
> + if (avio_read(pb, header + 6 + 3, 3) != 3)
> + return AVERROR_INVALIDDATA;
> + if (memcmp(header, AMR_MC_header, 12)) {
> + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> + return AVERROR_INVALIDDATA;
> + if (memcmp(header, AMRWB_MC_header, 15)) {
> + return -1;
> + }
> + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> + return AVERROR_PATCHWELCOME;
> + }
> + avpriv_report_missing_feature(s, "multi-channel AMR");
> + return AVERROR_PATCHWELCOME;
> }
>
> st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> --
> 2.25.1
>
Paul B Mahol Sept. 17, 2021, 6:48 a.m. UTC | #2
Are stereo files available somewhere? Known way to encode?

On Fri, Sep 17, 2021 at 4:14 AM Sun Zhenliang <hisunzhenliang@outlook.com>
wrote:

> Ping.
>
> Anyone could review this patch?
>
> Thx.
> 在 2021年9月16日 +0800 11:24,sunzhenliang <hisunzhenliang@outlook.com>,写道:
> > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > ---
> > libavformat/amr.c | 22 ++++++++++++++++++----
> > 1 file changed, 18 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > index 836b276fd5..2762010ebe 100644
> > --- a/libavformat/amr.c
> > +++ b/libavformat/amr.c
> > @@ -36,8 +36,10 @@ typedef struct {
> > uint64_t block_count;
> > } AMRContext;
> >
> > -static const char AMR_header[] = "#!AMR\n";
> > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > +static const char AMR_header[] = "#!AMR\n";
> > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> >
> > static const uint8_t amrnb_packed_size[16] = {
> > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > {
> > AVIOContext *pb = s->pb;
> > AVStream *st;
> > - uint8_t header[9];
> > + uint8_t header[15];
> >
> > if (avio_read(pb, header, 6) != 6)
> > return AVERROR_INVALIDDATA;
> > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > if (avio_read(pb, header + 6, 3) != 3)
> > return AVERROR_INVALIDDATA;
> > if (memcmp(header, AMRWB_header, 9)) {
> > - return -1;
> > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > + return AVERROR_INVALIDDATA;
> > + if (memcmp(header, AMR_MC_header, 12)) {
> > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > + return AVERROR_INVALIDDATA;
> > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > + return -1;
> > + }
> > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > + return AVERROR_PATCHWELCOME;
> > + }
> > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > + return AVERROR_PATCHWELCOME;
> > }
> >
> > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > --
> > 2.25.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".
>
Sun Zhenliang Sept. 17, 2021, 7:28 a.m. UTC | #3
在 2021年9月17日 +0800 14:49,Paul B Mahol <onemda@gmail.com>,写道:
> Are stereo files available somewhere? Known way to encode?
Here is the stereo file,
https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nb

It’s made by our internal amr codec tool which followed 3GPP specifications.

FFmpeg did not recognize this audio before. With this patch, it will detect correctly and
show patches welcome.
>
> On Fri, Sep 17, 2021 at 4:14 AM Sun Zhenliang <hisunzhenliang@outlook.com>
> wrote:
>
> > Ping.
> >
> > Anyone could review this patch?
> >
> > Thx.
> > 在 2021年9月16日 +0800 11:24,sunzhenliang <hisunzhenliang@outlook.com>,写道:
> > > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > > ---
> > > libavformat/amr.c | 22 ++++++++++++++++++----
> > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > index 836b276fd5..2762010ebe 100644
> > > --- a/libavformat/amr.c
> > > +++ b/libavformat/amr.c
> > > @@ -36,8 +36,10 @@ typedef struct {
> > > uint64_t block_count;
> > > } AMRContext;
> > >
> > > -static const char AMR_header[] = "#!AMR\n";
> > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > +static const char AMR_header[] = "#!AMR\n";
> > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > >
> > > static const uint8_t amrnb_packed_size[16] = {
> > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > {
> > > AVIOContext *pb = s->pb;
> > > AVStream *st;
> > > - uint8_t header[9];
> > > + uint8_t header[15];
> > >
> > > if (avio_read(pb, header, 6) != 6)
> > > return AVERROR_INVALIDDATA;
> > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > if (avio_read(pb, header + 6, 3) != 3)
> > > return AVERROR_INVALIDDATA;
> > > if (memcmp(header, AMRWB_header, 9)) {
> > > - return -1;
> > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > + return AVERROR_INVALIDDATA;
> > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > + return AVERROR_INVALIDDATA;
> > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > + return -1;
> > > + }
> > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > + return AVERROR_PATCHWELCOME;
> > > + }
> > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > + return AVERROR_PATCHWELCOME;
> > > }
> > >
> > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > --
> > > 2.25.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".
> >
> _______________________________________________
> 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".
Sun Zhenliang Sept. 18, 2021, 12:39 p.m. UTC | #4
Ping.
在 2021年9月17日 +0800 15:28,Sun Zhenliang <hisunzhenliang@outlook.com>,写道:
> 在 2021年9月17日 +0800 14:49,Paul B Mahol <onemda@gmail.com>,写道:
> > Are stereo files available somewhere? Known way to encode?
> Here is the stereo file,
> https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nb
>
> It’s made by our internal amr codec tool which followed 3GPP specifications.
>
> FFmpeg did not recognize this audio before. With this patch, it will detect correctly and
> show patches welcome.
> >
> > On Fri, Sep 17, 2021 at 4:14 AM Sun Zhenliang <hisunzhenliang@outlook.com>
> > wrote:
> >
> > > Ping.
> > >
> > > Anyone could review this patch?
> > >
> > > Thx.
> > > 在 2021年9月16日 +0800 11:24,sunzhenliang <hisunzhenliang@outlook.com>,写道:
> > > > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > > > ---
> > > > libavformat/amr.c | 22 ++++++++++++++++++----
> > > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > > index 836b276fd5..2762010ebe 100644
> > > > --- a/libavformat/amr.c
> > > > +++ b/libavformat/amr.c
> > > > @@ -36,8 +36,10 @@ typedef struct {
> > > > uint64_t block_count;
> > > > } AMRContext;
> > > >
> > > > -static const char AMR_header[] = "#!AMR\n";
> > > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > +static const char AMR_header[] = "#!AMR\n";
> > > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > > >
> > > > static const uint8_t amrnb_packed_size[16] = {
> > > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > > {
> > > > AVIOContext *pb = s->pb;
> > > > AVStream *st;
> > > > - uint8_t header[9];
> > > > + uint8_t header[15];
> > > >
> > > > if (avio_read(pb, header, 6) != 6)
> > > > return AVERROR_INVALIDDATA;
> > > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > > if (avio_read(pb, header + 6, 3) != 3)
> > > > return AVERROR_INVALIDDATA;
> > > > if (memcmp(header, AMRWB_header, 9)) {
> > > > - return -1;
> > > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > > + return AVERROR_INVALIDDATA;
> > > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > > + return AVERROR_INVALIDDATA;
> > > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > > + return -1;
> > > > + }
> > > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > > + return AVERROR_PATCHWELCOME;
> > > > + }
> > > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > > + return AVERROR_PATCHWELCOME;
> > > > }
> > > >
> > > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > > --
> > > > 2.25.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".
> > >
> > _______________________________________________
> > 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".
Sun Zhenliang Sept. 21, 2021, 12:08 p.m. UTC | #5
ping. Anyone could review this ?

> On Sep 18, 2021, at 20:40, Sun Zhenliang <hisunzhenliang@outlook.com> wrote:
> 
> Ping.
> 在 2021年9月17日 +0800 15:28,Sun Zhenliang <hisunzhenliang@outlook.com>,写道:
>> 在 2021年9月17日 +0800 14:49,Paul B Mahol <onemda@gmail.com>,写道:
>>> Are stereo files available somewhere? Known way to encode?
>> Here is the stereo file,
>> https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nb
>> 
>> It’s made by our internal amr codec tool which followed 3GPP specifications.
>> 
>> FFmpeg did not recognize this audio before. With this patch, it will detect correctly and
>> show patches welcome.
>>> 
>>> On Fri, Sep 17, 2021 at 4:14 AM Sun Zhenliang <hisunzhenliang@outlook.com>
>>> wrote:
>>> 
>>>> Ping.
>>>> 
>>>> Anyone could review this patch?
>>>> 
>>>> Thx.
>>>> 在 2021年9月16日 +0800 11:24,sunzhenliang <hisunzhenliang@outlook.com>,写道:
>>>>> Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
>>>>> ---
>>>>> libavformat/amr.c | 22 ++++++++++++++++++----
>>>>> 1 file changed, 18 insertions(+), 4 deletions(-)
>>>>> 
>>>>> diff --git a/libavformat/amr.c b/libavformat/amr.c
>>>>> index 836b276fd5..2762010ebe 100644
>>>>> --- a/libavformat/amr.c
>>>>> +++ b/libavformat/amr.c
>>>>> @@ -36,8 +36,10 @@ typedef struct {
>>>>> uint64_t block_count;
>>>>> } AMRContext;
>>>>> 
>>>>> -static const char AMR_header[] = "#!AMR\n";
>>>>> -static const char AMRWB_header[] = "#!AMR-WB\n";
>>>>> +static const char AMR_header[] = "#!AMR\n";
>>>>> +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
>>>>> +static const char AMRWB_header[] = "#!AMR-WB\n";
>>>>> +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
>>>>> 
>>>>> static const uint8_t amrnb_packed_size[16] = {
>>>>> 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
>>>>> @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
>>>>> {
>>>>> AVIOContext *pb = s->pb;
>>>>> AVStream *st;
>>>>> - uint8_t header[9];
>>>>> + uint8_t header[15];
>>>>> 
>>>>> if (avio_read(pb, header, 6) != 6)
>>>>> return AVERROR_INVALIDDATA;
>>>>> @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
>>>>> if (avio_read(pb, header + 6, 3) != 3)
>>>>> return AVERROR_INVALIDDATA;
>>>>> if (memcmp(header, AMRWB_header, 9)) {
>>>>> - return -1;
>>>>> + if (avio_read(pb, header + 6 + 3, 3) != 3)
>>>>> + return AVERROR_INVALIDDATA;
>>>>> + if (memcmp(header, AMR_MC_header, 12)) {
>>>>> + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
>>>>> + return AVERROR_INVALIDDATA;
>>>>> + if (memcmp(header, AMRWB_MC_header, 15)) {
>>>>> + return -1;
>>>>> + }
>>>>> + avpriv_report_missing_feature(s, "multi-channel AMRWB");
>>>>> + return AVERROR_PATCHWELCOME;
>>>>> + }
>>>>> + avpriv_report_missing_feature(s, "multi-channel AMR");
>>>>> + return AVERROR_PATCHWELCOME;
>>>>> }
>>>>> 
>>>>> st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
>>>>> --
>>>>> 2.25.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".
>>>> 
>>> _______________________________________________
>>> 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".
Sun Zhenliang Sept. 24, 2021, 4:18 p.m. UTC | #6
ping.
在 2021年9月21日 +0800 20:08,Sun Zhenliang <hisunzhenliang@outlook.com>,写道:
>
> ping. Anyone could review this ?
>
> > On Sep 18, 2021, at 20:40, Sun Zhenliang <hisunzhenliang@outlook.com> wrote:
> >
> > Ping.
> > 在 2021年9月17日 +0800 15:28,Sun Zhenliang <hisunzhenliang@outlook.com>,写道:
> > > 在 2021年9月17日 +0800 14:49,Paul B Mahol <onemda@gmail.com>,写道:
> > > > Are stereo files available somewhere? Known way to encode?
> > > Here is the stereo file,
> > > https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nb
> > >
> > > It’s made by our internal amr codec tool which followed 3GPP specifications.
> > >
> > > FFmpeg did not recognize this audio before. With this patch, it will detect correctly and
> > > show patches welcome.
> > > >
> > > > On Fri, Sep 17, 2021 at 4:14 AM Sun Zhenliang <hisunzhenliang@outlook.com>
> > > > wrote:
> > > >
> > > > > Ping.
> > > > >
> > > > > Anyone could review this patch?
> > > > >
> > > > > Thx.
> > > > > 在 2021年9月16日 +0800 11:24,sunzhenliang <hisunzhenliang@outlook.com>,写道:
> > > > > > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > > > > > ---
> > > > > > libavformat/amr.c | 22 ++++++++++++++++++----
> > > > > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > > > > >
> > > > > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > > > > index 836b276fd5..2762010ebe 100644
> > > > > > --- a/libavformat/amr.c
> > > > > > +++ b/libavformat/amr.c
> > > > > > @@ -36,8 +36,10 @@ typedef struct {
> > > > > > uint64_t block_count;
> > > > > > } AMRContext;
> > > > > >
> > > > > > -static const char AMR_header[] = "#!AMR\n";
> > > > > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > > > +static const char AMR_header[] = "#!AMR\n";
> > > > > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > > > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > > > > >
> > > > > > static const uint8_t amrnb_packed_size[16] = {
> > > > > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > > > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > > > > {
> > > > > > AVIOContext *pb = s->pb;
> > > > > > AVStream *st;
> > > > > > - uint8_t header[9];
> > > > > > + uint8_t header[15];
> > > > > >
> > > > > > if (avio_read(pb, header, 6) != 6)
> > > > > > return AVERROR_INVALIDDATA;
> > > > > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > > > > if (avio_read(pb, header + 6, 3) != 3)
> > > > > > return AVERROR_INVALIDDATA;
> > > > > > if (memcmp(header, AMRWB_header, 9)) {
> > > > > > - return -1;
> > > > > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > > > > + return AVERROR_INVALIDDATA;
> > > > > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > > > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > > > > + return AVERROR_INVALIDDATA;
> > > > > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > > > > + return -1;
> > > > > > + }
> > > > > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > > > > + return AVERROR_PATCHWELCOME;
> > > > > > + }
> > > > > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > > > > + return AVERROR_PATCHWELCOME;
> > > > > > }
> > > > > >
> > > > > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > > > > --
> > > > > > 2.25.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".
> > > > >
> > > > _______________________________________________
> > > > 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".
mypopy@gmail.com Sept. 26, 2021, 12:39 p.m. UTC | #7
On Thu, Sep 16, 2021 at 11:24 AM sunzhenliang
<hisunzhenliang@outlook.com> wrote:
>
> Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> ---
>  libavformat/amr.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/amr.c b/libavformat/amr.c
> index 836b276fd5..2762010ebe 100644
> --- a/libavformat/amr.c
> +++ b/libavformat/amr.c
> @@ -36,8 +36,10 @@ typedef struct {
>      uint64_t block_count;
>  } AMRContext;
>
> -static const char AMR_header[]   = "#!AMR\n";
> -static const char AMRWB_header[] = "#!AMR-WB\n";
> +static const char AMR_header[]      = "#!AMR\n";
> +static const char AMR_MC_header[]   = "#!AMR_MC1.0\n";
> +static const char AMRWB_header[]    = "#!AMR-WB\n";
> +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
I don't think you need to format the AMR_header[] and AMRWB_header[]
in the patch
>
>  static const uint8_t amrnb_packed_size[16] = {
>      13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
>  {
>      AVIOContext *pb = s->pb;
>      AVStream *st;
> -    uint8_t header[9];
> +    uint8_t header[15];
>
>      if (avio_read(pb, header, 6) != 6)
>          return AVERROR_INVALIDDATA;
> @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
>          if (avio_read(pb, header + 6, 3) != 3)
>              return AVERROR_INVALIDDATA;
>          if (memcmp(header, AMRWB_header, 9)) {
> -            return -1;
> +            if (avio_read(pb, header + 6 + 3, 3) != 3)
> +                return AVERROR_INVALIDDATA;
> +            if (memcmp(header, AMR_MC_header, 12)) {
> +                if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> +                    return AVERROR_INVALIDDATA;
> +                if (memcmp(header, AMRWB_MC_header, 15)) {
> +                    return -1;
> +                }
> +                avpriv_report_missing_feature(s, "multi-channel AMRWB");
> +                return AVERROR_PATCHWELCOME;
> +            }
> +            avpriv_report_missing_feature(s, "multi-channel AMR");
> +            return AVERROR_PATCHWELCOME;
>          }
>
>          st->codecpar->codec_tag   = MKTAG('s', 'a', 'w', 'b');
> --
> 2.25.1
>
Sun Zhenliang Sept. 27, 2021, 1:48 a.m. UTC | #8
在 2021年9月26日 +0800 20:40,mypopy@gmail.com <mypopy@gmail.com>,写道:
> On Thu, Sep 16, 2021 at 11:24 AM sunzhenliang
> <hisunzhenliang@outlook.com> wrote:
> >
> > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > ---
> > libavformat/amr.c | 22 ++++++++++++++++++----
> > 1 file changed, 18 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > index 836b276fd5..2762010ebe 100644
> > --- a/libavformat/amr.c
> > +++ b/libavformat/amr.c
> > @@ -36,8 +36,10 @@ typedef struct {
> > uint64_t block_count;
> > } AMRContext;
> >
> > -static const char AMR_header[] = "#!AMR\n";
> > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > +static const char AMR_header[] = "#!AMR\n";
> > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> I don't think you need to format the AMR_header[] and AMRWB_header[]
> in the patch
I just think aligning the equals sign will look neat, which can't be reflected in the email.
> >
> > static const uint8_t amrnb_packed_size[16] = {
> > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > {
> > AVIOContext *pb = s->pb;
> > AVStream *st;
> > - uint8_t header[9];
> > + uint8_t header[15];
> >
> > if (avio_read(pb, header, 6) != 6)
> > return AVERROR_INVALIDDATA;
> > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > if (avio_read(pb, header + 6, 3) != 3)
> > return AVERROR_INVALIDDATA;
> > if (memcmp(header, AMRWB_header, 9)) {
> > - return -1;
> > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > + return AVERROR_INVALIDDATA;
> > + if (memcmp(header, AMR_MC_header, 12)) {
> > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > + return AVERROR_INVALIDDATA;
> > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > + return -1;
> > + }
> > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > + return AVERROR_PATCHWELCOME;
> > + }
> > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > + return AVERROR_PATCHWELCOME;
> > }
> >
> > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > --
> > 2.25.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".
Sun Zhenliang Sept. 30, 2021, 3:04 a.m. UTC | #9
ping for review.
在 2021年9月27日 +0800 09:48,Sun Zhenliang <hisunzhenliang@outlook.com>,写道:
> 在 2021年9月26日 +0800 20:40,mypopy@gmail.com <mypopy@gmail.com>,写道:
> > On Thu, Sep 16, 2021 at 11:24 AM sunzhenliang
> > <hisunzhenliang@outlook.com> wrote:
> > >
> > > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > > ---
> > > libavformat/amr.c | 22 ++++++++++++++++++----
> > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > index 836b276fd5..2762010ebe 100644
> > > --- a/libavformat/amr.c
> > > +++ b/libavformat/amr.c
> > > @@ -36,8 +36,10 @@ typedef struct {
> > > uint64_t block_count;
> > > } AMRContext;
> > >
> > > -static const char AMR_header[] = "#!AMR\n";
> > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > +static const char AMR_header[] = "#!AMR\n";
> > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > I don't think you need to format the AMR_header[] and AMRWB_header[]
> > in the patch
> I just think aligning the equals sign will look neat, which can't be reflected in the email.
> > >
> > > static const uint8_t amrnb_packed_size[16] = {
> > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > {
> > > AVIOContext *pb = s->pb;
> > > AVStream *st;
> > > - uint8_t header[9];
> > > + uint8_t header[15];
> > >
> > > if (avio_read(pb, header, 6) != 6)
> > > return AVERROR_INVALIDDATA;
> > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > if (avio_read(pb, header + 6, 3) != 3)
> > > return AVERROR_INVALIDDATA;
> > > if (memcmp(header, AMRWB_header, 9)) {
> > > - return -1;
> > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > + return AVERROR_INVALIDDATA;
> > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > + return AVERROR_INVALIDDATA;
> > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > + return -1;
> > > + }
> > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > + return AVERROR_PATCHWELCOME;
> > > + }
> > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > + return AVERROR_PATCHWELCOME;
> > > }
> > >
> > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > --
> > > 2.25.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".
Paul B Mahol Sept. 30, 2021, 11:55 a.m. UTC | #10
On Thu, Sep 30, 2021 at 5:05 AM Sun Zhenliang <hisunzhenliang@outlook.com>
wrote:

> ping for review.
>

have amr-wb mc stereo sample?


> 在 2021年9月27日 +0800 09:48,Sun Zhenliang <hisunzhenliang@outlook.com>,写道:
> > 在 2021年9月26日 +0800 20:40,mypopy@gmail.com <mypopy@gmail.com>,写道:
> > > On Thu, Sep 16, 2021 at 11:24 AM sunzhenliang
> > > <hisunzhenliang@outlook.com> wrote:
> > > >
> > > > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > > > ---
> > > > libavformat/amr.c | 22 ++++++++++++++++++----
> > > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > > index 836b276fd5..2762010ebe 100644
> > > > --- a/libavformat/amr.c
> > > > +++ b/libavformat/amr.c
> > > > @@ -36,8 +36,10 @@ typedef struct {
> > > > uint64_t block_count;
> > > > } AMRContext;
> > > >
> > > > -static const char AMR_header[] = "#!AMR\n";
> > > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > +static const char AMR_header[] = "#!AMR\n";
> > > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > > I don't think you need to format the AMR_header[] and AMRWB_header[]
> > > in the patch
> > I just think aligning the equals sign will look neat, which can't be
> reflected in the email.
> > > >
> > > > static const uint8_t amrnb_packed_size[16] = {
> > > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > > {
> > > > AVIOContext *pb = s->pb;
> > > > AVStream *st;
> > > > - uint8_t header[9];
> > > > + uint8_t header[15];
> > > >
> > > > if (avio_read(pb, header, 6) != 6)
> > > > return AVERROR_INVALIDDATA;
> > > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > > if (avio_read(pb, header + 6, 3) != 3)
> > > > return AVERROR_INVALIDDATA;
> > > > if (memcmp(header, AMRWB_header, 9)) {
> > > > - return -1;
> > > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > > + return AVERROR_INVALIDDATA;
> > > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > > + return AVERROR_INVALIDDATA;
> > > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > > + return -1;
> > > > + }
> > > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > > + return AVERROR_PATCHWELCOME;
> > > > + }
> > > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > > + return AVERROR_PATCHWELCOME;
> > > > }
> > > >
> > > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > > --
> > > > 2.25.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".
> _______________________________________________
> 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".
>
Sun Zhenliang Sept. 30, 2021, 2:42 p.m. UTC | #11
在 2021年9月30日 +0800 19:56,Paul B Mahol <onemda@gmail.com>,写道:
> On Thu, Sep 30, 2021 at 5:05 AM Sun Zhenliang <hisunzhenliang@outlook.com>
> wrote:
>
> > ping for review.
> >
>
> have amr-wb mc stereo sample?
yes, here are the stereo amr-wb/nb files.

https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-wb
patch/stereo.amr-wb

https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nb
patch/stereo.amr-nb
>
>
> > 在 2021年9月27日 +0800 09:48,Sun Zhenliang <hisunzhenliang@outlook.com>,写道:
> > > 在 2021年9月26日 +0800 20:40,mypopy@gmail.com <mypopy@gmail.com>,写道:
> > > > On Thu, Sep 16, 2021 at 11:24 AM sunzhenliang
> > > > <hisunzhenliang@outlook.com> wrote:
> > > > >
> > > > > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > > > > ---
> > > > > libavformat/amr.c | 22 ++++++++++++++++++----
> > > > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > > > index 836b276fd5..2762010ebe 100644
> > > > > --- a/libavformat/amr.c
> > > > > +++ b/libavformat/amr.c
> > > > > @@ -36,8 +36,10 @@ typedef struct {
> > > > > uint64_t block_count;
> > > > > } AMRContext;
> > > > >
> > > > > -static const char AMR_header[] = "#!AMR\n";
> > > > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > > +static const char AMR_header[] = "#!AMR\n";
> > > > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > > > I don't think you need to format the AMR_header[] and AMRWB_header[]
> > > > in the patch
> > > I just think aligning the equals sign will look neat, which can't be
> > reflected in the email.
> > > > >
> > > > > static const uint8_t amrnb_packed_size[16] = {
> > > > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > > > {
> > > > > AVIOContext *pb = s->pb;
> > > > > AVStream *st;
> > > > > - uint8_t header[9];
> > > > > + uint8_t header[15];
> > > > >
> > > > > if (avio_read(pb, header, 6) != 6)
> > > > > return AVERROR_INVALIDDATA;
> > > > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > > > if (avio_read(pb, header + 6, 3) != 3)
> > > > > return AVERROR_INVALIDDATA;
> > > > > if (memcmp(header, AMRWB_header, 9)) {
> > > > > - return -1;
> > > > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > > > + return AVERROR_INVALIDDATA;
> > > > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > > > + return AVERROR_INVALIDDATA;
> > > > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > > > + return -1;
> > > > > + }
> > > > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > > > + return AVERROR_PATCHWELCOME;
> > > > > + }
> > > > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > > > + return AVERROR_PATCHWELCOME;
> > > > > }
> > > > >
> > > > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > > > --
> > > > > 2.25.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".
> > _______________________________________________
> > 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".
Paul B Mahol Sept. 30, 2021, 7:19 p.m. UTC | #12
On Thu, Sep 30, 2021 at 4:42 PM Sun Zhenliang <hisunzhenliang@outlook.com>
wrote:

> 在 2021年9月30日 +0800 19:56,Paul B Mahol <onemda@gmail.com>,写道:
> > On Thu, Sep 30, 2021 at 5:05 AM Sun Zhenliang <
> hisunzhenliang@outlook.com>
> > wrote:
> >
> > > ping for review.
> > >
> >
> > have amr-wb mc stereo sample?
> yes, here are the stereo amr-wb/nb files.
>

where is specification, its exact name for those stereo files?

>
>
> https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-wb
> patch/stereo.amr-wb
> <https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-wbpatch/stereo.amr-wb>
>
>
> https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nb
> patch/stereo.amr-nb
> <https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nbpatch/stereo.amr-nb>
> >
> >
> > > 在 2021年9月27日 +0800 09:48,Sun Zhenliang <hisunzhenliang@outlook.com
> >,写道:
> > > > 在 2021年9月26日 +0800 20:40,mypopy@gmail.com <mypopy@gmail.com>,写道:
> > > > > On Thu, Sep 16, 2021 at 11:24 AM sunzhenliang
> > > > > <hisunzhenliang@outlook.com> wrote:
> > > > > >
> > > > > > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > > > > > ---
> > > > > > libavformat/amr.c | 22 ++++++++++++++++++----
> > > > > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > > > > >
> > > > > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > > > > index 836b276fd5..2762010ebe 100644
> > > > > > --- a/libavformat/amr.c
> > > > > > +++ b/libavformat/amr.c
> > > > > > @@ -36,8 +36,10 @@ typedef struct {
> > > > > > uint64_t block_count;
> > > > > > } AMRContext;
> > > > > >
> > > > > > -static const char AMR_header[] = "#!AMR\n";
> > > > > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > > > +static const char AMR_header[] = "#!AMR\n";
> > > > > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > > > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > > > > I don't think you need to format the AMR_header[] and
> AMRWB_header[]
> > > > > in the patch
> > > > I just think aligning the equals sign will look neat, which can't be
> > > reflected in the email.
> > > > > >
> > > > > > static const uint8_t amrnb_packed_size[16] = {
> > > > > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > > > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > > > > {
> > > > > > AVIOContext *pb = s->pb;
> > > > > > AVStream *st;
> > > > > > - uint8_t header[9];
> > > > > > + uint8_t header[15];
> > > > > >
> > > > > > if (avio_read(pb, header, 6) != 6)
> > > > > > return AVERROR_INVALIDDATA;
> > > > > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > > > > if (avio_read(pb, header + 6, 3) != 3)
> > > > > > return AVERROR_INVALIDDATA;
> > > > > > if (memcmp(header, AMRWB_header, 9)) {
> > > > > > - return -1;
> > > > > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > > > > + return AVERROR_INVALIDDATA;
> > > > > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > > > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > > > > + return AVERROR_INVALIDDATA;
> > > > > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > > > > + return -1;
> > > > > > + }
> > > > > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > > > > + return AVERROR_PATCHWELCOME;
> > > > > > + }
> > > > > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > > > > + return AVERROR_PATCHWELCOME;
> > > > > > }
> > > > > >
> > > > > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > > > > --
> > > > > > 2.25.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".
> > > _______________________________________________
> > > 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".
> _______________________________________________
> 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".
>
Sun Zhenliang Oct. 1, 2021, 1:10 a.m. UTC | #13
2021年10月1日 +0800 03:19 Paul B Mahol <onemda@gmail.com>,写道:
> On Thu, Sep 30, 2021 at 4:42 PM Sun Zhenliang <hisunzhenliang@outlook.com>
> wrote:
>
> > 在 2021年9月30日 +0800 19:56,Paul B Mahol <onemda@gmail.com>,写道:
> > > On Thu, Sep 30, 2021 at 5:05 AM Sun Zhenliang <
> > hisunzhenliang@outlook.com>
> > > wrote:
> > >
> > > > ping for review.
> > > >
> > >
> > > have amr-wb mc stereo sample?
> > yes, here are the stereo amr-wb/nb files.
> >
>
> where is specification, its exact name for those stereo files?
>
I did not find the exact file extension of
those stereo files in specifications. I think
it should be same with mono files defaultly.
And these files follows the extension rules in sox.

Anything else for this patch to fix? Will this be applied?

And I noticed you submit patches for decoding
stereo amr. Good job!  I was planning to do it before.
> >
> >
> > https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-wb
> > patch/stereo.amr-wb
> > <https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-wbpatch/stereo.amr-wb>
> >
> >
> > https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nb
> > patch/stereo.amr-nb
> > <https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nbpatch/stereo.amr-nb>
> > >
> > >
> > > > 在 2021年9月27日 +0800 09:48,Sun Zhenliang <hisunzhenliang@outlook.com
> > > ,写道:
> > > > > 在 2021年9月26日 +0800 20:40,mypopy@gmail.com <mypopy@gmail.com>,写道:
> > > > > > On Thu, Sep 16, 2021 at 11:24 AM sunzhenliang
> > > > > > <hisunzhenliang@outlook.com> wrote:
> > > > > > >
> > > > > > > Signed-off-by: sunzhenliang <hisunzhenliang@outlook.com>
> > > > > > > ---
> > > > > > > libavformat/amr.c | 22 ++++++++++++++++++----
> > > > > > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > > > > > >
> > > > > > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > > > > > index 836b276fd5..2762010ebe 100644
> > > > > > > --- a/libavformat/amr.c
> > > > > > > +++ b/libavformat/amr.c
> > > > > > > @@ -36,8 +36,10 @@ typedef struct {
> > > > > > > uint64_t block_count;
> > > > > > > } AMRContext;
> > > > > > >
> > > > > > > -static const char AMR_header[] = "#!AMR\n";
> > > > > > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > > > > +static const char AMR_header[] = "#!AMR\n";
> > > > > > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > > > > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > > > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > > > > > I don't think you need to format the AMR_header[] and
> > AMRWB_header[]
> > > > > > in the patch
> > > > > I just think aligning the equals sign will look neat, which can't be
> > > > reflected in the email.
> > > > > > >
> > > > > > > static const uint8_t amrnb_packed_size[16] = {
> > > > > > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > > > > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > > > > > {
> > > > > > > AVIOContext *pb = s->pb;
> > > > > > > AVStream *st;
> > > > > > > - uint8_t header[9];
> > > > > > > + uint8_t header[15];
> > > > > > >
> > > > > > > if (avio_read(pb, header, 6) != 6)
> > > > > > > return AVERROR_INVALIDDATA;
> > > > > > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > > > > > if (avio_read(pb, header + 6, 3) != 3)
> > > > > > > return AVERROR_INVALIDDATA;
> > > > > > > if (memcmp(header, AMRWB_header, 9)) {
> > > > > > > - return -1;
> > > > > > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > > > > > + return AVERROR_INVALIDDATA;
> > > > > > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > > > > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > > > > > + return AVERROR_INVALIDDATA;
> > > > > > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > > > > > + return -1;
> > > > > > > + }
> > > > > > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > > > > > + return AVERROR_PATCHWELCOME;
> > > > > > > + }
> > > > > > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > > > > > + return AVERROR_PATCHWELCOME;
> > > > > > > }
> > > > > > >
> > > > > > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > > > > > --
> > > > > > > 2.25.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".
> > > > _______________________________________________
> > > > 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".
> > _______________________________________________
> > 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".
diff mbox series

Patch

diff --git a/libavformat/amr.c b/libavformat/amr.c
index 836b276fd5..2762010ebe 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -36,8 +36,10 @@  typedef struct {
     uint64_t block_count;
 } AMRContext;
 
-static const char AMR_header[]   = "#!AMR\n";
-static const char AMRWB_header[] = "#!AMR-WB\n";
+static const char AMR_header[]      = "#!AMR\n";
+static const char AMR_MC_header[]   = "#!AMR_MC1.0\n";
+static const char AMRWB_header[]    = "#!AMR-WB\n";
+static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
 
 static const uint8_t amrnb_packed_size[16] = {
     13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
@@ -82,7 +84,7 @@  static int amr_read_header(AVFormatContext *s)
 {
     AVIOContext *pb = s->pb;
     AVStream *st;
-    uint8_t header[9];
+    uint8_t header[15];
 
     if (avio_read(pb, header, 6) != 6)
         return AVERROR_INVALIDDATA;
@@ -94,7 +96,19 @@  static int amr_read_header(AVFormatContext *s)
         if (avio_read(pb, header + 6, 3) != 3)
             return AVERROR_INVALIDDATA;
         if (memcmp(header, AMRWB_header, 9)) {
-            return -1;
+            if (avio_read(pb, header + 6 + 3, 3) != 3)
+                return AVERROR_INVALIDDATA;
+            if (memcmp(header, AMR_MC_header, 12)) {
+                if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
+                    return AVERROR_INVALIDDATA;
+                if (memcmp(header, AMRWB_MC_header, 15)) {
+                    return -1;
+                }
+                avpriv_report_missing_feature(s, "multi-channel AMRWB");
+                return AVERROR_PATCHWELCOME;
+            }
+            avpriv_report_missing_feature(s, "multi-channel AMR");
+            return AVERROR_PATCHWELCOME;
         }
 
         st->codecpar->codec_tag   = MKTAG('s', 'a', 'w', 'b');