From 7851eb68c60e61497ec715f28f071c1527de1d38 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 22 Mar 2011 00:07:54 +0100 Subject: fate: add support for multithread testing Add a THREADS variable to fate calls. --- Makefile | 2 +- tests/fate-run.sh | 5 +++-- tests/regression-funcs.sh | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e3b7f1e686..2d97c8b375 100644 --- a/Makefile +++ b/Makefile @@ -290,7 +290,7 @@ fate: $(FATE) $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) @echo "TEST $(@:fate-%=%)" - $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' + $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' fate-list: @printf '%s\n' $(sort $(FATE)) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index c4a9a13e11..3a6b46b786 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -15,6 +15,7 @@ command=$5 cmp=${6:-diff} ref=${7:-"${base}/ref/fate/${test}"} fuzz=$8 +threads=${9:-1} outdir="tests/data/fate" outfile="${outdir}/${test}" @@ -48,7 +49,7 @@ run(){ } ffmpeg(){ - run ffmpeg -v 0 "$@" + run ffmpeg -v 0 -threads $threads "$@" } framecrc(){ @@ -77,7 +78,7 @@ regtest(){ cleanfiles="$cleanfiles $outfile $errfile" outfile=tests/data/regression/$2/$t errfile=tests/data/$t.$2.err - ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" + ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" } codectest(){ diff --git a/tests/regression-funcs.sh b/tests/regression-funcs.sh index 3ca3c9c77a..148a255556 100755 --- a/tests/regression-funcs.sh +++ b/tests/regression-funcs.sh @@ -9,6 +9,7 @@ test_ref=$2 raw_src_dir=$3 target_exec=$4 target_path=$5 +threads=${6:-1} datadir="./tests/data" target_datadir="${target_path}/${datadir}" @@ -52,7 +53,7 @@ echov(){ . $(dirname $0)/md5.sh -FFMPEG_OPTS="-v 0 -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact" +FFMPEG_OPTS="-v 0 -threads $threads -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact" run_ffmpeg() { -- cgit v1.2.3 From a96c176aed2ef7924941d690d6c3107ffe35c4cd Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 22 Mar 2011 00:13:48 +0100 Subject: fate: simplify regression-funcs.sh Factor ffmpeg calls using run_ffmpeg() --- tests/regression-funcs.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/regression-funcs.sh b/tests/regression-funcs.sh index 148a255556..4093656736 100755 --- a/tests/regression-funcs.sh +++ b/tests/regression-funcs.sh @@ -66,8 +66,7 @@ do_ffmpeg() f="$1" shift set -- $* ${target_path}/$f - $echov $ffmpeg $FFMPEG_OPTS $* - $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench + run_ffmpeg -benchmark $* > $bench do_md5sum $f >> $logfile if [ $f = $raw_dst ] ; then $tiny_psnr $f $raw_ref >> $logfile @@ -85,8 +84,7 @@ do_ffmpeg_nomd5() f="$1" shift set -- $* ${target_path}/$f - $echov $ffmpeg $FFMPEG_OPTS $* - $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench + run_ffmpeg -benchmark $* > $bench if [ $f = $raw_dst ] ; then $tiny_psnr $f $raw_ref >> $logfile elif [ $f = $pcm_dst ] ; then @@ -102,8 +100,7 @@ do_ffmpeg_crc() { f="$1" shift - $echov $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile" - $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile" + run_ffmpeg $* -f crc "$target_crcfile" echo "$f $(cat $crcfile)" >> $logfile } @@ -111,8 +108,7 @@ do_ffmpeg_nocheck() { f="$1" shift - $echov $ffmpeg $FFMPEG_OPTS $* - $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench + run_ffmpeg -benchmark $* > $bench expr "$(cat $bench)" : '.*utime=\(.*s\)' > $bench2 echo $(cat $bench2) $f >> $benchfile } -- cgit v1.2.3 From 15c5156d245af4c16ac4b1895495818ecdda2e41 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Tue, 22 Mar 2011 15:07:15 +0200 Subject: configure: Set the correct lib target for arm/wince dlltool The correct machine name for dlltool is arm-wince. Signed-off-by: Luca Barbato --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 19b9f9842d..00aa9ed9da 100755 --- a/configure +++ b/configure @@ -2407,7 +2407,7 @@ case $target_os in enable malloc_aligned LIBTARGET="i386:x86-64" elif enabled arm; then - LIBTARGET=arm + LIBTARGET=arm-wince fi shlibdir_default="$bindir_default" disable ffserver -- cgit v1.2.3 From e971d81364e93feae8c399075a3be2643192e031 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Tue, 22 Mar 2011 15:07:16 +0200 Subject: Document usage of import libraries created by dlltool Signed-off-by: Luca Barbato --- doc/general.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/general.texi b/doc/general.texi index f6c61a2342..1bce042569 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -1005,6 +1005,12 @@ libavutil/pixdesc.h you should have: extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[]; @end example +Note that using import libraries created by dlltool requires +the linker optimization option to be set to +"References: Keep Unreferenced Data (/OPT:NOREF)", otherwise +the resulting binaries will fail during runtime. This isn't +required when using import libraries generated by lib.exe. + @subsection Cross compilation for Windows with Linux You must use the MinGW cross compilation tools available at -- cgit v1.2.3 From e6e9823488b4cf42778411f1239592f0787e121e Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 20 Mar 2011 13:31:36 -0400 Subject: Add apply_window_int16() to DSPContext with x86-optimized versions and use it in the ac3_fixed encoder. --- libavcodec/ac3enc.c | 2 +- libavcodec/ac3enc_fixed.c | 10 +--- libavcodec/ac3enc_float.c | 4 +- libavcodec/ac3tab.c | 2 +- libavcodec/dsputil.c | 14 +++++ libavcodec/dsputil.h | 14 +++++ libavcodec/x86/dsputil_mmx.c | 40 ++++++++++++- libavcodec/x86/dsputil_yasm.asm | 126 ++++++++++++++++++++++++++++++++++++++++ tests/ref/acodec/ac3_fixed | 2 +- tests/ref/lavf/rm | 2 +- tests/ref/seek/ac3_rm | 30 ++++------ 11 files changed, 210 insertions(+), 36 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 202e611cc0..6a7610c322 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -167,7 +167,7 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct, static void mdct512(AC3MDCTContext *mdct, CoefType *out, SampleType *in); static void apply_window(DSPContext *dsp, SampleType *output, const SampleType *input, - const SampleType *window, int n); + const SampleType *window, unsigned int len); static int normalize_samples(AC3EncodeContext *s); diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index c3c7a63371..46f52e504a 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -252,15 +252,9 @@ static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in) * Apply KBD window to input samples prior to MDCT. */ static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input, - const int16_t *window, int n) + const int16_t *window, unsigned int len) { - int i; - int n2 = n >> 1; - - for (i = 0; i < n2; i++) { - output[i] = MUL16(input[i], window[i]) >> 15; - output[n-i-1] = MUL16(input[n-i-1], window[i]) >> 15; - } + dsp->apply_window_int16(output, input, window, len); } diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c index 91f73e5b44..d98025a483 100644 --- a/libavcodec/ac3enc_float.c +++ b/libavcodec/ac3enc_float.c @@ -83,9 +83,9 @@ static void mdct512(AC3MDCTContext *mdct, float *out, float *in) * Apply KBD window to input samples prior to MDCT. */ static void apply_window(DSPContext *dsp, float *output, const float *input, - const float *window, int n) + const float *window, unsigned int len) { - dsp->vector_fmul(output, input, window, n); + dsp->vector_fmul(output, input, window, len); } diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c index 0c5c642bdc..6a4d8cd0a2 100644 --- a/libavcodec/ac3tab.c +++ b/libavcodec/ac3tab.c @@ -141,7 +141,7 @@ const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 }; /* AC-3 MDCT window */ /* MDCT window */ -const int16_t ff_ac3_window[AC3_WINDOW_SIZE/2] = { +DECLARE_ALIGNED(16, const int16_t, ff_ac3_window)[AC3_WINDOW_SIZE/2] = { 4, 7, 12, 16, 21, 28, 34, 42, 51, 61, 72, 84, 97, 111, 127, 145, 164, 184, 207, 231, 257, 285, 315, 347, diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 1627262c22..15925f656b 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3890,6 +3890,19 @@ static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2, co return res; } +static void apply_window_int16_c(int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len) +{ + int i; + int len2 = len >> 1; + + for (i = 0; i < len2; i++) { + int16_t w = window[i]; + output[i] = (MUL16(input[i], w) + (1 << 14)) >> 15; + output[len-i-1] = (MUL16(input[len-i-1], w) + (1 << 14)) >> 15; + } +} + #define W0 2048 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ @@ -4364,6 +4377,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->vector_clipf = vector_clipf_c; c->scalarproduct_int16 = scalarproduct_int16_c; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; + c->apply_window_int16 = apply_window_int16_c; c->scalarproduct_float = scalarproduct_float_c; c->butterflies_float = butterflies_float_c; c->vector_fmul_scalar = vector_fmul_scalar_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 18885b3b79..a5ae68ab8b 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -524,6 +524,20 @@ typedef struct DSPContext { */ int32_t (*scalarproduct_and_madd_int16)(int16_t *v1/*align 16*/, const int16_t *v2, const int16_t *v3, int len, int mul); + /** + * Apply symmetric window in 16-bit fixed-point. + * @param output destination array + * constraints: 16-byte aligned + * @param input source array + * constraints: 16-byte aligned + * @param window window array + * constraints: 16-byte aligned, at least len/2 elements + * @param len full window length + * constraints: multiple of ? greater than zero + */ + void (*apply_window_int16)(int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len); + /* rv30 functions */ qpel_mc_func put_rv30_tpel_pixels_tab[4][16]; qpel_mc_func avg_rv30_tpel_pixels_tab[4][16]; diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index a611a71f06..4d1a3052ba 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2388,6 +2388,20 @@ int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2, int or int32_t ff_scalarproduct_and_madd_int16_mmx2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul); int32_t ff_scalarproduct_and_madd_int16_sse2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul); int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul); + +void ff_apply_window_int16_mmxext (int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len); +void ff_apply_window_int16_mmxext_ba (int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len); +void ff_apply_window_int16_sse2 (int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len); +void ff_apply_window_int16_sse2_ba (int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len); +void ff_apply_window_int16_ssse3 (int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len); +void ff_apply_window_int16_ssse3_atom(int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len); + void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top); int ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src, int w, int left); int ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, int w, int left); @@ -2749,6 +2763,11 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #if HAVE_YASM c->scalarproduct_int16 = ff_scalarproduct_int16_mmx2; c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmx2; + if (avctx->flags & CODEC_FLAG_BITEXACT) { + c->apply_window_int16 = ff_apply_window_int16_mmxext_ba; + } else { + c->apply_window_int16 = ff_apply_window_int16_mmxext; + } #endif } if(mm_flags & AV_CPU_FLAG_SSE){ @@ -2771,13 +2790,30 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #if HAVE_YASM c->scalarproduct_int16 = ff_scalarproduct_int16_sse2; c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2; + if (avctx->flags & CODEC_FLAG_BITEXACT) { + c->apply_window_int16 = ff_apply_window_int16_sse2_ba; + } else { + if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) { + c->apply_window_int16 = ff_apply_window_int16_sse2; + } + } c->emulated_edge_mc = emulated_edge_mc_sse; c->gmc= gmc_sse; #endif } - if((mm_flags & AV_CPU_FLAG_SSSE3) && !(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW)) && HAVE_YASM) // cachesplit - c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3; + if (mm_flags & AV_CPU_FLAG_SSSE3) { +#if HAVE_YASM + if (mm_flags & AV_CPU_FLAG_ATOM) { + c->apply_window_int16 = ff_apply_window_int16_ssse3_atom; + } else { + c->apply_window_int16 = ff_apply_window_int16_ssse3; + } + if (!(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW))) { // cachesplit + c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3; + } +#endif + } } if (CONFIG_ENCODERS) diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm index 07dd995599..f2c205b659 100644 --- a/libavcodec/x86/dsputil_yasm.asm +++ b/libavcodec/x86/dsputil_yasm.asm @@ -27,6 +27,8 @@ pb_zzzzzzzz77777777: times 8 db -1 pb_7: times 8 db 7 pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11 pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13 +pb_revwords: db 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1 +pd_16384: times 4 dd 16384 section .text align=16 @@ -202,6 +204,130 @@ SCALARPRODUCT_LOOP 0 RET +;----------------------------------------------------------------------------- +; void ff_apply_window_int16(int16_t *output, const int16_t *input, +; const int16_t *window, unsigned int len) +;----------------------------------------------------------------------------- + +%macro REVERSE_WORDS_MMXEXT 1-2 + pshufw %1, %1, 0x1B +%endmacro + +%macro REVERSE_WORDS_SSE2 1-2 + pshuflw %1, %1, 0x1B + pshufhw %1, %1, 0x1B + pshufd %1, %1, 0x4E +%endmacro + +%macro REVERSE_WORDS_SSSE3 2 + pshufb %1, %2 +%endmacro + +; dst = (dst * src) >> 15 +; pmulhw cuts off the bottom bit, so we have to lshift by 1 and add it back +; in from the pmullw result. +%macro MUL16FIXED_MMXEXT 3 ; dst, src, temp + mova %3, %1 + pmulhw %1, %2 + pmullw %3, %2 + psrlw %3, 15 + psllw %1, 1 + por %1, %3 +%endmacro + +; dst = ((dst * src) + (1<<14)) >> 15 +%macro MUL16FIXED_SSSE3 3 ; dst, src, unused + pmulhrsw %1, %2 +%endmacro + +%macro APPLY_WINDOW_INT16 3 ; %1=instruction set, %2=mmxext/sse2 bit exact version, %3=has_ssse3 +cglobal apply_window_int16_%1, 4,5,6, output, input, window, offset, offset2 + lea offset2q, [offsetq-mmsize] +%if %2 + mova m5, [pd_16384] +%elifidn %1, ssse3 + mova m5, [pb_revwords] + ALIGN 16 +%endif +.loop: +%if %2 + ; This version expands 16-bit to 32-bit, multiplies by the window, + ; adds 16384 for rounding, right shifts 15, then repacks back to words to + ; save to the output. The window is reversed for the second half. + mova m3, [windowq+offset2q] + mova m4, [ inputq+offset2q] + pxor m0, m0 + punpcklwd m0, m3 + punpcklwd m1, m4 + pmaddwd m0, m1 + paddd m0, m5 + psrad m0, 15 + pxor m2, m2 + punpckhwd m2, m3 + punpckhwd m1, m4 + pmaddwd m2, m1 + paddd m2, m5 + psrad m2, 15 + packssdw m0, m2 + mova [outputq+offset2q], m0 + REVERSE_WORDS m3 + mova m4, [ inputq+offsetq] + pxor m0, m0 + punpcklwd m0, m3 + punpcklwd m1, m4 + pmaddwd m0, m1 + paddd m0, m5 + psrad m0, 15 + pxor m2, m2 + punpckhwd m2, m3 + punpckhwd m1, m4 + pmaddwd m2, m1 + paddd m2, m5 + psrad m2, 15 + packssdw m0, m2 + mova [outputq+offsetq], m0 +%elif %3 + ; This version does the 16x16->16 multiplication in-place without expanding + ; to 32-bit. The ssse3 version is bit-identical. + mova m0, [windowq+offset2q] + mova m1, [ inputq+offset2q] + pmulhrsw m1, m0 + REVERSE_WORDS m0, m5 + pmulhrsw m0, [ inputq+offsetq ] + mova [outputq+offset2q], m1 + mova [outputq+offsetq ], m0 +%else + ; This version does the 16x16->16 multiplication in-place without expanding + ; to 32-bit. The mmxext and sse2 versions do not use rounding, and + ; therefore are not bit-identical to the C version. + mova m0, [windowq+offset2q] + mova m1, [ inputq+offset2q] + mova m2, [ inputq+offsetq ] + MUL16FIXED m1, m0, m3 + REVERSE_WORDS m0 + MUL16FIXED m2, m0, m3 + mova [outputq+offset2q], m1 + mova [outputq+offsetq ], m2 +%endif + add offsetd, mmsize + sub offset2d, mmsize + jae .loop + REP_RET +%endmacro + +INIT_MMX +%define REVERSE_WORDS REVERSE_WORDS_MMXEXT +%define MUL16FIXED MUL16FIXED_MMXEXT +APPLY_WINDOW_INT16 mmxext, 0, 0 +APPLY_WINDOW_INT16 mmxext_ba, 1, 0 +INIT_XMM +%define REVERSE_WORDS REVERSE_WORDS_SSE2 +APPLY_WINDOW_INT16 sse2, 0, 0 +APPLY_WINDOW_INT16 sse2_ba, 1, 0 +APPLY_WINDOW_INT16 ssse3_atom, 0, 1 +%define REVERSE_WORDS REVERSE_WORDS_SSSE3 +APPLY_WINDOW_INT16 ssse3, 0, 1 + ; void add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top) cglobal add_hfyu_median_prediction_mmx2, 6,6,0, dst, top, diff, w, left, left_top diff --git a/tests/ref/acodec/ac3_fixed b/tests/ref/acodec/ac3_fixed index 4ef69ffd93..d4ade32ddd 100644 --- a/tests/ref/acodec/ac3_fixed +++ b/tests/ref/acodec/ac3_fixed @@ -1,2 +1,2 @@ -b3a8f0a8809a58b2ece90744f06fff96 *./tests/data/acodec/ac3.rm +346073c97eada69330f61e103a170ca1 *./tests/data/acodec/ac3.rm 98751 ./tests/data/acodec/ac3.rm diff --git a/tests/ref/lavf/rm b/tests/ref/lavf/rm index 53b1255c83..bb0b1db6ed 100644 --- a/tests/ref/lavf/rm +++ b/tests/ref/lavf/rm @@ -1,2 +1,2 @@ -7da378131db880bcf2e58305d54418ec *./tests/data/lavf/lavf.rm +7b7ede9548a09346675edad36acfbf19 *./tests/data/lavf/lavf.rm 346706 ./tests/data/lavf/lavf.rm diff --git a/tests/ref/seek/ac3_rm b/tests/ref/seek/ac3_rm index 9b7db9ae9c..7b7d5b0bf7 100644 --- a/tests/ref/seek/ac3_rm +++ b/tests/ref/seek/ac3_rm @@ -1,45 +1,35 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret: 0 st: 0 flags:0 ts: 0.788000 -ret: 0 st: 0 flags:1 dts:12581.487000 pts:12581.487000 pos: 5822 size: 916 +ret:-1 st:-1 flags:1 ts: 1.894167 +ret:-1 st: 0 flags:0 ts: 0.788000 ret: 0 st: 0 flags:1 ts:-0.317000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts:524.800000 pts:524.800000 pos: 6155 size: 244 +ret:-1 st:-1 flags:0 ts: 2.576668 ret:-1 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:0 ts: 0.365000 -ret: 0 st: 0 flags:1 dts:12581.487000 pts:12581.487000 pos: 5822 size: 916 +ret:-1 st: 0 flags:0 ts: 0.365000 ret: 0 st: 0 flags:1 ts:-0.741000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st:-1 flags:0 ts: 2.153336 -ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 +ret:-1 st:-1 flags:1 ts: 1.047503 ret: 0 st: 0 flags:0 ts:-0.058000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret: 0 st: 0 flags:1 ts: 2.836000 -ret: 0 st: 0 flags:1 dts: 2.681000 pts: 2.681000 pos: 44105 size: 558 +ret:-1 st: 0 flags:1 ts: 2.836000 ret:-1 st:-1 flags:0 ts: 1.730004 -ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 +ret:-1 st:-1 flags:1 ts: 0.624171 ret: 0 st: 0 flags:0 ts:-0.482000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st: 0 flags:1 ts: 2.413000 ret:-1 st:-1 flags:0 ts: 1.306672 -ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 +ret:-1 st:-1 flags:1 ts: 0.200839 ret: 0 st: 0 flags:0 ts:-0.905000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st: 0 flags:1 ts: 1.989000 -ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts:12581.487000 pts:12581.487000 pos: 5822 size: 916 +ret:-1 st:-1 flags:0 ts: 0.883340 ret: 0 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st: 0 flags:0 ts: 2.672000 ret:-1 st: 0 flags:1 ts: 1.566000 -ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts:12581.487000 pts:12581.487000 pos: 5822 size: 916 +ret:-1 st:-1 flags:0 ts: 0.460008 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -- cgit v1.2.3 From 78e99e0f32b610a3cf302b2b35e500f4e9eaff07 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 22 Mar 2011 22:38:44 +0100 Subject: Do not use format string "%0.3f" for RTSP Range field. The format string was locale-depending. Signed-off-by: Ronald S. Bultje --- libavformat/rtspdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index ac1f22043f..571e76dfa9 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -60,8 +60,9 @@ static int rtsp_read_play(AVFormatContext *s) cmd[0] = 0; } else { snprintf(cmd, sizeof(cmd), - "Range: npt=%0.3f-\r\n", - (double)rt->seek_timestamp / AV_TIME_BASE); + "Range: npt=%"PRId64".%03"PRId64"-\r\n", + rt->seek_timestamp / AV_TIME_BASE, + rt->seek_timestamp / (AV_TIME_BASE / 1000) % 1000); } ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL); if (reply->status_code != RTSP_STATUS_OK) { -- cgit v1.2.3 From bc17bd90f51a6eb464746b2d5144e1ec57ca4bfb Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 21 Mar 2011 09:05:36 +0100 Subject: matroskaenc: simplify get_aac_sample_rates by using ff_mpeg4audio_get_config This also fixes broken SBR detection, which produced files with double sample rate since 8ae0fa2. Signed-off-by: Ronald S. Bultje --- libavformat/matroskaenc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index fba7dbc564..0ab1832cb7 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -439,28 +439,15 @@ static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContex static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int *sample_rate, int *output_sample_rate) { int sri; + MPEG4AudioConfig mp4ac; - if (codec->extradata_size < 2) { - av_log(s, AV_LOG_WARNING, "No AAC extradata, unable to determine samplerate.\n"); + if (ff_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) { + av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n"); return; } - sri = ((codec->extradata[0] << 1) & 0xE) | (codec->extradata[1] >> 7); - if (sri > 12) { - av_log(s, AV_LOG_WARNING, "AAC samplerate index out of bounds\n"); - return; - } - *sample_rate = ff_mpeg4audio_sample_rates[sri]; - - // if sbr, get output sample rate as well - if (codec->extradata_size == 5) { - sri = (codec->extradata[4] >> 3) & 0xF; - if (sri > 12) { - av_log(s, AV_LOG_WARNING, "AAC output samplerate index out of bounds\n"); - return; - } - *output_sample_rate = ff_mpeg4audio_sample_rates[sri]; - } + *sample_rate = mp4ac.sample_rate; + *output_sample_rate = mp4ac.ext_sample_rate; } static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec, int native_id, int qt_id) -- cgit v1.2.3 From 3dd851c46b21e858a3fd9a99d8e659a6d0baa868 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Mar 2011 21:58:13 +0100 Subject: lavc: move the version macros to a new installed header. Signed-off-by: Ronald S. Bultje --- libavcodec/Makefile | 2 +- libavcodec/avcodec.h | 52 +----------------------------------- libavcodec/version.h | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 52 deletions(-) create mode 100644 libavcodec/version.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 91dcdbe527..85d9a34f3e 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -3,7 +3,7 @@ include $(SUBDIR)../config.mak NAME = avcodec FFLIBS = avutil -HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h +HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h version.h xvmc.h OBJS = allcodecs.o \ audioconvert.o \ diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 5b046790d2..57e46f82a6 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -31,57 +31,7 @@ #include "libavutil/avutil.h" #include "libavutil/cpu.h" -#define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 114 -#define LIBAVCODEC_VERSION_MICRO 0 - -#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT - -#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) - -/** - * Those FF_API_* defines are not part of public API. - * They may change, break or disappear at any time. - */ -#ifndef FF_API_PALETTE_CONTROL -#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_MM_FLAGS -#define FF_API_MM_FLAGS (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_OPT_SHOW -#define FF_API_OPT_SHOW (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_AUDIO_OLD -#define FF_API_AUDIO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_VIDEO_OLD -#define FF_API_VIDEO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_SUBTITLE_OLD -#define FF_API_SUBTITLE_OLD (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_USE_LPC -#define FF_API_USE_LPC (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_SET_STRING_OLD -#define FF_API_SET_STRING_OLD (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_INOFFICIAL -#define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_OLD_SAMPLE_FMT -#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 53) -#endif -#ifndef FF_API_OLD_AUDIOCONVERT -#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53) -#endif +#include "libavcodec/version.h" #if LIBAVCODEC_VERSION_MAJOR < 53 # define FF_INTERNALC_MEM_TYPE unsigned int diff --git a/libavcodec/version.h b/libavcodec/version.h new file mode 100644 index 0000000000..fe608c78db --- /dev/null +++ b/libavcodec/version.h @@ -0,0 +1,75 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +#define LIBAVCODEC_VERSION_MAJOR 52 +#define LIBAVCODEC_VERSION_MINOR 114 +#define LIBAVCODEC_VERSION_MICRO 0 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_PALETTE_CONTROL +#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_MM_FLAGS +#define FF_API_MM_FLAGS (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_OPT_SHOW +#define FF_API_OPT_SHOW (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_AUDIO_OLD +#define FF_API_AUDIO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_VIDEO_OLD +#define FF_API_VIDEO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_SUBTITLE_OLD +#define FF_API_SUBTITLE_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_USE_LPC +#define FF_API_USE_LPC (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_SET_STRING_OLD +#define FF_API_SET_STRING_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_INOFFICIAL +#define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_OLD_SAMPLE_FMT +#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_OLD_AUDIOCONVERT +#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53) +#endif + +#endif /* AVCODEC_VERSION_H */ -- cgit v1.2.3 From b9d2f4a956dc7cfdf8b8ca1f3be4f26c752c8a22 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 23 Mar 2011 09:39:00 +0000 Subject: configure: get libavcodec version from new version.h header This fixes shared library versioning after 3dd851c. Signed-off-by: Mans Rullgard --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 00aa9ed9da..bde1dad1c4 100755 --- a/configure +++ b/configure @@ -3286,7 +3286,7 @@ get_version(){ get_version LIBSWSCALE libswscale/swscale.h get_version LIBPOSTPROC libpostproc/postprocess.h -get_version LIBAVCODEC libavcodec/avcodec.h +get_version LIBAVCODEC libavcodec/version.h get_version LIBAVDEVICE libavdevice/avdevice.h get_version LIBAVFORMAT libavformat/version.h get_version LIBAVUTIL libavutil/avutil.h -- cgit v1.2.3 From 1b7ecc1662956fc30d20bdcdbc0617127b2976cc Mon Sep 17 00:00:00 2001 From: Tomas Härdin Date: Mon, 21 Mar 2011 12:06:56 +0100 Subject: Add xd55 codec tag for XDCAM HD422 720p25 CBR files. Signed-off-by: Ronald S. Bultje --- libavformat/isom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/isom.c b/libavformat/isom.c index 6c380c1a12..c65f9317e7 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -157,6 +157,7 @@ const AVCodecTag codec_movvideo_tags[] = { { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'n') }, /* MPEG2 IMX NTSC 525/60 30mb/s produced by FCP */ { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'p') }, /* MPEG2 IMX PAL 625/50 30mb/s produced by FCP */ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '4') }, /* XDCAM HD422 720p24 CBR */ + { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '5') }, /* XDCAM HD422 720p25 CBR */ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '9') }, /* XDCAM HD422 720p60 CBR */ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'a') }, /* XDCAM HD422 720p50 CBR */ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'b') }, /* XDCAM HD422 1080i60 CBR */ -- cgit v1.2.3 From 28e9c42afbf0088aa1f4280a95d304dca4b675a0 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Wed, 23 Mar 2011 10:26:22 +0200 Subject: rtsp: Don't use a locale dependent format string In this particular case, we aren't ever printing anything else than 0.000 anyway. Signed-off-by: Ronald S. Bultje --- libavformat/rtspenc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index c163f4ce68..1f1fd32fc1 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -103,8 +103,7 @@ static int rtsp_write_record(AVFormatContext *s) char cmd[1024]; snprintf(cmd, sizeof(cmd), - "Range: npt=%0.3f-\r\n", - (double) 0); + "Range: npt=0.000-\r\n"); ff_rtsp_send_cmd(s, "RECORD", rt->control_uri, cmd, reply, NULL); if (reply->status_code != RTSP_STATUS_OK) return -1; -- cgit v1.2.3 From 91bcad197175bf82610ea52498854b5b0ed73de0 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 23 Mar 2011 11:24:10 +0000 Subject: Disable 'attribute "foo" ignored' warnings from icc ICC lies about the version of gcc it emulates, which results in unsupported attributes sometimes being used. The warning is an annoyance and should be disabled. Signed-off-by: Mans Rullgard --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index bde1dad1c4..316b849aa7 100755 --- a/configure +++ b/configure @@ -2987,10 +2987,11 @@ if enabled icc; then check_cflags -w1 # -wd: Disable following warnings # 144, 167, 556: -Wno-pointer-sign + # 1292: attribute "foo" ignored # 10006: ignoring unknown option -fno-signed-zeros # 10148: ignoring unknown option -Wno-parentheses # 10156: ignoring option '-W'; no argument required - check_cflags -wd144,167,556,10006,10148,10156 + check_cflags -wd144,167,556,1292,10006,10148,10156 # 11030: Warning unknown option --as-needed # 10156: ignoring option '-export'; no argument required check_ldflags -wd10156,11030 -- cgit v1.2.3 From 820818a330b0918557bf8403d10bec95c9b6ace7 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 23 Mar 2011 11:30:44 +0000 Subject: Remove unnecessary icc version checks With unknown attribute warnings disabled, these checks are no longer needed. Removing them improves readability while having no effect on generated code. Signed-off-by: Mans Rullgard --- libavutil/attributes.h | 6 +++--- libavutil/internal.h | 2 +- libavutil/mem.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavutil/attributes.h b/libavutil/attributes.h index 4ee0dde01a..4abe78f3bf 100644 --- a/libavutil/attributes.h +++ b/libavutil/attributes.h @@ -65,7 +65,7 @@ #endif #ifndef av_cold -#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3) +#if AV_GCC_VERSION_AT_LEAST(4,3) # define av_cold __attribute__((cold)) #else # define av_cold @@ -73,7 +73,7 @@ #endif #ifndef av_flatten -#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1) +#if AV_GCC_VERSION_AT_LEAST(4,1) # define av_flatten __attribute__((flatten)) #else # define av_flatten @@ -110,7 +110,7 @@ #endif #ifndef av_alias -#if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(3,3) +#if AV_GCC_VERSION_AT_LEAST(3,3) # define av_alias __attribute__((may_alias)) #else # define av_alias diff --git a/libavutil/internal.h b/libavutil/internal.h index ac2ad17f70..37bc6810f6 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -39,7 +39,7 @@ #include "timer.h" #ifndef attribute_align_arg -#if ARCH_X86_32 && (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(4,2) +#if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2) # define attribute_align_arg __attribute__((force_align_arg_pointer)) #else # define attribute_align_arg diff --git a/libavutil/mem.h b/libavutil/mem.h index da8ad892c1..f52777b071 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -56,7 +56,7 @@ #define av_malloc_attrib #endif -#if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(4,3) +#if AV_GCC_VERSION_AT_LEAST(4,3) #define av_alloc_size(n) __attribute__((alloc_size(n))) #else #define av_alloc_size(n) -- cgit v1.2.3 From 491653ed90e12feefada217a59af9cd69cc7ca31 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 23 Mar 2011 11:58:02 +0000 Subject: avio: cosmetics - nicer vertical alignment. Signed-off-by: Mans Rullgard --- libavformat/avio.h | 2 +- libavformat/avio_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 753fa0cc89..d11c3984f8 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -416,7 +416,7 @@ attribute_deprecated void put_tag(AVIOContext *s, const char *tag); */ attribute_deprecated int av_url_read_fpause(AVIOContext *h, int pause); -attribute_deprecated int64_t av_url_read_fseek( AVIOContext *h, int stream_index, +attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_index, int64_t timestamp, int flags); /** diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 7dd9bdf6a0..406101618e 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -67,7 +67,7 @@ uint64_t ffio_read_varlen(AVIOContext *bc); int ffio_set_buf_size(AVIOContext *s, int buf_size); int ffio_read_pause(AVIOContext *h, int pause); -int64_t ffio_read_seek( AVIOContext *h, int stream_index, +int64_t ffio_read_seek (AVIOContext *h, int stream_index, int64_t timestamp, int flags); -- cgit v1.2.3 From 264935c96212c922e63c1fdb3c6ebf0bfce5c45d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 23 Mar 2011 11:09:34 +0100 Subject: matroskaenc: remove a variable that's unused after bc17bd9. Signed-off-by: Ronald S. Bultje --- libavformat/matroskaenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 0ab1832cb7..4f9bf0a723 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -438,7 +438,6 @@ static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContex static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int *sample_rate, int *output_sample_rate) { - int sri; MPEG4AudioConfig mp4ac; if (ff_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) { -- cgit v1.2.3 From 4377fafda100117f75d62ba91bce6d8509e01a50 Mon Sep 17 00:00:00 2001 From: Vladimir Pantelic Date: Thu, 17 Mar 2011 22:34:52 +0100 Subject: asfdec: also subtract preroll when reading simple index object This was missed when ASF was changed to return timestamps without preroll. Signed-off-by: Mans Rullgard --- libavformat/asfdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 15dc55b823..14ef2a5c37 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -1219,10 +1219,10 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) int pktnum=avio_rl32(s->pb); int pktct =avio_rl16(s->pb); int64_t pos = s->data_offset + s->packet_size*(int64_t)pktnum; - int64_t index_pts= av_rescale(itime, i, 10000); + int64_t index_pts= FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0); if(pos != last_pos){ - av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d\n", pktnum, pktct); + av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d pts: %"PRId64"\n", pktnum, pktct, index_pts); av_add_index_entry(s->streams[stream_index], pos, index_pts, s->packet_size, 0, AVINDEX_KEYFRAME); last_pos=pos; } -- cgit v1.2.3 From 4ec153bb66a95da46c98e269bd0aa787e6172ed3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 8 Mar 2011 10:35:52 +0100 Subject: avio: make udp_set_remote_url/get_local_port internal. --- doc/protocols.texi | 4 ++-- libavformat/avio.h | 6 +++--- libavformat/avio_internal.h | 4 ++++ libavformat/rtpproto.c | 11 ++++++----- libavformat/udp.c | 7 ++++--- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index a17d66362a..83c238f346 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -433,9 +433,9 @@ set the time to live value (for multicast only) @item connect=@var{1|0} Initialize the UDP socket with @code{connect()}. In this case, the -destination address can't be changed with udp_set_remote_url later. +destination address can't be changed with ff_udp_set_remote_url later. If the destination address isn't known at the start, this option can -be specified in udp_set_remote_url, too. +be specified in ff_udp_set_remote_url, too. This allows finding out the source address for the packets with getsockname, and makes writes return with AVERROR(ECONNREFUSED) if "destination unreachable" is received. diff --git a/libavformat/avio.h b/libavformat/avio.h index d11c3984f8..07a893e312 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -448,6 +448,9 @@ attribute_deprecated void put_flush_packet(AVIOContext *s); */ attribute_deprecated int url_feof(AVIOContext *s); attribute_deprecated int url_ferror(AVIOContext *s); + +attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri); +attribute_deprecated int udp_get_local_port(URLContext *h); #endif AVIOContext *avio_alloc_context( @@ -675,9 +678,6 @@ void init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum); -/* udp.c */ -int udp_set_remote_url(URLContext *h, const char *uri); -int udp_get_local_port(URLContext *h); #if FF_API_UDP_GET_FILE int udp_get_file_handle(URLContext *h); #endif diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 406101618e..6eee947383 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -70,5 +70,9 @@ int ffio_read_pause(AVIOContext *h, int pause); int64_t ffio_read_seek (AVIOContext *h, int stream_index, int64_t timestamp, int flags); +/* udp.c */ +int ff_udp_set_remote_url(URLContext *h, const char *uri); +int ff_udp_get_local_port(URLContext *h); + #endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 7b86c2f8bb..6b537c88ec 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -27,6 +27,7 @@ #include "libavutil/parseutils.h" #include "libavutil/avstring.h" #include "avformat.h" +#include "avio_internal.h" #include "rtpdec.h" #include @@ -71,10 +72,10 @@ int rtp_set_remote_url(URLContext *h, const char *uri) path, sizeof(path), uri); ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path); - udp_set_remote_url(s->rtp_hd, buf); + ff_udp_set_remote_url(s->rtp_hd, buf); ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port + 1, "%s", path); - udp_set_remote_url(s->rtcp_hd, buf); + ff_udp_set_remote_url(s->rtcp_hd, buf); return 0; } @@ -191,7 +192,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags) if (url_open(&s->rtp_hd, buf, flags) < 0) goto fail; if (local_rtp_port>=0 && local_rtcp_port<0) - local_rtcp_port = udp_get_local_port(s->rtp_hd) + 1; + local_rtcp_port = ff_udp_get_local_port(s->rtp_hd) + 1; build_udp_url(buf, sizeof(buf), hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size, @@ -326,7 +327,7 @@ static int rtp_close(URLContext *h) int rtp_get_local_rtp_port(URLContext *h) { RTPContext *s = h->priv_data; - return udp_get_local_port(s->rtp_hd); + return ff_udp_get_local_port(s->rtp_hd); } /** @@ -338,7 +339,7 @@ int rtp_get_local_rtp_port(URLContext *h) int rtp_get_local_rtcp_port(URLContext *h) { RTPContext *s = h->priv_data; - return udp_get_local_port(s->rtcp_hd); + return ff_udp_get_local_port(s->rtcp_hd); } static int rtp_get_file_handle(URLContext *h) diff --git a/libavformat/udp.c b/libavformat/udp.c index 660229810d..8d50218f19 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -27,6 +27,7 @@ #define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */ #define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */ #include "avformat.h" +#include "avio_internal.h" #include "libavutil/parseutils.h" #include #include "internal.h" @@ -243,7 +244,7 @@ static int udp_port(struct sockaddr_storage *addr, int addr_len) * @param uri of the remote server * @return zero if no error. */ -int udp_set_remote_url(URLContext *h, const char *uri) +int ff_udp_set_remote_url(URLContext *h, const char *uri) { UDPContext *s = h->priv_data; char hostname[256], buf[10]; @@ -282,7 +283,7 @@ int udp_set_remote_url(URLContext *h, const char *uri) * @param h media file context * @return the local port number */ -int udp_get_local_port(URLContext *h) +int ff_udp_get_local_port(URLContext *h) { UDPContext *s = h->priv_data; return s->local_port; @@ -365,7 +366,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) if (flags & URL_WRONLY) goto fail; } else { - if (udp_set_remote_url(h, uri) < 0) + if (ff_udp_set_remote_url(h, uri) < 0) goto fail; } -- cgit v1.2.3