[FFmpeg-devel] [PATCH v1 1/1] libavformat/amr.c: remove mode range check
Those comfort noise frames and empty frames should be considered the correct frame. And amr.c/amr_read_packet() also takes them as correct frames too. Signed-off-by: sunzhenliang --- libavformat/amr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/amr.c b/libavformat/amr.c index 836b276fd5..540d8033d8 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -178,7 +178,7 @@ static int amrnb_probe(const AVProbeData *p) while (i < p->buf_size) { mode = b[i] >> 3 & 0x0F; -if (mode < 9 && (b[i] & 0x4) == 0x4) { +if ((b[i] & 0x4) == 0x4) { int last = b[i]; int size = amrnb_packed_size[mode]; while (size--) { @@ -234,7 +234,7 @@ static int amrwb_probe(const AVProbeData *p) while (i < p->buf_size) { mode = b[i] >> 3 & 0x0F; -if (mode < 10 && (b[i] & 0x4) == 0x4) { +if ((b[i] & 0x4) == 0x4) { int last = b[i]; int size = amrwb_packed_size[mode]; while (size--) { -- 2.30.1 (Apple Git-130) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 1/1] avformat/amr: Return PATCHWELCOME on stereo files
Signed-off-by: sunzhenliang --- 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1] doc/examples/transcoding: set ret before goto end
Signed-off-by: sunzhenliang --- doc/examples/transcoding.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index badfba62cb..24e64e572e 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -524,8 +524,10 @@ int main(int argc, char **argv) goto end; if ((ret = init_filters()) < 0) goto end; -if (!(packet = av_packet_alloc())) +if (!(packet = av_packet_alloc())) { +ret = AVERROR(ENOMEM); goto end; +} /* read all packets */ while (1) { -- 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-requ...@ffmpeg.org with subject "unsubscribe".