diff --git a/Makefile b/Makefile index 467691bc7e..3bb4112c1a 100644 --- a/Makefile +++ b/Makefile @@ -64,9 +64,10 @@ config.h: .config @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n' @-tput sgr0 2>/dev/null -SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \ - ALTIVEC-OBJS MMX-OBJS NEON-OBJS YASM-OBJS \ - HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS TOOLS +SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ + ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \ + ALTIVEC-OBJS ARMV6-OBJS MMX-OBJS NEON-OBJS YASM-OBJS \ + OBJS TESTOBJS define RESET $(1) := diff --git a/configure b/configure index 868ae2bc00..0afbf99fa1 100755 --- a/configure +++ b/configure @@ -1545,7 +1545,7 @@ vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" # parsers -h264_parser_select="golomb h264chroma h264dsp h264pred h264qpel" +h264_parser_select="golomb h264dsp h264pred" # external libraries libaacplus_encoder_deps="libaacplus" diff --git a/doc/APIchanges b/doc/APIchanges index 1cdcd1883d..ebd9525499 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -38,22 +38,23 @@ API changes, most recent first: 2012-01-24 - xxxxxxx - lavfi 2.60.100 Add avfilter_graph_dump. -2012-xx-xx - lavc 54.8.0 - xxxxxxx Add av_get_exact_bits_per_sample() - xxxxxxx Add av_get_audio_frame_duration() +2012-03-05 - lavc 54.8.0 + 6699d07 Add av_get_exact_bits_per_sample() + 9524cf7 Add av_get_audio_frame_duration() -2012-03-xx - xxxxxxx - lavc 54.7.0 - avcodec.h +2012-03-04 - 44fe77b - lavc 54.7.0 - avcodec.h Add av_codec_is_encoder/decoder(). -2012-xx-xx - xxxxxxx - lavc 54.3.0 - avcodec.h +2012-03-01 - 442c132 - lavc 54.3.0 - avcodec.h Add av_packet_shrink_side_data. -2012-xx-xx - xxxxxxx - lavf 54.2.0 - avformat.h +2012-02-29 - dd2a4bc - lavf 54.2.0 - avformat.h Add AVStream.attached_pic and AV_DISPOSITION_ATTACHED_PIC, used for dealing with attached pictures/cover art. 2012-02-25 - c9bca80 - lavu 51.24.0 - error.h Add AVERROR_UNKNOWN + NOTE: this was backported to 0.8 2012-02-20 - e9cda85 - lavc 54.2.0 Add duration field to AVCodecParserContext @@ -74,13 +75,16 @@ API changes, most recent first: 2012-01-31 - dd6d3b0 - lavf 54.01.0 Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags(). + NOTE: this was backported to 0.8 2012-01-31 - af08d9a - lavc 54.01.0 Add avcodec_is_open() function. + NOTE: this was backported to 0.8 2012-01-30 - 8b93312 - lavu 51.22.0 - intfloat.h Add a new installed header libavutil/intfloat.h with int/float punning functions. + NOTE: this was backported to 0.8 2012-01-25 - lavf 53.22.0 f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible @@ -286,9 +290,12 @@ API changes, most recent first: 2011-07-10 - a67c061 - lavf 53.6.0 Add avformat_find_stream_info(), deprecate av_find_stream_info(). + NOTE: this was backported to 0.7 2011-07-10 - 0b950fe - lavc 53.8.0 Add avcodec_open2(), deprecate avcodec_open(). + NOTE: this was backported to 0.7 + Add avcodec_alloc_context3. Deprecate avcodec_alloc_context() and avcodec_alloc_context2(). diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ec29ce5ef1..ba7b4b8963 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -763,8 +763,6 @@ HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \ dv_tablegen motionpixels_tablegen mpegaudio_tablegen \ pcm_tablegen qdm2_tablegen sinewin_tablegen -DIRS = alpha arm avr32 bfin mips ppc sh4 sparc x86 - CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 83e0d810e6..8ba7b805ad 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -602,29 +602,30 @@ buf_alloc_fail: static int alac_set_info(ALACContext *alac) { - const unsigned char *ptr = alac->avctx->extradata; + GetByteContext gb; - ptr += 4; /* size */ - ptr += 4; /* alac */ - ptr += 4; /* version */ + bytestream2_init(&gb, alac->avctx->extradata, + alac->avctx->extradata_size); - if(AV_RB32(ptr) >= UINT_MAX/4){ - av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n"); - return -1; - } + bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4 /* buffer size / 2 ? */ - alac->setinfo_max_samples_per_frame = bytestream_get_be32(&ptr); - ptr++; /* compatible version */ - alac->setinfo_sample_size = *ptr++; - alac->setinfo_rice_historymult = *ptr++; - alac->setinfo_rice_initialhistory = *ptr++; - alac->setinfo_rice_kmodifier = *ptr++; - alac->numchannels = *ptr++; - bytestream_get_be16(&ptr); /* maxRun */ - bytestream_get_be32(&ptr); /* max coded frame size */ - bytestream_get_be32(&ptr); /* average bitrate */ - bytestream_get_be32(&ptr); /* samplerate */ + alac->setinfo_max_samples_per_frame = bytestream2_get_be32u(&gb); + if (alac->setinfo_max_samples_per_frame >= UINT_MAX/4){ + av_log(alac->avctx, AV_LOG_ERROR, + "setinfo_max_samples_per_frame too large\n"); + return AVERROR_INVALIDDATA; + } + bytestream2_skipu(&gb, 1); // compatible version + alac->setinfo_sample_size = bytestream2_get_byteu(&gb); + alac->setinfo_rice_historymult = bytestream2_get_byteu(&gb); + alac->setinfo_rice_initialhistory = bytestream2_get_byteu(&gb); + alac->setinfo_rice_kmodifier = bytestream2_get_byteu(&gb); + alac->numchannels = bytestream2_get_byteu(&gb); + bytestream2_get_be16u(&gb); // maxRun + bytestream2_get_be32u(&gb); // max coded frame size + bytestream2_get_be32u(&gb); // average bitrate + bytestream2_get_be32u(&gb); // samplerate return 0; } diff --git a/libavcodec/alpha/Makefile b/libavcodec/alpha/Makefile index 2779a2316a..e55fe49b7b 100644 --- a/libavcodec/alpha/Makefile +++ b/libavcodec/alpha/Makefile @@ -1,6 +1,6 @@ -OBJS += alpha/dsputil_alpha.o \ - alpha/dsputil_alpha_asm.o \ - alpha/motion_est_alpha.o \ - alpha/motion_est_mvi_asm.o \ - alpha/mpegvideo_alpha.o \ - alpha/simple_idct_alpha.o \ +OBJS += alpha/dsputil_alpha.o \ + alpha/dsputil_alpha_asm.o \ + alpha/motion_est_alpha.o \ + alpha/motion_est_mvi_asm.o \ + alpha/mpegvideo_alpha.o \ + alpha/simple_idct_alpha.o \ diff --git a/libavcodec/bfin/Makefile b/libavcodec/bfin/Makefile index e50e3cd669..6b3e7cf67c 100644 --- a/libavcodec/bfin/Makefile +++ b/libavcodec/bfin/Makefile @@ -1,7 +1,7 @@ -OBJS += bfin/dsputil_bfin.o \ - bfin/fdct_bfin.o \ - bfin/idct_bfin.o \ - bfin/mpegvideo_bfin.o \ - bfin/pixels_bfin.o \ - bfin/vp3_bfin.o \ - bfin/vp3_idct_bfin.o \ +OBJS += bfin/dsputil_bfin.o \ + bfin/fdct_bfin.o \ + bfin/idct_bfin.o \ + bfin/mpegvideo_bfin.o \ + bfin/pixels_bfin.o \ + bfin/vp3_bfin.o \ + bfin/vp3_idct_bfin.o \ diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile index 8e37fc791d..d15fe2a1c9 100644 --- a/libavcodec/ppc/Makefile +++ b/libavcodec/ppc/Makefile @@ -1,19 +1,16 @@ OBJS += ppc/dsputil_ppc.o \ +FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o +ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \ + $(FFT-OBJS-yes) ALTIVEC-OBJS-$(CONFIG_H264DSP) += ppc/h264_altivec.o +ALTIVEC-OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodec_altivec.o ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o ALTIVEC-OBJS-$(CONFIG_VP3_DECODER) += ppc/vp3dsp_altivec.o ALTIVEC-OBJS-$(CONFIG_VP5_DECODER) += ppc/vp3dsp_altivec.o ALTIVEC-OBJS-$(CONFIG_VP6_DECODER) += ppc/vp3dsp_altivec.o ALTIVEC-OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o -ALTIVEC-OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodec_altivec.o - -FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o \ - -ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \ - $(FFT-OBJS-yes) - OBJS-$(HAVE_ALTIVEC) += ppc/dsputil_altivec.o \ ppc/fdct_altivec.o \ ppc/float_altivec.o \ diff --git a/libavcodec/sh4/Makefile b/libavcodec/sh4/Makefile index 142cba47d1..aa17eabd6e 100644 --- a/libavcodec/sh4/Makefile +++ b/libavcodec/sh4/Makefile @@ -1,3 +1,3 @@ -OBJS += sh4/dsputil_align.o \ - sh4/dsputil_sh4.o \ - sh4/idct_sh4.o \ +OBJS += sh4/dsputil_align.o \ + sh4/dsputil_sh4.o \ + sh4/idct_sh4.o \ diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 3c979ebbfa..04994b2d0c 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -362,17 +362,17 @@ static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *la static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; SmackVContext * const smk = avctx->priv_data; uint8_t *out; uint32_t *pal; + GetByteContext gb2; GetBitContext gb; int blocks, blk, bw, bh; int i; int stride; + int flags; - if(buf_size <= 769) + if (avpkt->size <= 769) return 0; smk->pic.reference = 3; @@ -384,23 +384,23 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac /* make the palette available on the way out */ pal = (uint32_t*)smk->pic.data[1]; - smk->pic.palette_has_changed = buf[0] & 1; - smk->pic.key_frame = !!(buf[0] & 2); + bytestream2_init(&gb2, avpkt->data, avpkt->size); + flags = bytestream2_get_byteu(&gb2); + smk->pic.palette_has_changed = flags & 1; + smk->pic.key_frame = !!(flags & 2); if(smk->pic.key_frame) smk->pic.pict_type = AV_PICTURE_TYPE_I; else smk->pic.pict_type = AV_PICTURE_TYPE_P; - buf++; for(i = 0; i < 256; i++) - *pal++ = 0xFF << 24 | bytestream_get_be24(&buf); - buf_size -= 769; + *pal++ = 0xFF << 24 | bytestream2_get_be24u(&gb2); last_reset(smk->mmap_tbl, smk->mmap_last); last_reset(smk->mclr_tbl, smk->mclr_last); last_reset(smk->full_tbl, smk->full_last); last_reset(smk->type_tbl, smk->type_last); - init_get_bits(&gb, buf, buf_size * 8); + init_get_bits(&gb, avpkt->data + 769, (avpkt->size - 769) * 8); blk = 0; bw = avctx->width >> 2; @@ -511,7 +511,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac *(AVFrame*)data = smk->pic; /* always report that the buffer was completely consumed */ - return buf_size; + return avpkt->size; } diff --git a/libavcodec/sparc/Makefile b/libavcodec/sparc/Makefile index 4b387461c2..d42bed0779 100644 --- a/libavcodec/sparc/Makefile +++ b/libavcodec/sparc/Makefile @@ -1,2 +1,2 @@ -OBJS-$(HAVE_VIS) += sparc/dsputil_vis.o \ - sparc/simple_idct_vis.o \ +OBJS-$(HAVE_VIS) += sparc/dsputil_vis.o \ + sparc/simple_idct_vis.o \ diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 267cf241b7..b0a1c7ef77 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -1,80 +1,6 @@ OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o - -YASM-OBJS-$(CONFIG_DCT) += x86/dct32_sse.o - -YASM-OBJS-FFT-$(HAVE_AMD3DNOW) += x86/fft_3dn.o -YASM-OBJS-FFT-$(HAVE_AMD3DNOWEXT) += x86/fft_3dn2.o -YASM-OBJS-FFT-$(HAVE_SSE) += x86/fft_sse.o -YASM-OBJS-$(CONFIG_FFT) += x86/fft_mmx.o \ - $(YASM-OBJS-FFT-yes) - -YASM-OBJS-$(CONFIG_DWT) += x86/dwt_yasm.o - -YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \ - x86/h264_chromamc_10bit.o - -MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_mmx.o -YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \ - x86/h264_deblock_10bit.o \ - x86/h264_idct.o \ - x86/h264_idct_10bit.o \ - x86/h264_weight.o \ - x86/h264_weight_10bit.o \ - -YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o \ - x86/h264_intrapred_10bit.o -MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o -YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_10bit.o - -MMX-OBJS-$(CONFIG_RV30_DECODER) += x86/rv34dsp_init.o -YASM-OBJS-$(CONFIG_RV30_DECODER) += x86/rv34dsp.o -MMX-OBJS-$(CONFIG_RV40_DECODER) += x86/rv34dsp_init.o \ - x86/rv40dsp_init.o -YASM-OBJS-$(CONFIG_RV40_DECODER) += x86/rv34dsp.o \ - x86/rv40dsp.o - -YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o - -YASM-OBJS-$(CONFIG_DIRAC_DECODER) += x86/diracdsp_mmx.o x86/diracdsp_yasm.o - -MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_mmx.o -YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o -MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o -MMX-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhd_mmx.o -MMX-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec_mmx.o -YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36_sse.o -MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o -YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_yasm.o -MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o -MMX-OBJS-$(CONFIG_LPC) += x86/lpc_mmx.o -YASM-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp.o -MMX-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp-init.o -YASM-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp.o -MMX-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp-init.o -YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o -MMX-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp-init.o -MMX-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o -YASM-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp.o -MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o \ - x86/dwt.o -YASM-OBJS-$(CONFIG_V210_DECODER) += x86/v210.o -MMX-OBJS-$(CONFIG_V210_DECODER) += x86/v210-init.o -MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o -YASM-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp.o -YASM-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp.o -MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp56dsp_init.o -YASM-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp.o \ - x86/vp56dsp.o -MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp56dsp_init.o -YASM-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp.o -MMX-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp-init.o -MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \ - x86/deinterlace.o \ - x86/fmtconvert.o \ - $(YASM-OBJS-yes) - -MMX-OBJS-$(CONFIG_FFT) += x86/fft.o +OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o OBJS-$(HAVE_MMX) += x86/dsputil_mmx.o \ x86/fdct_mmx.o \ @@ -85,4 +11,70 @@ OBJS-$(HAVE_MMX) += x86/dsputil_mmx.o \ x86/mpegvideo_mmx.o \ x86/simple_idct_mmx.o \ -OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o +MMX-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o +MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_mmx.o +MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o +MMX-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhd_mmx.o +MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o \ + x86/dwt.o +MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o +MMX-OBJS-$(CONFIG_FFT) += x86/fft.o +MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o +MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_mmx.o +MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o +MMX-OBJS-$(CONFIG_LPC) += x86/lpc_mmx.o +MMX-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec_mmx.o +MMX-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp-init.o +MMX-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp-init.o +MMX-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp-init.o +MMX-OBJS-$(CONFIG_RV30_DECODER) += x86/rv34dsp_init.o +MMX-OBJS-$(CONFIG_RV40_DECODER) += x86/rv34dsp_init.o \ + x86/rv40dsp_init.o +MMX-OBJS-$(CONFIG_V210_DECODER) += x86/v210-init.o +MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o +MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp56dsp_init.o +MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp56dsp_init.o +MMX-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp-init.o + +YASM-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp.o +YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o +YASM-OBJS-$(CONFIG_DCT) += x86/dct32_sse.o +YASM-OBJS-$(CONFIG_DIRAC_DECODER) += x86/diracdsp_mmx.o x86/diracdsp_yasm.o +YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_yasm.o +YASM-OBJS-FFT-$(HAVE_AMD3DNOW) += x86/fft_3dn.o +YASM-OBJS-FFT-$(HAVE_AMD3DNOWEXT) += x86/fft_3dn2.o +YASM-OBJS-FFT-$(HAVE_SSE) += x86/fft_sse.o +YASM-OBJS-$(CONFIG_FFT) += x86/fft_mmx.o \ + $(YASM-OBJS-FFT-yes) + +YASM-OBJS-$(CONFIG_DWT) += x86/dwt_yasm.o +YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \ + x86/h264_chromamc_10bit.o +YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \ + x86/h264_deblock_10bit.o \ + x86/h264_idct.o \ + x86/h264_idct_10bit.o \ + x86/h264_weight.o \ + x86/h264_weight_10bit.o +YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o \ + x86/h264_intrapred_10bit.o +YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_10bit.o +YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36_sse.o +YASM-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp.o +YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o +YASM-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp.o +YASM-OBJS-$(CONFIG_RV30_DECODER) += x86/rv34dsp.o +YASM-OBJS-$(CONFIG_RV40_DECODER) += x86/rv34dsp.o \ + x86/rv40dsp.o +YASM-OBJS-$(CONFIG_V210_DECODER) += x86/v210.o +YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o +YASM-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp.o +YASM-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp.o +YASM-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp.o \ + x86/vp56dsp.o +YASM-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp.o + +MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \ + x86/deinterlace.o \ + x86/fmtconvert.o \ + $(YASM-OBJS-yes) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 4a47fa8f51..66d305d210 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -168,8 +168,6 @@ OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_yvu9.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/pullup.o -DIRS = x86 libmpcodecs - TESTPROGS = drawutils formats TOOLS = graph2dot lavfi-showfiltfmts diff --git a/libavformat/Makefile b/libavformat/Makefile index 929682a2d1..212c9d7b50 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -6,6 +6,8 @@ FFLIBS = avcodec avutil HEADERS = avformat.h avio.h version.h OBJS = allformats.o \ + avio.o \ + aviobuf.o \ cutils.o \ id3v1.o \ id3v2.o \ @@ -351,8 +353,6 @@ OBJS-$(CONFIG_LIBNUT_MUXER) += libnut.o OBJS-$(CONFIG_LIBRTMP) += librtmp.o # protocols I/O -OBJS+= avio.o aviobuf.o - OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += hlsproto.o OBJS-$(CONFIG_BLURAY_PROTOCOL) += bluray.o OBJS-$(CONFIG_CACHE_PROTOCOL) += cache.o diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 36b874ba15..fcdaebe2d4 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -66,11 +66,23 @@ * set by user for input, always set by user for output (unless you are dealing * with an AVFMT_NOFILE format). * + * @section lavf_options Passing options to (de)muxers + * Lavf allows to configure muxers and demuxers using the @ref avoptions + * mechanism. Generic (format-independent) libavformat options are provided by + * AVFormatContext, they can be examined from a user program by calling + * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass + * from avformat_get_class()). Private (format-specific) options are provided by + * AVFormatContext.priv_data if and only if AVInputFormat.priv_class / + * AVOutputFormat.priv_class of the corresponding format struct is non-NULL. + * Further options may be provided by the @ref AVFormatContext.pb "I/O context", + * if its AVClass is non-NULL, and the protocols layer. See the discussion on + * nesting in @ref avoptions documentation to learn how to access those. + * * @defgroup lavf_decoding Demuxing * @{ * Demuxers read a media file and split it into chunks of data (@em packets). A - * @ref AVPacket "packet" contains one or more frames which belong a single - * elementary stream. In lavf API this process is represented by the + * @ref AVPacket "packet" contains one or more encoded frames which belongs to a + * single elementary stream. In the lavf API this process is represented by the * avformat_open_input() function for opening a file, av_read_frame() for * reading a single packet and finally avformat_close_input(), which does the * cleanup. @@ -100,10 +112,55 @@ * your reading callbacks to it. Then set the @em pb field of your * AVFormatContext to newly created AVIOContext. * + * Since the format of the opened file is in general not known until after + * avformat_open_input() has returned, it is not possible to set demuxer private + * options on a preallocated context. Instead, the options should be passed to + * avformat_open_input() wrapped in an AVDictionary: + * @code + * AVDictionary *options = NULL; + * av_dict_set(&options, "video_size", "640x480", 0); + * av_dict_set(&options, "pixel_format", "rgb24", 0); + * + * if (avformat_open_input(&s, url, NULL, &options) < 0) + * abort(); + * av_dict_free(&options); + * @endcode + * This code passes the private options 'video_size' and 'pixel_format' to the + * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it + * cannot know how to interpret raw video data otherwise. If the format turns + * out to be something different than raw video, those options will not be + * recognized by the demuxer and therefore will not be applied. Such unrecognized + * options are then returned in the options dictionary (recognized options are + * consumed). The calling program can handle such unrecognized options as it + * wishes, e.g. + * @code + * AVDictionaryEntry *e; + * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { + * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); + * abort(); + * } + * @endcode + * * After you have finished reading the file, you must close it with * avformat_close_input(). It will free everything associated with the file. * * @section lavf_decoding_read Reading from an opened file + * Reading data from an opened AVFormatContext is done by repeatedly calling + * av_read_frame() on it. Each call, if successful, will return an AVPacket + * containing encoded data for one AVStream, identified by + * AVPacket.stream_index. This packet may be passed straight into the libavcodec + * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or + * avcodec_decode_subtitle2() if the caller wishes to decode the data. + * + * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be + * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for + * pts/dts, 0 for duration) if the stream does not provide them. The timing + * information will be in AVStream.time_base units, i.e. it has to be + * multiplied by the timebase to convert them to seconds. + * + * The packet data belongs to the demuxer and is invalid after the next call to + * av_read_frame(). The user must free the packet with av_free_packet() before + * calling av_read_frame() again or closing the file. * * @section lavf_decoding_seek Seeking * @} @@ -564,7 +621,18 @@ typedef struct AVStream { * encoding: set by the user */ int id; - AVCodecContext *codec; /**< codec context */ + /** + * Codec context associated with this stream. Allocated and freed by + * libavformat. + * + * - decoding: The demuxer exports codec information stored in the headers + * here. + * - encoding: The user sets codec information, the muxer writes it to the + * output. Mandatory fields as specified in AVCodecContext + * documentation must be set even if this AVCodecContext is + * not actually used for encoding. + */ + AVCodecContext *codec; /** * Real base framerate of the stream. * This is the lowest framerate with which all timestamps can be @@ -583,10 +651,12 @@ typedef struct AVStream { /** * This is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. For fixed-fps content, - * time base should be 1/framerate and timestamp increments should be 1. + * of which frame timestamps are represented. + * * decoding: set by libavformat - * encoding: set by libavformat in av_write_header + * encoding: set by libavformat in av_write_header. The muxer may use the + * user-provided value of @ref AVCodecContext.time_base "codec->time_base" + * as a hint. */ AVRational time_base; diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index c3b3d5d69f..0618beb182 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -974,7 +974,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ts_st->prev_payload_key = key; } -static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) +static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) { AVStream *st = s->streams[pkt->stream_index]; int size = pkt->size; @@ -1091,27 +1091,48 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -static int mpegts_write_end(AVFormatContext *s) +static void mpegts_write_flush(AVFormatContext *s) { - MpegTSWrite *ts = s->priv_data; - MpegTSWriteStream *ts_st; - MpegTSService *service; - AVStream *st; int i; /* flush current packets */ for(i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - ts_st = st->priv_data; + AVStream *st = s->streams[i]; + MpegTSWriteStream *ts_st = st->priv_data; if (ts_st->payload_size > 0) { mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_size, ts_st->payload_pts, ts_st->payload_dts, ts_st->payload_flags & AV_PKT_FLAG_KEY); + ts_st->payload_size = 0; } + } + avio_flush(s->pb); +} + +static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) +{ + if (!pkt) { + mpegts_write_flush(s); + return 1; + } else { + return mpegts_write_packet_internal(s, pkt); + } +} + +static int mpegts_write_end(AVFormatContext *s) +{ + MpegTSWrite *ts = s->priv_data; + MpegTSService *service; + int i; + + mpegts_write_flush(s); + + for(i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + MpegTSWriteStream *ts_st = st->priv_data; av_freep(&ts_st->payload); av_freep(&ts_st->adts); } - avio_flush(s->pb); for(i = 0; i < ts->nb_services; i++) { service = ts->services[i]; @@ -1135,5 +1156,6 @@ AVOutputFormat ff_mpegts_muxer = { .write_header = mpegts_write_header, .write_packet = mpegts_write_packet, .write_trailer = mpegts_write_end, + .flags = AVFMT_ALLOW_FLUSH, .priv_class = &mpegts_muxer_class, }; diff --git a/libavutil/Makefile b/libavutil/Makefile index b02a1e3129..9b562335b0 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -82,15 +82,12 @@ OBJS = adler32.o \ OBJS-$(ARCH_PPC) += ppc/cpu.o OBJS-$(ARCH_X86) += x86/cpu.o - TESTPROGS = adler32 aes avstring base64 bprint cpu crc des eval file fifo \ lfg lls md5 opt pca parseutils random_seed rational sha tree TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo TOOLS = ffeval -DIRS = arm avr32 bfin mips ppc sh4 tomi x86 - ARCH_HEADERS = bswap.h intmath.h intreadwrite.h timer.h $(SUBDIR)lzo-test$(EXESUF): ELIBS = -llzo2 diff --git a/library.mak b/library.mak index 40a364eccc..53f1ee7741 100644 --- a/library.mak +++ b/library.mak @@ -51,12 +51,10 @@ endif clean:: $(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \ - $(foreach dir,$(DIRS),$(CLEANSUFFIXES:%=$(SUBDIR)$(dir)/%)) \ - $(HOSTOBJS) $(HOSTPROGS) + $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(HOSTOBJS) $(HOSTPROGS) distclean:: clean - $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) \ - $(foreach dir,$(DIRS),$(DISTCLEANSUFFIXES:%=$(SUBDIR)$(dir)/%)) + $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME) $(Q)mkdir -p "$(SHLIBDIR)" diff --git a/libswscale/Makefile b/libswscale/Makefile index e78ec42975..1586a7a6f3 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -5,8 +5,14 @@ FFLIBS = avutil HEADERS = swscale.h -OBJS = input.o options.o output.o rgb2rgb.o swscale.o \ - swscale_unscaled.o utils.o yuv2rgb.o +OBJS = input.o \ + options.o \ + output.o \ + rgb2rgb.o \ + swscale.o \ + swscale_unscaled.o \ + utils.o \ + yuv2rgb.o \ OBJS-$(ARCH_BFIN) += bfin/internal_bfin.o \ bfin/swscale_bfin.o \ @@ -27,5 +33,3 @@ $(SUBDIR)x86/swscale_mmx.o: CFLAGS += $(NOREDZONE_FLAGS) OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o TESTPROGS = colorspace swscale - -DIRS = bfin ppc sparc x86