It automatically honours block_align and it clears the AV_PKT_FLAG_CORRUPT flag which up until now was always set for the last packet if the number of input blocks was not divisible by 256 (or equivalently: if the number of input samples was not divisible by 1024).
It reads more data at once; this necessitated updates to FATE reference files. Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavformat/Makefile | 4 ++-- libavformat/aptxdec.c | 15 +++------------ tests/ref/fate/aptx | 14 +++----------- tests/ref/fate/aptx-hd | 14 +++----------- 4 files changed, 11 insertions(+), 36 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 7e0f587b41..becf07867d 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -99,9 +99,9 @@ OBJS-$(CONFIG_APM_DEMUXER) += apm.o OBJS-$(CONFIG_APM_MUXER) += apm.o rawenc.o OBJS-$(CONFIG_APNG_DEMUXER) += apngdec.o OBJS-$(CONFIG_APNG_MUXER) += apngenc.o -OBJS-$(CONFIG_APTX_DEMUXER) += aptxdec.o +OBJS-$(CONFIG_APTX_DEMUXER) += aptxdec.o pcm.o OBJS-$(CONFIG_APTX_MUXER) += rawenc.o -OBJS-$(CONFIG_APTX_HD_DEMUXER) += aptxdec.o +OBJS-$(CONFIG_APTX_HD_DEMUXER) += aptxdec.o pcm.o OBJS-$(CONFIG_APTX_HD_MUXER) += rawenc.o OBJS-$(CONFIG_AQTITLE_DEMUXER) += aqtitledec.o subtitles.o OBJS-$(CONFIG_ARGO_ASF_DEMUXER) += argo_asf.o diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c index a5ed921e2c..2cbf9a2cb8 100644 --- a/libavformat/aptxdec.c +++ b/libavformat/aptxdec.c @@ -22,6 +22,7 @@ #include "libavutil/opt.h" #include "avformat.h" +#include "pcm.h" #define APTX_BLOCK_SIZE 4 #define APTX_PACKET_SIZE (256*APTX_BLOCK_SIZE) @@ -70,16 +71,6 @@ static int aptx_hd_read_header(AVFormatContext *s) return 0; } -static int aptx_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - return av_get_packet(s->pb, pkt, APTX_PACKET_SIZE); -} - -static int aptx_hd_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - return av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE); -} - static const AVOption aptx_options[] = { { "sample_rate", "", offsetof(AptXDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, @@ -99,7 +90,7 @@ const AVInputFormat ff_aptx_demuxer = { .extensions = "aptx", .priv_data_size = sizeof(AptXDemuxerContext), .read_header = aptx_read_header, - .read_packet = aptx_read_packet, + .read_packet = ff_pcm_read_packet, .flags = AVFMT_GENERIC_INDEX, .priv_class = &aptx_demuxer_class, }; @@ -112,7 +103,7 @@ const AVInputFormat ff_aptx_hd_demuxer = { .extensions = "aptxhd", .priv_data_size = sizeof(AptXDemuxerContext), .read_header = aptx_hd_read_header, - .read_packet = aptx_hd_read_packet, + .read_packet = ff_pcm_read_packet, .flags = AVFMT_GENERIC_INDEX, .priv_class = &aptx_demuxer_class, }; diff --git a/tests/ref/fate/aptx b/tests/ref/fate/aptx index 22607e2b89..35729b77c7 100644 --- a/tests/ref/fate/aptx +++ b/tests/ref/fate/aptx @@ -6,14 +6,6 @@ b5d8a297c0e8d9854f19d9d3e8b82859 *tests/data/fate/aptx.aptx #sample_rate 0: 44100 #channel_layout 0: 3 #channel_layout_name 0: stereo -0, 0, 0, 1024, 4096, 0xcbb4ceff -0, 1024, 1024, 1024, 4096, 0xa66533e7 -0, 2048, 2048, 1024, 4096, 0x4f22ec39 -0, 3072, 3072, 1024, 4096, 0x45f117f9 -0, 4096, 4096, 1024, 4096, 0xad6c0b7a -0, 5120, 5120, 1024, 4096, 0x611618fd -0, 6144, 6144, 1024, 4096, 0x0ec02f2b -0, 7168, 7168, 1024, 4096, 0x2cf9ae5c -0, 8192, 8192, 1024, 4096, 0xfb008ac0 -0, 9216, 9216, 1024, 4096, 0x25068495 -0, 10240, 10240, 785, 3140, 0x5a260589 +0, 0, 0, 4096, 16384, 0xcc670736 +0, 4096, 4096, 4096, 16384, 0xf5a1020d +0, 8192, 8192, 2833, 11332, 0xcdf214ed diff --git a/tests/ref/fate/aptx-hd b/tests/ref/fate/aptx-hd index 8b62ea1611..fe611de03e 100644 --- a/tests/ref/fate/aptx-hd +++ b/tests/ref/fate/aptx-hd @@ -6,14 +6,6 @@ #sample_rate 0: 44100 #channel_layout 0: 3 #channel_layout_name 0: stereo -0, 0, 0, 1024, 8192, 0xa99888c6 -0, 1024, 1024, 1024, 8192, 0xc3e03a3c -0, 2048, 2048, 1024, 8192, 0x3f06e090 -0, 3072, 3072, 1024, 8192, 0x92fb18f3 -0, 4096, 4096, 1024, 8192, 0x3d5603a2 -0, 5120, 5120, 1024, 8192, 0xcc3d3101 -0, 6144, 6144, 1024, 8192, 0xbcc022ef -0, 7168, 7168, 1024, 8192, 0x600cbb73 -0, 8192, 8192, 1024, 8192, 0xdc938cbb -0, 9216, 9216, 1024, 8192, 0x37d968bc -0, 10240, 10240, 785, 6280, 0x48243144 +0, 0, 0, 4096, 32768, 0x00b6bc94 +0, 4096, 4096, 4096, 32768, 0x14411314 +0, 8192, 8192, 2833, 22664, 0xb4a826ca -- 2.30.2 _______________________________________________ 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".