diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-31 22:41:00 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-31 22:41:00 +0200 |
commit | d1dad7c824c14939a0e18fa262f3e51957de6e3e (patch) | |
tree | 615f6ba80611f53e520d2ae479d9d4409077a78d | |
parent | d2ca5dd0f33b0fdbb5d2a7429c8f71ff1dffffb7 (diff) | |
parent | f2ed006c90ccb65cd143d8b0fcfc28ffb98c4289 (diff) | |
download | ffmpeg-d1dad7c824c14939a0e18fa262f3e51957de6e3e.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mpc8: return more meaningful error codes.
mpc: return more meaningful error codes.
wv,mpc8: don't return apetag data in packets.
rtmp: do not warn about receiving metadata packets
x86: h264dsp: Adjust YASM #ifdefs
x86: yadif: Mark mmxext optimizations as such
h264: convert loop filter strength dsp function to yasm.
Improve descriptiveness of a number of codec and container long names
Conflicts:
libavcodec/flvdec.c
libavcodec/libopenjpegdec.c
libavformat/apetag.c
libavformat/mp3dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
64 files changed, 301 insertions, 257 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index fa71c77ddc..a71bae2887 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2914,7 +2914,7 @@ AVCodec ff_aac_latm_decoder = { .init = latm_decode_init, .close = aac_decode_close, .decode = latm_decode_frame, - .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"), + .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"), .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 7696e96bdf..b002b8c305 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -829,6 +829,6 @@ AVCodec ff_aac_encoder = { CODEC_CAP_EXPERIMENTAL, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"), + .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"), .priv_class = &aacenc_class, }; diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index 46e4856beb..c791110dc7 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -1080,7 +1080,7 @@ AVCodec ff_amrnb_decoder = { .init = amrnb_decode_init, .decode = amrnb_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate NarrowBand"), + .long_name = NULL_IF_CONFIG_SMALL("AMR-NB (Adaptive Multi-Rate NarrowBand)"), .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }, }; diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index beb3bd79a3..afd8d64b1b 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -1262,7 +1262,7 @@ AVCodec ff_amrwb_decoder = { .init = amrwb_decode_init, .decode = amrwb_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate WideBand"), + .long_name = NULL_IF_CONFIG_SMALL("AMR-WB (Adaptive Multi-Rate WideBand)"), .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }, }; diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c index 979af2a221..fc5ba14b4b 100644 --- a/libavcodec/assdec.c +++ b/libavcodec/assdec.c @@ -68,7 +68,7 @@ static int ass_decode_close(AVCodecContext *avctx) AVCodec ff_ass_decoder = { .name = "ass", - .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"), + .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"), .type = AVMEDIA_TYPE_SUBTITLE, .id = CODEC_ID_SSA, .init = ass_decode_init, diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c index 103f2ff276..87a8dd62c0 100644 --- a/libavcodec/assenc.c +++ b/libavcodec/assenc.c @@ -59,7 +59,7 @@ static int ass_encode_frame(AVCodecContext *avctx, AVCodec ff_ass_encoder = { .name = "ass", - .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"), + .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"), .type = AVMEDIA_TYPE_SUBTITLE, .id = CODEC_ID_SSA, .init = ass_encode_init, diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index b6bc830662..91e0829029 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -358,5 +358,5 @@ AVCodec ff_bmp_decoder = { .close = bmp_decode_end, .decode = bmp_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("BMP image"), + .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"), }; diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c index 455d2a9c80..2c60d16deb 100644 --- a/libavcodec/bmpenc.c +++ b/libavcodec/bmpenc.c @@ -179,5 +179,5 @@ AVCodec ff_bmp_encoder = { PIX_FMT_MONOBLACK, PIX_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("BMP image"), + .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"), }; diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index a0b257466b..9212e474ea 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -740,5 +740,5 @@ AVCodec ff_cavs_decoder = { .decode = cavs_decode_frame, .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY, .flush = cavs_flush, - .long_name = NULL_IF_CONFIG_SMALL("Chinese AVS video (AVS1-P2, JiZhun profile)"), + .long_name = NULL_IF_CONFIG_SMALL("Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile)"), }; diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 292148a043..d27530caf9 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1319,5 +1319,5 @@ AVCodec ff_cook_decoder = { .close = cook_decode_close, .decode = cook_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("COOK"), + .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"), }; diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c index ce7c722806..ce7ae2c2c3 100644 --- a/libavcodec/flvdec.c +++ b/libavcodec/flvdec.c @@ -128,6 +128,6 @@ AVCodec ff_flv_decoder = { .decode = ff_h263_decode_frame, .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, .max_lowres = 3, - .long_name = NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"), + .long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"), .pix_fmts = ff_pixfmt_list_420, }; diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c index 8cc2c9a604..397ca86ee3 100644 --- a/libavcodec/flvenc.c +++ b/libavcodec/flvenc.c @@ -95,6 +95,6 @@ AVCodec ff_flv_encoder = { .encode2 = ff_MPV_encode_picture, .close = ff_MPV_encode_end, .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUV420P, PIX_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"), + .long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"), .priv_class = &flv_class, }; diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index c174f7af36..77b0cca00e 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -245,7 +245,7 @@ AVCodec ff_libfaac_encoder = { .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"), + .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Coding)"), .profiles = NULL_IF_CONFIG_SMALL(profiles), .channel_layouts = faac_channel_layouts, }; diff --git a/libavcodec/libilbc.c b/libavcodec/libilbc.c index afdbaf0ebc..384dcb9c8f 100644 --- a/libavcodec/libilbc.c +++ b/libavcodec/libilbc.c @@ -114,7 +114,7 @@ AVCodec ff_libilbc_decoder = { .init = ilbc_decode_init, .decode = ilbc_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Internet Low Bitrate Codec (iLBC)"), + .long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"), .priv_class = &ilbc_dec_class, }; @@ -209,7 +209,7 @@ AVCodec ff_libilbc_encoder = { .close = ilbc_encode_close, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("Internet Low Bitrate Codec (iLBC)"), + .long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"), .defaults = ilbc_encode_defaults, .priv_class = &ilbc_enc_class, }; diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 85e6117a20..fc00841936 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -180,7 +180,7 @@ AVCodec ff_libopencore_amrnb_decoder = { .close = amr_nb_decode_close, .decode = amr_nb_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"), + .long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)"), }; static av_cold int amr_nb_encode_init(AVCodecContext *avctx) @@ -297,7 +297,7 @@ AVCodec ff_libopencore_amrnb_encoder = { .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SMALL_LAST_FRAME, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"), + .long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)"), .priv_class = &class, }; @@ -384,7 +384,7 @@ AVCodec ff_libopencore_amrwb_decoder = { .close = amr_wb_decode_close, .decode = amr_wb_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Wide-Band"), + .long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-WB (Adaptive Multi-Rate Wide-Band)"), }; #endif /* CONFIG_LIBOPENCORE_AMRWB */ diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index d9bde3ac95..cdd606813b 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -197,5 +197,5 @@ AVCodec ff_libvo_aacenc_encoder = { .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AAC"), + .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AAC (Advanced Audio Coding)"), }; diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index 8884e9da31..c1026869c5 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -148,7 +148,7 @@ AVCodec ff_libvo_amrwbenc_encoder = { .close = amr_wb_encode_close, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn Adaptive " - "Multi-Rate (AMR) Wide-Band"), + .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AMR-WB " + "(Adaptive Multi-Rate Wide-Band)"), .priv_class = &class, }; diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index 39da64ca14..1d1deac340 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -424,7 +424,7 @@ AVCodec ff_libxavs_encoder = { .close = XAVS_close, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("libxavs - the Chinese Audio Video Standard Encoder"), + .long_name = NULL_IF_CONFIG_SMALL("libxavs Chinese AVS (Audio Video Standard)"), .priv_class = &class, .defaults = xavs_defaults, }; diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 84fa632960..51731706e8 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -474,5 +474,5 @@ AVCodec ff_tta_decoder = { .close = tta_decode_close, .decode = tta_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("True Audio (TTA)"), + .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"), }; diff --git a/libavcodec/x86/h264_deblock.asm b/libavcodec/x86/h264_deblock.asm index ea422e3b3a..a4ab08722a 100644 --- a/libavcodec/x86/h264_deblock.asm +++ b/libavcodec/x86/h264_deblock.asm @@ -27,6 +27,10 @@ %include "libavutil/x86/x86inc.asm" %include "libavutil/x86/x86util.asm" +SECTION_RODATA + +pb_3_1: times 4 db 3, 1 + SECTION .text cextern pb_0 @@ -921,3 +925,167 @@ ff_chroma_intra_body_mmx2: paddb m1, m5 paddb m2, m6 ret + +;----------------------------------------------------------------------------- +; void h264_loop_filter_strength(int16_t bs[2][4][4], uint8_t nnz[40], +; int8_t ref[2][40], int16_t mv[2][40][2], +; int bidir, int edges, int step, +; int mask_mv0, int mask_mv1, int field); +; +; bidir is 0 or 1 +; edges is 1 or 4 +; step is 1 or 2 +; mask_mv0 is 0 or 3 +; mask_mv1 is 0 or 1 +; field is 0 or 1 +;----------------------------------------------------------------------------- +%macro loop_filter_strength_iteration 7 ; edges, step, mask_mv, + ; dir, d_idx, mask_dir, bidir +%define edgesd %1 +%define stepd %2 +%define mask_mvd %3 +%define dir %4 +%define d_idx %5 +%define mask_dir %6 +%define bidir %7 + xor b_idxd, b_idxd ; for (b_idx = 0; b_idx < edges; b_idx += step) +%%.b_idx_loop: +%if mask_dir == 0 + pxor m0, m0 +%endif + test b_idxd, dword mask_mvd + jnz %%.skip_loop_iter ; if (!(b_idx & mask_mv)) +%if bidir == 1 + movd m2, [refq+b_idxq+d_idx+12] ; { ref0[bn] } + punpckldq m2, [refq+b_idxq+d_idx+52] ; { ref0[bn], ref1[bn] } + pshufw m0, [refq+b_idxq+12], 0x44 ; { ref0[b], ref0[b] } + pshufw m1, [refq+b_idxq+52], 0x44 ; { ref1[b], ref1[b] } + pshufw m3, m2, 0x4E ; { ref1[bn], ref0[bn] } + psubb m0, m2 ; { ref0[b] != ref0[bn], + ; ref0[b] != ref1[bn] } + psubb m1, m3 ; { ref1[b] != ref1[bn], + ; ref1[b] != ref0[bn] } + + por m0, m1 + mova m1, [mvq+b_idxq*4+(d_idx+12)*4] + mova m2, [mvq+b_idxq*4+(d_idx+12)*4+mmsize] + mova m3, m1 + mova m4, m2 + psubw m1, [mvq+b_idxq*4+12*4] + psubw m2, [mvq+b_idxq*4+12*4+mmsize] + psubw m3, [mvq+b_idxq*4+52*4] + psubw m4, [mvq+b_idxq*4+52*4+mmsize] + packsswb m1, m2 + packsswb m3, m4 + paddb m1, m6 + paddb m3, m6 + psubusb m1, m5 ; abs(mv[b] - mv[bn]) >= limit + psubusb m3, m5 + packsswb m1, m3 + + por m0, m1 + mova m1, [mvq+b_idxq*4+(d_idx+52)*4] + mova m2, [mvq+b_idxq*4+(d_idx+52)*4+mmsize] + mova m3, m1 + mova m4, m2 + psubw m1, [mvq+b_idxq*4+12*4] + psubw m2, [mvq+b_idxq*4+12*4+mmsize] + psubw m3, [mvq+b_idxq*4+52*4] + psubw m4, [mvq+b_idxq*4+52*4+mmsize] + packsswb m1, m2 + packsswb m3, m4 + paddb m1, m6 + paddb m3, m6 + psubusb m1, m5 ; abs(mv[b] - mv[bn]) >= limit + psubusb m3, m5 + packsswb m1, m3 + + pshufw m1, m1, 0x4E + por m0, m1 + pshufw m1, m0, 0x4E + pminub m0, m1 +%else ; bidir == 0 + movd m0, [refq+b_idxq+12] + psubb m0, [refq+b_idxq+d_idx+12] ; ref[b] != ref[bn] + + mova m1, [mvq+b_idxq*4+12*4] + mova m2, [mvq+b_idxq*4+12*4+mmsize] + psubw m1, [mvq+b_idxq*4+(d_idx+12)*4] + psubw m2, [mvq+b_idxq*4+(d_idx+12)*4+mmsize] + packsswb m1, m2 + paddb m1, m6 + psubusb m1, m5 ; abs(mv[b] - mv[bn]) >= limit + packsswb m1, m1 + por m0, m1 +%endif ; bidir == 1/0 + +%%.skip_loop_iter: + movd m1, [nnzq+b_idxq+12] + por m1, [nnzq+b_idxq+d_idx+12] ; nnz[b] || nnz[bn] + + pminub m1, m7 + pminub m0, m7 + psllw m1, 1 + pxor m2, m2 + pmaxub m1, m0 + punpcklbw m1, m2 + movq [bsq+b_idxq+32*dir], m1 + + add b_idxd, dword stepd + cmp b_idxd, dword edgesd + jl %%.b_idx_loop +%endmacro + +INIT_MMX mmx2 +cglobal h264_loop_filter_strength, 9, 9, 0, bs, nnz, ref, mv, bidir, edges, \ + step, mask_mv0, mask_mv1, field +%define b_idxq bidirq +%define b_idxd bidird + cmp dword fieldm, 0 + mova m7, [pb_1] + mova m5, [pb_3] + je .nofield + mova m5, [pb_3_1] +.nofield: + mova m6, m5 + paddb m5, m5 + + shl dword stepd, 3 + shl dword edgesd, 3 +%if ARCH_X86_32 +%define mask_mv0d mask_mv0m +%define mask_mv1d mask_mv1m +%endif + shl dword mask_mv1d, 3 + shl dword mask_mv0d, 3 + + cmp dword bidird, 0 + jne .bidir + loop_filter_strength_iteration edgesd, stepd, mask_mv1d, 1, -8, 0, 0 + loop_filter_strength_iteration 32, 8, mask_mv0d, 0, -1, -1, 0 + + mova m0, [bsq+mmsize*0] + mova m1, [bsq+mmsize*1] + mova m2, [bsq+mmsize*2] + mova m3, [bsq+mmsize*3] + TRANSPOSE4x4W 0, 1, 2, 3, 4 + mova [bsq+mmsize*0], m0 + mova [bsq+mmsize*1], m1 + mova [bsq+mmsize*2], m2 + mova [bsq+mmsize*3], m3 + RET + +.bidir: + loop_filter_strength_iteration edgesd, stepd, mask_mv1d, 1, -8, 0, 1 + loop_filter_strength_iteration 32, 8, mask_mv0d, 0, -1, -1, 1 + + mova m0, [bsq+mmsize*0] + mova m1, [bsq+mmsize*1] + mova m2, [bsq+mmsize*2] + mova m3, [bsq+mmsize*3] + TRANSPOSE4x4W 0, 1, 2, 3, 4 + mova [bsq+mmsize*0], m0 + mova [bsq+mmsize*1], m1 + mova [bsq+mmsize*2], m2 + mova [bsq+mmsize*3], m3 + RET diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c index d767c687ad..54d83f0a45 100644 --- a/libavcodec/x86/h264dsp_mmx.c +++ b/libavcodec/x86/h264dsp_mmx.c @@ -88,158 +88,10 @@ void ff_h264_luma_dc_dequant_idct_sse2(DCTELEM *output, DCTELEM *input, int qmul /***********************************/ /* deblocking */ -#define h264_loop_filter_strength_iteration_mmx2(bS, nz, ref, mv, bidir, edges, step, mask_mv, dir, d_idx, mask_dir) \ - do { \ - x86_reg b_idx; \ - mask_mv <<= 3; \ - for( b_idx=0; b_idx<edges; b_idx+=step ) { \ - if (!mask_dir) \ - __asm__ volatile( \ - "pxor %%mm0, %%mm0 \n\t" \ - :: \ - ); \ - if(!(mask_mv & b_idx)) { \ - if(bidir) { \ - __asm__ volatile( \ - "movd %a3(%0,%2), %%mm2 \n" \ - "punpckldq %a4(%0,%2), %%mm2 \n" /* { ref0[bn], ref1[bn] } */ \ - "pshufw $0x44, 12(%0,%2), %%mm0 \n" /* { ref0[b], ref0[b] } */ \ - "pshufw $0x44, 52(%0,%2), %%mm1 \n" /* { ref1[b], ref1[b] } */ \ - "pshufw $0x4E, %%mm2, %%mm3 \n" \ - "psubb %%mm2, %%mm0 \n" /* { ref0[b]!=ref0[bn], ref0[b]!=ref1[bn] } */ \ - "psubb %%mm3, %%mm1 \n" /* { ref1[b]!=ref1[bn], ref1[b]!=ref0[bn] } */ \ - \ - "por %%mm1, %%mm0 \n" \ - "movq %a5(%1,%2,4), %%mm1 \n" \ - "movq %a6(%1,%2,4), %%mm2 \n" \ - "movq %%mm1, %%mm3 \n" \ - "movq %%mm2, %%mm4 \n" \ - "psubw 48(%1,%2,4), %%mm1 \n" \ - "psubw 56(%1,%2,4), %%mm2 \n" \ - "psubw 208(%1,%2,4), %%mm3 \n" \ - "psubw 216(%1,%2,4), %%mm4 \n" \ - "packsswb %%mm2, %%mm1 \n" \ - "packsswb %%mm4, %%mm3 \n" \ - "paddb %%mm6, %%mm1 \n" \ - "paddb %%mm6, %%mm3 \n" \ - "psubusb %%mm5, %%mm1 \n" /* abs(mv[b] - mv[bn]) >= limit */ \ - "psubusb %%mm5, %%mm3 \n" \ - "packsswb %%mm3, %%mm1 \n" \ - \ - "por %%mm1, %%mm0 \n" \ - "movq %a7(%1,%2,4), %%mm1 \n" \ - "movq %a8(%1,%2,4), %%mm2 \n" \ - "movq %%mm1, %%mm3 \n" \ - "movq %%mm2, %%mm4 \n" \ - "psubw 48(%1,%2,4), %%mm1 \n" \ - "psubw 56(%1,%2,4), %%mm2 \n" \ - "psubw 208(%1,%2,4), %%mm3 \n" \ - "psubw 216(%1,%2,4), %%mm4 \n" \ - "packsswb %%mm2, %%mm1 \n" \ - "packsswb %%mm4, %%mm3 \n" \ - "paddb %%mm6, %%mm1 \n" \ - "paddb %%mm6, %%mm3 \n" \ - "psubusb %%mm5, %%mm1 \n" /* abs(mv[b] - mv[bn]) >= limit */ \ - "psubusb %%mm5, %%mm3 \n" \ - "packsswb %%mm3, %%mm1 \n" \ - \ - "pshufw $0x4E, %%mm1, %%mm1 \n" \ - "por %%mm1, %%mm0 \n" \ - "pshufw $0x4E, %%mm0, %%mm1 \n" \ - "pminub %%mm1, %%mm0 \n" \ - ::"r"(ref), \ - "r"(mv), \ - "r"(b_idx), \ - "i"(d_idx+12), \ - "i"(d_idx+52), \ - "i"(d_idx*4+48), \ - "i"(d_idx*4+56), \ - "i"(d_idx*4+208), \ - "i"(d_idx*4+216) \ - ); \ - } else { \ - __asm__ volatile( \ - "movd 12(%0,%2), %%mm0 \n" \ - "psubb %a3(%0,%2), %%mm0 \n" /* ref[b] != ref[bn] */ \ - "movq 48(%1,%2,4), %%mm1 \n" \ - "movq 56(%1,%2,4), %%mm2 \n" \ - "psubw %a4(%1,%2,4), %%mm1 \n" \ - "psubw %a5(%1,%2,4), %%mm2 \n" \ - "packsswb %%mm2, %%mm1 \n" \ - "paddb %%mm6, %%mm1 \n" \ - "psubusb %%mm5, %%mm1 \n" /* abs(mv[b] - mv[bn]) >= limit */ \ - "packsswb %%mm1, %%mm1 \n" \ - "por %%mm1, %%mm0 \n" \ - ::"r"(ref), \ - "r"(mv), \ - "r"(b_idx), \ - "i"(d_idx+12), \ - "i"(d_idx*4+48), \ - "i"(d_idx*4+56) \ - ); \ - } \ - } \ - __asm__ volatile( \ - "movd 12(%0,%1), %%mm1 \n" \ - "por %a2(%0,%1), %%mm1 \n" /* nnz[b] || nnz[bn] */ \ - ::"r"(nnz), \ - "r"(b_idx), \ - "i"(d_idx+12) \ - ); \ - __asm__ volatile( \ - "pminub %%mm7, %%mm1 \n" \ - "pminub %%mm7, %%mm0 \n" \ - "psllw $1, %%mm1 \n" \ - "pxor %%mm2, %%mm2 \n" \ - "pmaxub %%mm0, %%mm1 \n" \ - "punpcklbw %%mm2, %%mm1 \n" \ - "movq %%mm1, %a1(%0,%2) \n" \ - ::"r"(bS), \ - "i"(32*dir), \ - "r"(b_idx) \ - :"memory" \ - ); \ - } \ - } while (0) - -static void h264_loop_filter_strength_mmx2( int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], - int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field ) { - __asm__ volatile( - "movq %0, %%mm7 \n" - "movq %1, %%mm6 \n" - ::"m"(ff_pb_1), "m"(ff_pb_3) - ); - if(field) - __asm__ volatile( - "movq %0, %%mm6 \n" - ::"m"(ff_pb_3_1) - ); - __asm__ volatile( - "movq %%mm6, %%mm5 \n" - "paddb %%mm5, %%mm5 \n" - :); - - // could do a special case for dir==0 && edges==1, but it only reduces the - // average filter time by 1.2% - step <<= 3; - edges <<= 3; - h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, edges, step, mask_mv1, 1, -8, 0); - h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, 32, 8, mask_mv0, 0, -1, -1); - - __asm__ volatile( - "movq (%0), %%mm0 \n\t" - "movq 8(%0), %%mm1 \n\t" - "movq 16(%0), %%mm2 \n\t" - "movq 24(%0), %%mm3 \n\t" - TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4) - "movq %%mm0, (%0) \n\t" - "movq %%mm3, 8(%0) \n\t" - "movq %%mm4, 16(%0) \n\t" - "movq %%mm2, 24(%0) \n\t" - ::"r"(bS[0]) - :"memory" - ); -} +void ff_h264_loop_filter_strength_mmx2(int16_t bS[2][4][4], uint8_t nnz[40], + int8_t ref[2][40], int16_t mv[2][40][2], + int bidir, int edges, int step, + int mask_mv0, int mask_mv1, int field); #define LF_FUNC(DIR, TYPE, DEPTH, OPT) \ void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *pix, int stride, \ @@ -342,14 +194,14 @@ H264_BIWEIGHT_10_SSE( 4, 10) void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) { +#if HAVE_YASM int mm_flags = av_get_cpu_flags(); if (chroma_format_idc == 1 && mm_flags & AV_CPU_FLAG_MMX2) { - c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2; + c->h264_loop_filter_strength = ff_h264_loop_filter_strength_mmx2; } if (bit_depth == 8) { -#if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) { c->h264_idct_dc_add = c->h264_idct_add = ff_h264_idct_add_8_mmx; @@ -430,9 +282,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chrom } } } -#endif } else if (bit_depth == 10) { -#if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) { if (mm_flags & AV_CPU_FLAG_MMX2) { #if ARCH_X86_32 @@ -510,6 +360,6 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chrom #endif /* HAVE_AVX */ } } -#endif } +#endif } diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c index 531d0b6225..f8843a37f9 100644 --- a/libavdevice/oss_audio.c +++ b/libavdevice/oss_audio.c @@ -296,7 +296,7 @@ static const AVClass oss_demuxer_class = { AVInputFormat ff_oss_demuxer = { .name = "oss", - .long_name = NULL_IF_CONFIG_SMALL("Open Sound System capture"), + .long_name = NULL_IF_CONFIG_SMALL("OSS (Open Sound System) capture"), .priv_data_size = sizeof(AudioData), .read_header = audio_read_header, .read_packet = audio_read_packet, @@ -309,7 +309,7 @@ AVInputFormat ff_oss_demuxer = { #if CONFIG_OSS_OUTDEV AVOutputFormat ff_oss_muxer = { .name = "oss", - .long_name = NULL_IF_CONFIG_SMALL("Open Sound System playback"), + .long_name = NULL_IF_CONFIG_SMALL("OSS (Open Sound System) playback"), .priv_data_size = sizeof(AudioData), /* XXX: we make the assumption that the soundcard accepts this format */ /* XXX: find better solution with "preinit" method, needed also in diff --git a/libavfilter/x86/yadif.c b/libavfilter/x86/yadif.c index 57b1a087c3..68aa249ccb 100644 --- a/libavfilter/x86/yadif.c +++ b/libavfilter/x86/yadif.c @@ -45,9 +45,9 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010 #undef COMPILE_TEMPLATE_SSE #endif -#if HAVE_MMX +#if HAVE_MMX2 #undef RENAME -#define RENAME(a) a ## _mmx +#define RENAME(a) a ## _mmx2 #include "yadif_template.c" #endif @@ -58,9 +58,9 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif) int cpu_flags = av_get_cpu_flags(); #if HAVE_INLINE_ASM -#if HAVE_MMX - if (cpu_flags & AV_CPU_FLAG_MMX) - yadif->filter_line = yadif_filter_line_mmx; +#if HAVE_MMX2 + if (cpu_flags & AV_CPU_FLAG_MMX2) + yadif->filter_line = yadif_filter_line_mmx2; #endif #if HAVE_SSE if (cpu_flags & AV_CPU_FLAG_SSE2) diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c index 966f61b773..3289b0d3a6 100644 --- a/libavformat/aacdec.c +++ b/libavformat/aacdec.c @@ -84,7 +84,7 @@ static int adts_aac_read_header(AVFormatContext *s) AVInputFormat ff_aac_demuxer = { .name = "aac", - .long_name = NULL_IF_CONFIG_SMALL("raw ADTS AAC"), + .long_name = NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio Coding)"), .read_probe = adts_aac_probe, .read_header = adts_aac_read_header, .read_packet = ff_raw_read_partial_packet, diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index bc2397f028..396cf8b856 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -165,7 +165,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) AVOutputFormat ff_adts_muxer = { .name = "adts", - .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC"), + .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), .mime_type = "audio/aac", .extensions = "aac,adts", .priv_data_size = sizeof(ADTSContext), diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 6f6a61b0ea..1818892b40 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -111,40 +111,47 @@ static int ape_tag_read_field(AVFormatContext *s) return 0; } -void ff_ape_parse_tag(AVFormatContext *s) +int64_t ff_ape_parse_tag(AVFormatContext *s) { AVIOContext *pb = s->pb; int file_size = avio_size(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; + int64_t tag_start; int i; if (file_size < APE_TAG_FOOTER_BYTES) - return; + return 0; avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); avio_read(pb, buf, 8); /* APETAGEX */ if (strncmp(buf, APE_TAG_PREAMBLE, 8)) { - return; + return 0; } val = avio_rl32(pb); /* APE tag version */ if (val > APE_TAG_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); - return; + return 0; } tag_bytes = avio_rl32(pb); /* tag size */ if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); - return; + return 0; + } + + tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES; + if (tag_start < 0) { + av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes); + return 0; } fields = avio_rl32(pb); /* number of fields */ if (fields > 65536) { av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); - return; + return 0; } val = avio_rl32(pb); /* flags */ @@ -157,4 +164,6 @@ void ff_ape_parse_tag(AVFormatContext *s) for (i=0; i<fields; i++) if (ape_tag_read_field(s) < 0) break; + + return tag_start; } diff --git a/libavformat/apetag.h b/libavformat/apetag.h index 17a9a72b19..0330c8986a 100644 --- a/libavformat/apetag.h +++ b/libavformat/apetag.h @@ -31,8 +31,10 @@ /** * Read and parse an APE tag + * + * @return offset of the tag start in the file */ -void ff_ape_parse_tag(AVFormatContext *s); +int64_t ff_ape_parse_tag(AVFormatContext *s); /** * Write an APEv2 tag diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 9bd55cc3ce..25c7ae5d64 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -1410,7 +1410,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int AVInputFormat ff_asf_demuxer = { .name = "asf", - .long_name = NULL_IF_CONFIG_SMALL("ASF format"), + .long_name = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"), .priv_data_size = sizeof(ASFContext), .read_probe = asf_probe, .read_header = asf_read_header, diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 92ac818a8f..5b5b0b0d2f 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -901,7 +901,7 @@ static int asf_write_trailer(AVFormatContext *s) #if CONFIG_ASF_MUXER AVOutputFormat ff_asf_muxer = { .name = "asf", - .long_name = NULL_IF_CONFIG_SMALL("ASF format"), + .long_name = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"), .mime_type = "video/x-ms-asf", .extensions = "asf,wmv,wma", .priv_data_size = sizeof(ASFContext), @@ -920,7 +920,7 @@ AVOutputFormat ff_asf_muxer = { #if CONFIG_ASF_STREAM_MUXER AVOutputFormat ff_asf_stream_muxer = { .name = "asf_stream", - .long_name = NULL_IF_CONFIG_SMALL("ASF format"), + .long_name = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"), .mime_type = "video/x-ms-asf", .extensions = "asf,wmv,wma", .priv_data_size = sizeof(ASFContext), diff --git a/libavformat/assdec.c b/libavformat/assdec.c index 157d2282bb..629588808d 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -205,7 +205,7 @@ static int read_seek2(AVFormatContext *s, int stream_index, AVInputFormat ff_ass_demuxer = { .name = "ass", - .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"), + .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"), .priv_data_size = sizeof(ASSContext), .read_probe = probe, .read_header = read_header, diff --git a/libavformat/assenc.c b/libavformat/assenc.c index 515ee0447b..73f6613209 100644 --- a/libavformat/assenc.c +++ b/libavformat/assenc.c @@ -79,7 +79,7 @@ static int write_trailer(AVFormatContext *s) AVOutputFormat ff_ass_muxer = { .name = "ass", - .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"), + .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"), .mime_type = "text/x-ssa", .extensions = "ass,ssa", .priv_data_size = sizeof(ASSContext), diff --git a/libavformat/au.c b/libavformat/au.c index b78d1ac18e..69d93c6d90 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -195,7 +195,7 @@ static int au_read_packet(AVFormatContext *s, #if CONFIG_AU_DEMUXER AVInputFormat ff_au_demuxer = { .name = "au", - .long_name = NULL_IF_CONFIG_SMALL("SUN AU format"), + .long_name = NULL_IF_CONFIG_SMALL("Sun AU"), .read_probe = au_probe, .read_header = au_read_header, .read_packet = au_read_packet, @@ -207,7 +207,7 @@ AVInputFormat ff_au_demuxer = { #if CONFIG_AU_MUXER AVOutputFormat ff_au_muxer = { .name = "au", - .long_name = NULL_IF_CONFIG_SMALL("SUN AU format"), + .long_name = NULL_IF_CONFIG_SMALL("Sun AU"), .mime_type = "audio/basic", .extensions = "au", .audio_codec = CODEC_ID_PCM_S16BE, diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 99a95b2aea..b62cccdf09 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1562,7 +1562,7 @@ static int avi_probe(AVProbeData *p) AVInputFormat ff_avi_demuxer = { .name = "avi", - .long_name = NULL_IF_CONFIG_SMALL("AVI format"), + .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"), .priv_data_size = sizeof(AVIContext), .read_probe = avi_probe, .read_header = avi_read_header, diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 4c983b5fe9..0a68aa7a50 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -650,7 +650,7 @@ static int avi_write_trailer(AVFormatContext *s) AVOutputFormat ff_avi_muxer = { .name = "avi", - .long_name = NULL_IF_CONFIG_SMALL("AVI format"), + .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"), .mime_type = "video/x-msvideo", .extensions = "avi", .priv_data_size = sizeof(AVIContext), diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 15b3a8ffcf..2c967f0a69 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -417,7 +417,7 @@ static int read_seek(AVFormatContext *s, int stream_index, AVInputFormat ff_caf_demuxer = { .name = "caf", - .long_name = NULL_IF_CONFIG_SMALL("Apple Core Audio Format"), + .long_name = NULL_IF_CONFIG_SMALL("Apple CAF (Core Audio Format)"), .priv_data_size = sizeof(CaffContext), .read_probe = probe, .read_header = read_header, diff --git a/libavformat/cavsvideodec.c b/libavformat/cavsvideodec.c index 4a399a26d1..a55438075f 100644 --- a/libavformat/cavsvideodec.c +++ b/libavformat/cavsvideodec.c @@ -65,4 +65,4 @@ static int cavsvideo_probe(AVProbeData *p) return 0; } -FF_DEF_RAWVIDEO_DEMUXER(cavsvideo, "raw Chinese AVS video", cavsvideo_probe, NULL, CODEC_ID_CAVS) +FF_DEF_RAWVIDEO_DEMUXER(cavsvideo, "raw Chinese AVS (Audio Video Standard)", cavsvideo_probe, NULL, CODEC_ID_CAVS) diff --git a/libavformat/dv.c b/libavformat/dv.c index 2faeb95897..7ea2d53b92 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -591,7 +591,7 @@ static int dv_probe(AVProbeData *p) #if CONFIG_DV_DEMUXER AVInputFormat ff_dv_demuxer = { .name = "dv", - .long_name = NULL_IF_CONFIG_SMALL("DV video"), + .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), .priv_data_size = sizeof(RawDVContext), .read_probe = dv_probe, .read_header = dv_read_header, diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index b936c693b1..880caeab72 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -407,7 +407,7 @@ static int dv_write_trailer(struct AVFormatContext *s) AVOutputFormat ff_dv_muxer = { .name = "dv", - .long_name = NULL_IF_CONFIG_SMALL("DV video"), + .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), .extensions = "dv", .priv_data_size = sizeof(DVMuxContext), .audio_codec = CODEC_ID_PCM_S16LE, diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index f8c25d36c1..5b81f395c9 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -889,7 +889,7 @@ static const AVClass class = { AVInputFormat ff_flv_demuxer = { .name = "flv", - .long_name = NULL_IF_CONFIG_SMALL("FLV format"), + .long_name = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"), .priv_data_size = sizeof(FLVContext), .read_probe = flv_probe, .read_header = flv_read_header, diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index c6a676a2db..a4911b8265 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -566,7 +566,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) AVOutputFormat ff_flv_muxer = { .name = "flv", - .long_name = NULL_IF_CONFIG_SMALL("FLV format"), + .long_name = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"), .mime_type = "video/x-flv", .extensions = "flv", .priv_data_size = sizeof(FLVContext), diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 5d42ff6837..ec82a7b209 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -569,7 +569,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, AVInputFormat ff_gxf_demuxer = { .name = "gxf", - .long_name = NULL_IF_CONFIG_SMALL("GXF format"), + .long_name = NULL_IF_CONFIG_SMALL("GXF (General eXchange Format)"), .priv_data_size = sizeof(struct gxf_stream_info), .read_probe = gxf_probe, .read_header = gxf_header, diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 3c5078ca9f..c1a2bb599c 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -986,7 +986,7 @@ static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pk AVOutputFormat ff_gxf_muxer = { .name = "gxf", - .long_name = NULL_IF_CONFIG_SMALL("GXF format"), + .long_name = NULL_IF_CONFIG_SMALL("GXF (General eXchange Format)"), .extensions = "gxf", .priv_data_size = sizeof(GXFContext), .audio_codec = CODEC_ID_PCM_S16LE, diff --git a/libavformat/iff.c b/libavformat/iff.c index ab8730453c..546836a3fd 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -388,7 +388,7 @@ static int iff_read_packet(AVFormatContext *s, AVInputFormat ff_iff_demuxer = { .name = "iff", - .long_name = NULL_IF_CONFIG_SMALL("Interchange File Format"), + .long_name = NULL_IF_CONFIG_SMALL("IFF (Interchange File Format)"), .priv_data_size = sizeof(IffDemuxContext), .read_probe = iff_probe, .read_header = iff_read_header, diff --git a/libavformat/iv8.c b/libavformat/iv8.c index c70a286019..6d482b9a05 100644 --- a/libavformat/iv8.c +++ b/libavformat/iv8.c @@ -110,7 +110,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AVInputFormat ff_iv8_demuxer = { .name = "iv8", - .long_name = NULL_IF_CONFIG_SMALL("A format generated by IndigoVision 8000 video server"), + .long_name = NULL_IF_CONFIG_SMALL("IndigoVision 8000 video"), .read_probe = probe, .read_header = read_header, .read_packet = read_packet, diff --git a/libavformat/mov.c b/libavformat/mov.c index 98e88af70e..46962d7b43 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3193,7 +3193,7 @@ static const AVClass class = { AVInputFormat ff_mov_demuxer = { .name = "mov,mp4,m4a,3gp,3g2,mj2", - .long_name = NULL_IF_CONFIG_SMALL("QuickTime/MPEG-4/Motion JPEG 2000 format"), + .long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"), .priv_data_size = sizeof(MOVContext), .read_probe = mov_probe, .read_header = mov_read_header, diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 48b7e6ae37..8196b73077 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3582,7 +3582,7 @@ static int mov_write_trailer(AVFormatContext *s) MOV_CLASS(mov) AVOutputFormat ff_mov_muxer = { .name = "mov", - .long_name = NULL_IF_CONFIG_SMALL("MOV format"), + .long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"), .extensions = "mov", .priv_data_size = sizeof(MOVMuxContext), .audio_codec = CODEC_ID_AAC, @@ -3602,7 +3602,7 @@ AVOutputFormat ff_mov_muxer = { MOV_CLASS(tgp) AVOutputFormat ff_tgp_muxer = { .name = "3gp", - .long_name = NULL_IF_CONFIG_SMALL("3GP format"), + .long_name = NULL_IF_CONFIG_SMALL("3GP (3GPP file format)"), .extensions = "3gp", .priv_data_size = sizeof(MOVMuxContext), .audio_codec = CODEC_ID_AMR_NB, @@ -3619,7 +3619,7 @@ AVOutputFormat ff_tgp_muxer = { MOV_CLASS(mp4) AVOutputFormat ff_mp4_muxer = { .name = "mp4", - .long_name = NULL_IF_CONFIG_SMALL("MP4 format"), + .long_name = NULL_IF_CONFIG_SMALL("MP4 (MPEG-4 Part 14)"), .mime_type = "application/mp4", .extensions = "mp4", .priv_data_size = sizeof(MOVMuxContext), @@ -3638,7 +3638,7 @@ AVOutputFormat ff_mp4_muxer = { MOV_CLASS(psp) AVOutputFormat ff_psp_muxer = { .name = "psp", - .long_name = NULL_IF_CONFIG_SMALL("PSP MP4 format"), + .long_name = NULL_IF_CONFIG_SMALL("PSP MP4 (MPEG-4 Part 14)"), .extensions = "mp4,psp", .priv_data_size = sizeof(MOVMuxContext), .audio_codec = CODEC_ID_AAC, @@ -3656,7 +3656,7 @@ AVOutputFormat ff_psp_muxer = { MOV_CLASS(tg2) AVOutputFormat ff_tg2_muxer = { .name = "3g2", - .long_name = NULL_IF_CONFIG_SMALL("3GP2 format"), + .long_name = NULL_IF_CONFIG_SMALL("3GP2 (3GPP2 file format)"), .extensions = "3g2", .priv_data_size = sizeof(MOVMuxContext), .audio_codec = CODEC_ID_AMR_NB, @@ -3673,7 +3673,7 @@ AVOutputFormat ff_tg2_muxer = { MOV_CLASS(ipod) AVOutputFormat ff_ipod_muxer = { .name = "ipod", - .long_name = NULL_IF_CONFIG_SMALL("iPod H.264 MP4 format"), + .long_name = NULL_IF_CONFIG_SMALL("iPod H.264 MP4 (MPEG-4 Part 14)"), .mime_type = "application/mp4", .extensions = "m4v,m4a", .priv_data_size = sizeof(MOVMuxContext), diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 3d52c3fe86..aa936c0e98 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -234,7 +234,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in AVInputFormat ff_mp3_demuxer = { .name = "mp3", - .long_name = NULL_IF_CONFIG_SMALL("MPEG audio layer 2/3"), + .long_name = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"), .priv_data_size = sizeof(MP3Context), .read_probe = mp3_read_probe, .read_header = mp3_read_header, diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index cc99e77a51..80d4675d86 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -373,7 +373,7 @@ static int mp2_write_trailer(struct AVFormatContext *s) #if CONFIG_MP2_MUXER AVOutputFormat ff_mp2_muxer = { .name = "mp2", - .long_name = NULL_IF_CONFIG_SMALL("MPEG audio layer 2"), + .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), .mime_type = "audio/x-mpeg", .extensions = "mp2,m2a", .audio_codec = CODEC_ID_MP2, @@ -507,7 +507,7 @@ static int mp3_write_trailer(AVFormatContext *s) AVOutputFormat ff_mp3_muxer = { .name = "mp3", - .long_name = NULL_IF_CONFIG_SMALL("MPEG audio layer 3"), + .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), .mime_type = "audio/x-mpeg", .extensions = "mp3", .priv_data_size = sizeof(MP3Context), diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 4637fcb138..03e09e94c5 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -59,17 +59,17 @@ static int mpc_read_header(AVFormatContext *s) if(avio_rl24(s->pb) != MKTAG('M', 'P', '+', 0)){ av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); - return -1; + return AVERROR_INVALIDDATA; } c->ver = avio_r8(s->pb); if(c->ver != 0x07 && c->ver != 0x17){ av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver); - return -1; + return AVERROR_INVALIDDATA; } c->fcount = avio_rl32(s->pb); if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){ av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n"); - return -1; + return AVERROR_INVALIDDATA; } if(c->fcount){ c->frames = av_malloc(c->fcount * sizeof(MPCFrame)); @@ -122,7 +122,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t pos; if (c->curframe >= c->fcount && c->fcount) - return -1; + return AVERROR_EOF; if(c->curframe != c->lastframe + 1){ avio_seek(s->pb, c->frames[c->curframe].pos, SEEK_SET); @@ -151,8 +151,8 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) } c->curbits = (curbits + size2) & 0x1F; - if (av_new_packet(pkt, size) < 0) - return AVERROR(EIO); + if ((ret = av_new_packet(pkt, size)) < 0) + return ret; pkt->data[0] = curbits; pkt->data[1] = (c->curframe > c->fcount) && c->fcount; @@ -166,7 +166,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) avio_seek(s->pb, -4, SEEK_CUR); if(ret < size){ av_free_packet(pkt); - return AVERROR(EIO); + return ret < 0 ? ret : AVERROR(EIO); } pkt->size = ret + 4; @@ -214,7 +214,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp ret = av_read_frame(s, pkt); if (ret < 0){ c->curframe = lastframe; - return -1; + return ret; } av_free_packet(pkt); } diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 026115481d..2951c27e78 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -52,6 +52,8 @@ typedef struct { int frame; int64_t header_pos; int64_t samples; + + int64_t apetag_start; } MPCContext; static inline int64_t bs_get_v(uint8_t **bs) @@ -200,7 +202,7 @@ static int mpc8_read_header(AVFormatContext *s) c->header_pos = avio_tell(pb); if(avio_rl32(pb) != TAG_MPCK){ av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n"); - return -1; + return AVERROR_INVALIDDATA; } while(!url_feof(pb)){ @@ -212,14 +214,14 @@ static int mpc8_read_header(AVFormatContext *s) } if(tag != TAG_STREAMHDR){ av_log(s, AV_LOG_ERROR, "Stream header not found\n"); - return -1; + return AVERROR_INVALIDDATA; } pos = avio_tell(pb); avio_skip(pb, 4); //CRC c->ver = avio_r8(pb); if(c->ver != 8){ av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); - return -1; + return AVERROR_PATCHWELCOME; } c->samples = ffio_read_varlen(pb); ffio_read_varlen(pb); //silence samples at the beginning @@ -245,7 +247,7 @@ static int mpc8_read_header(AVFormatContext *s) if (pb->seekable) { int64_t pos = avio_tell(s->pb); - ff_ape_parse_tag(s); + c->apetag_start = ff_ape_parse_tag(s); avio_seek(s->pb, pos, SEEK_SET); } @@ -260,6 +262,11 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) while(!url_feof(s->pb)){ pos = avio_tell(s->pb); + + /* don't return bogus packets with the ape tag data */ + if (c->apetag_start && pos >= c->apetag_start) + return AVERROR_EOF; + mpc8_get_chunk_header(s->pb, &tag, &size); if (size < 0) return -1; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 3183f87faa..e5378ce981 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -573,7 +573,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, AVInputFormat ff_mpegps_demuxer = { .name = "mpeg", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-PS format"), + .long_name = NULL_IF_CONFIG_SMALL("MPEG-PS (MPEG-2 Program Stream)"), .priv_data_size = sizeof(MpegDemuxContext), .read_probe = mpegps_probe, .read_header = mpegps_read_header, diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index cf92631433..c9f1e8e03e 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1147,7 +1147,7 @@ static const AVClass flavor ## _class = {\ MPEGENC_CLASS(mpeg) AVOutputFormat ff_mpeg1system_muxer = { .name = "mpeg", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 System format"), + .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 Systems / MPEG program stream"), .mime_type = "video/mpeg", .extensions = "mpg,mpeg", .priv_data_size = sizeof(MpegMuxContext), @@ -1163,7 +1163,7 @@ AVOutputFormat ff_mpeg1system_muxer = { MPEGENC_CLASS(vcd) AVOutputFormat ff_mpeg1vcd_muxer = { .name = "vcd", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 System format (VCD)"), + .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 Systems / MPEG program stream (VCD)"), .mime_type = "video/mpeg", .priv_data_size = sizeof(MpegMuxContext), .audio_codec = CODEC_ID_MP2, @@ -1196,7 +1196,7 @@ AVOutputFormat ff_mpeg2vob_muxer = { MPEGENC_CLASS(svcd) AVOutputFormat ff_mpeg2svcd_muxer = { .name = "svcd", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"), + .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 PS (SVCD)"), .mime_type = "video/mpeg", .extensions = "vob", .priv_data_size = sizeof(MpegMuxContext), diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 3a5ed696c8..17329b9017 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2217,7 +2217,7 @@ void ff_mpegts_parse_close(MpegTSContext *ts) AVInputFormat ff_mpegts_demuxer = { .name = "mpegts", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"), + .long_name = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"), .priv_data_size = sizeof(MpegTSContext), .read_probe = mpegts_probe, .read_header = mpegts_read_header, @@ -2229,7 +2229,7 @@ AVInputFormat ff_mpegts_demuxer = { AVInputFormat ff_mpegtsraw_demuxer = { .name = "mpegtsraw", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 raw transport stream format"), + .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-TS (MPEG-2 Transport Stream)"), .priv_data_size = sizeof(MpegTSContext), .read_header = mpegts_read_header, .read_packet = mpegts_raw_read_packet, diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index aba266b615..5d74971490 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -1225,7 +1225,7 @@ static int mpegts_write_end(AVFormatContext *s) AVOutputFormat ff_mpegts_muxer = { .name = "mpegts", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"), + .long_name = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"), .mime_type = "video/x-mpegts", .extensions = "ts,m2t,m2ts,mts", .priv_data_size = sizeof(MpegTSWrite), diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index d4f711af88..b544d71f3f 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2241,7 +2241,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti AVInputFormat ff_mxf_demuxer = { .name = "mxf", - .long_name = NULL_IF_CONFIG_SMALL("Material eXchange Format"), + .long_name = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format)"), .priv_data_size = sizeof(MXFContext), .read_probe = mxf_probe, .read_header = mxf_read_header, diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 5fa7ea2467..987f27022b 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2158,7 +2158,7 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int AVOutputFormat ff_mxf_muxer = { .name = "mxf", - .long_name = NULL_IF_CONFIG_SMALL("Material eXchange Format"), + .long_name = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format)"), .mime_type = "application/mxf", .extensions = "mxf", .priv_data_size = sizeof(MXFContext), @@ -2173,7 +2173,7 @@ AVOutputFormat ff_mxf_muxer = { AVOutputFormat ff_mxf_d10_muxer = { .name = "mxf_d10", - .long_name = NULL_IF_CONFIG_SMALL("Material eXchange Format, D-10 Mapping"), + .long_name = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format) D-10 Mapping"), .mime_type = "application/mxf", .priv_data_size = sizeof(MXFContext), .audio_codec = CODEC_ID_PCM_S16LE, diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index d14824839b..f9b92f5b43 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -60,7 +60,7 @@ AVOutputFormat ff_adx_muxer = { #if CONFIG_CAVSVIDEO_MUXER AVOutputFormat ff_cavsvideo_muxer = { .name = "cavsvideo", - .long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS video"), + .long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS (Audio Video Standard) video"), .extensions = "cavs", .audio_codec = CODEC_ID_NONE, .video_codec = CODEC_ID_CAVS, diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index f68b7e65a1..11ffca93d4 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -1114,7 +1114,8 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt) break; case RTMP_PT_VIDEO: case RTMP_PT_AUDIO: - /* Audio and Video packets are parsed in get_packet() */ + case RTMP_PT_METADATA: + /* Audio, Video and Metadata packets are parsed in get_packet() */ break; default: av_log(s, AV_LOG_VERBOSE, "Unknown packet type received 0x%02X\n", pkt->type); diff --git a/libavformat/segment.c b/libavformat/segment.c index f96398b6c7..744c147990 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -385,7 +385,7 @@ static const AVClass seg_class = { AVOutputFormat ff_segment_muxer = { .name = "segment", - .long_name = NULL_IF_CONFIG_SMALL("segment muxer"), + .long_name = NULL_IF_CONFIG_SMALL("segment"), .priv_data_size = sizeof(SegmentContext), .flags = AVFMT_GLOBALHEADER | AVFMT_NOFILE, .write_header = seg_write_header, diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 10a2ed733a..f74f453a85 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -276,7 +276,7 @@ static av_cold int swf_read_close(AVFormatContext *avctx) AVInputFormat ff_swf_demuxer = { .name = "swf", - .long_name = NULL_IF_CONFIG_SMALL("Flash format"), + .long_name = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash)"), .priv_data_size = sizeof(SWFContext), .read_probe = swf_probe, .read_header = swf_read_header, diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index f56c58017b..9eb2540955 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -505,7 +505,7 @@ static int swf_write_trailer(AVFormatContext *s) #if CONFIG_SWF_MUXER AVOutputFormat ff_swf_muxer = { .name = "swf", - .long_name = NULL_IF_CONFIG_SMALL("Flash format"), + .long_name = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash)"), .mime_type = "application/x-shockwave-flash", .extensions = "swf", .priv_data_size = sizeof(SWFContext), @@ -520,7 +520,7 @@ AVOutputFormat ff_swf_muxer = { #if CONFIG_AVM2_MUXER AVOutputFormat ff_avm2_muxer = { .name = "avm2", - .long_name = NULL_IF_CONFIG_SMALL("Flash 9 (AVM2) format"), + .long_name = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash) (AVM2)"), .mime_type = "application/x-shockwave-flash", .priv_data_size = sizeof(SWFContext), .audio_codec = CODEC_ID_MP3, diff --git a/libavformat/tta.c b/libavformat/tta.c index 2de6f5fbe7..dc58dcda4d 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -160,7 +160,7 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp AVInputFormat ff_tta_demuxer = { .name = "tta", - .long_name = NULL_IF_CONFIG_SMALL("True Audio"), + .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"), .priv_data_size = sizeof(TTAContext), .read_probe = tta_probe, .read_header = tta_read_header, diff --git a/libavformat/wav.c b/libavformat/wav.c index 749b2c5808..caf01a2e7d 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -215,7 +215,7 @@ static const AVClass wav_muxer_class = { AVOutputFormat ff_wav_muxer = { .name = "wav", - .long_name = NULL_IF_CONFIG_SMALL("WAV format"), + .long_name = NULL_IF_CONFIG_SMALL("WAV / WAVE (Waveform Audio)"), .mime_type = "audio/x-wav", .extensions = "wav", .priv_data_size = sizeof(WAVContext), @@ -699,7 +699,7 @@ static const AVClass wav_demuxer_class = { }; AVInputFormat ff_wav_demuxer = { .name = "wav", - .long_name = NULL_IF_CONFIG_SMALL("WAV format"), + .long_name = NULL_IF_CONFIG_SMALL("WAV / WAVE (Waveform Audio)"), .priv_data_size = sizeof(WAVContext), .read_probe = wav_probe, .read_header = wav_read_header, diff --git a/libavformat/wv.c b/libavformat/wv.c index cc01ff16f4..95d5044dbd 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -64,6 +64,8 @@ typedef struct { int block_parsed; uint8_t extra[WV_EXTRA_SIZE]; int64_t pos; + + int64_t apetag_start; } WVContext; static int wv_probe(AVProbeData *p) @@ -88,6 +90,11 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, uint32_t chmask; wc->pos = avio_tell(pb); + + /* don't return bogus packets with the ape tag data */ + if (wc->apetag_start && wc->pos >= wc->apetag_start) + return AVERROR_EOF; + if (!append) { tag = avio_rl32(pb); if (tag != MKTAG('w', 'v', 'p', 'k')) @@ -252,7 +259,7 @@ static int wv_read_header(AVFormatContext *s) if (s->pb->seekable) { int64_t cur = avio_tell(s->pb); - ff_ape_parse_tag(s); + wc->apetag_start = ff_ape_parse_tag(s); if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) ff_id3v1_read(s); avio_seek(s->pb, cur, SEEK_SET); |